Arm Community
Site
Search
User
Site
Search
User
Support forums
Architectures and Processors forum
Cortex-M unintentional Flash Read-While-Write
State
Accepted Answer
Locked
Locked
Replies
7 replies
Subscribers
350 subscribers
Views
9424 views
Users
0 members are here
Cortex-M7
Memory Protection Unit (MPU)
Cortex-M
Options
Share
More actions
Related
How was your experience today?
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
Cortex-M unintentional Flash Read-While-Write
piotr_r
over 7 years ago
Hello,
I am developing a bootloader for the ARM Cortex M7. All the functions that modify (either write or erase) the internal Flash are run from the RAM memory, the other code is run from the internal Flash. So there are RAM <-> Flash transitions in the bootloader execution flow.
It works just fine. But there is one thing that I would like to consult with the experts.
I'd like to ask if either cache or the processor's processing pipeline, with e.g. speculative fetches and branch prediction, can be a safety concern in that case.
I'd like to know answers to the following questions:
1) If the code is being executed from RAM, but the MCU decides to fetch code from the internal Flash, when the Flash is being written at the same time. Is it Flash access that may cause the processor to stall or do something unexpected?
2) If yes, then how to prevent it?
I will appreciate your help.
Thanks,
Piotr
Top replies
Joseph Yiu
over 7 years ago
in reply to
42Bastian Schick
+2
verified
Things could get a bit messy with branch prediction. It is possible for the cortex-M7 to speculatively prefetch instructions in other "Normal" memory locations due to misprediction. Normally, you won't...
42Bastian Schick
over 7 years ago
+1
verified
How _your_ MCU reacts on Flash read while writing can only be answered by the manufacturer (ideal: it can be found in the manual). Common traps are enabled interrupts and the vector table still points...
42Bastian Schick
over 7 years ago
in reply to
piotr_r
+1
I doubt that there will be someone with an guarantee. But from my understanding, turning off caches and executing from RAM will prevent further read access. Maybe some data barriers are needed in case...
0
Quote