jcw
February 22, 2022, 5:03pm
1
I’m using a custom uploader which needs a hex file. This used to be present in the build directory, but now it seems I only get .elf
and .bin
build output.
Is there an easy way to force creation of hex without resorting to extra_script.py
tricks?
Here’s what I have tried in platformio.ini
:
upload_protocol = custom
upload_command = cat $UPLOAD_FLAGS <$BUILD_DIR/${PROGNAME}.hex
upload_flags = >$UPLOAD_PORT
Please check a solution by @maxgerhardt
Due to spaces in the paths with missing quotes the command is not interpreted correctly. You need to quote the filepaths.
Write instead
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")
)
jcw
February 23, 2022, 11:30am
3
Ok, thx - that will solve it. Had hoped to avoid adding a .py script, but it’s not a show-stopper.