Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12436 Discussions

Using a bootloader for NIOS II, nios2-elf-objcopy creates very large object file

Honored Contributor II



I've an NIOS II application builded via the command line tools. I've now decided to run the program from the onchip_mem instead from the flash. 

Reading the AN458, it is clear that the .text and .rodata has to be set to the onchip_mem and the reset vector has to point to the flash. 


If I made these changes, the nios2-elf-objcopy creates then an binary output file which is 258 MB. 

Without the bootloader, this is only 25 kB. The elf-file is always 390 kB (regardless where the .text and .rodate are placed). 


I'm using Quartus 14.1 for building the application; FPGA is a Stratix IV. 


Maybe someone can help how I can debug this or any idea why the binary gets so large? 


Best Regards, 

0 Kudos
2 Replies
Honored Contributor II

Sounds like you have initialisation data for disjoint memory areas. 

look at the output of 'objdump -h' and 'objdump -p' - these should tell you which memory areas are being initialsed. 

At a guess you are trying to place code at the reset vector location.
Honored Contributor II

Thanks for your reply. It seems that the end address of the flash memory, given to elf2flash, is not correct. Changing this address seems to solve the problem. Best Regards, Bernd