add script to create HEX file for STM32 boards.

This commit is contained in:
Thomas Göttgens 2025-02-04 21:38:15 +01:00
parent 30fffbdc01
commit edb769128d
2 changed files with 22 additions and 1 deletions

View File

@ -2,7 +2,9 @@
extends = arduino_base
platform = ststm32
platform_packages = platformio/framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32.git#2.9.0
extra_scripts =
${env.extra_scripts}
post:extra_scripts/extra_stm32.py
build_type = release
;board_build.flash_offset = 0x08000000

19
extra_scripts/extra_stm32.py Executable file
View File

@ -0,0 +1,19 @@
Import("env")
# Custom HEX from ELF
env.AddPostAction(
"$BUILD_DIR/${PROGNAME}.elf",
env.VerboseAction(
" ".join(
[
"$OBJCOPY",
"-O",
"ihex",
"-R",
".eeprom",
"$BUILD_DIR/${PROGNAME}.elf",
"$BUILD_DIR/${PROGNAME}.hex",
]
),
"Building $BUILD_DIR/${PROGNAME}.hex",
),
)