Skip to content

Commit

Permalink
Add and update Wokwi files (#164)
Browse files Browse the repository at this point in the history
* feat: Add Wokwi files for CMake

* feat: Update ESP32 board, add H2

* style: Address review feedback
  • Loading branch information
SergioGasquez authored Oct 27, 2023
1 parent ab2c28d commit 038a1a0
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 13 deletions.
12 changes: 11 additions & 1 deletion README-cmake.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down Expand Up @@ -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/).
Expand Down
11 changes: 1 addition & 10 deletions cargo/diagram.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"",
[]
Expand All @@ -39,4 +30,4 @@
"display": "terminal",
"convertEol": true
}
}
}
4 changes: 2 additions & 2 deletions cargo/pre-script.rhai
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
35 changes: 35 additions & 0 deletions cmake/diagram.json
Original file line number Diff line number Diff line change
@@ -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": {}
}
4 changes: 4 additions & 0 deletions cmake/wokwi.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[wokwi]
version = 1
firmware = 'build/flasher_args.json'
elf = 'build/{{project-name}}.elf'

0 comments on commit 038a1a0

Please sign in to comment.