如下这个函数是在WINCE的BSP里面的,pTOC是ROMHDR结构,/* Routine to copy the flashed NK image to RAM */
int EverythingRelocate(void)
{
LONG len;
ROMHDR *ptoc;
ULONG pc, *toc, offset, dest;
/*
* First make sure we're running in flash, in
* which case we want to copy everything into
* RAM.
*/
pc = GetPC();
if ((pc <= PHYS_FLASH_BASE) || (pc >= ARMVPB_FLASH_END))
return -1;
/*
* The image has been built to run in RAM
* but is currently stored in flash,
* so we have to calculate the pTOC's address
* relative to the flash address.
*/
offset = NK_FLASH_BASE - ((ULONG)(&pTOC) & 0xffff0000);