Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12690 Discussions

.elf of updated build not downloading to Nios V from RiscFree

Eivind
Novice
822 Views

I have made a "hello world" project using Quartus lite23.1, RiscFree 24.3 on a Cyclone IV.

 

The initial project works OK, but if i do an edit to the c soure file (hello world), the newly compiled elf-file is not downloaded to the Nios V, it runs the old version of the program.

 

I have verified that the .elf file in the build/Default folder is updated, so it has been recompiled.. 

Using niosv-download from niosv-shell works, then the new .elf is downloaded, but recompile and run from riskFree does not work.

 

Any suggestions?

 

Eivind

0 Kudos
1 Solution
Eivind
Novice
361 Views

Thank You for Your reply.

 

Things has made a weird turn to the better..

I tried to recreate the situation before I did the edits in bsp_editor I mentioned in my previous post.

I started bsp_editor, opened the settings.bsp-file, checked enable_alt_load and enable_alt_load_copy_rwdata and generated bsp_settings again.

However, I did not get back to my previous situation. I was still in a situation where a reset would freeze the niosV, only a new run from RiscFree would get it running again.

 

To get out of this situation, I tried to generate a new bsp rather than editing the old one.

Voila:, everything works. If I edit the hello.c file, the newest version runs on then NIOS.

I think I am now in the situation where the old proverb "If it aint broken, dont fix it" applies. 

We can consider this case closed.

 

Unfortunately, when I regenerated the new setting.bsp the old one was overwritten, and it it thus not possible to compare working and non-working versions.

 

Thank You again for Your help. 

Best regards

Eivind

View solution in original post

0 Kudos
11 Replies
JingyangTeh
Employee
750 Views

Hi

 

When running downloading the elf in RiscFree did you by chance selected the old elf file in the configuration settings below:

2025-01-27_16h47_48.png

 

 

Regards

Jingyang, Teh

 

0 Kudos
Eivind
Novice
717 Views

Thanks for the reply.

There is only one .elf file in the system, the old one is overwritten during compile. I have verified that the .elf-file on the PC is in fact the newest version.

It makes no difference whether I have selected "use project binary" or "use file" and link to the correct file. Somehow  then new .elf seems to not download to the FPGA.

 

Regards

Eivind

 

0 Kudos
JingyangTeh
Employee
653 Views

Hi


Is there any error when you are trying to download the new elf file?

Did you select the reset signal after download option?

What kind of boot method the Nios is using?


Regards

Jingyang, Teh


0 Kudos
JingyangTeh
Employee
609 Views

Hi


Do you have any update on this case?

Did you manage to flash the new elf that you created?


Regards

Jingyang, Teh


0 Kudos
Eivind
Novice
569 Views

Thank you for your reply.

I have not had any progress lately.

1. I do not get any error messages when downloading new elf-file from riscFree. I have not been able to find any error message in any  .log-file. It just does not give the NIOS the latest elf.  Using niosv-download from niosv-shell works perfectly.

2. I do not know how to select reset signal after download option. I do not get an automatic reset after download, I need to do a reset from hardware (Push-button) to make the program on Nios to start running again.  This applies whether I try to download from riscFree or using niosv_download. I have tried adding the -r option to niosv-download without sucess.

3. I do not know what boot method the nios is using? How do I tell and where do I change it?

 

Best regards

Eivind

0 Kudos
Eivind
Novice
525 Views

Update: 

! have solved the problem with restart og program after download to NiosV:
I need to select "Resume" in startup in run configuration, or use niosv-download with the -g option.

Eivind_0-1739363427637.png

 

The main problem, getting riscFree to download updated .elf file remain unsolved.

 

Regards

 

Eivind

 

0 Kudos
JingyangTeh
Employee
477 Views

Hi


For the Nios V boot method, you could check the BSP setting of your project.

https://www.intel.com/content/www/us/en/docs/programmable/726952/22-1-21-2-0/processor-booting-methods.html


The niosv-download will only load the elf file into the memory.

If you are using a volatile boot method such as booting from Flash, that could explain why after reboot the old elf is reloaded into the memory.


Regards

JIngyang, Teh


0 Kudos
Eivind
Novice
460 Views

Thank You for Your reply.

 

I run the project om a DE2-115 evaluation board with Cyclone IVE. There is no flash memory so I assume I boot from OCRAM.

In Nios® V Embedded Processor Design Handbook I find: 

Nios® V processor application execute in-place from On-chip Memory (OCRAM)OCRAMOCRAMEnable allow_code_at_reset in Advanced.hal.linker and uncheck other settings.Make sure all Linker Sections are set to OCRAM.

 

I checked Advanced.hal.linker in bsp-editor. In my system allow_code_at_reset was checked, but also enable_alt_load and enable_alt_load_copy_rwdata.

Eivind_0-1739537410998.png

I unchecked enable_alt_load and enable_alt_load_copy_rwdata and generated bsp_settings again.

When I build the software project I now  sometimes, but not always, get this waring:

warning: hallo.elf has a LOAD segment with RWX permissions

If i get this warning, the program will not run at all. Pressing reset button has no effect.

However, if I do not get this waring during compile, the program is running latest version of the .elf-file.

The drawback is that a reset from reset button makes the app stop executing, it will not restart, not even after repeated  press to reset button.  To get the program running again I need to do a "run" from RiscFree software.

 

Best regards

 

Eivind

 

0 Kudos
JingyangTeh
Employee
388 Views

Hi

 

This could be a linker issue.

Could you share us your linker file and bsp setting files?

 

Just to confirm you are using the riscv32 compile to compile the elf right( riscv32-unknown-elf-gcc) 

 

Regards

Jingyang, Teh

 

0 Kudos
Eivind
Novice
362 Views

Thank You for Your reply.

 

Things has made a weird turn to the better..

I tried to recreate the situation before I did the edits in bsp_editor I mentioned in my previous post.

I started bsp_editor, opened the settings.bsp-file, checked enable_alt_load and enable_alt_load_copy_rwdata and generated bsp_settings again.

However, I did not get back to my previous situation. I was still in a situation where a reset would freeze the niosV, only a new run from RiscFree would get it running again.

 

To get out of this situation, I tried to generate a new bsp rather than editing the old one.

Voila:, everything works. If I edit the hello.c file, the newest version runs on then NIOS.

I think I am now in the situation where the old proverb "If it aint broken, dont fix it" applies. 

We can consider this case closed.

 

Unfortunately, when I regenerated the new setting.bsp the old one was overwritten, and it it thus not possible to compare working and non-working versions.

 

Thank You again for Your help. 

Best regards

Eivind

0 Kudos
JingyangTeh
Employee
293 Views

Hi


I’m glad that your question has been addressed, I will now transition this thread to community support. If you have a new question, Please login to ‘https://supporttickets.intel.com/s/?language=en_US’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions.


Regards

Jingyang, Teh


0 Kudos
Reply