[En-Nut-Discussion] Using NutOS without external SRAM?
Marc Wetzel
mwse at gmx.de
Wed May 12 09:18:50 CEST 2004
Thank you Oliver,
in fact it was no ram problem, but - because I compiled with
NUT_CPU_FREQ set to my special board frequency, I think that nasty old bug
was the cause (see other thread).
It's all working now, with some 900 bytes heap left :)
Thank you again for the in-depth explanation. I suppose you should put this
into the FAQ (if not already done :)
But one question is left for me:
How should I calculate the minimal heap a thread uses?
Take a thread with just some fgets(uart0) in a loop with an bufferarray[128]
+ max. 1-2 concurrent interrupt.
How much heap should we give the thread with NutThreadCreate ??
Greetings
/Marc
> -----Original Message-----
> From: en-nut-discussion-bounces at egnite.de
> [mailto:en-nut-discussion-bounces at egnite.de] On Behalf Of
> Oliver Schulz
> Sent: Monday, May 10, 2004 2:30 PM
> To: Ethernut User Chat (English)
> Subject: AW: [En-Nut-Discussion] Using NutOS without external SRAM?
>
>
> Hi Marc,
>
>
> > So, my question is: How much RAM is minimum, if I want to use
> > 2 buffered
> > uarts and 2 tasks?
> Exactly 3842 bytes... *g*
>
> No, just kidding. There is really no simple answer.
>
> Some points, that might help.
> 1. If using the USART driver, you need about 410 bytes per
> buffered uart.
> 2. Stack size of threads. Main's stack is 768 bytes and idle
> is 384 bytes. Add any additional thread stack size.
> (Would be no bad idea, if using the main thread as worker
> thread. That doesn't waste its stack.)
> 3. Any string constants used in your programm are located in
> static ram, unless they are declares as PROGMEM (or PCHAR).
> (Consider using printf_P functions.)
> 4. Some other internal variables used by Nut/OS. That are
> about some 30 bytes, but I'm not sure, depends on the used hardware...
>
> If using avr-gcc the separate irq stack can save heap mem, if
> you have more than two threads. There is no benefit, if
> having just main + idle.
>
> If your linker can create a map file of the linked project,
> you can figure out, how much static ram your program uses.
> Try to reduce the static variables.
> The remaining ram is configured for heap by Nut/OS and is
> used for thread's stacks and dynamically data, like usart buffers...
>
> Hope that helps a bit,
> Oliver.
> _______________________________________________
> 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