6 years, 4 months ago.

How do I compile mbed-dev library with mbed-cli?

Is there a way for the mbed-cli to compile with mbed-dev? I tried using mbed compile with the library, but could not find the build source for mbed-dev.

I also tried generating a Makefile that would generate the object files using this example as a guide: https://github.com/0xc0170/mbed_gcc_makefile However, I was not able to get it working since the folder tree differed the supported boards in the example above.

I am working with mbed os2 since it supports both the BBC micro:bit and the NRF52840_DK boards that I am working with.

1 Answer

6 years, 4 months ago.

Hi there,

It is possible to compile projects with Mbed OS 2 and mbed-dev using the Mbed CLI, here's an example use case:

mbed import https://os.mbed.com/teams/mbed/code/mbed_blinky/
cd mbed_blinky
mbed remove mbed
mbed add https://os.mbed.com/users/mbed_official/code/mbed-dev/
// You can export to GCC Makefiles for your board with the following command
mbed export -i gcc_arm -m kl25z
// You can compile your project with your desired toolchain and board with the following command
mbed compile -t gcc_arm -m kl25z

However, since you are using the NRF52840_DK board, I am only able to compile projects with the Mbed OS 2 library for this board and not the mbed-dev library since there doesn't seem to be any target information available for the NRF52840_DK board within the mbed-dev library.

You can use the following command to compile for the NRF52840_DK board with Mbed CLI if you are developing a project that uses the regular Mbed OS 2 library: mbed compile -t gcc_arm -m NRF52840_DK

Please let me know if you have any questions!

- Jenny, team Mbed

If this solved your question, please make sure to click the "Thanks" link below!

Accepted Answer

What target information would I need to modify the mbed-dev library with to get it to export to the NRF52840_DK board?

Since I am able to export to the NRF52840_DK with Mbed OS2, would it be possible to extract the information from the OS2 library and put it in the mbed-dev libary?

posted by Thu Cao 13 Jul 2018

Hi again,

I am currently troubleshooting why I am unable to compile mbed-dev with the NRF52840_DK board. I am getting the following error which is due to one of the python scripts: ConfigException: Invalid prefix 'target' for parameter name 'target.bootloader_img' in 'library:softdevice[*]'

Looking into it

- Jenny, team Mbed

posted by Jenny Plunkett 13 Jul 2018

I got the same error as well. Please let me know if you have any updates.

Thanks!

posted by Thu Cao 16 Jul 2018

Hi again,

I've filed a bug report with the Mbed OS team regarding the issue with mbed-dev and this board. However, I've been able to resolve the issue in the meantime with the following steps:

Import the Mbed OS 2 Blinky with Mbed CLI, then remove Mbed OS 2 and add mbed-dev:

mbed import https://os.mbed.com/teams/mbed/code/mbed_blinky/
cd mbed_blinky
mbed remove mbed
mbed add https://os.mbed.com/users/mbed_official/code/mbed-dev/

In your project directory, open the hidden .temp folder for the Mbed OS 2 tools and remove the /tools folder. Then, from an Mbed OS 5 project such as mbed-os-example-blinky copy the tools folder from /mbed-os and paste it into your .temp folder in the Mbed OS 2 project. Change the targets.json path in the .temp/tools/targets/__init__.py file to

__targets_json_location_default = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))), 'mbed-dev', 'targets', 'targets.json')

Finally, remove "CRYPTOCELL310" feature from MCU_NRF52840 target in targets.json within the /mbed-dev/targets folder.

Then you can successfully compile:

mbed compile -t gcc_arm -m nrf52840_dk

I apologize for this wonky workaround. Keep your eye out for a fix with the Mbed OS 2 tools!

- Jenny, team Mbed

posted by Jenny Plunkett 18 Jul 2018