7 years, 8 months ago.

can't build USBDevice with mbed-cli

I wanted to use the mbed-cli tool to build a small application based on USB-Serial/USB-Device. The code comes from the USB Serial example on the mbed site

#include "mbed.h"
#include "USBSerial.h"
 
//Virtual serial port over USB
USBSerial serial;
 
int main(void) {
 
    while(1)
    {
        serial.printf("I am a virtual serial port\r\n");
        wait(1);
    }
}

I used the following command to create the project:

mbed new mbed-os-program

Then, i cd'd into the 'mbed-os-program' directory and created a main.cpp file containing the code above. To build I ran:

mbed-cli compile -t GCC_ARM  -m K64F --usb

But had no luck. The error message is:

[ERROR] ./main.cpp:2:23: fatal error: USBSerial.h: No such file or directory
compilation terminated.

[mbed] ERROR: "python" returned error code 1.
[mbed] ERROR: Command "python -u /home/halherta/Dev/mbed-os-program/mbed-os/tools/make.py -t GCC_ARM -m K64F --source . --build ./.build/K64F/GCC_ARM --usb" in "/home/halherta/Dev/mbed-os-program"

Any help would be appreciated.

2 Answers

7 years, 8 months ago.

Hello,

support for libraries (Fat, USB and others) is not yet enabled by mbed-cli. To be precise, all these https://github.com/ARMmbed/mbed-os/tree/master/libraries

Accepted Answer

When will these libraries be supported by mbed-cli? To me mbed-cli and the mbed os 5 have been released pre-maturely. These high level libraries (USBDevice, FAT, dsp,rpc) are fundamental for the proper mbed experience. Hopefully this will be fixed soon.

I can still compile mbed based firmware offline ( with full USB support) the classical way i.e. by cloning the mbed-os repo on github, and building the libraries with a command such as:

python tools/build.py -drum NUCLEO_F411RE -t GCC_ARM

or

python tools/build.py -drum K64F -t GCC_ARM

then use a makefile to build the project.

posted by Ziryab 10 Aug 2016

Those libraries need a review. AS you noted, they are part of mbed 2 flow, and even you can use them here, it's just that currently not in the development (have not been synced) and can't be used within mbed 5.

That will change, but cant provide an estimation at the moment.

posted by Martin Kojtal 11 Aug 2016

It's been a while now - any news?

We'd really like to port our stuff to mbed-cli + add WebUSB support to the headers.

posted by Lars Knudsen 27 Sep 2016

opened an issue: https://github.com/ARMmbed/mbed-os/issues/2835

posted by Lars Knudsen 28 Sep 2016
7 years, 8 months ago.

I can confirm this problem. Assuming it has something to do with the include path.