[En-Nut-Discussion] Thread stack

Francois Rademeyer francois at asnone.com
Wed Feb 25 07:26:01 CET 2004


Read the following documents:
http://www.ethernut.de/pdf/entet100.pdf
&
http://www.ethernut.de/pdf/enmem100.pdf

They contain a very good explanation.

Do determine the excess stack memory, place the following logging code in
the deepest function calls with most local variables:

#include <sys/thread.h>

printf_P(PSTR("Free thread stack: %u\n"),
     (u_short) runningThread->td_sp -
     (u_short) runningThread->td_memory);

In one of my projects I don't have external RAM due to shortage of pins (not
even a single one!) and the use of a large graphic LCD.  I have 4 threads
and use 1 uart driver.  With Nut-Os you really have to economise. I have
stacks of SPI flash memory available (16Mbits) and if things get any
tighter, I'm thinking about writing a mod that swaps the thread stack to
flash.  Now when will Atmel bring out an ATmega256 with 64K internal RAM?
Probably never.  When will someone have a port of Nut-Os ready for the ARM?
GCC already has an ARM port, but the cost of developing for the ARM is very
high.  Yoda would have said: "Stuck between a rock and a hard place, I am.".

Cheers,
Francois

----- Original Message -----
From: "Gila" <Gila at home.nl>
To: "Ethernut User Chat (English)" <en-nut-discussion at egnite.de>
Sent: Tuesday, February 24, 2004 10:37 PM
Subject: Re: [En-Nut-Discussion] Thread stack


> On Tue, 2004-02-24 at 15:59, Francois Rademeyer wrote:
> > Ignore the message, I have figured it out by now.
>
> Mind sharing it ? :)
>
>
> > ----- Original Message -----
> > From: "Francois Rademeyer" <francois at asnone.com>
> > To: "Ethernut User Chat (English)" <en-nut-discussion at egnite.de>
> > Sent: Tuesday, February 24, 2004 3:15 PM
> > Subject: [En-Nut-Discussion] Thread stack
> >
> >
> > > Hi everyone,
> > >
> > > I have some stupid questions:
> > >
> > > Lately I have become very confused with all the GCC, AVR & NUT
memories.
> > I
> > > am trying to find a good balance for the stack size specified when
> > creating
> > > threads.  Except for all the registers that get pushed onto it when a
> > thread
> > > swap occurs, what else uses the thread stack? Unlike larger
processors,
> > > where local variables goes onto the stack, with the AVR they go into
.bss
> > > and .data, right?
> > >
> > > Thanks,
> > > Francois
> > >
> > >
> > > _______________________________________________
> > > En-Nut-Discussion mailing list
> > > En-Nut-Discussion at egnite.de
> > > http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
> > >
> >
> > _______________________________________________
> > En-Nut-Discussion mailing list
> > En-Nut-Discussion at egnite.de
> > http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>




More information about the En-Nut-Discussion mailing list