diff --git a/README-cmake.md b/README-cmake.md index f2bb04f..048ec59 100644 --- a/README-cmake.md +++ b/README-cmake.md @@ -88,6 +88,16 @@ I (0) cpu_start: Starting scheduler on APP CPU. Hello, world! ``` +## Simulate + +Wokwi for VS Code allows to simulte our application: +0. `diagram.json` might need to be updated with the proper board. See, [available boards](https://docs.wokwi.com/diagram-format#parts). +1. Press `F1` +2. Run `Wokwi: Start Simulator` + +For more information and details on how to use the Wokwi extension, see [Getting Started](https://docs.wokwi.com/vscode/getting-started) and [Debugging your code](https://docs.wokwi.com/vscode/debugging +) Chapter of the Wokwi documentation. + ## Prerequisites ### Install Rust (with `rustup`) @@ -125,7 +135,7 @@ While you **can** target the RISC-V Espressif SOCs (`esp32-cXX` and `esp32-hXX`) ```sh rustup toolchain install nightly --component rust-src ``` - + ### Install Python3 You need a Python 3.7 or later installed on your machine. Install it from the package distro of your OS, or download and install it [from the official Python site](https://www.python.org/downloads/). diff --git a/cargo/diagram.json b/cargo/diagram.json index 6e0683c..8cc2512 100644 --- a/cargo/diagram.json +++ b/cargo/diagram.json @@ -15,21 +15,12 @@ ], "connections": [ [ - {% if mcu == "esp32" -%} - "esp:TX0", - {% else -%} - "esp:TX", - {% endif -%} "$serialMonitor:RX", "", [] ], [ - {% if mcu == "esp32" -%} - "esp:RX0", - {% else -%} "esp:RX", - {% endif -%} "$serialMonitor:TX", "", [] @@ -39,4 +30,4 @@ "display": "terminal", "convertEol": true } -} \ No newline at end of file +} diff --git a/cargo/pre-script.rhai b/cargo/pre-script.rhai index af1c05d..d2db0d5 100644 --- a/cargo/pre-script.rhai +++ b/cargo/pre-script.rhai @@ -3,7 +3,7 @@ let targets = #{ arch: "xtensa", rust_target: "xtensa-esp32-espidf", gcc_target: "xtensa-esp32-elf", - wokwi_board: "board-esp32-devkit-v1", + wokwi_board: "board-esp32-devkit-c-v4", }, esp32c2: #{ arch: "riscv", @@ -27,7 +27,7 @@ let targets = #{ arch: "riscv", rust_target: "riscv32imac-esp-espidf", gcc_target: "riscv32-esp-elf", - wokwi_board: "", + wokwi_board: "board-esp32-h2-devkitm-1", }, esp32s2: #{ arch: "xtensa", diff --git a/cmake/diagram.json b/cmake/diagram.json new file mode 100644 index 0000000..16f5271 --- /dev/null +++ b/cmake/diagram.json @@ -0,0 +1,35 @@ +{ + "version": 1, + "author": "{{authors}}", + "editor": "wokwi", + "parts": [ + { + "type": "board-esp32-devkit-c-v4", + "id": "esp", + "top": 0, + "left": 0, + "attrs": { + "flashSize": "16" + } + } + ], + "connections": [ + [ + "esp:TX", + "$serialMonitor:RX", + "", + [] + ], + [ + "esp:RX", + "$serialMonitor:TX", + "", + [] + ] + ], + "serialMonitor": { + "display": "terminal", + "convertEol": true + }, + "dependencies": {} +} diff --git a/cmake/wokwi.toml b/cmake/wokwi.toml new file mode 100644 index 0000000..db7d62b --- /dev/null +++ b/cmake/wokwi.toml @@ -0,0 +1,4 @@ +[wokwi] +version = 1 +firmware = 'build/flasher_args.json' +elf = 'build/{{project-name}}.elf'