LOG written in FLASH : use memory in Release build

Hello,

I have issue with my application size which is too big to success DFU.

So i checked the memory content with nrfjprog --memrd 0x0001C000 --n 0x5C000.

I see that my prints are present in flash and consume the memory ! even if i build in release. see below an exemple.
I have that with "SEGGER_RTT_printf" and "__LOG" prints.
This looks really not normal in "release". It is not what I want.

0x00043410: 4C415620 54414449 21204445 32000A21 | VALIDATED !!..2|
0x00043420: 4F542064 20484355 65746564 64657463 |d TOUCH detected|
0x00043430: 0A212120 20643200 43554F54 41562048 | !!..2d TOUCH VA|
0x00043440: 4144494C 20444554 000A2121 54206433 |LIDATED !!..3d T|
0x00043450: 64205041 63657465 20646574 000A2121 |AP detected !!..|

Here is how I build and the configuration : 
Name="Release"
arm_use_builtins="Yes"
build_intermediate_directory="build/$(ProjectName)_$(Configuration)/obj"
build_output_directory="build/$(ProjectName)_$(Configuration)"
gcc_debugging_level="None"
gcc_entry_point="Reset_Handler"
gcc_omit_frame_pointer="Yes"
gcc_optimization_level="Optimize For Size" />

in sdk_config.h file : 
#define NRF_LOG_ENABLED 0

How can I still use this log in "debug" environment and disable in release to NOT write in FLASH which is precious.

Thank you for your help, I didn't find help on the forum.

Valentin

Related