You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -84,6 +85,7 @@ The result will look something like this:
84
85
85
86

86
87
88
+
In addition to the debugging capability, it is recommended to enable the merge bin option to have one binary file. To enable that option, go to the `Board Selection` menu and set `Merge raw binary files into a single file`. The rest of this article assumes that this option is enabled.
87
89
88
90
After configuration and setup, we can use the following command to compile:
89
91
@@ -97,6 +99,7 @@ We should see the following output:
97
99
LD: nuttx
98
100
CP: nuttx.hex
99
101
CP: nuttx.bin
102
+
Generated: nuttx.merged.bin
100
103
```
101
104
102
105
After the compilation process is successfully completed, we need the `nuttx` file for the simulation.
@@ -115,7 +118,7 @@ For details about Wokwi configuration files, see [here](https://docs.wokwi.com/v
115
118
116
119
If we go back to the Simulation section after these definitions, we need to do two things:
117
120
118
-
- Add the `nuttx` file path to the `wokwi.toml` file
121
+
- Add the `nuttx`and `nuttx.merged.bin`file paths to the `wokwi.toml` file
119
122
- Add the circuit diagram in the `diagram.json` file to use in simulation
120
123
121
124
The file contents we need in this example project will be as follows:
@@ -124,7 +127,7 @@ The file contents we need in this example project will be as follows:
If the merge bin option is not enabled, the `firmware` variable in `wokwi.toml` file will be set to `nuttx.bin`, and the `firmwareOffset` variable in the `diagram.json` file will be `0x1000`.
157
+
{{< /alert >}}
158
+
148
159
After creating the necessary files, we can start the simulation by pressing `F1` and selecting the `Wokwi: Start Simulator` option:
149
160
150
161

@@ -173,12 +184,31 @@ As a result of the process, the `wokwi.toml` file will look like this for this e
173
184
```toml
174
185
[wokwi]
175
186
version = 1
176
-
firmware = 'nuttx'
187
+
firmware = 'nuttx.merged.bin'
177
188
elf = 'nuttx'
178
189
gdbServerPort=3333
179
190
```
180
191
181
-
Also you need to create a launch configuration file for Visual Studio Code. You can create the file at `.vscode/launch.json` path or you can use `Open user settings (JSON)` option with pressing `F1` key.
192
+
After that, press `F1` and select `Wokwi: Start Simulator and Wait for Debugger` to start the simulator. Wokwi will then go into standby mode to allow the debugger to connect. In a separate terminal tab you can run GDB with `xtensa-esp32-elf-gdb` or similar commands for Xtensa devices or `riscv-none-elf-gdb` for RISC-V devices. To establish a proper connection with Wokwi, the following commands need to be applied:
193
+
194
+
```text
195
+
target remote :3333
196
+
set remote hardware-watchpoint-limit 2
197
+
mon reset halt
198
+
symbol-file nuttx
199
+
flushregs
200
+
c
201
+
```
202
+
203
+
These commands can be entered manually after starting the debugger, or they can be provided as a script file. For example, if the commands are saved in a file named `gdbinit`, you can run GDB with this command:
204
+
205
+
```bash
206
+
xtensa-esp32-elf-gdb -x gdbinit
207
+
```
208
+
209
+
After running the debugger, you can start to debug with Wokwi using the `F5` key in simulator.
210
+
211
+
This is one way to debug using the terminal, but there is also an alternative method that doesn’t require the terminal and everything can be done directly inside Visual Studio Code. If you want to avoid using the terminal-based debugger you need to create a launch configuration file for Visual Studio Code. You can create the file at `.vscode/launch.json` path or you can use `Open user settings (JSON)` option with pressing `F1` key.
182
212
183
213

184
214
@@ -202,8 +232,6 @@ Here's a template you can use:
202
232
}
203
233
```
204
234
205
-
After that, press `F1` and select `Wokwi: Start Simulator and Wait for Debugger` to start the simulator. Wokwi will then go into standby mode to allow the debugger to connect. In a separate terminal tab you can run GDB with `xtensa-esp32-elf-gdb` or similar commands for Xtensa devices or `riscv-none-elf-gdb` for RISC-V devices. After running the debugger, you can start to debug with Wokwi using the `F5` key in simulator.
206
-
207
235
For more detailed information about the debugging, you can visit [this link](https://docs.wokwi.com/guides/debugger).
208
236
209
237
Of course, our hope is that you will not need this process :)
0 commit comments