Nios 2 application running from external ram

Hi,

I have a bootloader running from internal ram (m4k blocks). I also build a standalone application to run from external ram. The application is a .bin file which is sent to the bootloader through a serial interface (RS232). The bootloader copies the application to external ram and executes it. My application is built to run from address 0x00200000. If I make a .bin file from the generated .elf file I get a file of about 2 MB. This is because the alt_exception and alt_irq_handler is laid at address 0x20 and 0xEC. AFAIK this is not necessary. Do I have to make a linker file to fix this? Or should I use another startup assembly file? In case of a linker file, does anyone have an example for this situation?

So the bootloader runs from internal ram (with base address 0) and the application runs from external ram (with base address 0x00200000).

TIA, Frank

Reply to
Frank van Eijkelenburg
Loading thread data ...

I'm assuming you're producing the bootloader and application as separate programs and that the bootloader isn't using interrupts.

In SOPC Builder, set the reset address to 0 and set the exception address to 0x00200000. When you extract the .bin file from the elf file, exclude the .reset section so you don't get the generated code at 0x0.

Mark

Reply to
Mark

Actually, I am using interrupts. Changing the reset address and exception address in SOPC builder is not an option. Each time I build the bootloader or application I have to check if these addresses are correct. Is there another option like using an linker script? For the microblaze I know you can specify the start address. Is there a same option for the Nios 2 software?

TIA, Frank

Reply to
Frank van Eijkelenburg

I have to use a custom linker script and I found an easy way to make it (at the nios forum):

- take the file generated.x in the system library directory;

- copy the file to a location which is not deleted with a "clean project" action;

- search for the sections .entry and .exceptions and map them to external ram;

.entry : { KEEP (*(.entry)) } > sram

.exceptions : { . = ALIGN(0x20); *(.irq) KEEP (*(.exceptions)); } > sram

- in the system library properties tell the IDE you want to use a custom linker script.

Reply to
Frank van Eijkelenburg

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.