Forum Discussion
Altera_Forum
Honored Contributor
19 years agoHi dunxm,
> Both the high memory and low memory program have exception code at 0x20. There are several ways to handle this. The most common ways are: 1. Disable interrupts during the download. In many situations this is not feasible -- due to the way your drivers operate. 2. Let your downloaded application relocate itself. That is, download the new app to some convenient memory location, disable interrupts, then jump to the new app's entry point. The new app is then responsible for moving its exception trampoline to the exeception address (and relocating any other sections to their appropriate addresses), jumping to the relocated code, then enabling interrupts when appropriate. This is the technique that u-boot uses. > Creating a bin file for the high memory program results in a file of over 15MB as it spans the > full distance from 0x20 to 0xFxxxxx. You can avoid this problem by changing the lma of the exception handler -- then moving it to the proper location at run time (just like# 2 above). Otherwise, objcopy will fill the unused memory regions (as you have observed). You can find an example of how to do this in the u-boot sources. Take a look at the linker script for one of the Nios II boards (e.g. board/altera/ep1c20/u-boot.lds, and the cpu starup code in the cpu/nios2/start.S file. Regards, --Scott