Hi,
anyone used any mutex by some special AVR32 instructions? like memc, mems and xchg.
Cheng
Hi,
anyone used any mutex by some special AVR32 instructions? like memc, mems and xchg.
Cheng
Yes, for example the Linux kernel has mutexes and semaphores implemented.
The toolchain has also loads of synchronized builtins enabled, see the __builtin_sync stuff.
Do you have any problems? I saw no question in your post.
where is this __builtin_sync???
Hmm, I was a bit fast typing the GCC intrinsic function name, it is all documented in the GCC manual:
I tried __sync_bool_compare_and_swap and __sync_lock_test_and_set in my AVR32 code, but the compiler can't compile them.
Severity and Description Path Resource Location Creation Time Id undefined reference to `__sync_bool_compare_and_swap_1' Framework/1.2.0ES-AT32UC3B/COMPONENTS/RF/CC2420 cc2420_pt.c line 236 1208180677671 67545
You will need a fairly new toolchain for them to work, I guess they were added in the GCC 4.2.2 release of GCC for AVR32.
Could you do a avr32-gcc --version?
avr32-gcc (GCC) 4.2.2-atmel.1.0.8 (mingw32 special)
This is mine.
Could you paste your code where you use the __sync_bool_compare_and_swap and __sync_lock_test_and_set? Just to sort out any syntax errors :)
ok:
U8 i = 0; int main(void) { ... __sync_bool_compare_and_swap(&i, 0, 1); ... }