Forum Discussion
Altera_Forum
Honored Contributor
12 years agoCurrently my application resides in external flash and then bootloads from flash to external sram at power on.
My goal, however, is to boot entirely from on-chip memory (.bss, .heap, .rodata, .rwdata, .stack, .text), have the bootloader verify the integrity of an external sram, and then if ok, bootload from flash into the external sram just like before. Do I need 2 separate SOPC files (one for the bootload app, and another for the main app)? For example... 1) I know the CPU's reset (in SOPC) needs to change from pointing to external flash, to on-chip memory. However, if I set the exception memory to also point to on-chip memory, what happens if I want my main application to have the .exceptions area to be in external sram? Maybe its preferable for the bootloader app and main app to have the same exception address to keep the same SOPC? Although I'm not using any interrupts in the bootloader, I assume it's not a good idea for the exception pointer to point to external sram, since the bootloader will be testing that memory. 2) The bootloader's linker settings should be set entirely for on-chip memory correct? (The resulting elf code is converted to a .hex file (elf2hex) and used as the Memory Initialization File for the on-chip memory (in SOPC)) The main application's linker setting should be set entirely for external sram correct? (The resulting elf code is flashed directly (elf2flash)) 3) Assuming one SOPC for the bootloader, and another for the map app... In SOPC1: Point Reset / Exceptions to Onchip Memory. Build Nios project with memory sections all pointing to on-chip memory. Synthesize using resulting .hex MIF. In SOPC2: Point Reset to External Flash, and Exception to External SRAM, Build Nios project with memory sections all pointing to external sram Flash the resulting build (which will automatically have a bootloader inserted) At power on, the onchip bootloader will do the memory test, and the code will then jump to external flash. This should work too, right? Jumping from on-chip ram to my current app in the external flash is the same as if the reset vector on the cpu would have jumped directly, no? Thanks!