- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I built the first software package "Hello World" using the templates in the NIOS2 Eclipse IDE and was able to run it on the target. My question is how to find the size of the physical memory required to run this program on the NIOS2 system. I tried the command line utility "nios2-elf-size" utility and it showed me the various sections. But I am confused how to interpret the information that this utility provides (text data bss dec hex filename). Do I use the value reported for 'data' as the size of the physical memory required in bytes? The requirement I have for my project is the software should run on the "On Chip RAM" without using any external memory. Thanks in advance. -RamLink Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
'text' is code, 'bss' is data that is initialed to zeros, the other partts are rather obvious - 'dec' and 'hex' are the totals.
The total size is probably just over 60k. To run in internal memory you need to remove all the calls to libc functions. So the printf() has to go! The code that calls your main() also calls intio libc - so you need to get rid of that as well. (I cheated and renamed main()). If you need to load data into a tightly coupled data block you will have to write your own linker script as well. The JTAG loader seems to run code from the jtag block - so it is the nios cpu that writes into memory and you need vaddr == paddr for the elf sections. If you are loading via external access to the Avalon bus, then you'll need to use the external address of data sections.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If the program is still too large, I find using optimization levels -O2 or -O3, in the C/C++ build settings for the system library, really cut down on the amount of on-chip memory used.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the good info you have provided.
I also saw one template - hello_world_small that is less than 400 bytes when built. Ofcourse the BSP is really bare bone. Thanks. -Ram.
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