ATMega128 and .HEX file only support 64K

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

Correct me if I'm wrong, but after looking this over it looks like the .hex files generated by GCC do not support the upper 64k of memory in the ATmega128.

This is a sample .hex record:

:1006B00038F08D91C8953196801919F40020B1F762

It is read as follows

10 = 16 bytes in the record
06B0 = Starting address in memory of the record
00 = Data record
38F08D91C8953196801919F40020B1F7 = 16 bytes of data
62 = 2's compliment checksum

The problem is this - There is only 16 bits reserved for addressing in the .hex file making a top address of 64k. I know the AVR parts use a 16 bit memory organization but the hex file is not, it is 8 bit orgranized.

If the hex file is 8 bit organized with a 16 bit address slot, there is no way to access the upper 64k unless two .hex files are generated?

I hope someone can clear this up for me.

Regards,
Jason Riffel

admin's test signature
 

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

Hi There!

I do not think that is correct. At work, we have made a bootloader in c, and the generated .hex file is programmed in the correct place. The bootloader resides in the upper part of the flash.

Here is the explanation for the intel hex file:

Char 1 is always ':' as a start of line marker
Char 2 and 3 Record Length: 0-255
Char 4 and 7 Address: 0 to 65,535 represented as a 4-digit hexidecimal value.
Byte 8 and 9 Record Type: This field indicates the type of record for this line. The possible values are: 00=Register contains normal data. 01=End of File. 02=Extended address.

The thing you're looking for is the record type 02-extended address.

When you hit the boundary at 64 kb you send the following line is generated:

:020000021000

This means that all lines following this will have an address with an offset

I.E. if you need to get to address 0x10fff you get:
:020000021000
:100fff00

this means that the address 0x0fff is added to the offsett address given above:
0x10000 + 0x0fff = 0x10fff

Best regards gtoo

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

Thanks everyone for the clarity, I apreciate it very much!

Regards,
Jason Riffel

admin's test signature