5 years, 3 months ago.

How can I create a program for Mbed OS2 with Mbed CLI?

The Mbed CLI documentation suggests to issue the following command:

mbed new mbed-classic-program --mbedlib

But the result is:

D:\src\arm\mbed_cli>mbed new mbed-classic-program --mbedlib
[mbed] Working path "D:\src\arm\mbed_cli" (directory)
[mbed] Program path "D:\src\arm\mbed_cli"
[mbed] Creating new program "mbed-classic-program" (git)
[mbed] Adding library "mbed" from "https://mbed.org/users/mbed_official/code/mbed/builds" at branch/tag "tip"
[mbed] Downloading library build "3a7713b1edbc" (might take a while)
[mbed] ERROR: OS Error: The process cannot access the file because it is being used by another process
---

Why would you want to use CLI rather than the cloud compiler? that's like DOS from the 70's. Is there something going down with the online system apart from the usual bugs or am I missing something important here.

I understood that Keil was second to none. OS-5 is BIG trouble but OS2 MBED-DEV (some earlier versions) work really well.

posted by Paul Staron 19 Jan 2019

To be frank with you, I am mainly interested in source codes of the latest mbed OS2 library (rev 164) used by the online compiler. Since mbed-dev has rev 163, I thought they could be imported by creating a new Mbed OS2 project with Mbed CLI.

posted by Zoltan Hudak 19 Jan 2019

I know what you mean, I'm using rev 148 for some targets and 177 particularly for the STM32F103 (blue pill) this was from your recommendation and it does actually work well including RTC, that's on the black pill version. BTW your Bluetooth project works well, I have been using this :)

I tend not to update the library's if they work now, 9 times out of 10 they stop working if I do, and I absolutely can not get low power deepsleep to work on anything but with the previous libraries. Completely given up with Silicon Labs, no one answers any technical issues which is a bit of shame as I got the BURTC working.

Do you think Arduino is the future now?

posted by Paul Staron 19 Jan 2019

Hello Paul,

It seems that Team Mbed is not interested in fixing the last Mbed OS2 library. So this is what worked for me:

  • Download the .gz (.zip is incomplete) repository from mbed-dev to your local drive and unpack.
  • Rename f392fc9709a3 folder to mbed-dev.
  • Open the mbed-dev/cmsis folder and delete the BUILD subfolder.
posted by Zoltan Hudak 10 Apr 2019

1 Answer

5 years, 3 months ago.

Hi,

I could not reproduce the problem as below. Can your try again?

PS D:\work> mbed new hello --mbedlib
[mbed] Working path "D:\work" (directory)
[mbed] Program path "D:\work"
[mbed] Creating new program "hello" (git)
[mbed] Adding library "mbed" from "https://mbed.org/users/mbed_official/code/mbed/builds" at branch/tag "tip"
[mbed] Downloading library build "3a7713b1edbc" (might take a while)
[mbed] Unpacking library build "3a7713b1edbc" in "D:\work\hello\mbed"
[mbed] Updating reference "mbed" -> "https://mbed.org/users/mbed_official/code/mbed/builds/3a7713b1edbc"
[mbed] Couldn't find build tools in your program. Downloading the mbed 2.0 SDK tools...
PS D:\work> dir hello


    Directory: D:\work\hello


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        1/21/2019   1:45 PM                .temp
d-----        1/21/2019   1:42 PM                mbed
-a----        1/21/2019   1:37 PM              8 .mbed
-a----        1/21/2019   1:45 PM             68 mbed.bld
-a----        1/21/2019   1:46 PM           1421 mbed_settings.py


PS D:\work> mbed --version
1.8.3

Accepted Answer

Thank you for a quick reply. I did try again but with no success. It takes couple of minutes to get the error message since receiving Downloading library build "3a7713b1edbc" (might take a while).
Though I am able to create programs for Mbed OS5 with no problems :)

posted by Zoltan Hudak 21 Jan 2019

It does not seem to work on Windows 7. So I tried Linux (Ubuntu 18.04). The download succeeded but compile did not work:

zoli@zoli-ubuntu:~/src/arm/cli$ mbed new hello --mbedlib
[mbed] Working path "/home/zoli/src/arm/cli" (directory)
[mbed] Program path "/home/zoli/src/arm/cli"
[mbed] Creating new program "hello" (git)
[mbed] Adding library "mbed" from "https://mbed.org/users/mbed_official/code/mbed/builds" at branch/tag "tip"
[mbed] Unpacking library build "3a7713b1edbc" in "/home/zoli/src/arm/cli/hello/mbed"
[mbed] Unpacking library build "3a7713b1edbc" in "/home/zoli/src/arm/cli/hello/mbed"
[mbed] Updating reference "mbed" -> "https://mbed.org/users/mbed_official/code/mbed/builds/3a7713b1edbc"
[mbed] Couldn't find build tools in your program. Downloading the mbed 2.0 SDK tools...

zoli@zoli-ubuntu:~/src/arm/cli/hello$ ls -l
total 12
drwxr-xr-x 5 zoli zoli 4096 Feb  3 16:16 mbed
-rw-r--r-- 1 zoli zoli   67 Feb  3 16:17 mbed.bld
-rw-r--r-- 1 zoli zoli 1421 Feb  3 16:17 mbed_settings.py

zoli@zoli-ubuntu:~/src/arm/cli/hello$ mbed --version
1.8.3

zoli@zoli-ubuntu:~/src/arm/cli/hello$ mbed compile -t GCC_ARM -m LPC1768
[mbed] Working path "/home/zoli/src/arm/cli/hello" (program)
Building project hello (LPC1768, GCC_ARM)
Scan: hello
Compile [100.0%]: main.cpp
[Fatal Error] main.cpp@1,18: mbed.h: No such file or directory
[ERROR] ./main.cpp:1:18: fatal error: mbed.h: No such file or directory
 #include "mbed.h"
                  ^
