Content originally posted in LPCWare by bavarian on Tue Sep 24 06:51:37 MST 2013
With swap-in/swap-out you most likely mean that you relocate code to the internal SRAM and execute it from there. After execution you come back to the SPIFI code execution.
In principle it's simply a copy process from the object code to the SRAM and then you branch to the address where you copied the code to.
But there are also the interrupt vectors. If you don't use IRQs, fine. If yes then your interrupt vector will be cought from the SPIFI and then jump to the ISR which is also in SPIFI.
So depending on what you want to do in the SRAM code you need to relocate more or less.
If you want to have the same piece of code running from SPIFI and from SRAM, then you need to create position independent code.
If you only need to relocate the code4 one time after startup, then I would give this job to the compiler: specify the object which need to run from SPIFI, specify the others which need to run from SRAM and then the compiler/linker will do the rest.
Overall it is a complex but not very difficult thing if you know what I mean ;-)
Regards,
NXP Support.