Nios® V Processor Software Developer Handbook

ID 743810
Date 5/26/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

13.2.2.1. elf2hex

Synopsis

elf2hex [OPTIONS] <ELF FILE> <HEX FILE>

Description

The elf2hex utility converts the software and data within an .elf file in the address range [base, end] into a .hex file that can be used as the initialization data for a memory component. The width option is to ensure 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.

Usage

#Generate hex file for OCM Memory initialization
elf2hex <elf input file> -b <On-chip memory start address> -w <On-chip memory data width in bits> -e <On-chip memory end address> -r 4 -o <hex output file>

Example: elf2hex software/app/build/hello.elf  -b 0x0 -w 32 -e 0x4FFFF -r 4 -o ram.hex

Options

Options Description
-b,--base <addr> Hex data base address
--big-endian-mem Force big-endian memory layout
--debug Debug mode
-e,--end <addr> Hex data end address
-h,--help Print this message
-i,--input <file> Input ELF file to process
-l,--create-lanes <value> 1 if lane files should be created
--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
-o,--output <file> Output Hex file
-q,--quiet Only print errors
-r,--record <length> Output record length, in bytes.
-s,--silent Silent mode - same as quiet
-v,--verbose Lots of interesting information
-w,--width <value> [ 8 | 16 | 32 | 39 | 64 | 128]