platformio / platform-atmelavr

Atmel AVR: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/atmelavr
Apache License 2.0
138 stars 105 forks source link

Export HEX file with bootloader included #139

Open MCUdude opened 5 years ago

MCUdude commented 5 years ago

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!

ivankravets commented 5 years ago

How do you do that with Arduino IDE?

MCUdude commented 5 years ago

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

image
pfeerick commented 5 years ago

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

josefgull commented 3 years ago

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

deladriere commented 3 years ago

@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 ?