Forum Discussion
Altera_Forum
Honored Contributor
20 years agoHi tns1,
> Is there a simple directive I can use to limit the memory used, crt0 sets the stack pointer to the symbol __alt_stack_pointer which is wrapped in a linker PROVIDE ... so you should be able to define it with a command line argument: --defsym __alt_stack_pointer=0xWHATEVER You might need the "-Wl,xxx" in the IDE. > Is there a way to get objdump to give me a clearer picture of what is being used and > what is free? objdump (with -h) is about as clear (well ... detailed) as you can get -- it's all there. > but it is kinda cryptic (what's an LMA?), and you need a calculator too. Fair enough ... it's not exactly the friendliest output to become familiar with ... but it's _well_ worth the effort to learn ... just dig in and suffer for a few hours ... you won't be sorry ... objdump is a very powerful tool. LMA is an acronym for "Load Memory Address", as opposed to VMA which is "Virtual Memory Address". For Nios-II, the VMA is just the physical address where the code and data should be located before main() is called. The LMA is where the code is loaded. For example, you can set the LMA of each section to an address in flash, then let the linker provide the "load addresses" to the startup code so it knows where each section is located in flash (and then does the copy from LMA to VMA). > Is there a page describing what all those extra sections are (.comment, > .debug_blah_blah) and if they ever use memory on the target? Look at the compiler/linker docs, manpages and info pages. But a simple rule is: if the ALLOC attribute is not set, it's not occupying any target memory. If the LOAD attribute is not set -- it doesn't get loaded (e.g. .bss/.sbss). You can strip most of the junk if you like (but you'll loose your symbols). Sometimes it's handy to just make a copy of your elf, then strip the copy: $ nios2-elf-strip myapp-copy.elf Regards, --Scott