I am attempting to run code copied to RAM as outlined in AP138 but the program stops when the call is made to the copied procedure. This setup works correctly in another program. The hmemcpy appears to be OK, but the program never jumps to the flash_loader procedure. I believe that there may be a problem in the linker settings. Have you any advice on how to troubleshoot this problem?
In the calling unit: ... extern void far flash_loader(unsigned long size); SROM_PS (LOADER) ... hmemcpy (SROM_PS_TRG(LOADER), SROM_PS_SRC(LOADER), SROM_PS_LEN(LOADER)); flash_loader(psize); // <-- Program stops here ... The loader unit: #pragma RENAMECLASS (FCODE=FLASH_CODE) ... void flash_loader(unsigned long size) { // Never gets here } Linker Settings: User Classes SROM (0xC00000-0xC1FFFF) User Sections ?PR?LOADER%FLASH_CODE (0x41D000)[!]
Did you try single-stepping through the code in the debugger to see what actually happens? - mike
I am afraid that it is not possible at this point to run the code in the simulator as there are many devices used on the actual hardware that are not supported in the debugger. There is no way to even trigger the file loader procedures.
Maybe you could try the linker option without the exclamation mark, so that memory is automatically reserved for your flash loader?