Forum Discussion

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

Error in "Run as -> Nios II Modelsim" using Eclipse SBT

Hello:

I'm using Quartus 11.1 under Ubuntu 11.10.

I've been following this(altera.com/support/examples/nios2/exm-simulating-niosii.html) tutorial, trying to simulate a system created with Qsys.

Everything goes fine, until I finally try to simulate the system in modelsim. When I execute "Run as -> Nios II Modelsim" I get the following error:

Failed Executing: make sim SPD=/home/daniel/Documentos/universidad/Proyecto/tutorial_diseno/an351_design/niosii_system_tb.spd ELF=/home/daniel/Documentos/universidad/Proyecto/tutorial_diseno/an351_design/software/hello_world_an351/hello_world_an351.elf ENABLE_VSIM_GUI=1 VSIM_DIR=/home/daniel/altera/11.1/modelsim_ase/linuxaloem  return code: 2
Checking the Nios II console, the error seems to come from the file sh_jar.sh:

Post-processing to create mem_init/niosii_system_ram.hex...
elf2hex /home/daniel/Documentos/universidad/Proyecto/tutorial_diseno/an351_design/software/hello_world_an351/hello_world_an351.elf 0x00010000 0x0001ffff --width=32 
        --little-endian-mem --create-lanes=0  mem_init/niosii_system_ram.hex
/home/daniel/altera/11.1/nios2eds/bin/sh_jar.sh: 2: Bad substitution
make: ***  Error 2
And the content of that file is:

# !/bin/sh
FILEPATH=${0//\\/\/}
_this_script=$(cd ${FILEPATH%*} && echo $(pwd 2>/dev/null)/${FILEPATH##*/})
_this_script_dir=$(dirname ${_this_script})
CMD="$0"
perl -I ${_this_script_dir} ${_this_script_dir}/pl_jar.pl "$CMD" "$@"
~                                                                       
As suggested in some forums, I tried to change the first line with "#!/bin/bash", but it didn't work.

It seems that the problem is located in the second line: "FILEPATH=${0//\\/\/}"

Has anybody else encountered with this problem? I'd really appreciate any help on this issue

Regards

3 Replies

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

    Finally, I found an answer in this post: alteraforum.com/forum/showthread.php?t=32760

    
    One  point that we have found with Ubuntu.  Most things do work well,  however the issue that you mention in your note is very similar to some  other .sh issues that we have seen.  On Ubuntu, this is commonly  resolved by changing the symbolic link for /bin/sh from /bin/dash to  /bin/bash:
    sudo rm /bin/sh
    sudo ln -s /bin/bash /bin/sh
    Dash and Bash have a slightly different syntax, and that gets us around most issues. 

    This solution worked for me :)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Did both of answers you provided, none worked.

    Any other solutions?
  • ABinO1's avatar
    ABinO1
    Icon for New Contributor rankNew Contributor

    I faced the same issue, I solve it by modifying the path shown to run modelsim , so instead of calling modelsim ae , I make it call modelsim ase