PlatformIO Community

Export compiled hex file


I’m all new to platformio and I’d like to use it for my Arduino boards replacing the Arduino IDE.
Is it possible to export compiled binary hex files?
On Arduino I select Sketch > Export compiled Binary and I get 2 hex files, with and without bootloader.



Sure, check a hidden .pioenvs directory in the project.


Thank you, I found the firmware.hex so I’m guessing that’s what I need.


I just found the firmware.bin wtihout hex,How I need to setup ? Please tell me


Whats your platformio.ini?



platform = ststm32
framework = stm32cube
board = genericSTM32F103ZE
upload_speed = 115200
upload_port = COM4
upload_protocol =serial

It‘s my setup . I was generated success, but can’t find .hex file


You’re right, by default they only build the .bin file. To change this, go into your PlatformIO folder (/home/<user>/.platform or C:\Users\<user>\.platform and open packages/ststm32/builder/ and change

    target_firm = env.ElfToBin(join("$BUILD_DIR", "${PROGNAME}"), target_elf)


    target_firm = env.ElfToHex(join("$BUILD_DIR", "${PROGNAME}"), target_elf)

and rebuild. The resulting hex file will be in .pioenvs/genericSTM32F103ZE/firmware.hex.

@ivankravets Maybe it’s good feature to be able to change what builder will be used via the platformio.ini?


@Weeeendi please file a feature request here


Thanks for your help,and I hope create this feature too.


Thanks,But I also want to know why I choose serial upload failed.what differents have between

common ISP upload and using upload_protocol = serial in platformio.ini