The IAR ELF Tool—ielftool
The IAR ELF Tool, ielftool, can generate a checksum on specific ranges of memories. This checksum can be compared with a checksum calculated on your application.
The source code for ielftool and a CMake configuration file are available in the rl78\src\elfutils directory. If you have specific requirements for how the checksum should be generated or requirements for format conversion, you can modify the source code accordingly. The CMake file can be used as a Microsoft Visual Studio project or it can be used to generate makefiles for use on Linux, etc.
Invocation syntax
The invocation syntax for the IAR ELF Tool is:
ielftool [options]inputfileoutputfile[options]
The ielftool tool will first process all the fill options, then it will process all the checksum options (from left to right).
Parameters
The parameters are:
Parameter | Description |
|---|---|
| An absolute ELF executable image produced by the ILINK linker. |
| Any of the available command line options, see Summary of ielftool options. |
| An absolute ELF executable image, or if one of the relevant command line options is specified, an image file in another format. |
See also Rules for specifying a filename or directory as parameters.
Example
This example fills a memory range with 0xFF and then calculates a checksum on the same range:
ielftool my_input.out my_output.out ‑‑fill 0xFF;0–0xFF ‑‑checksum __checksum:4,crc32;0–0xFFSummary of ielftool options
This table summarizes the ielftool command line options:
Command line option | Description |
|---|---|
Sets the format of the output file to raw binary. | |
Produces output to multiple raw binary files. | |
Generates a checksum. | |
Specifies fill requirements. | |
Outputs headers in the beginning of the file. | |
Sets the format of the output file to 32-bit linear Intel Extended hex. | |
Sets the number of data bytes in Intel Hex records. | |
Formats the output as JSON. | |
Adds (or subtracts) an offset to all addresses in the generated output file. | |
Generates parity bits. | |
Not for general use. | |
Sets silent operation. | |
Sets the format of the output file to Simple-code. | |
As | |
Sets the format of the output file to Motorola S-records. | |
Sets the number of data bytes in each S-record. | |
Restricts the S-record output to contain only a subset of records. | |
Removes debug information. | |
Sets the format of the output file to Texas Instruments TI-TXT. | |
Replaces the ELF file content for the specified symbol. | |
Prints all performed operations. | |
Sends tool output to the console and then exits. |
For more information, see Descriptions of utilities options.
Specifying ielftool address ranges
At the most basic level, an address range for ielftool consists of two hexadecimal numbers—0x8000-0x87FF—which includes both 0x8000 and 0x87FF.
You can specify ELF symbols that are present in the processed ELF file as a start or end address using __checksum_begin-__checksum_end. This range begins on the byte that has the address value of the __checksum_begin symbol and ends (inclusive) on the byte that has the address value of the __checksum_end symbol. Symbol values of 0x40 and 0x3FD would equate to specifying 0x40-0x3FD.
You can add offsets to symbolic values using __start+3-__end+0x10. The calculation is done in modulo 32-bits, therefore adding 0xFFFFFFFF is equivalent to subtracting 1.
You can specify blocks from an .icf file that are present in the processed ELF file using {BLOCKNAME}. A block started on 0x400 and ending (inclusively) on 0x535, would equate to specifying 0x400-0x535.
You can combine several address ranges, as long as they do not overlap, separated by 0x800-1FFF {FARCODE_BLOCK}.
You can specify __FLASH_BASE-__FLASH_END as a legal range (as long as there is no overlap).
Note
If your application is linked with address translation (see logical directive), make sure that any checksums are calculated using explicit physical checksum ranges, see Checksums of address-translated ranges.