Arm Community
Site
Search
User
Site
Search
User
Groups
Education Hub
Distinguished Ambassadors
Open Source Software and Platforms
Research Collaboration and Enablement
Forums
AI and ML forum
Architectures and Processors forum
Arm Development Platforms forum
Arm Development Studio forum
Arm Virtual Hardware forum
Automotive forum
Compilers and Libraries forum
Graphics, Gaming, and VR forum
High Performance Computing (HPC) forum
Infrastructure Solutions forum
Internet of Things (IoT) forum
Keil forum
Morello forum
Operating Systems forum
SoC Design and Simulation forum
SystemReady Forum
Blogs
AI and ML blog
Announcements
Architectures and Processors blog
Automotive blog
Graphics, Gaming, and VR blog
High Performance Computing (HPC) blog
Infrastructure Solutions blog
Internet of Things (IoT) blog
Operating Systems blog
SoC Design and Simulation blog
Tools, Software and IDEs blog
Support
Arm Support Services
Documentation
Downloads
Training
Arm Approved program
Arm Design Reviews
Community Help
More
Cancel
Support forums
Architectures and Processors forum
Cortex-M unintentional Flash Read-While-Write
Jump...
Cancel
State
Accepted Answer
Locked
Locked
Replies
7 replies
Subscribers
349 subscribers
Views
8724 views
Users
0 members are here
Cortex-M7
Memory Protection Unit (MPU)
Cortex-M
Options
Share
More actions
Cancel
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 6 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 6 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 6 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 6 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...
Parents
0
Joseph Yiu
over 6 years ago
in reply to
piotr_r
I forgot to mention - you might also want to set the XN attribute in the MPU region as well.
Cancel
Up
0
Down
Cancel
Reply
0
Joseph Yiu
over 6 years ago
in reply to
piotr_r
I forgot to mention - you might also want to set the XN attribute in the MPU region as well.
Cancel
Up
0
Down
Cancel
Children
No data