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) $< $@
The Intel HEX file is an ASCII text file with lines of text that follow the Intel HEX file format. Each line in an Intel HEX file contains one HEX record. These records are made up of hexadecimal numbers that represent machine language code and/or constant data.
Intel hexadecimal object file format, Intel hex format or Intellec Hex is a file format that conveys binary information in ASCII text form. It is commonly used for programming microcontrollers, EPROMs, and other types of programmable logic devices and hardware emulators.
ASCII Characters If you set your compiler to output a . bin file it will appear as garbage in a text editor, so an Intel Hex file stores data as ASCII characters, which can be read by an editor. The device programmer has to convert these ASCII values into binary data for the microcontroller.
The Intel hex (ihex) generally known as hex file, is a format used to store machine language code in hexadecimal form. It is widely used format to store programs to be transferred to microcontrollers, ROM and EEPROM.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With