7 years, 6 months ago.

lots of linker error with mbed-cli

I've setup the mbed-cli environment and imported a simple test program (https://developer.mbed.org/users/JojoS/code/mbed_blinky/). But compiling for LPC1768 / LPC1549 / LPC1347 gives only a lot of linker errors: undefined references to _fclose_r, wrap_free_r, sflush_r and many more. The included lib is mbed classic, toolchain GCC_ARM 5.4.1. Another question: the import pulls in the mbed lib with sources for all targets, resulting in nearly 1GB size! Is there a way to use a common local mbed lib? The import takes much too long when always the whole lib is downloaded.

1 Answer

-deleted-
7 years, 6 months ago.

Hi Johannes,

Thanks for raising this up.

This example program is using very old version of the mbed library (from October 2014), which might not be optimally supported in the mbed command-line tools. I'll investigate this and let you know. In the meantime could you try with more recent mbed library release?

Also, regarding the size of the mbed library, this example program can make use the mbed library build instead of the mbed library repository. To achieve this, you can open command prompt in the imported example, then remove the mbed library and re-import it as a library build from http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89, e.g.

$ cd <mbed_blinky directory>
$ mbed remove mbed
$ mbed add http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89

After this you can publish the updated program with mbed CLI ('mbed publish' ...). This will make the example program significantly faster to import both in the mbed Online IDE and on command line with mbed CLI!

Hope this helps.

Cheers,
Mihail

Accepted Answer

Also making use of the mbed library build allows the build system to trigger the correct compatibility profile. E.g. I was able to successfully compile the program after switching to the mbed library build in your example (described in my previous post)

 mbed compile -t GCC_ARM -m LPC1768 -c 
Building project mbed_blinky (LPC1768, GCC_ARM)
Scan: .
Scan: mbed
Scan: env
Compile: Adafruit_GFX.cpp
Compile: Adafruit_SSD1306.cpp
Compile: main.cpp
Link: mbed_blinky
Elf2Bin: mbed_blinky
+-----------+-------+-------+------+
| Module    | .text | .data | .bss |
+-----------+-------+-------+------+
| Subtotals | 71863 |  2264 | 2928 |
+-----------+-------+-------+------+
Allocated Heap: 2048 bytes
Allocated Stack: 3072 bytes
Total Static RAM memory (data + bss): 5192 bytes
Total RAM memory (data + bss + heap + stack): 10312 bytes
Total Flash memory (text + data + misc): 74127 bytes
Image: ./.build/LPC1768/GCC_ARM/mbed_blinky.bin
posted by -deleted- 16 Sep 2016

Thanks for your help, that was useful. I've updated the program to the actual mbed version 126 and renamed it to https://developer.mbed.org/users/JojoS/code/Test_OLED_Display/ So, now it compiles, but still some trouble with my target LPC1347 that I want to use. Size is too large, but this is strange: LPC1768 - GCC_ARM: 73k LPC1549 - GCC_ARM 22k LPC1347 - GCC_ARM 73k (overflow flash+ram) LPC1347 - ARM online 35k LPC1347 - ARM offlinie >32k, exceeds limit of my free version LPCxxx - GCC_CR does not work at all. I have installed LPCXpresso 8.2 and set the path in the python config.Get again lots of linker errors. For LPC1347 I have copied the contents from TOOLCHAIN_ARM to TOOLCHAIN_CR as LPCXpresso uses the same gcc. My target is to get an export from my online LPC1347 projects to the LPCXpresso IDE. This is not supported in the online compiler, so my idea was to go over the mbed-cli and add my own exporter, but this way is full of traps :-(

posted by Johannes Stratmann 17 Sep 2016

Ok, finally I I've learned how to use mbed-cli. And I see that it is not the solution to use it as a 'converter' from the online IDE to some other offline IDE. I will open a new question for my trouble.

posted by Johannes Stratmann 18 Sep 2016