Arm Community
Site
Search
User
Site
Search
User
Support forums
Arm Development Studio forum
Flags of APSR Register in Cortex M3
Jump...
Cancel
Locked
Locked
Replies
3 replies
Subscribers
119 subscribers
Views
4702 views
Users
0 members are here
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
Flags of APSR Register in Cortex M3
Muhammad Ahsan
over 12 years ago
Note: This was originally posted on 19th April 2011 at
http://forums.arm.com
Hello all,
I am having probelm in writing Flags of APSR Register in Cortex M3. The result of a comparison cuases the negative flag to get set to 1. Next instruction reads the APSR using MRS instruction. Before executing this instruction I clear the negative flag to 0. If I execute the instruction of reading the APSR after clearing the negative flag, program jumps to hardfault handler. Reference manual states that these flags are writable.
We can write APSR using MSR instruction too. But is it possible to change a single bit(Flag) as I have mentioned above?
Thanks in advance
Parents
Joseph Yiu
over 12 years ago
Note: This was originally posted on 22nd April 2011 at
http://forums.arm.com
Hi,
I have tested this using Keil MDK with ULINK2 with Cortex-M3 r2p0 but didn't get any problem.
I used a simple test
__asm void test_1(void)
{
MOVS R0, #0 ; Breakpoint set here, then single step through
MOVS R1, #
SUBS R0, R0, R1 ; Set N flag, then use MDK uVision debug to clear N bit to 0
MRS R0, APSR
BX LR
}
It might worth checking the value of xPSR before and after the change to see if the debugger change other bits.
Also, when it enter hard fault, please check the values of various fault staus registers.
It might also worth email IAR to see if they are aware of any known problem which might affect this.
I am away next week so won't be able to check the forum until May.
regards,
Joseph
Cancel
Vote up
0
Vote down
Cancel
Reply
Joseph Yiu
over 12 years ago
Note: This was originally posted on 22nd April 2011 at
http://forums.arm.com
Hi,
I have tested this using Keil MDK with ULINK2 with Cortex-M3 r2p0 but didn't get any problem.
I used a simple test
__asm void test_1(void)
{
MOVS R0, #0 ; Breakpoint set here, then single step through
MOVS R1, #
SUBS R0, R0, R1 ; Set N flag, then use MDK uVision debug to clear N bit to 0
MRS R0, APSR
BX LR
}
It might worth checking the value of xPSR before and after the change to see if the debugger change other bits.
Also, when it enter hard fault, please check the values of various fault staus registers.
It might also worth email IAR to see if they are aware of any known problem which might affect this.
I am away next week so won't be able to check the forum until May.
regards,
Joseph
Cancel
Vote up
0
Vote down
Cancel
Children
No data