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

LDREX, STREX does not work as I expected in M4/M4F

Hi,

As I expect:

LDREX will Lock the address of VarTest. If I change vale of VarTest, STREX will return 1.

But in my test (Picture below). after all, VarTest4 = 0 although I modify VarTest before STREX. As I expected VasTest4 have to is 1.

Thanks and best regards!

Parents
  • The example code, if your intent is to try the LDREX/STREX instructions, should probably be changed to declare the variables as volatile.

    Otherwise it is likely that the compiler makes optimizations that invalidate your test.

Reply
  • The example code, if your intent is to try the LDREX/STREX instructions, should probably be changed to declare the variables as volatile.

    Otherwise it is likely that the compiler makes optimizations that invalidate your test.

Children
No data