Hi eveyone
I have some question in Flash Program. I segemented non-paged FLASHs named BOOT_MEM and relocated this segement to RAM (in .prm file). So i need to copy my function code in RAM. But something wrong in this step. When run my program, it was paused in move code function and reminder me that "No source available for "0x000001 (0x000001)() "
this is main function
void main(void)
{
word sector = 0;
dword addr = 0xFD8000;
word databuffer[4] = {0x1234, 0x2344, 0x4562, 0x4525};
DrSys_Cpu_Lock();
INIT_PLL_64M(); //
Flash_Init();
DrSys_Cpu_Unlock();
Code_Move((dword*)0x00FD6400, (dword*)0x00003c00,0x400);
PFlash_Write(addr, databuffer);
while(1)
{
Dalay();
}
}
this is Code_Move function
void Code_Move(dword *source, dword *desk, dword size)
{
while (size--)
{
*desk++ = *source++;
}
}
已解决! 转到解答。
Hi,
You want to copy from segment
BOOT_MEM = READ_ONLY 0xFD6400 TO 0xFD67FF;
which is 0x400 wide
to
RAM_BOOT = READ_WRITE 0x003C00 TO 0x003FFF;
which is also 0x400 wide.
But the code you are using copies 0x1000 of data, because both the pointers desk and source increment by 4 bytes while the size variable decrements by 1.
So, if you change the size argument to 0x100, it should work.
Code_Move((dword*)0x00FD6400, (dword*)0x00003c00, 0x100);
Regards,
Daniel
Hi,
Please step the code and watch size, source and desk variables.
The size variable decrements by 1 whereas desk and source by 4.
So after 100 iterations, you reach address RAM_BOOT 0x4000.
Regards,
Daniel
Hi,
You want to copy from segment
BOOT_MEM = READ_ONLY 0xFD6400 TO 0xFD67FF;
which is 0x400 wide
to
RAM_BOOT = READ_WRITE 0x003C00 TO 0x003FFF;
which is also 0x400 wide.
But the code you are using copies 0x1000 of data, because both the pointers desk and source increment by 4 bytes while the size variable decrements by 1.
So, if you change the size argument to 0x100, it should work.
Code_Move((dword*)0x00FD6400, (dword*)0x00003c00, 0x100);
Regards,
Daniel