# RustRover Setup for Infineon Traveo II Debugging This document provides instructions for setting up RustRover to replicate the VSCode debugging experience for Infineon Traveo II microcontrollers. ## Prerequisites 1. **RustRover IDE** installed 2. **GNU Arm Embedded Toolchain** installed at `C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin` 3. **OpenOCD** installed and available in PATH 4. **ST-Link debugger** connected to your target hardware ## Project Structure The converted configurations support two target architectures: - **Cortex-M7**: `thumbv7em-none-eabi` with `traveo-cyt4bf` feature - **Cortex-M0+**: `thumbv6m-none-eabi` with `traveo-cyt2b7` feature ## Run/Debug Configurations The following configurations have been created in `.idea/runConfigurations/`: ### Debug Configurations 1. **Debug Traveo (Cortex-M7)** - OpenOCD configuration: `interface/stlink.cfg;target/stm32f7x.cfg` - GDB port: 3333 - Builds with: `thumbv7em-none-eabi` target and `traveo-cyt4bf` feature 2. **Debug Traveo (Cortex-M0+)** - OpenOCD configuration: `interface/stlink.cfg;target/stm32f0x.cfg` - GDB port: 3333 - Builds with: `thumbv6m-none-eabi` target and `traveo-cyt2b7` feature 3. **Attach to OpenOCD** - For connecting to an already running OpenOCD instance - GDB port: 3333 ### Build Configurations 1. **Build Traveo (Cortex-M7)** - Command: `cargo build --target thumbv7em-none-eabi --features traveo-cyt4bf` 2. **Build Traveo (Cortex-M0+)** - Command: `cargo build --target thumbv6m-none-eabi --features traveo-cyt2b7` ## Setup Instructions ### 1. Open Project in RustRover 1. Launch RustRover 2. Open the project directory 3. Ensure Cargo.toml is detected as a Rust project ### 2. Configure Toolchains 1. Go to **File > Settings > Languages & Frameworks > Rust** 2. Ensure the correct toolchain is selected for embedded development 3. Add the GNU Arm Embedded Toolchain to your system PATH if not already present ### 3. Import Run Configurations The run configurations are already created in `.idea/runConfigurations/`. They should be automatically detected by RustRover. ### 4. Verify OpenOCD Installation 1. Open a terminal in RustRover 2. Run `openocd --version` to verify installation 3. Ensure ST-Link drivers are installed ### 5. Hardware Setup 1. Connect your ST-Link debugger to the target board 2. Ensure proper power supply and connections 3. Verify the target board is recognized by OpenOCD ## Usage ### Building 1. Select the appropriate build configuration from the run configurations dropdown 2. Click the run button or press Shift+F10 3. The project will build for the selected target architecture ### Debugging 1. Select the appropriate debug configuration (Cortex-M7 or Cortex-M0+) 2. Click the debug button or press Shift+F9 3. RustRover will: - Build the project with the appropriate features - Start OpenOCD with the correct configuration - Launch the debugger and connect to the target ### Attaching to Running OpenOCD 1. Start OpenOCD manually in a terminal: ```bash openocd -f interface/stlink.cfg -f target/stm32f7x.cfg -c "adapter speed 1000" -c "init" -c "reset init" -c "cortex_m reset_config sysresetreq" ``` 2. Select "Attach to OpenOCD" configuration in RustRover 3. Click debug to connect to the running OpenOCD instance ## Troubleshooting ### Common Issues 1. **OpenOCD not found** - Ensure OpenOCD is installed and in your system PATH - Restart RustRover after installing OpenOCD 2. **ST-Link not recognized** - Check ST-Link drivers installation - Verify USB connections - Try different USB port 3. **Target not found** - Check target board power and connections - Verify OpenOCD configuration matches your hardware - Check console output for error messages 4. **Build errors** - Ensure all required features are available in Cargo.toml - Check that the correct toolchain is being used - Verify target architecture matches your hardware ### Debug Console Open the Debug console in RustRover to see detailed output from OpenOCD and GDB. This can help diagnose connection and configuration issues. ## Advanced Configuration ### Customizing OpenOCD Arguments To modify OpenOCD behavior, edit the run configuration and adjust the `OPENOCD_SERVER_ARGS` field: - Current: `--command "adapter speed 1000" --command "init" --command "reset init" --command "cortex_m reset_config sysresetreq"` - Modify adapter speed, initialization commands, or reset configuration as needed ### Adding New Targets To add support for additional Traveo II devices: 1. Add the feature to Cargo.toml 2. Create a new build configuration with the appropriate target and features 3. Create a corresponding debug configuration with the matching OpenOCD config files 4. Update this documentation ## Comparison with VSCode | Feature | VSCode (cortex-debug) | RustRover | |---------|----------------------|-----------| | Extension/Plugin | cortex-debug extension | Built-in Embedded Development | | Configuration | launch.json + tasks.json | XML run configurations | | OpenOCD Integration | Through cortex-debug | Native OpenOCD support | | Build Integration | Tasks system | Cargo command configurations | | Debugging Features | GDB integration | Full GDB debugging support | The RustRover configurations provide equivalent functionality to the VSCode setup while leveraging RustRover's native embedded development capabilities.