You are absolutely right. The linker should warn you about that. A table showing memory usage is usually displayed at the the end of a successful compilation.
Is it possible in mBED studio to compile just the OS components with a different level of optimization and into a single linkable object so that my application code can be compiled with -g O0 and linked with the OS object file?
I’ve never done it but I think that’s possible:
-
A static
mbed-oslibrary (libmbed-os.a) shall be built using the mbed-cli command line interface (Mbed Studion doesn’t have such feature yet). In addition I’m not sure theArm Compiler 6is capable to build static libraries so I’d suggest to use the GCC ARM instead. This thread could help. -
You can use a
mbed_app.jsonconfiguration file to configure thembed-oslibrary to your needs. See https://forums.mbed.com/t/static-library-and-mbed-app-json -
Create a new project with the Mbed Studio and delete the
mbed-osdirectory (mbed-os source files) .Copy & pastethelibmbed-os.astatic library file into the root directory of the project and compile with the GCC ARM compiler (see the link in my first post how to switch Mbed Studio to GCC ARM).