kconfig: Change how optimization level is set

This patch does several things, most notably it changes the semantics
of CONFIG_DEBUG. CONFIG_DEBUG continues to behave as a vaguely defined
"debug mode" that enables printf's, -Og, etc. but now the user may
choose to be in "debug mode" while using a different optimization
level than -Og.

Tp support this a new config is defined to enable -Og;
CONFIG_DEBUG_OPTIMIZATIONS.

Additionally CONFIG_SIZE_OPTIMIZATIONS is introduced to allow the user
to explicitly request optimizing for size instead of relying on
defaulting to it.

The three config's {NO,SIZE,DEBUG}_OPTIMIZATIONS are now organized in
a Kconfig choice to ensure that at most one can be enabled at a time.

Finally, selected users of CONFIG_DEBUG have been ported to use one of
the optimizations configs when it was clear from usage that the
intention was to behave differently when using a different
optimization level and not when in "debug mode".

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This commit is contained in:
Sebastian Bøe 2018-01-24 10:40:32 +01:00 committed by Anas Nashif
commit 600c8f7d85
4 changed files with 37 additions and 14 deletions

View file

@ -1,5 +1,5 @@
#ifndef KOBJECT_TEXT_AREA
#if defined(CONFIG_DEBUG) || defined(CONFIG_STACK_CANARIES)
#if ! defined(CONFIG_SIZE_OPTIMIZATIONS) || defined(CONFIG_STACK_CANARIES)
#define KOBJECT_TEXT_AREA 256
#else
#define KOBJECT_TEXT_AREA 128