Hello,
A lot of library path information looks to be programmed into the STM32 flash memory.
If I read back the programmed memory of the STM32 with the ST32 ST-Link utility I see a lot of the following entries:
Is there a build option that I can set to remove that information and decrease the flash memory footprint?
platformio.ini
----
[env:bluepill_f103c8_128k]
platform = ststm32
board = genericSTM32F103CB ;128k
framework = arduino
board_build.core = maple ; use Arduino STM32 (maple)
board_build.variant = maple ; use Arduino STM32 (maple)
upload_flags =
-c*
set CPUTAPID 0x1ba01477 ; Original STM32F103 parts*
debug_tool = stlink
Greetings,
Emile
The output is generated from ASSERT()
expressions in the code as a means of error-catching
Whereas ASSERT()
expands to
#ifndef DEBUG_LEVEL
#define DEBUG_LEVEL DEBUG_ALL
#endif
#if DEBUG_LEVEL >= DEBUG_ALL
#define ASSERT(exp) \
if (exp) { \
} else { \
_fail(__FILE__, __LINE__, #exp); \
}
#else
#define ASSERT(exp) (void)((0))
#endif
So this is where the __FILE__
and __LINE
information come from and your path informatin is included.
This code also shows that this code can be deactivated when DEBUG_LEVEL < DEBUG_ALL
aka DEBUG_NONE
or DEBUG_FAULT
(see surrounding code). So just add
build_flags = -D DEBUG_LEVEL=0
and it evaluates to an empty expression and your problem is solved…
1 Like
Hello Max,
Thanks for the quick reply and the excellent explanation!
Adding build_flags = -D DEBUG_LEVEL=0 shaved ~3K off the memory usage.
Greetings,
Emile
1 Like