Compile Tracker-edge firmware with Particle CLI

I can not seem to compile tracker-edge firmware (GitHub - particle-iot/tracker-edge: Particle Tracker reference application) using Particle CLI and the CLI Reference documentation here (Command Line Interface (CLI) | Reference | Particle) does not have an example for Tracker products

Hey, welcome to the community!
I would try using Particle Workbench to compile the Tracker code.

If you REALLY want to use the command line, you would need to use a tool like neopo created by @nrobinson2000 .

Let us know how it goes,
Gustavo.

Hi Gustavo,

I need to be able to build via CLI to set up a CI/CD pipeline for the project. Can help me verify if the following command works?

$ neopo run compile-all myProject

My main.cpp has dependencies in lib/module and the build fails because the include statement could not resolve the path to the module. Given the follow file structure, can you give a sample build command?

root
| -- lib/tracker
           | -- tracker.cpp
           | -- tracker.h
| -- src/main.cpp (include tracker.h in code)

Thank you

Hey @khuondn,

The following works to clone and build the tracker-edge repo with neopo:

git clone https://github.com/particle-iot/tracker-edge
cd tracker-edge
git submodule update --init --recursive
neopo configure tracker 3.3.0
neopo build -v

Is there a specific reason for why you have changed the project structure?

1 Like

(thank you for the assistance, Nathan!)

1 Like

Hi Nathan,

I just tried to tidy up the /src folder, but in doing so the code would not compile. I will reverse back the project structure to that of tracker-edge

@nrobinson2000
I was also looking to pass a variable TARGET_VERSION into neopo compile as discussed in this thread but was not able to do so successfully.
The command I use is

neopo configure tracker 3.3.0 myProject
cd myProject
neopo flags "-DTARGET_VERSION=28" 
neopo compile

This is my main.cpp

#include "Particle.h"

#include "tracker_config.h"
#include "tracker.h"

#ifndef TARGET_VERSION
#define TARGET_VERSION 30 // fall back value
#endif


PRODUCT_ID(_SOME_ID);
PRODUCT_VERSION(TARGET_VERSION);
...

I confirmed that the flag value is correctly set to 28 as shown in neopo-compile-user.sh

#!/bin/sh
PATH="$PATH:/root/.particle/toolchains/gcc-arm/10.2.1/bin:/root/.particle/toolchains/buildtools/1.1.1"

make -sf /root/.particle/toolchains/buildscripts/1.11.0/Makefile \
PARTICLE_CLI_PATH=/root/.neopo/particle \
APPDIR=/root/myProject \
DEVICE_OS_PATH=/root/.particle/toolchains/deviceOS/3.3.0 \
PLATFORM=tracker \
EXTRA_CFLAGS=-DTARGET_VERSION=28 \ <== correct value
compile-user

Please let me know if I’m missing anything. Thank you.

It actually works with the above setting now. Will be closing this topic.

1 Like