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++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Nios2 problem

Altera_Forum
Honored Contributor II
1,955 Views

Hi, 

 

I am trying to run a simple code of led blinking but I get this error 

 

Description Resource Path Location Type 

 

led_nois.elf: section .exceptions lma 0x1020 overlaps previous sections led_nois line 0 C/C++ Problem 

 

led_nois.elf: section .text lma 0x11b4 overlaps previous sections led_nois line 0 C/C++ Problem 

 

make: *** [led_nois.elf] Error 1 led_nois line 0 C/C++ Problem 

region onchip_mem is full (led_nois.elf section .text) led_nois line 0 C/C++ Problem 

 

section .exceptions [00001020 -> 000011b3] overlaps section .rodata [00001020 -> 00001067] led_nois line 0 C/C++ Problem 

section .rwdata [00002ab0 -> 000044f7] overlaps section .text [000011b4 -> 000064ff] led_nois line 0 C/C++ Problem 

 

 

The code is 

# include <stdio.h># include "system.h"# include "altera_avalon_pio_regs.h" 

 

int main () 

int i; 

 

//Send a message to console 

printf("Hello from Nios II!\n"); 

 

//Blink the LEDs in a counting-up manner from 0 to 255 

for(i=0;i<256;i++)  

/*This writes values to the LEDs using macro defined in altera_avalon_pio_regs.h 

This macro accepts two arguments: the base address of the PIO and the value that will be written to the PIO.  

In this example, the PIO base address is defined in the system.h file to be LED_PIO_BASE.*/ 

IOWR_ALTERA_AVALON_PIO_DATA(LED_BASE,i); 

 

return 0; 

 

 

Its a pretty simple code with simple sopc design of a processor,led,jtag and uart,onchip mem. 

 

onchip mem = 4kb...But i still get the erorr of onchip mem full when I compile the code.I dont know why? 

 

Apart from the demo code any code I try to run has the same error 

 

 

Help :confused:
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
670 Views

Using printf() pulls in quite a lot of code from libc, you'll need about 64k. You can use a smaller libc and smaller functions than printf() to get code to run in smaller memory blocks. 

 

Doing anything in 4k using any of the altera libc code is rather optimistic! If you write everything yourself (and don't want anything like printf) it can be done.
0 Kudos
Altera_Forum
Honored Contributor II
670 Views

first go to your bsp editor (right click on project->nios2) and enable the small c library. then change your printf() to alt_printf() this is a shredded down version of printf which lacks certain formatting functions. but since you're not doing any formatting it should be the same. and dont include stdio.h alt_printf is in the hal library

0 Kudos
Altera_Forum
Honored Contributor II
670 Views

Assuming you don't need much formatting you might want to try including "alt_stdio.h" and using alt_printf(). Search for reducing code footprint in the Nios II software developer handbook to find out more details.

0 Kudos
Altera_Forum
Honored Contributor II
670 Views

There is also a problem that I am not able to select more than 4kb of onchip memory.It gives me an error of  

 

Error: cpu_0.instruction_master: onchip_memory2_0.s1 cannot be at 0x2000 (0x0 or 0x10000 are acceptable) 

Error: cpu_0.data_master: onchip_memory2_0.s1 cannot be at 0x2000 (0x0 or 0x10000 are acceptable) 

 

Is this a problem because I downloaded the free version from the internet.All the design examples the onchip memory is 64kb.When I run them there is no problem.But if I make a design it doesnot allow to select more than 4kb  

 

Why is that so?
0 Kudos
Altera_Forum
Honored Contributor II
670 Views

are you trying to assign this memory at the sopc builder? the error looks like an address conflict to me. try 'auto assign base addresses' from the system menu after changing to 64k

0 Kudos
Altera_Forum
Honored Contributor II
670 Views

Hey thanks..It worked..

0 Kudos
Reply