Deprecation note: Mbed OS now supports bare-metal mode, and this example is no longer necessary.
This application demonstrates how to remove Mbed RTOS from an Mbed OS 5 program to save RAM and flash. Note that you'll lose IP networking capabilities, and the opportunity to run tests through Greentea. This also has effects on tickless mode and the sleep manager might not function anymore. In the future Mbed OS is introducing a bare-metal mode, which no longer requires this work.
Note that patching the networking libraries is possible, see mbed-os#7956 for some pointers.
In .mbedignore
folders that depend on the RTOS are excluded. This also means the MBED_CONF_RTOS_PRESENT
is no longer defined.
Additional optimizations
- Disable flush of standard I/O's at exit (see mbed_app.json).
- Build with newlib-nano.
- Disable error reporting (due to #9464, see mbed_app.json).
Compiled with GCC 6 on a FRDM-K64F with newlib-nano and a release profile:
Total Static RAM memory (data + bss): 2568 bytes
Total Flash memory (text + data): 6656 bytes
To compile with newlib-nano in release mode, build with the tiny
profile:
$ mbed compile --profile=./profiles/tiny.json
UART and Serial drivers take up a lot of space. See minimal-printf for a size-optimized library.