--- title: "compiling" date: 2025-02-20 draft: false description: "How to compile the project" tags: ["clone", "compile"] --- # Preconditions: * **Rust:** `rustup` installed with the Rust toolchain. * **ESP32 Toolchain:** `espup` installed for ESP32 support. * **Build Utilities:** `ldproxy` and `espflash` installed via cargo. * **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 ``` # Toolchain Setup The project uses Rust with ESP32-C6 support. The toolchain setup involves installing the necessary components: 1. **Rust Toolchain:** ```bash rustup toolchain install stable rustup default stable ``` # 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 npx webpack cd .. ``` # Compiling the Firmware 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).