This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

performance in flash or RAM

Note: This was originally posted on 6th July 2010 at http://forums.arm.com

Hello.

I tried to improve the speed of an IRQ function by putting it to RAM.
The function is in fact in RAM (as an assembly view and the debugger show), but the time spent is the same than in Flash.
I use a test point and an oscilloscope to check the duration, not a software estimation.
µP : STM32F101 @ 36MHz, 1 wait state.

Why do I get the same result ?
What do I miss ?

Thanks for your help
         Denis
  • Note: This was originally posted on 16th July 2010 at http://forums.arm.com

    You didn't miss anything.
    At 32 Mhz there is little difference between flash execution and RAM execution.  Flash has one wait state at 32Mhz, but when executing out of RAM, the instruction fetch and data R/W are running over the same DCode bus.  Now if you were running a STM32F103 @72 Mhz, there may or may not be a difference, I have not yet tried.  It runs fast enough out of flash.
  • Note: This was originally posted on 12th July 2010 at http://forums.arm.com

    How long is your ISR?

    Is it mostly using 16-bit or 32-bit instructions?

    The cortex-M3 includes a 3-word prefetch buffer, so it is quite good at hiding a single cycle instruction latency if there is another instruction already in the buffer and ready to use. Combined with the prefetch of the interrupt vector during the exception state save, you may not actually see much difference for short pieces of code.
  • Note: This was originally posted on 12th July 2010 at http://forums.arm.com

    what processor are you using ? are you using cached processor ?
    if yes, it is always possbile that your ISR hadler is executed from cache rather than RAM/Flash.