This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
(This question was originally posted in the Stellaris area but Dave pointed out that it really belongs here)
__ldrex and __strex intrinsics don't qualify parameter with volatile.
According to ARM, the pointer parameter should be "volatile void*".
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0491c/CJAFAFAF.html
I have a variable which many source tasks race to change from zero to non-zero; this should use LL-SC. But only one sink task can change it when already non-zero. The sink task therefore doesn't need LL-SC, merely a volatile read and volatile write. However, the compiler won't let me mark the variable as volatile.
These intrinsics should accept a pointer to volatile, because they access the location with volatile semantics, and the volatile qualifier can be implicitly added but not removed.
volatile uint8_t active;
do {
if (__ldrexb(&active)) return;
} while (__strexb(5, &active));
Can anyone confirm that this is an error in TI's toolchain? I wanted to submit a bug report to TI, but the support form at http://www.ti.com/general/docs/contact.tsp didn't seem to have a category related to compilers.
Or is there some reason that these instructions wouldn't behave as expected with volatile variables?