Forum Discussion

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

alt_load() - Anyone having info?

Hi

This function is briefly mentioned in the Nios II Software Developer’s Handbook.

It is the boot loader that copies segments from FLASH to RAM at power-up.

Best Regards http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif

/Jan

3 Replies

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

    alt_load() is only used when there is no bootloader in your system, for example when you run from flash. This happens when you set the .text section to be in the same memory as the reset vector.

    Otherwise a seperate loader is used to load the code from flash. The source for this can be found in the directory: components\altera_nios2\sdk\src\boot_loader_sources in the Nios II kit.

    When called, alt_load() will copy out the: .rwdata, .rodata, and .exception sections from the boot device to external memory devices, as required.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Just curious, why does the .rodata (read only data) section need to be copied to RAM? Wouldn&#39;t it save RAM requirements to not copy the section?

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

    It&#39;s only copied to RAM if that&#39;s what you&#39;ve asked for on the system library properties page. If you&#39;ve assigned the .rodata section to be in flash, it will be left in flash.

    The same is true of the .exceptions section, except in this case where it is placed is determined by where you point the hardware exceptions vector in SOPC builder.

    There is an engineering trade off here. It will save RAM if you leave these sections in flash, but it will also potentially slow your code down. What the right choice is for you depends on your requirements.