Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12409 Discussions

Nios II EDS: mem_init_generate failing

DWolf
Beginner
808 Views

Hi,

 

Yesterday I was able to generate a .hex file for my onchip flash memory contents, but today when I run the mem_init_generate make target it's giving me an error.

 

Here is the console output:

 

wsl make mem_init_generate 

Info: Building /mnt/e/repos/Vx834_LRF/FPGA/TestBoard/software/Vx834_LRF_bsp/

make --no-print-directory -C /mnt/e/repos/Vx834_LRF/FPGA/TestBoard/software/Vx834_LRF_bsp/

[BSP build complete]

Post-processing to create mem_init/onchip_flash_0.hex...

alt-file-convert.exe -I elf32-littlenios2 -O hex --input=Vx834_LRF.elf --output=mem_init/onchip_flash_0.hex --base=0x00020000 --end=0x0003c7ff --reset=0x00020000 --out-data-width=8 --boot="/mnt/e/intelfpga_lite/19.1/nios2eds/components/altera_nios2/boot_loader_cfi.srec"

Apr 9, 2020 11:41:43 AM - (SEVERE) elf2flash: Read error: File not found: /mnt/e/intelfpga_lite/19.1/nios2eds/components/altera_nios2/boot_loader_cfi.srec

Apr 9, 2020 11:41:43 AM - (SEVERE) elf2flash: Error reading boot copier

Apr 9, 2020 11:41:43 AM - (SEVERE) elf2flash: Error generating Flash file, exiting

nios2-elf-objcopy: 'C:\Users\devin\AppData\Local\Temp\tmp3_iay72c': No such file

Converting Nios II ELF file to HEX file. Appending boot file.

Post-processing to create onchip_flash_0.flash...

elf2flash.exe --input=Vx834_LRF.elf --output=onchip_flash_0.flash --sim_optimize=0 --base=0x00020000 --end=0x0003c7ff --reset=0x00020000 --boot="/mnt/e/intelfpga_lite/19.1/nios2eds/components/altera_nios2/boot_loader_cfi.srec"

Apr 9, 2020 11:41:43 AM - (SEVERE) elf2flash: Read error: File not found: /mnt/e/intelfpga_lite/19.1/nios2eds/components/altera_nios2/boot_loader_cfi.srec

Apr 9, 2020 11:41:43 AM - (SEVERE) elf2flash: Error reading boot copier

Apr 9, 2020 11:41:43 AM - (SEVERE) elf2flash: Error generating Flash file, exiting

make: *** [onchip_flash_0.flash] Error 5

/mnt/e/repos/Vx834_LRF/FPGA/TestBoard/software/Vx834_LRF_bsp/mem_init.mk:359: recipe for target 'onchip_flash_0.flash' failed

 

elf2flash is throwing an error saying that "boot_loader_cfi.srec" can't be found, but the file exists in the specified directory. If I open wsl and enter the directory as specified, I can see the file just fine.

 

I googled various permutations of the error message. The only thing I found that was matching was something from ~2009, applicable to the first gen Nios processor, saying you need to run the SOPC Builder, but I don't think this is applicable here.

 

Any idea what is going on?

 

-Devin

 

0 Kudos
7 Replies
JLee25
Novice
718 Views

Hi Devin,

I am facing the same issue.

 

Did your problem got resolved ?

 

BRs,

Johnson

DWolf
Beginner
718 Views

Not yet, just started working on something else for a bit to see if I got any replies. Gonna take another crack at it, maybe later today. I'll post if I get any results.

JLee25
Novice
718 Views

Hi Devin,

Thanks for the reply and hope you have good news to share.

 

I found a link about how to generate the flash manually by using alt-file-convert.

https://www.intel.com/content/www/us/en/programmable/support/support-resources/knowledge-base/embedd...

 

I tried but not work..

Because I don't know how to use this program...

FYI!

 

BRs,

Johnson

 

DWolf
Beginner
718 Views

Capture.JPGI tried using the method in the link, by copying the boot_loader_cfi.srec file to my Nios II software directory and running alt-file-convert.exe through the Nios command line. This is the error I received. It seems suspiciously similar to the old error. Unfortunately, the output of the executable is ambiguous as to which file it could not find, the .ELF or the bootloader, although I suspect that it is the bootloader. I tried omitting the --boot option from the executable arguments, and got a different error - "must be str, not NoneType".

 

If I can't convert my .ELF file to a hex, I'm kind of dead in the water with my design. Can someone else please weigh in on this?

 

-Devin

JLee25
Novice
718 Views

Hi Devin,

I tried the link and generate the hex file successfully.

But for unknown reason, my Nios 2 does not boot after programming.

I noticed minor difference between your setting and mine.

 

Anyway, i attached my command below for your reference,

hex_gen.jpg

 

FYI!

 

BRs,

Johnson

ppauli
Beginner
662 Views

Hit this error also.

It seems that there is some file path problems between Windows and linux subsystem.

Found out a workaround by making a copy of bootloader_cfi.srec to eclipse workspace directory and making modification to BOOT_LOADER_CFI in bsp mem_init.mk file.

#BOOT_LOADER_CFI ?= $(BOOT_LOADER_PATH)/boot_loader_cfi.srec
BOOT_LOADER_CFI ?= ../boot_loader_cfi.srec

(Nios project and bsp are directly under workspace)

edit: --

alt-file-convert.exe seems to want a windows path for --boot option (in windows machines), as mem_init.mk BOOT_LOADER_CFI modification to windows path removes error:

BOOT_LOADER_CFI ?= "'C:\intelFPGA\19.1\nios2eds\components\altera_nios2\boot_loader_cfi.srec'"

---

With this modification the mem_init_generate runs and there is a flash hex file which content seems to be correct (real world booting not tested yet)

-Pauli-

diwi
Beginner
506 Views

Hi @ppauli ,

many thanks for this solution!

I am facing this issue with Quartus Prime Pro 19.3 as well. Your fix seems to work. I did not verified on a target, yet.

 

Is this issue fixed in newer Versions of Quartus Prime? Is there an official solution provided by Intel?

BR, Dirk

Reply