Our project is based on the old using MCF52258, 512KB flash, 64 K sram + 128K external SDRAM. Now the code is increasing, I am considering that place partial code in SPI flash, then load and run in SDRAM. Here is what I am thinking,
file1.c
function1() { } function2() { }
file2.c
function3() { } function4() { }
Objective: placing file1.c in to internal flash, file2.c in to spi flash, when calling function3 and function4, read the code from SPI flash to external ram, then run in ram
Is this feasible? How to?
Does Anyone have any advice?
external ram
Hi,
Unfortunately, due to the CORE architecture the processor cannot fetch instructions from the SPI bus. So an external spi flash cannot be used same as an internal flash.
> the processor cannot fetch instructions from the SPI bus.
That is NOT what the OP asked. He asked how to copy the code from external SPI Flash to RAM and then execute it from there.
That has nothing to do with this CPU. It is a general question that applies equally to all types of CPU.
If the OP is using CodeWarrior, then the question is "how do I configure CodeWarrior so it will generate code I can then copy to RAM"? This question should be moved to the CodeWarrior forum. The question might/should be answered in the Codewarrior documentation. There should be examples on how to do this. Has the OP looked there?
If using a different toolchain, then it should be in the documentation for that.
Tom