8

What are the intel hex records type 03 or 05 doing in iHex program?

Record type 03: Start Segment Address For 80x86 processors, specifies the initial content of the CS:IP registers. The address field is 0000, the byte count is 04, the first two bytes are the CS value, the latter two are the IP value.

Record type 05: Start Linear Address The address field is 0000 (not used) and the byte count is 04. The four data bytes represent the 32-bit value loaded into the EIP register of the 80386 and higher CPU.

Do these even make sense for an ARM program?

Whenever I generate .hex to program embedded ARM, the ending looks something like this:

:10851400B4040020BC040020BC040020C4040020D7
:10852400C4040020CC040020CC040020D404002087
:10853400D4040020DC040020DC040020E404002037
:10854400E4040020EC040020EC040020F4040020E7
:10855400F4040020FC040020FC040020FFFFFFFFC3
:048564000000020011
:0400000508002910B6
:00000001FF

I've edited the programming app to ignore this record, and just today a coworker reported his compiler produced a 03 type record on the second-to-last line, which prevented programming the MPU.

Why does objcopy create these records? Can I stop it from doing it?

Relevant Makefile lines:

 FORMAT = ihex
 OBJCOPY = arm-elf-objcopy

  %.hex: %.elf
    @echo
    @echo $(MSG_FLASH) $@
    $(OBJCOPY) -O $(FORMAT) $< $@
4

1 回答 1

9

Do these even make sense for an ARM program?

An ARM program will always have an entry point set, even if you provided a vector table in the bare metal case.

The arm-*-objcopy program is not very intelligent and just produces the 03 record when the entry address is within the first megabyte for compatibility reasons, and the 05 otherwise.

A flash tool can safely ignore these record types on bare metal ARM, because the vector table contains the required addresses already. You could try filtering the hex file to remove these records, e.g. using sed.

于 2014-10-10T11:26:54.090 回答