Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Dynamic programming


  • Please log in to reply
7 replies to this topic

#1 Mattster

Mattster

    Advanced Member

  • Members
  • PipPipPip
  • 46 posts
  • Locationusually South Florida

Posted 19 October 2012 - 02:59 PM

I understand that the STM32F4 is supposed to execute code faster from flash than it can from RAM. But I have a concern that flash has a limited number of write cycles (ten thousand maybe?) before it will fail. I'm working on a system that has to be reprogrammable most every time it runs, receiving its code from another part of the system. I'm thinking that the code will have to go into RAM if I don't want to limit the lifespan of the device. Can anyone comment about dynamically loading code into RAM or flash and executing it at run-time? Thanks!

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 19 October 2012 - 03:14 PM

Hi Mattster,

I understand that the STM32F4 is supposed to execute code faster from flash than it can from RAM. But I have a concern that flash has a limited number of write cycles (ten thousand maybe?) before it will fail. I'm working on a system that has to be reprogrammable most every time it runs, receiving its code from another part of the system. I'm thinking that the code will have to go into RAM if I don't want to limit the lifespan of the device. Can anyone comment about dynamically loading code into RAM or flash and executing it at run-time?

Your code should run with about the same efficiency from flash or RAM. If you're pulling in code on the fly, I'd recommend running it from RAM.

STM32F4's flash is rated for a minimum of 10,000 flash cycles.

Chris

P.S. Here's an article talking about Flash vs. RAM execution speed on STM32F4.
Both flash and RAM execution are high-performance.
http://www.futurlec....F4_Series.shtml

#3 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 19 October 2012 - 04:51 PM

I have run code from both RAM and flash without any problems. I also believe the code executes from flash a little bit faster than from RAM, because of the dedicated I-Bus and prefetch buffers (when running from RAM, "...the instruction hast to be fetched using the system bus, which incurs and extra wait state" [1]), but I have not performed any measurements. If the number of internal flash rewrite cycles is an issue, you might want to consider using and external memory (100 k cycles and more) , STM32F4 micros have external memory bus interface .

[1] The Insider's Guide To The STM32 ARM Based Microcontroller

#4 Mattster

Mattster

    Advanced Member

  • Members
  • PipPipPip
  • 46 posts
  • Locationusually South Florida

Posted 19 October 2012 - 11:18 PM

Hi Mattster,


Your code should run with about the same efficiency from flash or RAM. If you're pulling in code on the fly, I'd recommend running it from RAM.

STM32F4's flash is rated for a minimum of 10,000 flash cycles.

Chris

P.S. Here's an article talking about Flash vs. RAM execution speed on STM32F4.
Both flash and RAM execution are high-performance.
http://www.futurlec....F4_Series.shtml


Chris:

Thanks for the confirmation of my understanding on the flash re-write limitations. I seem to recall reading somewhere here (maybe in the N+ forum?) about runtime loading of executable modules - do you know where I might have seen this?

Thanks,
Mattster

#5 Mattster

Mattster

    Advanced Member

  • Members
  • PipPipPip
  • 46 posts
  • Locationusually South Florida

Posted 19 October 2012 - 11:19 PM

I have run code from both RAM and flash without any problems. I also believe the code executes from flash a little bit faster than from RAM, because of the dedicated I-Bus and prefetch buffers (when running from RAM, "...the instruction hast to be fetched using the system bus, which incurs and extra wait state" [1]), but I have not performed any measurements. If the number of internal flash rewrite cycles is an issue, you might want to consider using and external memory (100 k cycles and more) , STM32F4 micros have external memory bus interface .

[1] The Insider's Guide To The STM32 ARM Based Microcontroller

CW2: thanks for the insights, and yes, the number of rewrites is an issue. Can you point me at any additional references on the use of external memory? Also, what can you tell me about the performance of external memories?

Thanks!

#6 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 20 October 2012 - 12:10 AM

Hi Mattster,

Thanks for the confirmation of my understanding on the flash re-write limitations. I seem to recall reading somewhere here (maybe in the N+ forum?) about runtime loading of executable modules - do you know where I might have seen this?

Check out the MonoBootloader in the Mono forum. It loads assemblies from an SD card.

Chris

#7 Mattster

Mattster

    Advanced Member

  • Members
  • PipPipPip
  • 46 posts
  • Locationusually South Florida

Posted 20 October 2012 - 12:14 AM

Hi Mattster,


Check out the MonoBootloader in the Mono forum. It loads assemblies from an SD card.

Chris


Kewl, thanks!

#8 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 20 October 2012 - 03:09 PM

For example Olimex STM32-P407 (schematic, pdf) has external SRAM on board. Unfortunately, I cannot say much about the performance of external memories, I don't really have any practical experience with them.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.