Hello All,
I placed function #1 in address 0xB0000000 that copies function #2 from 0xB0020000 to 0x00800000. then I verify result. Then I have two ways. In 1st way I jump to 0xB0020000 that starts original func#2 then it executes. In 2nd way I want jump to 0x00800000, but dsp doesn`t initialise (because func#1 doesn't starts)
func#1 //placed in 0xB0000000 starts in boot
int main(void) {
Uint32* PERLOCK = (Uint32*)0x02AC0004;
Uint32* PERCFG0 = (Uint32*)0x02AC0008;
Uint32* GPIO_DIR = (Uint32*) 0x02B00010;
Uint32* GPIO_OUT = (Uint32*) 0x02B00014;
//GPIO enable
*PERLOCK = (Uint32) 0x0F0A0B00;
*PERCFG0 |= (Uint32) 0x400;
asm(" nop 9");
asm(" nop 9");
asm(" nop 9");
//GPIO config
*GPIO_DIR = (Uint32)0xCF3F;
*GPIO_OUT = (Uint32)0x3000; //light up light-emitting diode #1 and #2
Uint32* dst = (Uint32*) 0x00800000;
Uint32* src = (Uint32*) 0xB0020000;
//transfer func#2
short i, b=0;
for(i=0; i<64; i++) {*dst++ = *src++;}
//verify transfer
for(i=0;i<64;i++){ if(*(Uint32*)(0x800000 + i) != *(Uint32*)(0xB0020000+i)) b = 1;}
if(b==0) *GPIO_OUT = (Uint32)0x3080; //light up light-emitting diode #1 and #2 and #3
//jump to func #2
void (*init)();
init = (void*) 0xB0020000; //1st way
// init = (void*) 0x800000; //2nd way
(*init)();
asm(" nop 9");
asm(" nop 9");
asm(" nop 9");
asm(" nop 9");
return 0;
}
func#2 //original placed in 0xB0020000 and copy placed in 0x00800000 after transfer
void prog(void) {
Uint32* GPIO_OUT = (Uint32*) 0x02B00014;
*GPIO_OUT |= (Uint32)0x40; //light up light-emitting diode #4
}
All results of work I watched with diods
functions loaded with JTAG and 2nd way completely works after system reset (without power off). All four diodes lights
And doesn't works after power off/on. no one diode lights, I think DSP does not initialize (I can not find out why!!!)
1st way completely works every time. All four diodes lights