New FreeRTOS and ChibiOS/RT real time operating system libraries

I notice that you call these functions in setup()

  halInit();
  chSysInit();

I added a function, chBegin(), that calls these functions and fills the stack and never returns on AVR. On ARM chBegin() totally changes stack use and must be called.

I assume you are using the AVR version. You should be able to call these functions on AVR but you must not call any other ChibiOS functions before these calls and interrupts must be disabled when you call the functions. chSysInit will enable interrupts.

I did not enable memory pools and did not try this feature. I assume you enabled memory pools since your code compiles.

I didn't see a call to chPoolInit(). I believe the init call should replace this:

 for(int i=0; i <= MB_SIZE; i++) {
      chPoolFree(&pool, &data[i]);
  }

I have played with mailbox examples but not in this port.

I have several other mysteries so I am planing to port the ChibiOS testsuite to the Arduino environment. That may take some time.

You might download ChibiOS and look at the testsuite functions as examples.

Sorry I can't be of more help. I am very interested in what you are doing so please don't worry about posting too much code. I will be happy to help find problems by writing or looking at example code.