hex file for Atmega 1284p bootloader

Last post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I've written a basic bootloader to aloow me to update my atmega1284p over the air. The application space is split to allow me to have two separate apps in FLASH and the bootloader selects the correct application to run based on an EEPROM setting.

I've compiled the bootloader on its own using the following linker settings:

-Wl,-section-start=.text=0x1F800 

From my reading of the datasheet this should translate to the bootloader adddress space for a 1024 word bootloader.

The elf file that is generated appears to have the correct address information:


Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000222  0001f800  0001f800  0000030a  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .jumps        00000276  00000000  00000000  00000094  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 .sharedFuncs  00000004  0001fe00  0001fe00  0000052c  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  3 .stab         00000ca8  00000000  00000000  00000530  2**2
                  CONTENTS, READONLY, DEBUGGING
  4 .stabstr      000009b8  00000000  00000000  000011d8  2**0
                  CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:

0001f800 <__vectors>:
   1f800:	0c 94 46 fc 	jmp	0x1f88c	; 0x1f88c <__ctors_end>

However the hex file that is generated is starting at the wrong address 0f 0xfe00

:10F800000C9446FC0C9465FC0C9465FC0C9465FC13
:10F810000C9465FC0C9465FC0C9465FC0C9465FCE4

Any idea as to how I get the hex file to use the extended addressing?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

However the hex file that is generated is starting at the wrong address 0f 0xfe00

Look before this - there should be a 32 bit offset record. The code you show is at (byte address) 0xF800. There will be an offset record that repositions this by 0x00010000 so that the composite address is the correct 0x0001F800 but Intel Hex only has room for 4 hex digits of addressing in each record. Don't worry!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK I see what you mean, the line immediately before had the extended address offset,

:020000021000EC

I miss read the line, I had thought it was another data record.