mkrec

Convert a binary image into ROM format (QNX)

Syntax:

mkrec [option | imagefilename] …

Options:

-a align[K|M|G]
Force the next file to be aligned on an align-byte boundary (the default is 1 byte).
-f format
Output format:
  • binary or b — raw binary file.
  • srec or s — Motorola S records.
  • intel or i — Intel hex records.
  • full or f — pad the file to the size specified by the -s option (implies binary format).

The default is srec. When using binary, the file's offset is printed to stderr.

-l reclen
(el) Length of data bytes per line (the default is 32).
-o offset
The offset, in hexadecimal (the default is 0).
-r
Suppress the reset vector record.
-s romsize[K|M|G]
Size of ROM (the default is 4G). The case of the suffixes doesn't matter.

Description:

The mkrec utility converts a binary image into either Motorola S records or Intel hex records, which are suitable input for most Flash/EPROM programmers. Most ICEs also expect these formats. The format defaults to Motorola S records but may be changed using the -f format option. Note that the Intel format is limited to 1M offsets.

By default, mkrec assumes the image contains code that is the initial program loader (IPL), which is connected to the power-on reset vector of the processor. The mkrec utility locates the image such that it's placed in the address space where it will end at the reset vector. A record is then output for the reset vector, which will do a 16-bit relative jmp to the start of the image.

The reset vector on an Intel (e.g. 486) processor is located at linear address 0xFFFFFFF0 (16 bytes below 4 Gigabytes). The offsets used for the records by default address this area. It's as though you had a 4-Gigabyte ROM and needed to load code into the top of it. This is what most ICEs expect. If you're sending your output to a small Flash/EPROM programmer, it may wish the offsets to be relocated to the top of the the Flash/EPROM alone. You can do this by using the -s size option.

If the -r option is set, it indicates that the image shouldn't be considered a power-on IPL. The record offsets for the image start at zero; a jmp isn't be programmed at the top of the device. You can use the -o option to change the record offset. Note that you can use the -o option only if you use -r.

For compatibility with most devices that accept these records, each record is limited to a maximum of 32 bytes. You can use the -l option to increase this limit to a maximum of 255 bytes. Larger records have less overhead and result in slightly faster downloads.

Examples:

The following converts the binary image explr2 into Motorola S records. The offset used in the records starts the image such that it ends at the reset vector 0xFFFFFFF0. A 16-bit relative jmp is programmed at 0xFFFFFFF0 to jmp to the start of the image.

mkrec explr2

The following converts the binary image ipl into Intel hex records. The offset used in the records starts the image such that it ends at the reset vector in the 256K ROM (0x3FFF0). A 16-bit relative jmp is programmed at 0x3FFF0 to jmp to the start of the image.

mkrec -f i -s 256k ipl

The following converts the binary image notipl into Motorola S records. The offset used in the records starts at 0; a reset vector jmp isn't output.

mkrec -r notipl