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++
12589 Discussions

Error building a Nios2 project HEX file/On chip RAM

Altera_Forum
Honored Contributor II
982 Views

Dear all,  

 

I started a couple of day ago working on the tutorial SOPC builder with VHDL.  

The mini code as many of you know it already is:  

# define Switches (volatile char *) 0x0003000# define LEDs (char *) 0x0003010 

 

void main() 

while (1) 

*LEDs = *Switches; 

 

My system specification contains ON chip RAM with an initialized .hex file that I created it using SOPC builder. I did everything exactly as it shows in the walk-through but had this strange error when trying to build the nios2 project on SBT eclipse:  

make: *** [/home/mehdi/Documents/il2207/Lab1/onchip_memory2_0.hex] Error 2 

 

Does anyone have any idea about this? I would appreciate your help. Thanks!
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
303 Views

make is just reporting that an error occurred during compilation, the real error message is probably a bit further up.

0 Kudos
Altera_Forum
Honored Contributor II
303 Views

This problem is freaking me out as none of my classmates could guess where the problem is coming from. Did I mention i am using ubuntu machine with the latest version of aletra tools. I did not change anything to default entries when setting the onchip ram with SOPC. How can i trace up the original error?

0 Kudos
Altera_Forum
Honored Contributor II
303 Views

Problem Solved! 

 

It seems that there is a problem with everyone using Ubuntu newer versions. What I understood that this issue is related to the Linux shell. These two commands can make it work:  

 

sudo rm /bin/sh (to delete the old entry of linux shell) 

sudo ln -s /bin/bash /bin/sh (link to the actual one which is bash)
0 Kudos
Altera_Forum
Honored Contributor II
303 Views

You really don't want to do that. 

You need to change the shell specified in /etc/passwd for your username. 

 

Separately it is worth sorting out whether the problem is that the script is non-portable (is using bash specific features), or whether the default /bin/sh in ubuntu is not complying to the posix rules.
0 Kudos
Altera_Forum
Honored Contributor II
303 Views

Once you get that sorted out I would recommend making your code cache coherency safe. Using pointers will not bypass the data cache (if one is present) so your code will most likely keep writing the same value out to the LEDs no matter what button combination you push. The PIO comes with cache bypassing macros, you can find them in altera_avalon_pio_regs.h

0 Kudos
Altera_Forum
Honored Contributor II
302 Views

Thanks BadOmen :-)

0 Kudos
Reply