AW: [En-Nut-Discussion] Using NutOS without external SRAM?

Oliver Schulz Oliver.Schulz at bong.de
Mon May 10 14:30:28 CEST 2004


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.



More information about the En-Nut-Discussion mailing list