Go Down

Topic: What is the bootloaders address of Mega2560, and how to find it in hex-file (Read 237 times) previous topic - next topic

LMI1

I sometimes get 2560 hex-files which are supposed toi contain a bootloader. How can I tell if a hex-file really contains a bootloader or not. Hex-files are originally made for 65k files and 02 Extended Segment Address makes finding bootloader difficult.

westfw

The bootloader on a 2560 should occupy the last 8k of flash, starting a 0x3E000.
(Unless it's got optiboot, which is only 1k.)

Um, it looks like the ".ino.with_bootloader.hex" is incorrect for mega2560 - it's missing the "extended segment address" entry, and as a result the bootloader is positioned at the last 8k of the first 64k (which presumably won't work!)

Normally, you can look at a .hex file with tools like avr-objdump.  A corrected .hex file looks like:





avr-objdump -x /tmp/Arduino1.8.13Build/Blink.ino.with_bootloader.hex  


/tmp/Arduino1.8.13Build/Blink.ino.with_bootloader.hex:     file format ihex
/tmp/Arduino1.8.13Build/Blink.ino.with_bootloader.hex
architecture: UNKNOWN!, flags 0x00000000:

start address 0x00000000
Sections:

Idx Name          Size      VMA       LMA       File off  Algn
0 .sec1         00000600  00000000  00000000  00000010  2**0
               CONTENTS, ALLOC, LOAD

1 .sec2         00001d1e  0003e000  0003e000  000010a0  2**0
               CONTENTS, ALLOC, LOAD



LMI1

Thank you. The command line you gave looks usefull. I have searched for :020000023000CC or first bytes in hex-files with notepad. But some files have different bootloader address. I have to check every file if I need to have bootloader..



Go Up