cancel
Showing results for 
Search instead for 
Did you mean: 

Internal flash vs. RAM execution speed

Pavel A.
Evangelist III
Posted on December 24, 2017 at 19:54

The manuals mention 'ART accelerator allowing 0-wait state execution'.

Do all STM32 models run off the internal flash at maximum speed? Would code copied to RAM run faster?

-- pa

#performance
4 REPLIES 4
Posted on December 24, 2017 at 22:38

The ART can provide data to prefetch port within the current cycle, so faster than SRAM on a cache hit. So nets out about even.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Jan Waclawek
Senior II
Posted on December 25, 2017 at 19:00

The manuals mention 'ART accelerator allowing 0-wait state execution'.

That's a marketing lie of course - 0 waitstate only if all jumps are matched by entries in the jumpcache and the linear part of code contains enough single-(half)word instructions. This is rougly fulfilled with simple code with lots of local loops -- which is what's most benchmarks are all about.

There's also interaction with constants memory and data memory and other bus masters activities etc.etc.

Would code copied to RAM run faster?

Execution through S bus is slower than through I bus, so you may want to remap the SRAM to boot position when executing from it.

One of the short lived Technical Updates contained an interesting analysis of execution times vs. various mapping options.

Do all STM32 models run off the internal flash atmaximumspeed?

AFAIK only F4 and F7 through TCM has ART.

JW

Posted on December 25, 2017 at 21:53

The flash and cache lines are 128-bit wide, the wait state to load is all in the first word, and the next 7x 16-bit words have zero load time, compared to SRAM which will still cost a cycle a piece. Note that's not the same as zero wait state.

If you have linear execution or hit the cache it will run faster. 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on January 03, 2018 at 13:11

Thanks for the helpful info.   -- pa