Nios2 problems when building tests

Roger Dahlkvist ruppe at
Wed Mar 25 17:40:54 UTC 2009


Yes, I defenately think the errors are memory related. I'll look at the hints you gave.

When I for example run hello.exe in the Altera NiosII ISS I get the following errors before the program terminates. 

Error! : Failed memory access in component cpu_0 - Reading data 0x0 from uninitialized memory (addr = 0x1f33c)
Error! : Simulation failed in component cpu_0 at instruction 33372 (PC=0x8eb8 instr=0x2c000017).


Roger Dahlkvist wrote:
> Thanks, any help is greatly appreciated.
> The status for me right now is that I have switched to newlib-1.17.0.  I also changed both cpukit/wrapup/ and c/src/wrapup/, as suggested.
> That fixed most errors, now that both librtemscpu.a and librtemsbsp.a are added correctly.
Then you are probably close to in sync with what I have
on my laptop at home.
> I've tried myself to solve the remaining issues, by including /shared/bsppretaskinghook.c to libbsp.a, and define WorkAreaBase in linkcmds.
> However the resulting tests fail in the simulator, so that might not have been the right way to go, or there are other things to consider aswell.

How do the tests fail?

Usually at this point it is memory layout.

All BSPs now use the same framework for BSP initialization
and most use exactly the same mechanism for dividing memory
between the RTEMS Workspace and C program heap.

Can you get debug IO via printk at this point on the simulator?
If so, make printk work and turn on debugging in libbsp/shared/bootcard.c.

If not, or if it is just as easy, trace through bootcard.c in the debugger
and see if things look ok.

Also (very common), the starting stack (the one the BSP start code
runs on) may NOT be properly accounted for in the linkcmds and
your work memory (workspace and C program heap) may overlap it.
Then the init is clobbering the stack out from underneath you.

> Looking forward to your inputs.
> //Roger
> ________________________________________
> Från: millibit at [millibit at] för Morten Kristiansen [millibit+rtems at]
> Skickat: den 24 mars 2009 09:30
> Till: Joel Sherrill
> Kopia: Roger Dahlkvist; rtems-users at
> Ämne: Re: Nios2 problems when building tests
> 2009/3/20 Joel Sherrill <joel.sherrill at>:
>> My full NIOS patches are at home.  Morten can help you
>> get things going.
> I should think so. I'll take a look at it this evening.
>> The biggest issue you are facing is that the NIOS II binutils
>> version Altera uses is TOO old for the feature used in cpukit/wrapup.
> I fetched the relevant versions into Subversion and tried merging. It
> wasn't straightforward, but as a quick solution I can create a patch
> that allows it to read options from a file.
> /MK

Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985

More information about the users mailing list