Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
11 years ago

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

Hello,

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,

Bernd

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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