This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Boot Loader hex55 format

I'm having problems writing a boot loader for binary files created by hex55.exe according to sprabd7a (See Table 3 on pg 8).

To create my binary file, I'm doing to following:
hex55.exe -boot -map helloWorld.map -v5505 -b -fill ffffh helloWorld.out -o helloWorld.bin

According to the boot image format, sections should be padded to start on a 64-bit boundary. As shown below, section 1 starts and ends on 64-bit boundary. However, there is 1 word of padding between section 1 and section 2. Why?
Looking at other places between sections, the amount of padding seems random. What gives?

How do I calculate the amount of padding that I need to skip over between sections?

  • Most likely the linker is trying to pad the end of an executable section with NOP (0x20).  I cannot say from the hex converter output whether this is a bug or not.  Please post helloWorld.map.

  • So it turns out that the 64-bit "boundary" doesn't refer to offsets from the beginning of the file. Instead, the "size+2" of each section must be a multiple of 4-words (64-bits).
    So in the example above, the size of the section is 0x2D (decimal:45). Since the size+2 is 47, there is 1 word of padding (0x2020) to make it 48 words (which is divisible by 4).