How build code

Platform support

Framework:

  • Arduino

This code is made to be used with:

  • All (with Standard Library c++11 support)

Attention

Code will not compile on boards without standard library c++11 support.

Assembling dependencies

The SYSROX code uses repo to synchronize all necessary repositories. The app_ins can not work without the necessary libraries and it is recommended to use repo or a zip file containing all dependencies.

Using repo

The repo system is a tool made by google to manage multiple git repositories. With a file (manifest) containing all the repositories links, it is possible to clone et keep synchronized all project dependencies with a single command.

Tip

The idea is to repo sync the code the first time, do modifications in one or multiple repositories. When the base code is updated, all repositories can be update to the latest version with repo sync. Custom modification can then be rebased on top of the new code!

Install repo

sudo apt-get install repo

If your distribution does not have a repo package, you can do:

mkdir -p ~/.bin
PATH="${HOME}/.bin:${PATH}"
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
chmod a+rx ~/.bin/repo

Create a folder of your choice to place the project and go to it.

Repo sync code with SSH key

repo init -u ssh://git@git.sysrox.com:2224/code/manifests/manifest_ins_minimal.git
repo sync

Repo sync code with HTTPS

repo init -u https://git.sysrox.com/code/manifests/manifest_ins_minimal.git
repo sync

Using platformio

The easiest way to use the code is to use platformio. It includes many tools to build, test and upload the code to the board. If you use vscode, you can install the extension and juste source the environment.

Sourcing the environment or using the cli is not mandatory as you can just repo sync the code and use platformio extension (on windows for example), but it simplifies the process as you just need to copy paste the following commands. If you can not do it, you can just use the platformio extension and install Expressif32 platform.

Platformio cli

pip install -U platformio

Platformio with vscode IDE

If vscode extension is installed, you can just source the env:

source ~/.platformio/penv/bin/activate

Build full code

The configuration file for the build is a conf.ini located in conf folder. We want to create a symbolic link or copy this file to the root of the project in order to be able to build:

ln -s src/appDM_ins_minimal/conf/conf.ini platformio.ini

Now we can build the code with:

pio run -e your_env

Example

pio run -e lolin_s3

and build+flash with:

pio run -e your_env --target upload

Example

pio run -e lolin_s3 --target upload

The your_env is the name of the environment you want to build for. You can find examples in platformio.ini file (ie the configuration file located in conf/conf.ini) Depending on the microcontroller you use, you can add any environment you want with modifying this file, following Platformio syntax.

Example

 1[env:lolin_s3]
 2platform = espressif32
 3monitor_filters = esp32_exception_decoder
 4board = lolin_s3
 5framework = arduino
 6upload_speed = 921600
 7build_unflags = -Os
 8board_build.f_cpu = 240000000L
 9board_build.f_flash = 80000000L
10board_build.partitions = default_16MB.csv
11board_build.filesystem = spiffs
12build_flags =
13    -O2
14    -DBOARD_HAS_PSRAM
15
16    -I lib/libDM_ctrl/src/
17    -I lib/libDM_no_dep_abstract_sensors/src/
18    -I lib/libDM_no_dep_icm42688/src/
19    -I lib/libMM_no_dep_lps_22hb/src/
20    -I lib/libDM_no_dep_mmc5983ma/src/
21    -I lib/libDM_SRX_INS_10_DOF/src/
22    -I lib/libDM_SRX_INS_10_DOF/src/model
23
24    -I src/appDM_ins_minimal
25
26    # Model static libs
27    -L lib/libDM_SRX_INS_10_DOF/src/static_libs
28    -l Srx10Dof_esp32s3.a
29lib_deps =
30    SPI
31
32[env:teensy41]
33platform = teensy@4.17
34board = teensy41
35framework = arduino
36board_build.f_cpu = 600000000L
37; extra_scripts = pre:src/correct_clone.py
38build_flags =
39    -D TEENSY_OPT_FASTER ; -D TEENSY_OPT_SMALLEST_CODE can be faster
40
41    -I lib/libDM_ctrl/src/
42    -I lib/libDM_no_dep_abstract_sensors/src/
43    -I lib/libDM_no_dep_icm42688/src/
44    -I lib/libMM_no_dep_lps_22hb/src/
45    -I lib/libDM_no_dep_mmc5983ma/src/
46    -I lib/libDM_SRX_INS_10_DOF/src/
47    -I lib/libDM_SRX_INS_10_DOF/src/model
48
49    -I src/appDM_ins_minimal
50
51    # Model static libs
52    -L lib/libDM_SRX_INS_10_DOF/src/static_libs
53    -l Srx10Dof_teensy41.a
54lib_deps =
55    SPI
56
57[env:teensy4]
58platform = teensy
59board = teensy40
60framework = arduino
61board_build.f_cpu = 600000000L
62; extra_scripts = pre:src/correct_clone.py
63build_flags =
64    -D TEENSY_OPT_FASTER ; -D TEENSY_OPT_SMALLEST_CODE can be faster
65    ; -g
66
67    -I lib/libDM_ctrl/src/
68    -I lib/libDM_no_dep_abstract_sensors/src/
69    -I lib/libDM_no_dep_icm42688/src/
70    -I lib/libMM_no_dep_lps_22hb/src/
71    -I lib/libDM_no_dep_mmc5983ma/src/
72    -I lib/libDM_SRX_INS_10_DOF/src/
73    -I lib/libDM_SRX_INS_10_DOF/src/model
74
75    -I src/appDM_ins_minimal
76
77    # Model static libs
78    -L lib/libDM_SRX_INS_10_DOF/src/static_libs
79    -l Srx10Dof_teensy40.a
80lib_deps =
81    SPI