How to test atomic access implemented with Load Store Exclusive Assembly (LDREX / STREX)

Hi there,

i have several inline assembly functions wrapped in C.

They implement atomic / read-modfy-write style

  • Compare And Swap
  • Increment
  • Decrement
  • Lock Semaphore

Creating a  good case Test i got done.

But now i am struggling to produce a reliable and reproducible bad case test. I want to test the "exclusive store failed" paths in all functions.

Is there any way i can induce a Fail to the exclusive store upon the exclusive load?

Testing by Debugger to manually manipulate the Program Counter could be a way, but I prefer to 

Id prefer to manipulate something in Memory to have a "minimal" effect...

My initial Tests to first:

simply halt execution between load and store exclusive,

then:

accessing RAM via debugger,

did not result in a failing Store Exclusive....

Is there some approach to this?

My Plan-B is to Brute Force it, by repeatedly calling the functions and trying to generate a lot IRQs to interrupt in the critical moment.

But that seems hardly reliable and reproducible....

Parents Reply Children
No data
More questions in this forum