-
Notifications
You must be signed in to change notification settings - Fork 18
Description
After looking through the RTOS source in the mbed framework V5 and V6, I'm pretty sure that the "rtos" package should always be included into the build, even for bare-metal profile. If you look at the bare-metal examples on the mbed website, they always show rtos being included to access the special namespace ThisThread
, and potentially other non-rtos constructs.
I'm not a python expert, so please forgive me if I'm wrong, but I think the problem is in the code linked below; where there seems to be an assumption that if RTOS is not enabled, then the "rtos" package is not included. However, ThisThread
which is critically important in mbed 6 as many older APIs were removed, is also the prescribed way to perform yielding, sleeping and other such tasks even on bare-metal boards. Further, all other bare-metal incompatible constructs (both in CPP and H files) are protected by checks for RTOS being present.
builder-framework-mbed/platformio-build.py
Line 165 in 152ac44
if MBED_RTOS: |
I've done quite a bit of research on this now, and I'm pretty sure this is the right behaviour. But this is a far from simple domain, and there could others with more experience of mbed bare-metal. Up to now, I generally don't use bare-metal, favouring only RTOS boards. However, this is probably the most useful page I found on bare-metal: https://os.mbed.com/docs/mbed-os/v6.4/bare-metal/index.html
Also, take a look at the source in .platformio/packages/framework-mbed/rtos and the source directory under there, you'll see most source is protected by:
#if MBED_CONF_RTOS_PRESENT
This is linked to the following forum post: https://community.platformio.org/t/mbed-rtos-baremetal-and-thisthread-compilation-issues/17555