Skip to main content

IAR Embedded Workbench for RL78 5.20

The IAR ELF Tool—ielftool

In this section:

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] inputfile outputfile [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

inputfile

An absolute ELF executable image produced by the ILINK linker.

options

Any of the available command line options, see Summary of ielftool options.

outputfile

An absolute ELF executable image, or if one of the relevant command line options is specified, an image file in another format.

Table 94. ielftool parameters 


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–0xFF

Summary of ielftool options

This table summarizes the ielftool command line options:

Command line option

Description

‑‑bin

Sets the format of the output file to raw binary.

‑‑bin-multi

Produces output to multiple raw binary files.

‑‑checksum

Generates a checksum.

‑‑fill

Specifies fill requirements.

‑‑front_headers

Outputs headers in the beginning of the file.

‑‑ihex

Sets the format of the output file to 32-bit linear Intel Extended hex.

‑‑ihex-len

Sets the number of data bytes in Intel Hex records.

‑‑json

Formats the output as JSON.

‑‑offset

Adds (or subtracts) an offset to all addresses in the generated output file.

‑‑parity

Generates parity bits.

‑‑self_reloc

Not for general use.

‑‑silent

Sets silent operation.

‑‑simple

Sets the format of the output file to Simple-code.

‑‑simple-ne

As ‑‑simple, but without an entry record.

‑‑srec

Sets the format of the output file to Motorola S-records.

‑‑srec-len

Sets the number of data bytes in each S-record.

‑‑srec-s3only

Restricts the S-record output to contain only a subset of records.

‑‑strip

Removes debug information.

‑‑titxt

Sets the format of the output file to Texas Instruments TI-TXT.

‑‑update_symbol

Replaces the ELF file content for the specified symbol.

‑‑verbose, -V

Prints all performed operations.

‑‑version

Sends tool output to the console and then exits.

Table 95. ielftool options summary 


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.