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

Application of Mailbox

How are the functions _init_box & _declare_box different from os_mbx_init & os_mbx_declare.
I am studying the their application and usage but am finding it quite confusing.

googled but cant find relevant results. havent come across any article that explains the memory allocation related to mailbox.

Am i correct in implementing mailbox in isr?

Parents
  • Allocating 1-byte memory blocks?

    And allocating using a traditional heap implementation in an ISR?

    And allocating without checking if you got any memory block or not?

    Lots of bad things to think twice about. 1 byte is the smallest addressable object (unless playing with 8051 chips or similar that happens to have bit objects). So why use a 4 byte pointer to point at a (probably 32 byte large with book-keeping information and rounded to a suitable minimum block size) memory block containing a single character received from the UART? Does it sound like a good transport mechanism? If this is a 32-bit ARM processor, that pointer was already 4 bytes - four times larger than the character you received from the UART. Doesn't that make you think about the possibilities? Sometimes pointer abuse isn't really abuse but the only practical route.

Reply
  • Allocating 1-byte memory blocks?

    And allocating using a traditional heap implementation in an ISR?

    And allocating without checking if you got any memory block or not?

    Lots of bad things to think twice about. 1 byte is the smallest addressable object (unless playing with 8051 chips or similar that happens to have bit objects). So why use a 4 byte pointer to point at a (probably 32 byte large with book-keeping information and rounded to a suitable minimum block size) memory block containing a single character received from the UART? Does it sound like a good transport mechanism? If this is a 32-bit ARM processor, that pointer was already 4 bytes - four times larger than the character you received from the UART. Doesn't that make you think about the possibilities? Sometimes pointer abuse isn't really abuse but the only practical route.

Children
No data