From edb769128d49e31649cd3ee237b2e99eca7dca05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Tue, 4 Feb 2025 21:38:15 +0100 Subject: [PATCH] add script to create HEX file for STM32 boards. --- arch/stm32/stm32.ini | 4 +++- extra_scripts/extra_stm32.py | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100755 extra_scripts/extra_stm32.py diff --git a/arch/stm32/stm32.ini b/arch/stm32/stm32.ini index a1bdc6658..7280fc3f8 100644 --- a/arch/stm32/stm32.ini +++ b/arch/stm32/stm32.ini @@ -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 diff --git a/extra_scripts/extra_stm32.py b/extra_scripts/extra_stm32.py new file mode 100755 index 000000000..7448cef3d --- /dev/null +++ b/extra_scripts/extra_stm32.py @@ -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", + ), +)