Forum Discussion

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

Problem while compiling NIOSII application to be loaded into DRAM from FLASH

Hi,

I am writing a custom boot loader + an application. The bootloader will run from onchip-ram and will copy application,which needs to be stored in CFI flash, to DRAM.

Reset & exception vectors in SOPC points to onchip-ram.

I am able to compile the bootloader with no error. But the problem is that I am not able to compile application code.

While compiling code, linker gives following error:

alt_irq_handler.c:96: relocation truncated to fit: r_nios2_call26 osintenter

I have to use customized bootloader because it also performs some additional tasks apart from loading application from FLASH to DRAM.

Any idea ??

FYI:

I am using Altera Embedded Dev. Kit (3c120).

Thanks in advance

Sanjay

2 Replies

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

    The error is a call instruction that needs to change the highest 4 bits of the address - probably a call from on-chip memory to SDRAM.

    You can make the code work by using an indirect call.

    But you probably want to have the irq entry point into the 'bootloader' and have the application register it's own function.

    That means you probably don't want the code from alt_irq_handler.c in your application.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    from this post:

    http://www.alteraforum.com/forum/showthread.php?t=18932

    I got the similar problem when using Quartus II 9.1 and

    I fixed it by changing the setting of Nios II processor in SOPC Builder.

    As shown in attached picture, the memory segment for "Reset Vector" should be the same as that in the property of system library "Program memory (.text)".

    Also, I found that memory segment for "Exception Vector" would be put together within segment for .text from the linker script that is automatically generated by Nios II tools. Therefore, I think this memory should be set as the same as "Reset Vector".

    You can see this linker script from path:

    \software\XXX_syslib\Debug\system_description\gene rated.x