Unable to build boron device OS locally

Hi, I’m trying to build the device OS locally and then flash it to my boron.

I followed the guide from the device-os github page here. I cloned the repo and checked out the tag v4.0.0. My goal was to build everything identically to the boron v4.0.0 OS. I wrote a very simple application in order to check that the build was correct:

user\src\application.cpp
#include "application.h"

SYSTEM_MODE(SEMI_AUTOMATIC);
SYSTEM_THREAD(ENABLED);

void setup() {
    pinMode(7, OUTPUT);
}

void loop() {
    digitalWrite(7, HIGH);
    delay(1000);
    digitalWrite(7, LOW);
    delay(1000);
}

I was able to generate three hex files:

  • Bootloader at:
    build\target\bootloader\platform-13-m-lto\bootloader.hex
  • Application at:
    build\target\user-part\platform-13-m\user-part.hex
  • And device OS at:
    build\target\system-part1\platform-13-m\system-part1.hex

Then I assume the required softdevice hex file is located here:
third_party\nrf5_sdk\nrf5_sdk\components\softdevice\s140\hex\s140_nrf52_6.1.1_softdevice.hex

Then, I flashed the four hex files to my boron using the Programmer tool from nRF Connect (using jlink). But the outcome is that the pin 7 is not toggling as it should. It does toggle if I flash the same code but built using the device OS found here and the WebIDE.

So my conclusion is that my code isn’t working because I probably missed something important. Any idea what it might be?

One surprising thing is that particle’s device OS v4.0.0 seems to have the softdevice v7.0.1 whereas the v4.0.0 tag on git seems to point to the softdevice v6.1.1. I understand that some building processes might me machine dependent (I installed ARM GCC version 10-2020-q4-major as requested), but what I don’t understand is why my generated hex files are completely different from the ones that we can find on particle’s website. Aren’t they generated with the same process?

Thanks in advance

The first thing I’d check is to see if the dependencies are correct. Put the device in listening mode (blinking dark blue) and do:

particle serial inspect

My guess is that the SoftDevice version is incorrect, and that would show up in the serial inspect output. And if there are missing dependencies, your use firmware will not run.

Thanks for the quick reply, unfortunately I couldn’t run particle serial inspect with my locally built device OS. I couldn’t even find it in the list after running particle serial list. It worked fine with the device OS obtained from particle’s website however.

I’m confused as to what version of the softdevice I need to use. I cloned the device-os repo at the tag v4.0.0, and this is what we can find on the nrf5_sdk folder. It points to the nrf5_sdk repo, and there the only hex file for s140 that can be found is this one. I could try to use another version of the hex file, but I think it will create even more errors as the device OS seems to be configured for softdevice v6.1.1.

Is the device showing any status LED colors? If not, you almost certainly have a SoftDevice issue of some sort. I’d grab the restore hex file and make sure you can restore the device to working state over SWD:

https://docs.particle.io/reference/developer-tools/jtag/#restore-binaries

Then try flashing only your user firmware and see if that works. Then add in system-part1, bootloader, and see if that works.

Thank you! That worked.

First I built my simple user firmware locally. Although the binary was different from the one built from particle Web IDE, I could flash it together with the device OS from particle’s device restore page, and it executed nicely.

Then, I took particle’s device OS hex file, removed only the system part and replaced it with my own, then added the user firmware. That worked. I didn’t know these were the steps. I thought we were supposed to add the softdevice hex file found in the repo.

To sum it up, the final configuration that worked for me is:

1 Like