Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 7 months ago.
Problem with building with static library of mbed-os
Hi,
I am trying to build mbed-os-blinky example by generating a static library for mbed os and then building the main app by linking it against the library.
Commands used to compile static library:
mbed compile -t GCC_ARM -m NUCLEO_F429ZI --library --source=mbed-os --build=../LIB_BUILD mbed compile -t GCC_ARM -m NUCLEO_F429ZI --source=./main.app --source=../LIB_BUILD --build=../basic-out
LIB_BUILD is the build dir that contains the generated .o files and static lib .a; basic-out is the build dir where the final main app linked with mbed static lib is built and .bin is generated.
NOTE: I took off the "no-archive" flag mentioned in the link: https://docs.mbed.com/docs/mbed-os-handbook/en/5.1/dev_tools/cli/#compiling-static-libraries, since mbed compile wasn't generating ".a" static lib with that flag.
main.cpp
#include "mbed.h" DigitalOut led1(LED1); // main() runs in its own thread in the OS int main() { while (true) { led1 = !led1; wait(0.5); } }
When I am trying to build blinky example with the static library, it doesn't seem to run. The LED that's supposed to blink just gets turned ON and doesn't toggle, which seems to be a timer issue as the program execution is stuck on wait(0.5) function call. Looks like the mbed static library isn't compiling everything together(since the timer doesn't seem to be working).
Any ideas?
Thanks!
I would also like to do this. I have approx 80 projects which I give to students, and rebuilding each takes a long time. Linking to a library would be a good way to avoid this.
posted by Nicholas Outram 13 Jul 2017