cancel
Showing results for 
Search instead for 
Did you mean: 

Running user code from STM32F4's internal RAM

ashwinvijayakumar
Associate
Posted on January 13, 2012 at 13:57

Hi,

I am new to ARM development, I just bought a STM32F4Discovery board and am experimenting with it. I was wondering if there was a way to load and run user code from the internal RAM; it would be very helpful if the experts out there would point me in the right direction.

Thank you in advance

5 REPLIES 5
Posted on January 13, 2012 at 16:40

At one level you can simply copy code there are jump to it (remember PC must be an odd address, ie copy 16-bit words to 0x20004000, call 0x20004001)

You could also define your memory map in the linker script or scatter file, and then direct the compiler to place functions in specific segments/sections with #pragma's etc. In some chains this can be achieved by enumerating specific functions in the segment/section you wish the linker to place them.

On the STM32F4 the best memory to use for this is the 64K of CCM (Closely Coupled Memory) attached to the core.

For debugging in Keil, it is also possible to define the IROM address range within an SRAM, and the IDE will download and run directly from RAM. I believe you could do this with IAR, at least the older ones it was easy to do.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
rmteo
Associate II
Posted on January 13, 2012 at 16:53

With Rowley Crossworks, it is as simple as making a selection from a drop-down menu.

0690X00000602jvQAA.jpg

digital_dreamer
Associate II
Posted on January 15, 2012 at 11:42

teo.rene,

Where do you find this menu? I must be blind! :p

I'm using v2.1.2 on the Mac.

I did a little research into this and see the flash placement and ram placement xml files in packages/targets/STM32 directory. But, isn't Crossworks supposed to access this info automatically?

All I have in my projects' System Files folder is the STM32_Startup.s, STM32_Target.js, and thumb_crt0.s files. Are other files supposed to be in there?

I don't see my MCU part name (STM32F407xx from STMF4Discovery board) in the STM32_Target.js file.

Nevermind here, I see the part #.

I, too, would like control over where the code gets uploaded to.

On a related theme, I believe my code is going to flash (0x08000000), but after a reset, it will not run. How do I set the bootloader to run the code from flash after a power cycle/reset?

Posted on January 15, 2012 at 14:04

On a related theme, I believe my code is going to flash (0x08000000), but after a reset, it will not run. How do I set the bootloader to run the code from flash after a power cycle/reset?

 

Technically the boot loader (system rom) doesn't do this, you control the BOOTx pins externally and these shadow the FLASH, RAM or ROM to address zero, and then the vector load (SP/PC) causes the execution to redirect to that memories natural location (ie 0x080xxxxx for FLASH)

If this isn't occurring, take a look at the MAP or HEX file to confirm the build address base. The MAP, or equivalent, file should give information about the placement of the vector table, from startup.s, or whatever, should be linked first at 0x08000000.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
rmteo
Associate II
Posted on January 15, 2012 at 16:12

Right click on the active project in the ''Project Items'' Window.

0690X00000602k0QAA.jpg