Forum Discussion

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

Nios II System download problem!

Hello everyone! I'm new to Altera's FPGAs and Nios soft cpu!

I got a DE2 board a few days ago from my university and I'm playing around with it to get to know it better! It has a Cyclon II device on it! I downloaded the following software from Altera's website:

1.quartus ii web edition software v9.1 Service Pack 1

2.[/B][/B]nios ii embedded design suite

3.modelsim altera

I created a system with Nios II, a Jtag Uart interface, two parallel IO interfaces and an on-chip memory. I configured each component, i constrained the clock, I assigned the pins on the board and I compiled it successfully! Then I downloaded it to the board!

Up till now everything seems to work perfectly! The problem arises when I try to compile and download my code for the Nios core to execute! I first used Altera Debug Client to compile and run my code (simple led control with switches) but I got the following message:

Writing "system.h" in "C:\Users\GeorgeK\Documents\QuartusProjects\sopc_builder_tut\app_software\include" directory...
Cannot find the Altera University Program IP Cores path from registry. You may need to manually the configure SDK usage.
Compiling source files...
nios2-elf-as --gstabs -I C:/altera/91sp1/nios2eds/components/altera_nios2/sdk/inc C:/Users/GeorgeK/Documents/QuartusProjects/sopc_builder_tut/app_software/lights.s -o C:/Users/GeorgeK/Documents/QuartusProjects/sopc_builder_tut/app_software/lights.s.o 
/usr/bin/bash: nios2-elf-as: command not found
Linking...
nios2-elf-ld --defsym nasys_program_mem=0x1000 --defsym nasys_data_mem=0x1000 --section-start .exceptions=0x1020 --section-start .reset=0x1000 -e _start -u _start --script C:/altera/91sp1/nios2eds/bin/monitor/build/nios_as_build.ld -g -o C:/Users/GeorgeK/Documents/QuartusProjects/sopc_builder_tut/app_software/lights.elf C:/Users/GeorgeK/Documents/QuartusProjects/sopc_builder_tut/app_software/lights.s.o 
/usr/bin/bash: nios2-elf-ld: command not found
Compilation stopped.
Of course I have already configured system options (ptf file etc) and I tried it with assembly and C! Same problem arises for both!

Next I try to use Nios II EDS Eclipse platform! I create a BSP project using the sopc info file wich was generated by SOPC earlier (in design time) in Quartus! Then I created a Nios Application project linked to the BSP I just created! I add a .c file to the project and I write my code in there! The code is the following:

#define Switches (volatile char *) 0x0003000# define LEDs (char *) 0x0003010
void main()
{
    while (1)
    {
        *LEDs = *Switches;
    }
}
When I try to build the project I get an error that says something that the memory (the on chip memory I used) has to be larger! And it exits saying this:


Info: Linking RUN_ON_HDL_SIMULATOR_ONLY_Lights.elf
nios2-elf-g++  -T'../Lights_bsp//linker.x' -msys-crt0='../Lights_bsp//obj/HAL/src/crt0.o' -msys-lib=hal_bsp -L../Lights_bsp/  -msmallc  -Wl,-Map=RUN_ON_HDL_SIMULATOR_ONLY_Lights.map   -O0 -g -Wall   -mno-hw-div -mno-hw-mul -mno-hw-mulx  -o RUN_ON_HDL_SIMULATOR_ONLY_Lights.elf obj/lights.o -lm 
/cygdrive/c/altera/91sp1/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/bin/ld: region onchip_memory2_0 is full (RUN_ON_HDL_SIMULATOR_ONLY_Lights.elf section .text). Region needs to be 3272 bytes larger.
/cygdrive/c/altera/91sp1/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/bin/ld: section .rodata  overlaps section .text 
/cygdrive/c/altera/91sp1/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/bin/ld: section .rwdata  overlaps section .text 
/cygdrive/c/altera/91sp1/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/bin/ld: section .bss  overlaps section .text 
collect2: ld returned 1 exit status
make: ***  Error 1
What can I do?!?!?!?!?!:confused: Is Eclipse IDE generating larger code than the Debug Client? The Debug Client seems a lot easier to use and is straightforward for tutorials and stuff! How can I get it to work!!?!

ps: I also get this at the Eclipse platform error and stuff:

../Lights_bsp//libhal_bsp.a(alt_close.o)(.text+0x128): In function `alt_get_errno':
HAL/inc/sys/alt_errno.h:81: Unable to reach errno (at 0x00004024) from the global pointer (at 0x00010880) because the offset (-51292) is out of the allowed range, -32678 to 32767.

I even made the on chip memory larger but nothing changed!

Thank you all in advance for any help you may provide!

Cheers,

GeorgeK

11 Replies