Altera_Forum
Honored Contributor
21 years agothe bootloader
I'm a beginner and i have some questions as follows: Does the NiosII IDE generat bootloader automatically?How can i find the bootloader in the Nios II IDE? thank you!
Hello csuperman,
Yes, the Nios II IDE automatically inserts the bootcopier (aka bootloader) in front of your elf image when you program your image to flash, as long as the reset is set to be in flash (via SOPC Builder) and the .elf image code section is located in RAM. The bootcopier, at reset, copies your code from flash into RAM, and begins execution out of RAM. See the following excerpt from the Nios II Flash Programmer User Guide: Boot-Copier Program When programming software content (.elf files) into flash, you can automatically insert a small boot-copier program immediately before your software contents in flash to allow the system to boot from flash. The Using the Nios II Flash Programmer & Instantiating Flash Memory boot copier will relocate your software to the address where it has been linked in the .elf file, then branch to it. Normally, the address to where the software is relocated will be occupied by a volatile memory such as a RAM, SDRAM, on-chip RAM, etc. Nios II IDE can be used to configure where the different sections of your software are linked in the .elf file. For more information, refer to Editing Project Properties in the Nios II IDE Software Tutorial. The decision of whether or not to insert a boot copier is made by the elf2flash utility, based on the switches --base, --end, --reset, and the location to which your software content is linked in the .elf file. The elf2flash utility will insert a boot copier in front of your software content when—and only when—the reset address is within flash and the .elf file is linked to a location outside of the flash. For example, if your flash memory is mapped to (0x0 – 0x7FFFFF) in SOPC Builder, and you have linked your software so that it is to be located at 0x800000 where an external RAM is mapped in SOPC Builder, elf2flash will insert a boot copier at address 0x0, followed by your software contents. Upon reset, the boot copier relocates the software contents from flash to the external RAM located at 0x800000 before executing it.