Place code in internal flash and SPI flash

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Place code in internal flash and SPI flash

589 Views
leocheng
Contributor II

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

Labels (1)
Tags (1)
0 Kudos
2 Replies

380 Views
miduo
NXP Employee
NXP Employee

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.

0 Kudos

380 Views
TomE
Specialist II

> 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

0 Kudos