Nios® V Processor Software Developer Handbook

ID 743810
Date 7/08/2024
Public
Document Table of Contents

14.4. Programming the Zip File to On-Chip ROM

To access files in the zip file subsystem, you must first program the zip data into the On-Chip ROM Intel® FPGA IP (OCROM). To memory initialize the OCROM, you need an Altera-style HEX file (.hex), which includes the data for the zip file system.

You need the RISC-V GNU objcopy, RISC-V GNU linker, and elf2hex utility to generate an Altera-style HEX file.
$ riscv32-unknown-elf-objcopy --input-target binary \
--output-target elf32-littleriscv example.zip example.o

$ riscv32-unknown-elf-ld -e <OCROM Base Address> \
--Ttext <OCROM Base Address> -o example.elf example.o

$ elf2hex example.elf -b <OCROM Base Address> \
-e <OCROM End Address> -r <OCROM Data Width in bytes> \
-w <OCROM Data Width in bits> -o example.hex