Intel: Running the "Make Targets" => "Build" => "mem_init_generate" step in the Nios® II Software Build Tools (SBT) gives an error elf2flash: Error reading boot copier and does not generate Hex.

Nios II

Category: Nios® II
Tools: Nios® II EDS
device:-

<Error message>
Critical: elf2flash: Read error: File not found: /mnt/c/intelFPGA_pro/19.3/nios2eds/components/altera_nios2/boot_loader_cfi.srec
Jan 28, 2020 10:39:52 PM com.altera.commandApplication.CmdApp severe
Critical: elf2flash: Error reading boot copier
Jan 28, 2020 10:39:52 PM com.altera.commandApplication.CmdApp severe
SEVERE: elf2flash: Error generating Flash file, exiting

This error is a tool issue.
This issue has been confirmed with Nios® II SBT in Quartus® Prime ver19.2 Pro Edition, ver19.1 Standard Edition or later.
You can avoid it by the following method.

<Workaround>
(1) Execute mem_init once and check the command
(2) Store "boot_loader_cfi.srec" in application folder
(3) Copy the confirmed command, modify the --boot option part, and execute it with Nios II Command Shell
As shown in the command example below, since it is in the application folder, modify it so that only the file name is specified.
(From the Nios® II SBT, right-click the application to start it, and you can start it while moving to the working directory.)

Command example

$ alt-file-convert.exe -I elf32-littlenios2 -O hex --input=mem_test.elf --output=mem_init/epcq_controller2_0.hex --base=0x02000000 --end=0x03ffffff --reset=0x02050000 --out-data-width=8 --boot="boot_loader_cfi.srec"

(4) Use epcq_controller2_0.hex generated in the mem_init folder

Experienced FAE
Free consultation is available.

From specific product specifications to parts selection, the Company FAE will answer your technical concerns free of charge. Please feel free to contact us.