Skip to content

Commit

Permalink
translate debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Narukara committed Mar 25, 2024
1 parent c6f1386 commit 8bf1352
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
这里是 https://github.com/esp-rs/book 的简体中文翻译。[直接在网页中阅读](https://narukara.github.io/rust-on-esp-book-zh-cn/)

目前进度:已经翻译完成(部分更新的内容需要重新翻译),跟踪到 b411988
目前进度:已经翻译完成(部分更新的内容需要重新翻译),跟踪到 a485f31

---

Expand Down
14 changes: 7 additions & 7 deletions src/tooling/debugging/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
| **ESP32-S2** |||
| **ESP32-S3** |||

## `USB-JTAG-SERIAL` Peripheral
## `USB-JTAG-SERIAL` 外设

Some of our recent products contain the `USB-JTAG-SERIAL` peripheral that allows for debugging without any external hardware debugger. More info on configuring the interface can be found in the official documentation for the chips that support this peripheral:
我们最近的一些产品包含 `USB-JTAG-SERIAL` 外设,允许在不借助任何外部硬件调试器的情况下进行调试。对于支持此外设的芯片,可以在官方文档里找到关于配置接口的更多信息:
- [ESP32-C3][esp32c3-docs]
- The availability of built-in JTAG interface depends on the ESP32-C3 revision:
- Revisions older than 0.3 **don't** have a built-in JTAG interface.
- Revisions 0.3 (and newer) **do** have a built-in JTAG interface, and you don't have to connect an external device to be able to debug.
- 内置 JTAG 接口的可用性取决于 ESP32-C3 版本:
- 0.3 之前的版本**没有**内置 JTAG 接口。
- 0.3(及之后的版本)**具有**内置 JTAG 接口,无需连接外部设备即可进行调试。

To find your ESP32-C3 revision, run:
要查询 ESP32-C3 的版本,请运行以下命令:
```shell
cargo espflash board-info
# or
# 或者
espflash board-info
```
- [ESP32-C6][esp32c6-docs]
Expand Down
36 changes: 18 additions & 18 deletions src/tooling/debugging/probe-rs.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
- 类似于 [IDF 的 `app_trace` 组件][app-trace-idf]
- 烧录算法

Follow the [installation][prober-rs-installation] and [setup][prober-rs-setup] instructions at the [`probe-rs`][probe-rs] website.
请按照 [`probe-rs`][probe-rs] 网站上的[安装][prober-rs-installation][设置][prober-rs-setup]说明进行操作。

Espressif products containing the [`USB-JTAG-SERIAL` peripheral][usb-jtag-serial] can use `probe-rs` without any external hardware.
包含 [`USB-JTAG-SERIAL` 外设][usb-jtag-serial]的乐鑫产品无需任何外部硬件即可使用 `probe-rs`

[probe-rs]: https://probe.rs/
[openocd]: https://openocd.org/
Expand All @@ -24,27 +24,27 @@ Espressif products containing the [`USB-JTAG-SERIAL` peripheral][usb-jtag-serial
[prober-rs-setup]: https://probe.rs/docs/getting-started/probe-setup/
[usb-jtag-serial]: index.md#usb-jtag-serial-peripheral

## Flashing with `probe-rs`
## `probe-rs` 烧写

`probe-rs` can be used to flash applications to your target since it supports the [ESP-IDF image format][idf-image].
- Example command for flashing an ESP32-C3: `probe-rs run --chip esp32c3`
`probe-rs` 可以用于烧写程序,因为它支持 [ESP-IDF image format][idf-image]
- 烧写 ESP32-C3 的命令示例: `probe-rs run --chip esp32c3`

The flashing command can be set as a custom Cargo runner by adding the following to your project's `.cargo/config.toml` file:
添加以下内容到项目中的 `.cargo/config.toml` 文件,就可以把烧写命令用作自定义 Cargo runner:

```toml
[target.'cfg(any(target_arch = "riscv32", target_arch = "xtensa"))']
runner = "probe-rs run --chip esp32c3"
```

With this configuration, you can flash and monitor your application using `cargo run`.
通过此配置,就可以使用 `cargo run` 来烧写并监控你的应用程序。

[idf-image]: https://docs.espressif.com/projects/esptool/en/latest/esp32c3/advanced-topics/firmware-image-format.html

## VS Code Extension
## VS Code 扩展

There is a `probe-rs` extension in VS Code, see `probe-rs` [VS Code documentation][probe-rs-vscode] for details on how to install, configure and use it.
VS Code 有 `probe-rs` 扩展。关于如何安装、配置和使用,请参考 `probe-rs` [VS Code 文档][probe-rs-vscode]

### Example `launch.json`
### 示例 `launch.json`

```json
{
Expand Down Expand Up @@ -88,26 +88,26 @@ There is a `probe-rs` extension in VS Code, see `probe-rs` [VS Code documentatio
}
```

The `Launch` configuration will flash the device and start debugging process while `Attach` will start the debugging in the already running application of the device. See VS Code documentation on [differences between launch and attach][vscode-configs] for more details.
`Launch` 配置将烧写设备并开始调试,而 `Attach` 将在正在运行的应用程序上开始调试。有关更多详细信息,请参考 [launch attach 之间差异][vscode-configs]的 VS Code 文档。


[probe-rs-vscode]: https://probe.rs/docs/tools/debugger/
[vscode-configs]: https://code.visualstudio.com/docs/editor/debugging#_launch-versus-attach-configurations

## `cargo-flash` and `cargo-embed`
## `cargo-flash` `cargo-embed`

`probe-rs` comes along with these two tools:
- [`cargo-flash`][cargo-flash]: A flash tool that downloads your binary to the target and runs it.
- [`cargo-embed`][cargo-embed]: Superset of `cargo-flash` that also allows opening an RTT terminal or a GDB server. A [configuration file][cargo-embed-config] can used to define the behavior.
`probe-rs` 附带这两个工具:
- [`cargo-flash`][cargo-flash]:一个烧写工具,可将二进制文件烧写到目标设备,并运行。
- [`cargo-embed`][cargo-embed]`cargo-flash` 的超集,允许打开 RTT 终端或 GDB 服务器。可以用[配置文件][cargo-embed-config]来定义其行为。

[cargo-flash]: https://probe.rs/docs/tools/cargo-flash/
[cargo-embed]: https://probe.rs/docs/tools/cargo-embed/
[cargo-embed-config]: https://probe.rs/docs/tools/cargo-embed/#configuration

## GDB Integration
## GDB 集成

`probe-rs` includes a GDB stub to integrate into your usual workflow with common tools. The `probe-rs gdb` command runs a GDB server, by default in port, `1337`.
`probe-rs` 包含 GDB stub,可以使用常用工具集成到你的常用工作流程中。 `probe-rs gdb` 命令会启动 GDB server,默认在 `1337` 端口上运行。

GDB with all the Espressif products supported can be obtained in [`espressif/binutils-gdb`][binutils-repo]
[`espressif/binutils-gdb`][binutils-repo] 包含支持所有乐鑫设备的 GDB。

[binutils-repo]: https://github.com/espressif/binutils-gdb

0 comments on commit 8bf1352

Please sign in to comment.