cancel
Showing results for 
Search instead for 
Did you mean: 

Run code from SDRAM with STM32F4 (e.g. STM32F229)

stcom9
Associate II
Posted on November 18, 2014 at 14:14

Hello,

we are considering to use the STM32F4, probably the STM32F429 or STM32F427. For our application we would need to run the program from SDRAM.

I was looking around for application notes, but could not find something specifically on that topic. E.g. in the AN2606 on page 75 it described to boot to ''RAM'' or ''System memory'', but does that include SDRAM? I am going through other application notes, and maybe I will find something, but it would be great if someone could point me to the right document(s).

Especially interesting would be for us

- how to configure boot to SDRAM

- the update of the flash initiated e.g. from a USB host, when the MCU is running code from the SDRAM

With an MCU from another vendor this turned out to be somewhat complicated, and I have to ask what support from ST there is in the form of application notes (and the like) for this use case - we are a bit reluctant to spent time to have to ''reinvent the wheel'', when there is no support for this from the vendor.

Kindest regards,

Tony
13 REPLIES 13
stcom9
Associate II
Posted on November 27, 2014 at 17:22

Hello Clive,

after looking at AN3965, I can say this must be the example you were writing about. The source for AN3965 is available here (scroll to the bottom).

http://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1743/LN1734/PF257903

From the example documentation, I gather there is an ''IAP Code'' from 0x800 0000 to 0x800 3FFF, and a ''User Code'' from 0x800 4000 to the ''top flash memory address'' (equal to 0x080F FFFF for STM32F4xx devices).

Now where do I find this distinction in the sources? Is this example both, or only ''IAP code'', or only ''User code''?

I would have simply opened to the project, but unfortunately the projects included with the AN3965 can not be opened by me. I do not know what IDE ''RIDE'' is, and the other project files are for IAR, Keil, Tasking and Atollic products, and I do not have access to those IDEs at the moment (my boss does not want to give me the money just yet to buy a full version, and I don't want to blow a 30 day test version just on this).

Now, this would be

very fine

somewhat acceptable

doable if I had to do this for me privately, then I could sit down and spend my unlimited spare time reverse engineering this. But my boss wants to have a little bit more solid information that what we need to do is possible with the STM32F4 chip. A simple ''here is an example that does something similar, modify it yourself mate'' is not enough for my boss (no offense Clive, you do a great job, but I need some tangible information before we can proceed with the STM32F4, and it has to be offical ST information). Yes, yes, I know, I know, I tried to tell him that we should spend time reverse engineering ST's example code and tinker around with it until I understand it, but he just would not listen...

So, is there any documentation about IAP on the STM32F4 from ST? Anything other than AN3965?

Posted on November 27, 2014 at 17:53

> From the example documentation, I gather there is an ''IAP Code'' from 0x800 0000 to 0x800 3FFF,

> and a ''User Code'' from 0x800 4000 to the ''top flash memory address'' (equal to 0x080F FFFF for STM32F4xx devices).

> Now where do I find this distinction in the sources?

The only ''distinction'' is the APPLICATION_ADDRESS symbol defined in flash_if.h, and the way how the code is written and linked (ie. it assumes that the bootloader sits at the default reset address 0x08000000 - this is the only logical way for it, if it is to be a bootloader, not just a generic IAP set of routines).

> Is this example both, or only ''IAP code'', or only ''User code''?

Only ''IAP code'', more precisely, an UART-bootloader using YMODEM protocol, as Clive said above. ''User code'' is what you write and download using the bootloader.

> I would have simply opened to the project, but unfortunately the projects included with the AN3965 can not be opened by me.

You don't need to ''open the project''. Simply start a new project with the ''standard peripheral library'' as you normally do, and add the content of src and include subdirectories.

> I do not know what IDE ''RIDE'' is

http://www.raisonance.com

> and it has to be offical ST information

Then why are you asking here? Go to your ST representative/FAE.

> So, is there any documentation about IAP on the STM32F4 from ST?

UM0090 rev.7, ch.3.6 (Erase and program operations). You don't need anything more.

JW

Posted on November 27, 2014 at 18:53

The primary difference between the Loader and App as used by the IDE's is the ROM(FLASH) memory arena the linkers use to build the code, and the address used to set the base for the Vector Table, SCB->VTOR in SystemInit().

The Loader would be at the 0x08000000 base of flash, so as to catch the CPU reset, and the App would be placed at 0x08004000, or 0x08008000 depending on the number of flash sectors the Loader takes up, expand as required. The length of the flash passed to the Loader's project would be shrunk to the 16 or 32KB limit, and the base address of the Application's project advanced by the same amount, and it's size shrunk similarly.

A lot of these things aren't particularly ST specific. ST may well have other IAP (In Application Programming) notes/examples, the theme is all very similar. I don't work for ST. As Jan suggests poke an FAE

USB Flash Drive IAP - STM32F429I-Discovery_FW_V1.0.1\Projects\FW_upgrade

http://www.st.com/web/en/catalog/tools/PF259429

This book has some pretty good coverage of the concept

http://www.amazon.com/Making-Embedded-Systems-Patterns-Software/dp/1449302149/ref=sr_1_fkmr1_1?ie=UTF8&qid=1417110175&sr=8-1-fkmr1&keywords=alicia+embedded

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on November 27, 2014 at 19:01

A simple ''here is an example that does something similar, modify it yourself mate'' is not enough for my boss (no offense Clive, you do a great job, but I need some tangible information before we can proceed with the STM32F4, and it has to be official ST information). Yes, yes, I know, I know, I tried to tell him that we should spend time reverse engineering ST's example code and tinker around with it until I understand it, but he just would not listen...

No offense taken, but I'm not paid to do your due-diligence work either.

If you're a good commercial prospect, call your local ST sales rep, and discuss what sort of resources they, or the distributor, can bring to bear.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..