Kconfig.compiler 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. menu "Compiler options"
  2. choice OPTIMIZATION_COMPILER
  3. prompt "Optimization Level"
  4. default OPTIMIZATION_LEVEL_DEBUG
  5. help
  6. This option sets compiler optimization level (gcc -O argument).
  7. - for "Release" setting, -Os flag is added to CFLAGS.
  8. - for "Debug" setting, -Og flag is added to CFLAGS.
  9. "Release" with -Os produces smaller & faster compiled code but it
  10. may be harder to correlated code addresses to source files when debugging.
  11. To add custom optimization settings, set CFLAGS and/or CPPFLAGS
  12. in project makefile, before including $(IDF_PATH)/make/project.mk. Note that
  13. custom optimization levels may be unsupported.
  14. config OPTIMIZATION_LEVEL_DEBUG
  15. bool "Debug (-Og)"
  16. config OPTIMIZATION_LEVEL_RELEASE
  17. bool "Release (-Os)"
  18. endchoice
  19. choice OPTIMIZATION_ASSERTION_LEVEL
  20. prompt "Assertion level"
  21. default OPTIMIZATION_ASSERTIONS_ENABLED
  22. help
  23. Assertions can be:
  24. - Enabled. Failure will print verbose assertion details. This is the default.
  25. - Set to "silent" to save code size (failed assertions will abort() but user
  26. needs to use the aborting address to find the line number with the failed assertion.)
  27. - Disabled entirely (not recommended for most configurations.) -DNDEBUG is added
  28. to CPPFLAGS in this case.
  29. config OPTIMIZATION_ASSERTIONS_ENABLED
  30. prompt "Enabled"
  31. bool
  32. help
  33. Enable assertions. Assertion content and line number will be printed on failure.
  34. config OPTIMIZATION_ASSERTIONS_SILENT
  35. prompt "Silent (saves code size)"
  36. bool
  37. help
  38. Enable silent assertions. Failed assertions will abort(), user needs to
  39. use the aborting address to find the line number with the failed assertion.
  40. config OPTIMIZATION_ASSERTIONS_DISABLED
  41. prompt "Disabled (sets -DNDEBUG)"
  42. bool
  43. help
  44. If assertions are disabled, -DNDEBUG is added to CPPFLAGS.
  45. endchoice # assertions
  46. menuconfig CXX_EXCEPTIONS
  47. bool "Enable C++ exceptions"
  48. default n
  49. help
  50. Enabling this option compiles all IDF C++ files with exception support enabled.
  51. Disabling this option disables C++ exception support in all compiled files, and any libstdc++ code which throws
  52. an exception will abort instead.
  53. Enabling this option currently adds an additional ~500 bytes of heap overhead
  54. when an exception is thrown in user code for the first time.
  55. config CXX_EXCEPTIONS_EMG_POOL_SIZE
  56. int "Emergency Pool Size"
  57. default 0
  58. depends on CXX_EXCEPTIONS
  59. help
  60. Size (in bytes) of the emergency memory pool for C++ exceptions. This pool will be used to allocate
  61. memory for thrown exceptions when there is not enough memory on the heap.
  62. choice STACK_CHECK_MODE
  63. prompt "Stack smashing protection mode"
  64. default STACK_CHECK_NONE
  65. help
  66. Stack smashing protection mode. Emit extra code to check for buffer overflows, such as stack
  67. smashing attacks. This is done by adding a guard variable to functions with vulnerable objects.
  68. The guards are initialized when a function is entered and then checked when the function exits.
  69. If a guard check fails, program is halted. Protection has the following modes:
  70. - In NORMAL mode (GCC flag: -fstack-protector) only functions that call alloca,
  71. and functions with buffers larger than 8 bytes are protected.
  72. - STRONG mode (GCC flag: -fstack-protector-strong) is like NORMAL, but includes
  73. additional functions to be protected -- those that have local array definitions,
  74. or have references to local frame addresses.
  75. - In OVERALL mode (GCC flag: -fstack-protector-all) all functions are protected.
  76. Modes have the following impact on code performance and coverage:
  77. - performance: NORMAL > STRONG > OVERALL
  78. - coverage: NORMAL < STRONG < OVERALL
  79. config STACK_CHECK_NONE
  80. bool "None"
  81. config STACK_CHECK_NORM
  82. bool "Normal"
  83. config STACK_CHECK_STRONG
  84. bool "Strong"
  85. config STACK_CHECK_ALL
  86. bool "Overall"
  87. endchoice
  88. config STACK_CHECK
  89. bool
  90. default !STACK_CHECK_NONE
  91. help
  92. Stack smashing protection.
  93. config WARN_WRITE_STRINGS
  94. bool "Enable -Wwrite-strings warning flag"
  95. default "n"
  96. help
  97. Adds -Wwrite-strings flag for the C/C++ compilers.
  98. For C, this gives string constants the type ``const char[]`` so that
  99. copying the address of one into a non-const ``char *`` pointer
  100. produces a warning. This warning helps to find at compile time code
  101. that tries to write into a string constant.
  102. For C++, this warns about the deprecated conversion from string
  103. literals to ``char *``.
  104. endmenu # Compiler Options