2 years, 4 months ago.

Cannot build mbed-os with NRF52840_DK

I am using the build.py tool to build the mbed-os library with the NRF52840_DK board and GCC_ARM compiler.

After invoking <<code>> python build.py -t gcc_arm -m nrf52840_dk <</code>> , the header files were copied, however, there was an error when compiling.

Is there a fix for this?

fatal error: objects_cryptocell.h: No such file or directory

Scan: TARGET_NRF52840_DK
Compile [  1.2%]: mbed_tz_context.c
Compile [  2.4%]: startup_NRF52840.S
Compile [  3.6%]: cmsis_nvic.c
Compile [  4.8%]: PeripheralPinsDefault.c
Compile [  6.0%]: system_nrf52840.c
Compile [  7.1%]: PeripheralPins.c
Compile [  8.3%]: critical_section_api.c
Compile [  9.5%]: analogin_api.c
[Fatal Error] objects.h@58,10: objects_cryptocell.h: No such file or directory
In file included from ../mbed-os/BUILD/mbed/TARGET_NRF52840_DK/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/TARGET_NRF52840_DK/device.h:36:0,
                 from ../mbed-os/BUILD/mbed/hal/analogin_api.h:22,
                 from ../mbed-os/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/analogin_api.c:18:
../mbed-os/BUILD/mbed/TARGET_NRF52840_DK/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/objects.h:58:10: fatal error: objects_cryptocell.h: No such file or directory
 #include "objects_cryptocell.h"
compilation terminated.

Completed in: (1.76)s

Build failures:
  * GCC_ARM::NRF52840_DK

1 Answer

2 years, 4 months ago.


If you are using the Mbed CLI, please use the following command to build your program within its root directory: mbed compile -t gcc_arm -m nrf52840_dk --clean

Also, please make sure you are on the most recent version of mbed-os using the following Mbed CLI commands within your project directory:

cd mbed-os
mbed update latest

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

Running the build.py script from the tools directory within Mbed OS will not work as it will not grab the board's separate features including cryptocell.

- Jenny, team Mbed

posted by Jenny Plunkett 18 Jul 2018

Hi Jenny,

I am trying to build mbed-os library itself in order to make edits to library. I created a fork of the mbed-os repository [https://github.com/ARMmbed/mbed-os] and cloned it in my working directory. I followed an old documentation: https://os.mbed.com/teams/SDK-Development/wiki/Mbed-SDK-build-script-introduction in order to generate a build of the mbed-os library.

git clone https://github.com/ARMmbed/mbed-os
cd mbed-os/tools
python build.py -t gcc_arm -m nrf52840_dk

I tested the build.py script with the nrf51_microbit and the kl25z and both were able to build the mbed-os. Once the mbed-os library is built, a new directory called BUILD is created inside mbed-os.

cd mbed-os/BUILD
cd mbed

Inside this mbed, the library is built and the .o files are generated. However, this failed for the nrf52840_dk with the above error. If build.py is not the way to build mbed-os itself, then how can I build mbed-os?

posted by Thu Cao 19 Jul 2018

You can make edits to Mbed OS itself and still use mbed compile, the Mbed CLI will use the Mbed OS library files present in your project, so you can still alter Mbed OS and mbed compile will see and compile those changes.

- Jenny, team Mbed

posted by Jenny Plunkett 19 Jul 2018

That Mbed SDK build script link is also extremely old and is written for Mbed OS 2 and 3, not Mbed OS 5 (the latest version).

- Jenny, team Mbed

posted by Jenny Plunkett 19 Jul 2018

Make changes to your own copy of Mbed OS within another program like mbed-os-example-blinky and then use mbed compile -t gcc_arm -m nrf52840_dk --clean to build Mbed OS.

- Jenny, team Mbed

posted by Jenny Plunkett 19 Jul 2018