Nios® II Software Developer Handbook

ID 683525
Date 8/28/2023
Public
Document Table of Contents

5.11.3.3.5. elf2hex

Description

The elf2hex utility takes a software file in ELF format and translates it to a HEX file that can be used as the initialization data for a memory component.

Usage

elf2hex [--debug] [--record=length] [--base=addr] [--quiet]
       [--width=value] [--big-endian-mem] [--no-zero-fill]
       [--create-lanes[=value]] [--lower] [--end=addr] [--verbose] [--silent]
       [--help] [--log=file] [--input=file] [--little-endian-mem]
       [--output=file]

Options

--base=<addr>              Hex data base address
    --big-endian-mem           Force big-endian memory layout
    --create-lanes[=<value>]   1 if lane files should be created
    --debug                    debug mode
    --end=<addr>               Hex data end address
    --help                     print this message
    --input=<file>             input ELF file to process
    --little-endian-mem        Force little-endian memory layout
    --log=<file>               file for logging progress
    --lower                    If you prefer your hex in lower case
    --no-zero-fill             No zero fill of empty sections
    --output=<file>            output Hex file
    --quiet                    only print errors
    --record=<length>          Output record length, in bytes.
    --silent                   silent mode - same as quiet
    --verbose                  lots of interesting information
    --width=<value>            [ 8 | 16 | 32 | 39 | 64 | 128]

The elf2hex utility converts the software and data within an ELF file in the address range [base, end] into a HEX file. The width option is used to insure that the resulting HEX file is formatted properly for its corresponding memory component. This utility can also create lane files which are used to initialize multi-laned memory components.