[En-Nut-Discussion] Nut/OS thread stackpointer overwritten on ARM7S

Tim DeBaillie debaillie at ciholas.com
Mon Nov 26 16:07:32 CET 2007

On Sun, 25 Nov 2007, Michael Bieri wrote:

> Hi
> I 've got a very strange bug in my Nut/OS application: The stackpointer
> in NUTTHREADINFO.td_sp is overwritten with the value 0x600000D3.
> Some additional information:
> - I use an AT91SAM7S256 on an olimex dev board, for debugging, I use
> olimex' ARM-USB-OCD together with GDB in Eclipse.
> - The problem occurs in MmCardReadOrVerify (mmcard.c:465) when I try to
> mount an SD-Card with volid = _open(BLKDEV_NAME ":1/" FSDEV_NAME,
> - Very strange: The problem seems to occur on different locations,
> probably depending on my debugging. (When I do single steps, the problem
> normally occurs earlier, but in every case in MmCardReadOrVeryify or
> functions called by this - mostly on/after returning to MmCardReadOrVerify)
> - And very strange, too: In assembly-instruction stepping mode, I caught
> the problem several times occuring immediately after an LDMIA
> instruction, this instruction loads some values from memory to
> registers. But how can this overwrite my NUTTHREADINFO.td_sp, that is
> stored in memory (and not in a register.)?
> - Further, the problem only occurs if I compile with the -O0 parameter,
> using -Os does not make any problems. But of course, I need -O0 for
> debugging.
> Does anyone know anything about this problem? I've got no further idea
> to solve this...
> Thanks a lot,
> Michael
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion

I'm glad to see someone else is using the SAM7S with Ethernut.  We have 
had no similar issues with the GCC-4.2.1 compiler with the -Os compile 
flag.  Of course you have said that this works with your compiler.

Which compiler are you using.  I had a similar issue with the AT91SAM7X256 
and the WinARM compiler.  Switching to GNUARM fixed the problem.  Since 
then we have switched to GNUARM for linux.


More information about the En-Nut-Discussion mailing list