update: improve documentation and restructure code for modular hardware integration, add CAN communication to HAL, and update KiCad layouts

This commit is contained in:
2026-01-23 22:02:14 +01:00
parent 1de40085fb
commit 0c0b62e2ed
18 changed files with 486 additions and 219 deletions

View File

@@ -5,37 +5,57 @@ draft: false
description: "How to compile the project"
tags: ["clone", "compile"]
---
# Preconditons:
* NPM is installed
* rustup is installed
* espup is installed
# Preconditions:
* **Rust:** `rustup` installed.
* **ESP32 Toolchain:** `espup` installed.
* **Build Utilities:** `ldproxy` and `espflash` installed.
* **Node.js:** `npm` installed (for the web interface).
# Cloning the Repository
Clone the repository including submodules:
```bash
git clone --recursive https://git.mannheim.ccc.de/C3MA/PlantCtrl.git
cd PlantCtrl/Software/MainBoard/rust
```
# Cloning Git
Clone the git via the tool of your choice to your local computer
```
git clone https://git.mannheim.ccc.de/C3MA/PlantCtrl.git
```
switch to the newly cloned folder
```
cd PlantCtrl/rust
```
# Install rust
rustup description
install ldproxy
```
cargo install ldproxy
```
# Esp Toolchain
espup description
# Webpack install
The buildin config website is currently build inline via npm - typescript - webpack and then directly embedded into the binary, so it is required to have webpack build working.
```
# Toolchain Setup
1. **Install Rust:** If not already done, visit [rustup.rs](https://rustup.rs/).
2. **Install ldproxy:**
```bash
cargo install ldproxy
```
3. **Install espup:**
```bash
cargo install espup
```
4. **Install ESP toolchain:**
```bash
espup install
```
5. **Install espflash:**
```bash
cargo install espflash
```
# Building the Web Interface
The configuration website is built using TypeScript and Webpack, then embedded into the Rust binary.
```bash
cd src_webpack/
npm install
```
Check the webpack build is working
```
npx webpack
cd ..
```
# Cargo Build
# Compiling the Firmware
Build the project using Cargo:
```bash
cargo build --release
```
The resulting binary will be located in `target/riscv32imac-unknown-none-elf/release/plant-ctrl2`.
# Using Build Scripts
To simplify the process, several bash scripts are provided in the `Software/MainBoard/rust` directory:
* **`image_build.sh`**: Automatically builds the web interface, compiles the Rust firmware in release mode, and creates a flashable `image.bin`.
* **`all.sh`**: Performs all steps from `image_build.sh` and additionally flashes the firmware to a connected device and starts the serial monitor.
* **`wokwi_build.sh`**: Builds a debug version of the firmware and creates a full 16MB flash image for use with the [Wokwi simulator](https://wokwi.com).