cancel
Showing results for 
Search instead for 
Did you mean: 

MSR instruction has no effect....!?

oys_mo
Associate II
Posted on February 08, 2011 at 22:08

MSR instruction has no effect....!?

4 REPLIES 4
oys_mo
Associate II
Posted on May 17, 2011 at 14:24

Too bad, I was hoping that I did something wrong. I'll try in hardware as soon as I get a chance, though that might take a while.

For now, I can assure that the simulator is genuinely certain that the APSR was not updated (it's not just the register view messing up), since instructions like ''ADC'' and ''RRX'' work as if the register was not updated. ''EORS R0, R0'' did successfully update the APSR, and so do several other instructions (such as ''RRXS'').

I've also tried with different values, but no help there.

It also seems that I am unable both to load from and store to any PSR with the ''MRS'' and ''MSR'' instructions (using a register as target/source). When loading, the value obtained is always 0 (so far at least), and when storing, no change is made.
picguy2
Associate II
Posted on May 17, 2011 at 14:24

[Consults ARMv7-M Architecture Reference Manual] This should work.  Simulator bug?  Try on real hardware.

I think that eorS may clear carry.  Try moving ASPR to r1 for easy inspection after MSR and to r2 after eor.  Both on the simulator and on real hardware.
picguy2
Associate II
Posted on May 17, 2011 at 14:24

Try IAR tools.  The free try before you buy version is “limited�? to 20+years and more than enough code size to do real projects.  There are several other limits i.e. no library source but it’s still quite useful.

oys_mo
Associate II
Posted on May 17, 2011 at 14:24

Problem solved! 🙂  Kind of..

I found this forum thread: 

http://forum.raisonance.com/viewtopic.php?id=3466

and it turns out that this is a current limitation of the simulator. Weird that this was not easier to find out, but so it is.

The administrator on the Raisonance forum had this reply:

''Concerning the simulator, it is actually not a bug. Our simulator is a Core simulatore i.e., it only simulates the execution of instructions and the basic registers. Peripherals and advanced registers are not simulated, hence the simulation of your code does not produce anything in the simulator.

- The second problem you reported is a limitation of our debugger. It is currently not able to see the registers PSP, PRIMASK, BASEPRI, BASEPRI_MASK, FAULTMASK and CONTROL.

This limitation will be corrected in a future release of RKit-ARM (although we will not have enough time to integrate it in the next release, dues in few weeks).''

I obviously need to switch to testing in hardware as soon as possible. Too bad, really. The simulator is very user-friendly. Hopefully this will be fixed in the future.