bootloader, intel Hex and the endians (help....)

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

Hi guys:

How are you? I´m programming a bootloader for the mega8515 and Ihave it done by 98%

The remaining 2% is about the order of bytes coming in flash.

If I have a IHEX record beginning as:

:0600000067C13CC2AFC164
being $0000 the base address, the first word would be "67C1" ok?

Now, is "67" located at $0000 and "C1" located at $0001 ?(think of BYTE address as those read by LPM)
Said the other way, Should "67" come to R0, and "C1" to R1 ? (think of WORD address when filling the temporary WO buffer)

Coud you help me?

Tks in advance
Nachus

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

Quote:
:0600000067C13CC2AFC164

IHEX records are in bytes. With this data 67 will be in BYTE location 0 and c1 will be in BYTE location 1. Since the AVR's are little-endian the instruction at WORD location 0 will be c167.
Dave Raymond

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

OK :

Now I understand, (i think so) so, this means that "67" must go to R0 and "C1" needs to land on R1, to burn "C167" into the page buffer
... er am I ok?

Than you dave
Nachus

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

Quote:
... er am I ok?

That depends entirely on your program. If you are writing in assembler you have complete control over which registers to use. Atmel only enforces little-endian in a few places such as flash and the X, Y, and Z register pairs. The compiler I use, Imagecraft, uses little-endian by convention in many other places. You have to ask what does your environment do. If r1 is the msbyte, you are ok.
Dave Raymond