💡
|
If you want to create your own project with the enV5 please use the base-project |
This repository aims to provide the Elastic-AI implementation for the Elastic Node version 5 (enV5). Mor about this project can be found at the project homepage.
For compiling the project, the required tools are:
-
gcc (local C compiler)
-
arm-non-eabi-gcc (C compiler for RP2040)
-
CMake (Build Script Generator)
-
Ninja (Build Tool)
We recommended pre-commit to check that the commit messages align with the conventional commit message standard.
💡
|
You can check if your local machine satisfies the required dependencies by executing test_setup.sh script in the project documentation
directory.
|
First, you need to generate the build scripts with cmake and then execute them
ℹ️
|
If you use the CLion IDE as recommended, the build script generation is done by the IDE itself. |
If you want to do this by yourself, please refer to CMake.
To run the FPGA related flash scripts, it is recommended to create a local virtual Python environment and install the tools from the requirements.txt file.
❗
|
You have to adjust the network/mqtt broker credentials as mentioned in network README! |
There are three CMake Profiles provided with the CLion settings: Debug, Release, and UnitTests.
Only the UnitTests profile allows you to compile source code for your local machine and therefore run the unit tests. The Debug and Release targets differ only in the amount of printed information when the software is executed on an enV5-device.
# Unit-test profile
cmake -B build/unit-tests -G Ninja -D CMAKE_BUILD_TYPE=DEBUG -D UNIT_TEST:BOOL=ON -D DEBUG_MODE:BOOL=ON -D
# Debug profile
cmake -B build/debug -G Ninja -D CMAKE_BUILD_TYPE=DEBUG -D UNIT_TEST:BOOL=OFF -D DEBUG_MODE:BOOL=ON -D REVISION=1
# Release profile
cmake -B build/release -G Ninja -D CMAKE_BUILD_TYPE=RELEASE -D UNIT_TEST:BOOL=OFF -D DEBUG_MODE:BOOL=OFF -D REVISION=1
The flag -G Ninja
tells CMake to use Ninja as the build tool.
If this flag is not passed, CMake will use the default build tool on your machine (mostly Makefiles).
The flag -D REVISION
tells CMake the hardwareConfiguration. We highly recommend using our matching configurations to our revisions. You can use your own configuration by adding the file with -D REVISION=your/own/configuration/EnV5HwConfiguration.h
.
Not passing the flag will cause a fatal error.
The local execution of the source code requires a different hal implementation, due to the fact that the hal implementation from the src
folder is directly connected to the pico-sdk which forces the compiler to build for the RP2040 arm-based platform instead of your local machine.
The hal dummies for the local machine can be found under test/unit/dummies.
The unit-tests can be build and executed by running:
# build the unit-tests
cmake --build build/unit-tests -j 4 --clean-first
# execute the unit-tests
ctest --test-dir build/unit-tests/test/unit --output-on-failure
The built unit-tests can then be found under build/unit-tests/test/unit as executables.
The debug targets can be built by executing:
cmake --build build/debug -j 4
The release targets can be built by executing:
cmake --build build/release -j 4
The *.uf2
files to flash the pico can than be found under the
out folder.
The hardware tests can be build using
cmake --build build/debug -j 4 --target <test_name>
replacing <test_name>
with the name of the test.
The resulting <test_name>.u2f
files to flash the pico can be found under the out folder.
-
Press and hold
MCU BOOT
on the Elastic Node -
Press
MCU RST
on the Elastic Node -
Release
MCU BOOT
-
Copy the
*.uf2
File to the RPI-RP2 device
If the pico is connected to the local machine the printf()
statements inside the code will be redirected to the USB and are available as serial port output.
This output can be read via a serial port reader like screen, minicom or
putty.
The following example shows how to use minicom on a Unix-based system:
minicom \
-b 115200 \ #(1)
-o \ #(2)
-D /dev/ttyACM0 #(3)
-
-b 115200
→ baud rate for connection -
-o
→ disable modem initialisation -
-D /dev/ttyACM0
→ serial port
❗
|
The serial port differs depending on the host machine!
It can be found via |
To enable enhanced Debug output, add the flag -D DEBUG_OUTPUT:BOOL=ON
to the CMake Setup call (or add it in the CLion CMake options).
This enables the PRINT_DEBUG(…)
macro from Common.h in all targets.
Following submodules are being used
ℹ️
|
These submodules will automatically downloaded by CMake on initialization! |
-
To generate a clean CMake Build without deleting and reinitializing the build directory run
cmake --build <build_dir> --target clean
. -
If the device doesn’t connect to the wifi or mqtt broker make sure that you set up the correct credentials! (NetworkConfig.c)