compilation terminated.

[mbed] ERROR: "/usr/bin/python" returned error.
       Code: 1
       Path: "/home/zoli/src/arm/cli/hello"
       Command: "/usr/bin/python -u /home/zoli/src/arm/cli/hello/.temp/tools/make.py -t GCC_ARM -m LPC1768 --source . --build ./BUILD/LPC1768/GCC_ARM"
       Tip: You could retry the last command with "-v" flag for verbose output
---

I think there is still some issue with the correct download and unzipping of mbed library. Below is the content of the mbed directory:

zoli@zoli-ubuntu:~/src/arm/cli/hello/mbed$ ls
3a7713b1edbc
zoli@zoli-ubuntu:~/src/arm/cli/hello/mbed$ cd 3a7713b1edbc/
zoli@zoli-ubuntu:~/src/arm/cli/hello/mbed/3a7713b1edbc$ ls
TARGET_ARCH_BLE             TARGET_EFM32GG_STK3700    TARGET_LPC11U35_501          TARGET_MTS_MDOT_F411RE
TARGET_ARCH_GPRS            TARGET_EFM32HG_STK3400    TARGET_LPC11U37H_401         TARGET_NCS36510
TARGET_ARCH_MAX             TARGET_EFM32LG_STK3600    TARGET_LPC11U68              TARGET_NRF51822
TARGET_ARCH_PRO             TARGET_EFM32PG12_STK3402  TARGET_LPC1347               TARGET_NRF51_DK
TARGET_ARM_BEETLE_SOC       TARGET_EFM32PG_STK3401    TARGET_LPC1549               TARGET_NRF51_DONGLE
TARGET_ARM_CM3DS_MPS2       TARGET_EFM32WG_STK3800    TARGET_LPC1768               TARGET_NRF51_DONGLE_LEGACY
TARGET_ARM_IOTSS_BEID       TARGET_EFM32ZG_STK3200    TARGET_LPC1769               TARGET_NRF51_MICROBIT
TARGET_ARM_MPS2_M0          TARGET_ELMO_F411RE        TARGET_LPC4088               TARGET_NRF51_MICROBIT_B
TARGET_ARM_MPS2_M0P         TARGET_FF_LPC546XX        TARGET_LPC4088_DM            TARGET_NUCLEO_F030R8
TARGET_ARM_MPS2_M3          TARGET_GR_LYCHEE          TARGET_LPC4337               TARGET_NUCLEO_F031K6
TARGET_ARM_MPS2_M4          TARGET_HEXIWEAR           TARGET_LPC54114              TARGET_NUCLEO_F042K6
TARGET_ARM_MPS2_M7          TARGET_HRM1017            TARGET_LPC546XX              TARGET_NUCLEO_F070RB
TARGET_B96B_F446VE          TARGET_K20D50M            TARGET_LPC812                TARGET_NUCLEO_F072RB
TARGET_DELTA_DFCM_NNN40     TARGET_K22F               TARGET_LPC824                TARGET_NUCLEO_F091RC
TARGET_DISCO_F303VC         TARGET_K64F               TARGET_MAX32600MBED          TARGET_NUCLEO_F103RB
TARGET_DISCO_F334C8         TARGET_K66F               TARGET_MAX32620FTHR          TARGET_NUCLEO_F207ZG
TARGET_DISCO_F407VG         TARGET_K82F               TARGET_MAX32625MBED          TARGET_NUCLEO_F302R8
TARGET_DISCO_F413ZH         TARGET_KL05Z              TARGET_MAX32625NEXPAQ        TARGET_NUCLEO_F303K8
TARGET_DISCO_F429ZI         TARGET_KL25Z              TARGET_MAX32625PICO          TARGET_NUCLEO_F303RE
TARGET_DISCO_F469NI         TARGET_KL27Z              TARGET_MAX32630FTHR          TARGET_NUCLEO_F303ZE
TARGET_DISCO_F746NG         TARGET_KL43Z              TARGET_MICRONFCBOARD         TARGET_NUCLEO_F334R8
TARGET_DISCO_F769NI         TARGET_KL46Z              TARGET_MIMXRT1050_EVK        TARGET_NUCLEO_F401RE
TARGET_DISCO_L053C8         TARGET_KL82Z              TARGET_MOTE_L152RC           TARGET_NUCLEO_F410RB
TARGET_DISCO_L072CZ_LRWAN1  TARGET_KW24D              TARGET_MTB_MTS_DRAGONFLY     TARGET_NUCLEO_F411RE
TARGET_DISCO_L475VG_IOT01A  TARGET_KW41Z              TARGET_MTM_MTCONNECT04S      TARGET_NUCLEO_F412ZG
TARGET_DISCO_L476VG         TARGET_LPC1114            TARGET_MTS_DRAGONFLY_F411RE  TARGET_NUCLEO_F413ZH
TARGET_DISCO_L496AG         TARGET_LPC11U24           TARGET_MTS_DRAGONFLY_L471QG  TARGET_NUCLEO_F429ZI
TARGET_EFM32GG11_STK3701    TARGET_LPC11U35_401       TARGET_MTS_MDOT_F405RG

It contains only TARGETs. No mbed.h, hal, platform, drivers ... It could be just a coincidence, but the zip repository at mbedofficial/mbed also contains only TARGETs and lacks mbed.h, hal, platform etc.

posted by Zoltan Hudak 03 Feb 2019

The problem seems to be same issue in here: https://github.com/ARMmbed/mbed-cli/issues/805

posted by Toyomasa Watarai 04 Feb 2019

Thank you.

posted by Zoltan Hudak 04 Feb 2019