ARMmbed

Installed toolchain and mbed-cli on linux - tutorial mbed compile failes

Hi,
I installed mbed-cli and toolchain on Linux Mint.

$ uname -a
Linux GS72 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/os-release
NAME="Linux Mint"
VERSION="18.1 (Serena)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 18.1"
VERSION_ID="18.1"
HOME_URL="http://www.linuxmint.com/"
SUPPORT_URL="http://forums.linuxmint.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/linuxmint/"
VERSION_CODENAME=serena
UBUNTU_CODENAME=xenial

What I did was this (something too much, and probably something forgotten):

adamgreen/gcc4mbed:

Arm Mbed CLI

$ sudo pip install mbed-cli
$ mbed-cli --version
1.2.2
$ mbed --version
1.2.2

mbed-cli (1.2.2)

mbed-greentea (1.3.2)

$ sudo pip install mbed-greentea

mbed-host-tests (version?)

$ sudo pip install mbed-host-tests

mbed-ls (1.3.4)

$ sudo pip install mbed-ls

mbed-test-wrapper (1.0.0)

$ sudo pip install mbed-test-wrapper

Adding Bash tab completion:

$ cd ~/apps/mbed-cli-master/tools/bash_completion
$ sudo cp mbed /etc/bash_completion.d/.

i386 architecture packages:

$ sudo dpkg --add-architecture i386
$ sudo apt-get update
$ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386

Install arm-none-eabi-gcc:

$ sudo apt-get update
$ sudo apt install gcc-arm-none-eabi -y
$ arm-none-eabi-gcc --version
4.9.3

$ wget https://launchpadlibrarian.net/287101520/gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2
$ tar xvf gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2
$ mv gcc-arm-none-eabi-5_4-2016q3 ~/apps/.
$ mbed config --global GCC_ARM_PATH "/home/jack/apps/gcc-arm-none-eabi-5_4-2016q3/bin"

$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (15:4.9.3+svn231177-1) 4.9.3 20150529 (prerelease)

Set path

$ mbed config -G ARM_PATH "/usr/bin/arm-none-eabi-gcc"

Checking PATH"

$ echo $PATH
/home/jack/.npm-packages/bin:/home/jack/.nvm/versions/node/v4.4.7/bin:~/.npm-global/bin:/home/jack/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

Install Mercurial:

$ sudo apt install mercurial -y
$ hg --version
Mercurial Distributed SCM (version 3.7.3)

Install requirements:

$ sudo apt-get -y install lib32ncurses5
$ pip install -r requirements.txt
$ sudo pip install colorama jinja2 intelhex junit_xml pyyaml mbed_host_tests mbed_greentea beautifulsoup4 fuzzywuzzy

Board connected to pc:

$ mbedls
+---------------+----------------------+-----------------------------+--------------+--------------------------+-----------------+
| platform_name | platform_name_unique | mount_point                 | serial_port  | target_id                | daplink_version |
+---------------+----------------------+-----------------------------+--------------+--------------------------+-----------------+
| NUCLEO_F446RE | NUCLEO_F446RE[0]     | /media/jack/NODE_F446RE | /dev/ttyACM0 | 077702210C5A6970331EFF3A | 0221            |
+---------------+----------------------+-----------------------------+--------------+--------------------------+-----------------+

mbed-cli compile -j0 -t GCC_ARM -m OUR_TARGET_K64F_IPV6 -o debug-info
mbed-cli compile -j0 -t GCC_ARM -m OUR_TARGET_K64F_IPV6 --profile debug
mbed-cli compile -j0 -t GCC_ARM -m OUR_TARGET_K64F_IPV6 --profile mbed-os/tools/profiles/debug.json
If you're not using recent version of mbed-os, you'll need to put whole path to the profile file eg --profile mbed-os/tools/profiles/debug.json

Starting to test the toolchain, using this tutorial:


https://docs.mbed.com/docs/mbed-os-handbook/en/5.1/getting_started/blinky_cli/

$ mbed import https://github.com/ARMmbed/mbed-os-example-blinky
$ cd mbed-os-example-blinky

Active Mbed CLI configuration:

$ mbed config --list
[mbed] Global config:
ARM_PATH=/usr/bin/arm-none-eabi-gcc

[mbed] Local config (/home/jack/mbed/mbed-os-example-blinky):
No local configuration is set

$ mbed update --clean
[mbed] Synchronizing dependency references...
[mbed] Updating program "mbed-os-example-blinky" to latest revision in the current branch
[mbed] Updating library "mbed-os" to rev #5f6572179d66

