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

What is better as mutex on Cortex-M4 - Bitband or LDREX/STREX

The two options are available.

What is the difference in respect of "cost" "speed" and "complexity" for the two method?

When we need more than few mutexs like that, say 100, is the answer different?

Parents
  • There are several limitations with the bit-band method:

    - the semaphore data are limited to bit type. With exclusive accesses you can have byte, halfword and word size. (For simple mutex operations bit data is fine).

    - Since bit band data is limited to 32-bit, and use each bit for each application task, so limited to 32 tasks to share the data.  Exclusive accesses don't have this limitation.

    - Bit band can only be used in bit band regions. Exclusive accesses can be used in other memory space.

    - Bit band is not supported in Cortex-M7 processor (chip designer can add bit band on the peripheral space using additional bus level component).

    In terms of cost and speed they are fairly similar.  Given that semaphore and mutex don't happen frequenctly, even if one of the methods is faster the benefit is small.

    In terms of complextity, you can do bit band easily with C, and for exclusive accesses you need to use intrinsic functions.

    Hope this helps.

    regards,

    Joseph

Reply
  • There are several limitations with the bit-band method:

    - the semaphore data are limited to bit type. With exclusive accesses you can have byte, halfword and word size. (For simple mutex operations bit data is fine).

    - Since bit band data is limited to 32-bit, and use each bit for each application task, so limited to 32 tasks to share the data.  Exclusive accesses don't have this limitation.

    - Bit band can only be used in bit band regions. Exclusive accesses can be used in other memory space.

    - Bit band is not supported in Cortex-M7 processor (chip designer can add bit band on the peripheral space using additional bus level component).

    In terms of cost and speed they are fairly similar.  Given that semaphore and mutex don't happen frequenctly, even if one of the methods is faster the benefit is small.

    In terms of complextity, you can do bit band easily with C, and for exclusive accesses you need to use intrinsic functions.

    Hope this helps.

    regards,

    Joseph

Children