Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

Error building a Nios2 project HEX file/On chip RAM

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!

6 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

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

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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?

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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