$ mbed compile -t GCC_ARM -m NUCLEO_F446RE
Building project mbed-os-example-blinky (NUCLEO_F446RE, GCC_ARM)
Scan: .
Scan: mbed
Scan: env
+------------------+-------+-------+------+
| Module           | .text | .data | .bss |
+------------------+-------+-------+------+
| [fill]           |   124 |     8 |   12 |
| [lib]/c.a        | 17985 |  2472 |   56 |
| [lib]/gcc.a      |  3128 |     0 |    0 |
| [lib]/misc       |   236 |    16 |   28 |
| main.o           |    72 |     4 |   28 |
| mbed-os/drivers  |   136 |     4 |  100 |
| mbed-os/hal      |   893 |     0 |   26 |
| mbed-os/platform |  1240 |     4 |  270 |
| mbed-os/rtos     |  8577 |   180 | 5988 |
| mbed-os/targets  |  8761 |     4 |  832 |
| Subtotals        | 41152 |  2692 | 7340 |
+------------------+-------+-------+------+
Total Static RAM memory (data + bss): 10032 bytes
Total Flash memory (text + data): 43844 bytes

Image: ./BUILD/NUCLEO_F446RE/GCC_ARM/mbed-os-example-blinky.bin

$ mbed test --compile -t GCC_ARM -m NUCLEO_F446RE
Building library mbed-build (NUCLEO_F446RE, GCC_ARM)
Scan: mbed-os-example-blinky
Compile [  0.3%]: AnalogIn.cpp
[Fatal Error] platform.h@22,19: cstddef: No such file or directory
Failed to build library

Memory map breakdown for built projects (values in Bytes):
+------+--------+-----------+------------+-------------+
| name | target | toolchain | static_ram | total_flash |
+------+--------+-----------+------------+-------------+
+------+--------+-----------+------------+-------------+


Build failures:
* NUCLEO_F446RE::GCC_ARM::MBED-BUILD
        Building library mbed-build (NUCLEO_F446RE, GCC_ARM)
        Scan: mbed-os-example-blinky
        Compile [  0.3%]: AnalogIn.cpp
        [Fatal Error] platform.h@22,19: cstddef: No such file or directory
        
[mbed] ERROR: "/usr/bin/python" returned error code 1.
[mbed] ERROR: Command "/usr/bin/python -u /home/jack/mbed/mbed-os-example-blinky/mbed-os/tools/test.py -t GCC_ARM -m NUCLEO_F446RE --source /home/jack/mbed/mbed-os-example-blinky --build /home/jack/mbed/mbed-os-example-blinky/BUILD/tests/NUCLEO_F446RE/GCC_ARM --test-spec /home/jack/mbed/mbed-os-example-blinky/BUILD/tests/NUCLEO_F446RE/GCC_ARM/test_spec.json" in "/home/jack/mbed/mbed-os-example-blinky"
---


$ cp ./BUILD/NUCLEO_F446RE/GCC_ARM/mbed-os-example-blinky.bin /media/jack/NODE_F446RE

Update, after reading here:

$ wget https://launchpadlibrarian.net/287101520/gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2
$ tar xvf gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2
$ mv gcc-arm-none-eabi-5_4-2016q3 ~/apps/.
$ mbed config --global GCC_ARM_PATH "/home/jack/apps/gcc-arm-none-eabi-5_4-2016q3/bin"

$ mbed compile -t GCC_ARM -m NUCLEO_F446RE
Building project mbed-os-example-blinky (NUCLEO_F446RE, GCC_ARM)
Scan: .
Scan: mbed
Scan: env
+------------------+-------+-------+------+
| Module           | .text | .data | .bss |
+------------------+-------+-------+------+
| [fill]           |   124 |     8 |   12 |
| [lib]/c.a        | 17985 |  2472 |   56 |
| [lib]/gcc.a      |  3128 |     0 |    0 |
| [lib]/misc       |   236 |    16 |   28 |
| main.o           |    72 |     4 |   28 |
| mbed-os/drivers  |   136 |     4 |  100 |
| mbed-os/hal      |   893 |     0 |   26 |
| mbed-os/platform |  1240 |     4 |  270 |
| mbed-os/rtos     |  8577 |   180 | 5988 |
| mbed-os/targets  |  8761 |     4 |  832 |
| Subtotals        | 41152 |  2692 | 7340 |
+------------------+-------+-------+------+
Total Static RAM memory (data + bss): 10032 bytes
Total Flash memory (text + data): 43844 bytes

Image: ./BUILD/NUCLEO_F446RE/GCC_ARM/mbed-os-example-blinky.bin

$ cp ./BUILD/NUCLEO_F446RE/GCC_ARM/mbed-os-example-blinky.bin /media/jack/NODE_F446RE

And the LED flashes at the right rate!
Hope this helps somebody…

But is GNU Arm Embedded version 6 not compatible with mbed-cli?
Or can it be used, with the correct configuration?

Best regards,
Jack.

But is GNU Arm Embedded version 6 not compatible with mbed-cli?

Both GNU Arm Embedded 4.9.3 and GNU Arm Embedded 6 should work. But GCC6 should be used for new projects, we’re dropping 4.9 support.

I’m building with GCC6 and see no issues with Mbed OS 5.6…