platform-atmelavr icon indicating copy to clipboard operation
platform-atmelavr copied to clipboard

Export HEX file with bootloader included

Open MCUdude opened this issue 6 years ago • 5 comments

Hi! In Arduino IDE it's possible to export the compiled project hex file with the bootloader included in the same HEX file. Would this be possible with PlatformIO as well? As for MightyCore (and other MCUdude cores), F_CPU, upload speed, and upload port have to be defined somehow.

Thanks!

MCUdude avatar May 03 '19 08:05 MCUdude

How do you do that with Arduino IDE?

ivankravets avatar May 06 '19 19:05 ivankravets

The Export compiled binary option leaves two hex files in the sketch folder. One with and one without a bootloader included. Very useful!

image

MCUdude avatar May 06 '19 19:05 MCUdude

The binary that platformio creates is relatively easy to find... it's in the project folders .pioenvs/environment-name folder... i.e. for an project with an environment name of 'uno' it's in the .pioenvs/uno folder as firmware.hex... the giveaway being the last few lines of the compile... but that doesn't help with a version with a bootloader.

Linking .pioenvs/uno/firmware.elf
Checking size .pioenvs/uno/firmware.elf
Building .pioenvs/uno/firmware.hex
Memory Usage -> http://bit.ly/pio-memory-usage
DATA:    [          ]   0.4% (used 9 bytes from 2048 bytes)
PROGRAM: [          ]   1.4% (used 444 bytes from 32256 bytes)

If this information is correct, it should't be to hard too add building a bootloader as an extra_script.py, as it's 'just' a matter of adding the bootloader hex to the application hex, with one minor change.

https://www.avrfreaks.net/forum/merging-bootloader-hex-file-and-application-hex-file-one

pfeerick avatar May 07 '19 06:05 pfeerick

is there now a sultion i would also like to generaate an hexfirmware file with a bootloader for an mrkzero

josefgull avatar Feb 25 '21 12:02 josefgull

@josefgull I use Bossac to download the firmware from the chip once programmed in a classic way (using the IDE- Plaftormio or Arduino) It includes the bootloader and can be used with a binary programmer Does it make sense ?

deladriere avatar Jun 10 '21 13:06 deladriere