|
PER Firmware
|
This guide sets up the complete PER software development environment.
It is possible to build the PER software on macOS, Linux, and Windows. However, if you are using Windows, you should either use WSL 2, a Linux virtual machine, or dual boot into Linux. (If you use a VM or dual boot, follow the Linux instructions.)
Git is required on every platform.
Check that it is installed:
If you don't have git, see: Section 3.
Open a terminal and move to the directory where you want to keep the PER code. (Recommended: your home directory.)
Then clone the repository:
Then initialize the submodules:
Check that it worked and submodules were also cloned:
You should see something like:
VS Code is the recommended editor for PER development.
Download and install VS Code:
After installing VS Code, open the repository:
You can also open it from the VS Code GUI: File -> Open Folder -> then navigate to where you cloned monorepo
When VS Code prompts you to install the recommended extensions, install all of them.
You can also open the Extensions panel:
Ctrl + Shift + XCmd + Shift + Xand select Install All under the recommended extensions.
Install the tools for your operating system.
The FIL build requires Make (make) and Clang (clang++). Both tools must be available on PATH. See PER FIL tests for details.
Install Homebrew if it is not already installed.
Check:
Run:
These provide Make (make), the host compiler, and other standard development tools used by the project.
Run:
Override default Xcode LLVM:
Install the ARM embedded compiler:
Check:
If you are using linux, you probably already know what you're doing. However, here is an overview of the setup for Debian/apt-based distributions (Ubuntu, Debian, Pop!_OS, etc.).
Check:
If your primary OS is Windows, it is highly advised to use:
for PER development.
Below are the instructions for WSL 2.
Follow Microsoft's WSL installation guide: https://learn.microsoft.com/en-us/windows/wsl/install
After installation, install the most recent Ubuntu distribution. (As of the time of writing, Ubuntu 26.04 is the latest version.)
Open a WSL terminal and check:
Inside WSL:
Then follow the Linux instructions in Section 3B inside of WSL.
Additionally for WSL, run:
Install the normal Windows version of VS Code.
Then install the WSL extension.
From the WSL terminal, enter the repository and run:
VS Code should open the repository using the WSL environment.
You can also open the repository inside of WSL + VS Code by Ctrl + Shift + P -> "WSL: Reopen Folder in WSL".
Building inside WSL does not require USB access.
However. You will need additional USB configuration to connect an ST-LINK debugger directly to WSL.
This can be configured like so:
PER's build and code-generation tooling uses Python.
The repository currently pins its Python dependencies in requirements.txt.
For best integration with the VS Code tasks/launch configurations, install the dependencies to your system Python:
Install Rust using rustup.
Run:
Then restart your terminal.
Use the stable Rust toolchain:
Check:
Linux needs additional packages for serial-device enumeration:
These were already installed in the Linux setup section.
On Ubuntu or Ubuntu inside WSL, install the SQLite CLI:
Install the Diesel CLI with bundled SQLite support:
Check:
The repository's main build entry point is:
This builds the firmware, builds and tests all DAQ workspace targets, runs the generator and firmware host-test workflow, then builds FIL and runs the PER integration tests.
If this completes successfully, your development environment is set up correctly.
You can also build individual parts of the repository.
From the repository root, build all workspace members and targets:
To build only DaqApp from the repository root:
Running binaries is supported only from their individual package directories. From the repository root, run DaqApp with:
From the repository root, run DaqCli with:
From the repository root, run DaqCloud with:
This also generates the host-test coverage report.
Once the repository is open in VS Code, use:
Ctrl + Shift + BCmd + Shift + BThis will run the default build task, which builds the entire repository.
You can also use:
Ctrl/Cmd + Shift + B -> "Tasks: Run Task"Then select the individual build task you want to run.
Once your software build works, you can connect an ST-LINK debugger and flash firmware.
In VS Code:
The repository contains VS Code launch configurations for the supported targets.