- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does any one knows how to get real requirements for stack and heap memory?
And not that message from IDE for each project "16Mb free for stack and heap"? Any info please. Target system NiosII CPU standart design.Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hmm. I'm looking at this problem myself right now...
Several things: a: Use 'objdump -h' (nios2-elf-objdump) from the nios shell on the .elf file. This should give you some info on the "static" sizes of things like code, data, bss. b: for ucos task stacks, note that sizeof(OS_STK) is 4, not 1. So your stack usage may be 4 x higher than you think. c: If you use LWIP, then 8KB per possible task of stack is preallocated in sys_arch.c. On my system, that took up 504K. A sane person might wish to alter this to use a less brain-dead approach. Also, if a task started with sys_new_task terminates, the stack (and the task priority) are not 'reclaimed' in any way. d: the newlib 'mallinfo' calls are effectively pointless. Calling 'mallinfo' will give you an idea of how much heap you're using, but you have - AFAIK - NO WAY of telling how much is left, because malloc itself requests memory via sbrk(), which seems to have no concept of the amount of available memory. It just keeps giving malloc more and more... Has anybody attempted to rebuild newlib yet? - Roddy
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page