and so the Error_Handler() will be defined as an empty function, not taking __FILE__ and __LINE__ atall, if the macro NDEBUG (no debug) is defined. And by default, that macro is activated in the PlatformIO build process.
So instead of writing a work around for an older version, can you make sure you’re using the very latest STM32 platform instead? Quickest way to update is to go CLI → pio pkg update -g -p ststm32.
I’m running PLATFORM: ST STM32 (15.5.1+sha.4c9ab2d) currently, pretty close to latest.
With build_unflags = -DNDEBUG and build_flags = “-fmacro-prefix-map=${platformio.packages_dir}\framework-arduinoststm32=.” even more flash memory is occupied…I’m trying to free flash memory, if I didn’t explain that well - sorry…
I can’t attach it like a .txt file here. Here is the beginning of log if is helpful , if not - I will attach that log here as a comment (if that is ok because is pretty long)
Executing task in folder PLC_STM32_IO_TEST: C:\Users\HP\.platformio\penv\Scripts\platformio.exe run
Processing bluepill_f103c8 (platform: ststm32; board: bluepill_f103c8; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/bluepill_f103c8.html
PLATFORM: ST STM32 (15.6.0) > BluePill F103C8
HARDWARE: STM32F103C8T6 72MHz, 20KB RAM, 64KB Flash
DEBUG: Current (stlink) External (blackmagic, cmsis-dap, jlink, stlink)
PACKAGES:
- framework-arduinoststm32 @ 4.20400.0 (2.4.0)
- framework-cmsis @ 2.50700.210515 (5.7.0)
- toolchain-gccarmnoneeabi @ 1.90201.191206 (9.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 15 compatible libraries
Executing task in folder minStm32: C:\Users\HP\.platformio\penv\Scripts\platformio.exe run --target upload
Processing bluepill_f103c8 (platform: ststm32; board: bluepill_f103c8; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/bluepill_f103c8.html
PLATFORM: ST STM32 (15.6.0) > BluePill F103C8
HARDWARE: STM32F103C8T6 72MHz, 20KB RAM, 64KB Flash
DEBUG: Current (stlink) External (blackmagic, cmsis-dap, jlink, stlink)
PACKAGES:
- framework-arduinoststm32 @ 4.20400.0 (2.4.0)
- framework-cmsis @ 2.50700.210515 (5.7.0)
- tool-dfuutil @ 1.11.0
- tool-openocd @ 2.1100.211028 (11.0)
- tool-stm32duino @ 1.0.2
- toolchain-gccarmnoneeabi @ 1.90201.191206 (9.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 12 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Checking size .pio\build\bluepill_f103c8\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [ ] 3.8% (used 780 bytes from 20480 bytes)
Flash: [= ] 10.8% (used 7072 bytes from 65536 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, cmsis-dap, dfu, jlink, mbed, stlink
CURRENT: upload_protocol = stlink
Uploading .pio\build\bluepill_f103c8\firmware.elf
xPack OpenOCD x86_64 Open On-Chip Debugger 0.11.0+dev (2021-10-16-21:19)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 1
hla_swd
none separate
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800015c msp: 0x20005000
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
shutdown command invoked
======================================================================================== [SUCCESS] Took 8.24 seconds ======================================================================================== * Terminal will be reused by tasks, press any key to close it.
No paths in flash now! But I erased flash with STM32 ST-LINK Utility before uploading the code with Platformio.
Now, even if I upload my old code,there are no those paths in flash.
Is it possible that those paths for some reason existed in Flash before the stm32 platform update and my code upload didn’t delete them at those addresses (until I erased the whole flash manually )?