6 years, 11 months ago.

mbed-os .a .lib

Hi Im working with the mbed online compiler. To debug, id like to export to system workbench ide, although this is never working since mbed-os has always messed up include paths and other things i cannot fix.

My idea would be to use a pre compiled library file of mbed-os, since im not going to debug mbed os itself but my app code only..

When i export my project, then delete mbed-os folder but keep the libmbed-os.lib file, include this correctly to eclipses (ac6) settings, why do i get the error mbed.h not found?

Isnt the .lib file the entire lib? I thought header files + lib.a generates the .lib?

Appendix: I managed to build the mbed-os repository with mbed cli as library with -t gcc_arm -m Nucleo_f103rb. But also here. Missing mbed.h when i include the .lib file to eclipse

2 Answers

6 years, 11 months ago.

Exporting to system workbench is very frustrating and has been broken since I started playing with mbed. The good news is that it does actually work when you get everything sorted out. My strategy at this point is to export from mbed-cli, open in Eclipse and adjust some linker flags and compiler options, make sure fpu is right. In the eclipse project tree, you need to spend some time excluding items from the build that are not required for the particular target. Right click->Resource Configuration->Exclude from Build.

Here, I made you a clean system workbench project for the f103rb. Using system workbench 1.14.0. It compiles, should run. I set mbed-os as a submodule, so use recursive when you clone the repo to pull mbed-os files in as well.

git clone --recursive https://gitlab.com/gs-open-source/F103RB

In linker options I compiled with full Newlib which supports multithreading. If you only need 1 thread you can reduce code size a lot by using newlib-nano by adding this linker flag.

--specs=nano.specs

I had to add MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE 9600 to the Symbol list for all languages. This value is in mbed_config.h, but RawSerial.h can't see it.

In System Workbench: File->Import->General->Existing Project Into Workspace

And then just select the directory. There is a spammy popop "Auto ignore derived resources" when you first compile it, but I think it can be ignored.

Good luck.

Accepted Answer

Hello Graham. Thank you for your work! I'll gonna try this, thank you.

posted by jibba jibba 14 May 2017
6 years, 11 months ago.

SW4STM32 export is broken. I use EmBitz IDE https://www.embitz.org/ (Windows only). The exporter is better, and the IDE is fast and reliable. There are advanced debug features like live variable watch without stopping the target. And it is free.

Hi Mark. Okay, so its best to leave SW4 and use other IDE like embitz? I'll check it out thank you. Do you know if there is another IDE working well with the exporters but is free (no code limit), maybe eclipse based? im a mac user, i do have a vir win thought. Thank you.

posted by jibba jibba 14 May 2017

There is Coocox CoIDE. It is Eclipse based but Windows only. Free.

Atollic True Studio is also Eclipse based, works on all platforms (Win, OSX, Linux) (tested). You can try it with Eclipse exporter. Building and debugging are free, you have to pay only for advanced debug features, like live variable watch, RTOS thread debug, etc

posted by Mark Peter Vargha 14 May 2017

I gave EmBitz a try today. The exporter is definitely better. My project also compiles much faster than in eclipse 25secs vs 50seconds which is very nice. IDE is much less cluttered and gets right to business. Unfortunately I hit a wall with the STLink debugger. I tried both the Nucleo 2.1 and standalone STLink 2. But EmBitz provided STLinkGDB.exe cannot connect to them. Appears to be a common problem, possibly related to USB 3. So I'm kind of stuck. STLink utilities work, Eclipse works, but EmBitz can't connect to the debugger. Their suggestions include changing windows USB driver, which I am uninclined to do, given that every other USB device I use seems to work fine.

posted by Graham S. 15 May 2017