I try to write a small ldr file, that will be programmed at the top of my flash, and will select dynamically at which flash address is the rest of program to boot upon.
To do this, I have seen in the loader manual that if, inside an initcode, we modify the R0 register, then the boot program (0xfe00....) will continue loading the program not after current position in the flash, but at the R0 address.
So I have written a small initcode (and burned its ldr at offset 0x20000000 of my flash) that, after SDRAM & Flash initialization, modify the R0 register to the value 0x20010000. Then I expect that the boot program will continue loading boot sections from 0x20010000, where I have burned the ldr of my full program (without initcode).
Unfortunatly, it fails, and after days of investigations, i did'nt manage to understand why.
You can find attached the project for my initcode. As you will see, I have modified it, and, at the end of the initcode routine, to set it to a fixed value (0x20010000) :
r0.h = 0x2001;
r0.l = 0x0000;
(p5:0) = [sp++];
(r7:1) = [sp++];
rets = [sp++]; /* Do not restore saved R0 */
rets = [sp++];
astat = [sp++];
I would be very grateful if you had any suggestions to help me solve this problem !
PS : My configuration :
- Visual DSP 5, update 8.
- EZ-BOARD BF526.
- I tried also with analog devide initcode example, but if fails also.
- My program boot perfectly from flash if i add a standard initcode (not modifiying R0) to it and burn it at offset 0x20000000 (which i don't want : i would like that the program resides at another offset in flash, i want to leave just the initcode as a resident program at offset 0x20000000).