Application code works under bare metal profile, but not when compiled with RTOS profile

Hello all and happy New Year. I hope 2020 is full of rewarding projects.

I’m playing around with some Google TensorFlow code on the NXP FRDM-K66F and noticed an odd behaviour with the -D PIO_FRAMEWORK_MBED_RTOS_PRESENT build flag.

Here’s a link to the code I’ve been playing with:

The base Google code seems to be have been based on the NXP SDK and as such does not make use of the Mbed RTOS primitives. When I build the app without the PIO_FRAMEWORK_MBED_RTOS_PRESENT build flag, the app works flawlessly. However when I include -D PIO_FRAMEWORK_MBED_RTOS_PRESENT as a build flag, the apps works for a few seconds and then audio loopback cuts out. I’m not sure whether it’s the SAI interface that stops working or something in buffer handling that dies.

So what does that build flag do, because even though there is no app-side code changes, including the Mbed RTOS primitives definitely impacts the app. Any thoughts/information would be appreciated.

Thanks

The topic title is a bit misleading, and should be “application code works under bare metal profile, but not when compiled with RTOS profile”.