This section helps you set up the environment and build an application using the command-line.
Prerequisites
To be able to build the applications from the command-line, you need to install the following tools first:
Note:
If you are using a Unix-based OS, Make might already be installed. Check this by runningmake -v
in your terminal.
Note:
On Windows OS, make sure thatmingw32-make.exe
can be used from command-line, i.e. that it gets recognized as a command.
Setup
- Clone the Generic Node Sensor Edition GitHub project as mentioned before and checkout the
develop
branch:
git checkout develop
- Set
TOOLCHAIN_PREFIX
with your compiler path in the/Software/cross.cmake
file.
macOS & Linux example
To set up environment on macOS or Linux, you first need to adjust the following line with your compiler path:
set(TOOLCHAIN_PREFIX "/Users/USER/opt/gcc-arm-none-eabi-9-2020-q2-update/")
Then, you need to add this line to the generic-node-se/Software/cross.cmake
file.
After that, navigate to the project folder and run the following commands:
$ cd generic-node-se/Software/
$ mkdir -p build/debug
$ cd build/debug
Now build the application with Make:
$ cmake ../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../../cross.cmake -DTARGET_APP=basic
$ make
or with Ninja:
$ cmake -G Ninja ../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../../cross.cmake -DTARGET_APP=basic
$ ninja -v
Windows example
To set up environment on Windows, you first need to adjust the following line with your compiler path:
set(TOOLCHAIN_PREFIX "C:/Program Files (x86)/GNU Tools ARM Embedded/9 2020-q2-update/")
Then, add this line to the generic-node-se/Software/cross.cmake
file.
Next, navigate to the Generic Node Sensor Edition project folder and run the following commands:
$ cd generic-node-se\Software\
$ mkdir build\debug
$ cd build\debug
$ cmake -G "MinGW Makefiles" ../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../../cross.cmake -DTARGET_APP=basic
$ mingw32-make.exe
Note:
You can configure the following fields in the cmake
command:
DTARGET_APP
to build a different application (try-DTARGET_APP=basic_lorawan
)DCMAKE_BUILD_TYPE
toRelease
(instead ofDebug
) to build a smaller application for release purposes
For examples above, find your newly built application in the generic-node-se/Software/build/debug/app/basic
folder.