Arm Community
Site
Search
User
Site
Search
User
Groups
Arm Research
DesignStart
Education Hub
Graphics and Gaming
High Performance Computing
Innovation
Multimedia
Open Source Software and Platforms
Physical
Processors
Security
System
Software Tools
TrustZone for Armv8-M
中文社区
Blog
Announcements
Artificial Intelligence
Automotive
Healthcare
HPC
Infrastructure
Innovation
Internet of Things
Machine Learning
Mobile
Smart Homes
Wearables
Forums
All developer forums
IP Product forums
Tool & Software forums
Pelion IoT Platform
Support
Open a support case
Documentation
Downloads
Training
Arm Approved program
Arm Design Reviews
Community Help
More
Cancel
Developer Community
Tools and Software
Software Tools
Jump...
Cancel
Software Tools
Arm Development Studio forum
Cortex M3 - how to enter Privileged Mode?
Tools, Software and IDEs blog
Forums
Videos & Files
Help
Jump...
Cancel
New
Replies
3 replies
Subscribers
127 subscribers
Views
4619 views
Users
0 members are here
Related
Cortex M3 - how to enter Privileged Mode?
Offline
Sebastian Gaertner
over 7 years ago
Note: This was originally posted on 15th July 2009 at http://forums.arm.com
Hi,
I try to get an implementation that disables all interrupts up to an specific level. I use the BASEPRI for this.
However the disabling doesnt work, all interrupts are passing through like before.
At the moment of entering the disabling function the CONTROL register is "0x00".
Now what means 0x00? The Cortex TRM says
CONTROL[0] = 0 is user mode and
CONTROL[0] = 1 is privileged mode.
And the book "The Definitive Guide to the Arm Cortex-M3" says it mixed up:
CONTROL[0] = 1 is user mode and
CONTROL[0] = 0 is privileged mode.
I expect the information in the TRM is the right... is it?
I wonder why my debugger is showing the CONTROL = 0x00 at reset of the device. Should not normally the device start in privileged mode?
Does anyone work with a Cortex M3 and can confirm that?
Offline
Sebastian Gaertner
over 7 years ago
Note: This was originally posted on 16th July 2009 at
http://forums.arm.com
Hi Joseph
thanks for the hints with the priorities, I understand better now. Seems my priority is still set to 0 - so I see still the interrupt.
Yes, here we have two different versions of the CONTROl[0] description. This is a part of the TRM I used:
Cortex™-M3 TRM Revision: r1p1:
Thread mode is privileged out of reset, but you can change it to user or unprivileged by
clearing
the CONTROL[0] bit using the MSR instruction.
Cancel
Up
0
Down
Reply
Cancel
Offline
guestposter guestposter
over 7 years ago
Note: This was originally posted on 15th July 2009 at
http://forums.arm.com
Hi Ssss,
CONTROL[0] = 0 is privileged mode
CONTROL[0] = 1 is user mode
Could you tell me which page in TRM you are referring to?
(and which revision of the TRM).
From page 2-3 of Cortex-M3 revision 2 TRM:
"Thread mode is privileged out of reset, but you can change it to user or unprivileged by
setting the CONTROL[0] bit using the MSR instruction."
That's why the CONTROL register is 0x00 out of reset (privileged).
Setting CONTROL[0] to 1 will change it to user mode.
To use BASEPRI, you need to set it to a non-zero value. For example,
if 16 priority levels are available, it will be 0x10, 0x20, ... 0xF0.
If you set it to 0x00, the BASEPRI masking function is disabled.
However, by default all interrupts are at priority level 0. So they are higher
priority than any BASEPRI value. As a result, no matter what value you
set BASEPRI to, the interrupts will still get through. Therefore, BASEPRI
can only mask a interrupt if the priority level of the interrupt is not set to 0.
To mask interrupts with priority level 0, you need to use PRIMASK.
The easiest way to set PRIMASK is using (in assembly)
CPSID i
or in C:
__disable_irq();
regards,
Joseph
Cancel
Up
0
Down
Reply
Cancel
Offline
guestposter guestposter
over 7 years ago
Note: This was originally posted on 16th July 2009 at
http://forums.arm.com
Thanks. I checked our support system and found that it is
a known documentation errata on the r1p1 TRM.
regards,
Joseph
Cancel
Up
0
Down
Reply
Cancel
More questions in this forum
By title
By date
By reply count
By view count
By most asked
By votes
By quality
Descending
Ascending
All recent questions
Unread questions
Questions you've participated in
Questions you've asked
Unanswered questions
Answered questions
Questions with suggested answers
Questions with no replies
Suggested Answer
Debugging kernel: OS support not working for Linux 5.4
0
Kernel Developers
External Hardware Debug
Debugger
3007
views
5
replies
Latest
1 month ago
by
sgoldschmidt
Suggested Answer
DS-5 bare metal wait error after run "debug"
0
DS-5 Development Studio
Debugging
Arm Compiler 5
Memory
24474
views
14
replies
Latest
1 month ago
by
prasadghole
Suggested Answer
ARM development studio with ARM Juno r2 board
0
Juno Arm Development Platform
Arm Development Studio
Products
Arm Support
2947
views
2
replies
Latest
1 month ago
by
Ronan Synnott
Answered
"Unable to execute remote query (response code 503) " issue
0
2911
views
1
reply
Latest
1 month ago
by
Ronan Synnott
Not Answered
Where can I download DS-5 hardware firmware??
0
2671
views
1
reply
Latest
1 month ago
by
Ronan Synnott
<
>
View all questions in Arm Development Studio forum