Device OS from GitHub won't compile

I am desperately trying to compile the application and deviceOS locally for the Tracker One on Windows 10 with the following versions:

arm-none-eabi-gcc --version -> arm-none-eabi-gcc (GNU Arm Embedded Toolchain 10-2020-q4-major) 10.2.1 20201103 (release)
make --version -> GNU Make 3.82.90 (MinGW)
makefile from Particle workbench -> buildscripts@1.11.0

Here’s how I proceeded retrieving the source code files:

  1. Pull the deviceOS (https://github.com/particle-iot/device-os, branch develop, SHA 5deba5a aka version 4.0.2)
git clone https://github.com/particle-iot/device-os.git
cd device-os
git checkout 5deba5a
git reset --hard
git clean -xdf
git submodule update --init --recursive
  1. Pull the tracker-edge firmware (https://github.com/particle-iot/tracker-edge, branch develop, SHA 144b29c)
git clone https://github.com/particle-iot/tracker-edge.git
cd tracker-edge
git submodule update --init --recursive
  1. Create folder structure like the following:
    particle
    |-device-os
    |-tracker-edge
    |-Makefile

  2. Execute the make command:

make compile-all APPDIR=tracker-edge DEVICE_OS_PATH=device-os PLATFORM_ID=26
  1. After ~8 minutes the following result is prompted:
Invoking: ARM GNU Create Flash Image
arm-none-eabi-objcopy -O binary ../../../build/target/system-part1/platform-26-m/system-part1.elf ../../../build/target/system-part1/platform-26-m/system-part1.bin.pre_crc
if [ -s ../../../build/target/system-part1/platform-26-m/system-part1.bin.pre_crc ]; then \
head -c $((`stat --print %s ../../../build/target/system-part1/platform-26-m/system-part1.bin.pre_crc` - 38)) ../../../build/target/system-part1/platform-26-m/system-part1.bin.pre_crc > ../../../build/target/system-part1/platform-26-m/system-part1.bin.no_crc && \
tail -c 38 ../../../build/target/system-part1/platform-26-m/system-part1.bin.pre_crc > ../../../build/target/system-part1/platform-26-m/system-part1.bin.crc_block && \
test "0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20280078563412" = `xxd -p -c 500 ../../../build/target/system-part1/platform-26-m/system-part1.bin.crc_block` && \
sha256sum ../../../build/target/system-part1/platform-26-m/system-part1.bin.no_crc | cut -c 1-65 | xxd -r -p | dd bs=1 of=../../../build/target/system-part1/platform-26-m/system-part1.bin.pre_crc seek=$((`stat --print %s ../../../build/target/system-part1/platform-26-m/system-part1.bin.pre_crc` - 38)) conv=notrunc  && \
head -c $((`stat --print %s ../../../build/target/system-part1/platform-26-m/system-part1.bin.pre_crc` - 4)) ../../../build/target/system-part1/platform-26-m/system-part1.bin.pre_crc > ../../../build/target/system-part1/platform-26-m/system-part1.bin.no_crc && \
 crc32 ../../../build/target/system-part1/platform-26-m/system-part1.bin.no_crc | cut -c 1-10 | xxd -r -p | dd bs=1 of=../../../build/target/system-part1/platform-26-m/system-part1.bin.pre_crc seek=$((`stat --print %s ../../../build/target/system-part1/platform-26-m/system-part1.bin.pre_crc` - 4)) conv=notrunc ;\
fi
../../../build/module.mk:201: recipe for target '../../../build/target/system-part1/platform-26-m/system-part1.bin' failed
make[2]: *** [../../../build/target/system-part1/platform-26-m/system-part1.bin] Error 1
make[2]: Leaving directory 'C:/particle/device-os/modules/tracker/system-part1'
makefile:50: recipe for target 'C:/particle/device-os/modules/tracker/system-part1/makefile' failed
make[1]: *** [C:/particle/device-os/modules/tracker/system-part1/makefile] Error 2
make[1]: Leaving directory 'C:/particle/device-os/modules'
Makefile:73: recipe for target 'compile-all' failed
make: *** [compile-all] Error 2

However, when using the deviceOS that comes with the Particle workbench it compiles fine without any errors. For a continuous integration pipeline I am reliant on the deviceOS from GitHub and therefore want to make it work.

If you have any idea of how I can solve this, I’d greatly appreciate your help.

My guess is that your standalone build environment does not have the crc32.exe binary in your PATH. This isn’t included in the device-os repo since it’s a native tool. It’s often available on Mac and Linux, but almost never on Windows.

Hi rickkas7,

I added the buildtools/1.1.1/bin directory (including the crc32.exe) to the environment variable PATH beforehand. When typing crc32 in the terminal I get the no file specified response as an indication of success.

Any other thoughts? What is different from the device-os that comes with the workbench and the device-os from GitHub?

The Workbench device-os is unmodified from the repo, so it’s probably some sort of environment or tool difference, but it’s not obvious to me what the problem is.

Once thing you could try is from Workbench, use the Particle: Launch Compiler Shell command, then cd into the tree you checked out and do a make from the modules directory. That would help isolate whether the problem is in your source or your local toolchain.

After doing so, I’m getting the following prompt:

make -C ../../../user
make[3]: Entering directory '/cygdrive/c/particle/device-os/user'
build.mk:67: *** "No sources found in tracker-edge/".  Stop.
make[3]: Leaving directory '/cygdrive/c/particle/device-os/user'
make[2]: *** [../../../build/recurse.mk:12: user] Error 2
make[2]: Leaving directory '/cygdrive/c/particle/device-os/modules/tracker/user-part'
make[1]: *** [makefile:51: /cygdrive/c/particle/device-os/modules/tracker/user-part/makefile] Error 2
make[1]: Leaving directory '/cygdrive/c/particle/device-os/modules'
make: *** [Makefile:74: compile-all] Error 2

I stumbled upon the No sources found error a couple of times now but couldn’t seem to resolve it. According to this post, I should be fine since both the toolchain and the application is on drive C:.

Update
After sorting the error it compiled successfully from the Compiler Shell.
Coming back to the question, is it not possible to compile without the compiler shell, for example from eclipse?

Yes, it is possible. That’s how our internal CI builds work. However, they run under Linux, not Windows, and I suspect there is something missing in your non-Workbench shell environment, but I’m not sure what.

Incidentally, if you can run your CI builds over Linux, it’s significantly faster. Even running Linux in a VM or Docker instance is faster than running Windows natively. It’s caused by the way the gcc-arm compiler is launched under Cygwin, it’s really slow.

Thanks for keeping up on this so quickly.

I appreciate your help and will test it on Linux natively although it is not quite what I aimed for, thanks!

Compiling with the particle/buildpack-particle-firmware docker image works as expected on Docker Desktop but unfortunately not within my Jenkins CI due to missing root permissions.

Even under WSL (Windows Subsystem for Linux) it’s considerably faster - even more surprising was that running the Windows based Workbench installation works way faster when the build process was initiated from within WSL :astonished:

1 Like