From 868395efce35536fafe2151e9911eeda132da883 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 5 Jul 2017 14:08:53 +0700 Subject: [PATCH] allow to change optimization level with debug mode --- boards.txt | 12 ++++++------ .../Bluefruit52Lib/src/utility/bootloader_util.c | 1 + platform.txt | 8 ++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/boards.txt b/boards.txt index fcd15eb0..acb8d91d 100644 --- a/boards.txt +++ b/boards.txt @@ -48,11 +48,11 @@ feather52.build.extra_flags=-DARDUINO_FEATHER52 # Debug Menu feather52.menu.debug.l0=Level 0 (Release) -feather52.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +feather52.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 -Os feather52.menu.debug.l1=Level 1 (Error Message) -feather52.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +feather52.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 -Os feather52.menu.debug.l2=Level 2 (Full Debug) -feather52.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +feather52.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 -Os #********************************************** # Metro nrf52 Board @@ -78,8 +78,8 @@ feather52.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 # Debug Menu #metro52.menu.debug.l0=Level 0 (Release) -#metro52.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 +#metro52.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0 -Os #metro52.menu.debug.l1=Level 1 (Error Message) -#metro52.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 +#metro52.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1 -Os #metro52.menu.debug.l2=Level 2 (Full Debug) -#metro52.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 +#metro52.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2 -Os diff --git a/libraries/Bluefruit52Lib/src/utility/bootloader_util.c b/libraries/Bluefruit52Lib/src/utility/bootloader_util.c index ead6de36..2db23bb2 100644 --- a/libraries/Bluefruit52Lib/src/utility/bootloader_util.c +++ b/libraries/Bluefruit52Lib/src/utility/bootloader_util.c @@ -28,6 +28,7 @@ * * @note This function will never return but issue a reset into provided application. */ + static inline void bootloader_util_reset(uint32_t start_addr) __attribute__ ((optimize("-fomit-frame-pointer"))); static inline void bootloader_util_reset(uint32_t start_addr) { __asm volatile( diff --git a/platform.txt b/platform.txt index 46a13749..647a3fed 100644 --- a/platform.txt +++ b/platform.txt @@ -30,13 +30,13 @@ compiler.warning_flags.all=-Wall -Wextra -Wno-unused-parameter -Wno-missing-fiel compiler.path={runtime.tools.gcc-arm-none-eabi-5_2-2015q4.path}/bin/ compiler.c.cmd=arm-none-eabi-gcc -compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g -Os {compiler.warning_flags} {build.float_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD -DSOFTDEVICE_PRESENT +compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD -DSOFTDEVICE_PRESENT compiler.c.elf.cmd=arm-none-eabi-gcc compiler.c.elf.flags=-Os -Wl,--gc-sections -save-temps compiler.S.cmd=arm-none-eabi-gcc compiler.S.flags=-c -g -x assembler-with-cpp compiler.cpp.cmd=arm-none-eabi-g++ -compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g -Os {compiler.warning_flags} {build.float_flags} -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD +compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD compiler.ar.cmd=arm-none-eabi-ar compiler.ar.flags=rcs compiler.objcopy.cmd=arm-none-eabi-objcopy @@ -51,7 +51,7 @@ compiler.size.cmd=arm-none-eabi-size # this can be overriden in boards.txt build.extra_flags= build.lfclk_flags=-DUSE_LFXO -build.debug_flags= +build.debug_flags=-DCFG_DEBUG=0 -Os build.float_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16 build.ldscript=bluefruit52_s132_v201.ld @@ -61,7 +61,7 @@ nffs.path={runtime.platform.path}/libraries/nffs/src compiler.nrf.flags=-DARDUINO_NRF52_ADAFRUIT -DNRF5 -DNRF52 -DS132 "-I{nrf.sdk.path}/components/toolchain/" "-I{nrf.sdk.path}/components/toolchain/CMSIS/Include" "-I{nrf.sdk.path}/components/toolchain/gcc/" "-I{nrf.sdk.path}/components/device/" "-I{nrf.sdk.path}/components/drivers_nrf/delay/" "-I{nrf.sdk.path}/components/softdevice/s132/headers/" "-I{rtos.path}/source/include" "-I{rtos.path}/config" "-I{rtos.path}/portable/GCC/nrf52" "-I{rtos.path}/portable/CMSIS/nrf52" -nffs.includes="-I{nffs.path}/fs/nffs/include" "-I{nffs.path}/fs/fs/include" "-I{nffs.path}/util/crc/include" "-I{nffs.path}/kernel/os/include" "-I{nffs.path}/kernel/os/include/os/arch/cortex_m4" "-I{nffs.path}/hw/hal/include" "-I{nffs.path}/sys/flash_map/include" +nffs.includes="-I{nffs.path}/fs/nffs/include" "-I{nffs.path}/fs/fs/include" "-I{nffs.path}/util/crc/include" "-I{nffs.path}/kernel/os/include" "-I{nffs.path}/kernel/os/include/os/arch/cortex_m4" "-I{nffs.path}/hw/hal/include" "-I{nffs.path}/sys/flash_map/include" "-I{nffs.path}/sys/defs/include" # These can be overridden in platform.local.txt compiler.c.extra_flags=