cancel
Showing results for 
Search instead for 
Did you mean: 

STM32Discovery with external flash memory using SPI

vinothraj
Associate II
Posted on July 21, 2012 at 07:58

Hi,i start a new one with STM32 Discovery.I need to know ''external flash is used for programing purpose?''

I try like:

1.STM32 Discovery connect with external flash memory like S25FL128P by SPI.

2.My application program is programmed to external flash memory and run on.

Is it possible?Any suggestion or any comments useful for me. 

#stm32discov-with-external-flash #bootloader #iap
4 REPLIES 4
Andrew Neil
Evangelist
Posted on July 21, 2012 at 11:54

''STM32 Discovery''

You realise that there are (at least) four different ''STM32 Discovery'' boards - yes?

''external flash is used for programing purpose?''

Yes - it could be.

What you need is a Bootloader to get the data from the external source, put it into the STM32 memory, and run it.

ST has several application notes on this; they describe it as IAP for

I

n-

A

pplication

P

rogramming

Posted on July 21, 2012 at 13:03

You're not going to be able to execute directly from SPI FLASH, you could copy to RAM and run code from there.

Ideally to run code directly you'd want to look at 16-bit wide NOR FLASH, but I'd imagine it would be quite slow.

For large applications people sometimes use 16-bit wide SRAM, and 8/16 bit NAND FLASH, or SD Card, to store the application code, copying/decompressing to external SRAM, and perhaps time critical portions to internal SRAM. Boards running ucLinux tend to use this type of model. Now, generally there are better CPU/Memory choices to be had here, unless the STM32 is critical to the design.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
vinothraj
Associate II
Posted on July 23, 2012 at 09:05

Firstly i thank for quick reply from u both neil.andrew and clive1.

 yes.

i am using STM32F407 Discovery board.My application hex file is more than 3 mb and greater than flash memory of STM32f4o7vgt6.so i could not downloaded in my Stm32f407 Discovery.

so i decided to add the external flash (

S25FL128P by SPI

)for programming purpose.

You are telling that copy to ram and run it.i do not know how to do it.give any suggestion and any basic code like my concept?   

Posted on July 23, 2012 at 17:00

For the flash you could review STM32F4xx_DSP_StdPeriph_Lib_V1.0.1\Project\STM32F4xx_StdPeriph_Examples\SPI\SPI_FLASH

Executing arbitrary code in RAM is a matter of setting the PC appropriately, either in C or Assembler. The IAP example might provide some specific example of how to use the CPU, as would some of the manuals and books related to the M3/M4 cores.

typedef void (*pFunction)(void);
{
pFunction Jump_To_ExtRAM;
Jump_To_ExtRAM = (pFunction) 0x60000001; // ODD Address for Thumb2 @ 0x60000000
Jump_To_ExtRAM();
}

ldr r0,=0x60000001
blx r0
OR
ldr r0,=0x60000000
;..
orr r0,r0,#1 ; Thumb
blx r0

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..