Skip to content

Commit

Permalink
update tooling simulating troubleshooting
Browse files Browse the repository at this point in the history
  • Loading branch information
ing03201 committed Apr 7, 2024
1 parent 23f935d commit 3b8fb79
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 134 deletions.
30 changes: 15 additions & 15 deletions src/tooling/debugging/openocd.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@

# OpenOCD

Similar to [`probe-rs`][probe-rs], OpenOCD doesn't have support for the `Xtensa` architecture. However, Espressif does maintain a fork of OpenOCD under [`espressif/openocd-esp32`][espressif-openocd-esp32] which has support for Espressif's chips.
[`probe-rs`][probe-rs]와 마찬가지로, OpenOCD는 `Xtensa` 아키텍처를 지원하지 않습니다. 그러나, Espressif는 Espressif의 칩을 지원하는 [`espressif/openocd-esp32`][espressif-openocd-esp32] 리포지토리에서 OpenOCD의 fork 리포지토리를 유지합니다.

Instructions on how to install `openocd-esp32` for your platform can be found in [the Espressif documentation][espressif-documentation].
플랫폼에 `openocd-esp32`를 설치하는 방법에 대한 지침은 [Espressif 문서][espressif-documentation]에서 찾을 수 있습니다.

GDB with all the Espressif products supported can be obtained in [`espressif/binutils-gdb`][binutils-repo].
지원되는 모든 Espressif 제품이 있는 GDB는 [`espressif/binutils-gdb`][binutils-repo]에서 얻을 수 있습니다.

Once installed, it's as simple as running `openocd` with the correct arguments. For chips with the built-in [`USB-JTAG-SERIAL` peripheral][usb-jtag-serial], there is normally a config file that will work out of the box, for example on the ESP32-C3:
일단 설치되면, 올바른 인수로 `openocd`를 실행하는 것만큼 간단합니다. [`USB-JTAG-SERIAL` peripheral 장치][usb-jtag-serial]가 내장된 칩의 경우, 일반적으로 ESP32-C3에서 즉시 작동하는 구성 파일이 있습니다.

```shell
openocd -f board/esp32c3-builtin.cfg
```

For other configurations, it may require specifying the chip and the interface, for example, ESP32 with a J-Link:
다른 구성의 경우, 칩과 인터페이스를 지정해야 할 수 있습니다. 예를 들어, J-Link가 있는 ESP32:

```shell
openocd -f interface/jlink.cfg -f target/esp32.cfg
Expand All @@ -27,19 +27,19 @@ openocd -f interface/jlink.cfg -f target/esp32.cfg

## VS Code Extension

OpenOCD can be used in VS Code via the [`cortex-debug`][cortex-debug] extension to debug Espressif products.
OpenOCD는 Espressif 제품을 디버깅하기 위해 [`cortex-debug`][cortex-debug] 확장을 통해 VS 코드에서 사용할 수 있습니다.

[cortex-debug]: https://marketplace.visualstudio.com/items?itemName=marus25.cortex-debug

### Configuration

1. If required, connect the external JTAG adapter.
1. See Configure Other JTAG Interfaces section of ESP-IDF Programming Guide. Eg: [Section for ESP32][jtag-interfaces-esp32]
> ⚠️ **Note**: On Windows, `USB Serial Converter A 0403 6010 00` driver should be WinUSB.
2. Set up VSCode
1. Install [Cortex-Debug][cortex-debug] extension for VS Code.
2. Create the `.vscode/launch.json` file in the project tree you want to debug.
3. Update `executable`, `svdFile`, `serverpath` paths, and `toolchainPrefix` fields.
1. 필요한 경우, 외부 JTAG 어댑터를 연결하세요.
1. ESP-IDF 프로그래밍 가이드의 다른 JTAG 인터페이스 구성 섹션을 참조하십시오. 예: [Section for ESP32][jtag-interfaces-esp32]
> ⚠️ **Note**: Windows에서는, `USB Serial Converter A 0403 6010 00`드라이버가 WinUSB이어야 합니다.
2. VSCode 설정하기
1. [Cortex-Debug][cortex-debug] VS Code 확장 익스텐션 설치하기.
2. 디버그하려는 프로젝트 트리에 `.vscode/launch.json` 파일을 만드세요.
3. `executable`, `svdFile`, `serverpath` `toolchainPrefix` 필드를 업데이트하십시오.

```json
{
Expand Down Expand Up @@ -75,6 +75,6 @@ OpenOCD can be used in VS Code via the [`cortex-debug`][cortex-debug] extension

[jtag-interfaces-esp32]: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/jtag-debugging/configure-other-jtag.html

# Debugging with Multiple Cores
# 여러 코어들을 디버깅하기

Sometimes you may need to debug each core individually in GDB or with VSCode. In this case, change `set ESP_RTOS none` to `set ESP_RTOS hwthread`. This will make each core appear as a hardware thread in GDB. This is not currently documented in Espressif official documentation but in OpenOCD docs: https://openocd.org/doc/html/GDB-and-OpenOCD.html
때때로 GDB 또는 VSCode에서 각 코어를 개별적으로 디버깅해야 할 수도 있습니다. 이 경우, `set ESP_RTOS none` `set ESP_RTOS hwthread`으로 바꾸십시오. 이것은 각 코어를 GDB의 하드웨어 스레드로 보이게 할 것이다. 이것은 현재 Espressif 공식 문서에 문서화되어 있지 않지만 OpenOCD 문서에 문서화되어 있습니다: https://openocd.org/doc/html/GDB-and-OpenOCD.html
27 changes: 14 additions & 13 deletions src/tooling/espflash.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,60 @@
# `espflash`

`espflash` is a serial flasher utility, based on [esptool.py][esptool], for Espressif SoCs and modules.
`espflash`는 Espressif SoCs 와 modules을 위한 [esptool.py][esptool]를 기반으로 하는 시리얼 플래시 usb 유틸리티입니다.

The [`espflash`][espflash] repository contains two crates, `cargo-espflash` and `espflash`. For more information on these crates, see the respective sections below.
[`espflash`][espflash] 저장소에는 두 개의 crate들, `cargo-espflash` `espflash`가 포함되어 있습니다. 이 crate 대한 자세한 내용은 아래의 각 섹션을 참조하십시오.

[esptool]: https://github.com/espressif/esptool
[espflash]: https://github.com/esp-rs/espflash

> ⚠️ **Note**: The `espflash` and `cargo-espflash` commands shown below, assume that version `2.0` or greater is used.
> ⚠️ **Note**: 아래에 표시된 `espflash` `cargo-espflash` 명령은 버전 `2.0` 이상이 사용되었다고 가정합니다.
## `cargo-espflash`

Provides a subcommand for `cargo` that handles cross-compilation and flashing.
교차 컴파일과 플래싱을 처리하는 `cargo`에 대한 하위 명령을 제공합니다.

To install `cargo-espflash`, ensure that you have the [necessary dependencies][cargo-espflash-dependencies] installed, and then execute the following command:
`cargo-espflash`를 설치하려면, [필요한 종속성][cargo-espflash-dependencies]이 설치되어 있는지 확인한 다음, 다음 명령을 실행하십시오:

```shell
cargo install cargo-espflash
```

This command must be run within a Cargo project, ie. a directory containing a `Cargo.toml` file. For example, to build an example named 'blinky', flash the resulting binary to a device, and then subsequently start a serial monitor:
이 명령은 Cargo 프로젝트, 즉 `Cargo.toml` 파일이 포함된 디렉토리 내에서 실행되어야 합니다. 예를 들어, 'blinky'라는 예제를 만들려면, 결과 바이너리를 장치에 플래시한 다음, 시리얼 모니터를 시작하십시오:

```shell
cargo espflash flash --example=blinky --monitor
```

For more information, please see the [`cargo-espflash`][cargo-espflash] README.
자세한 내용은 [`cargo-espflash`][cargo-espflash] README를 참조하십시오.

[cargo-espflash]: https://github.com/esp-rs/espflash/blob/master/cargo-espflash/README.md
[cargo-espflash-dependencies]: https://github.com/esp-rs/espflash/blob/main/cargo-espflash/README.md#installation

## `espflash`

Provides a standalone command-line application that flashes an ELF file to a device.
ELF 파일을 장치에 플래시하는 독립형 명령줄 애플리케이션을 제공합니다.

To install `espflash`, ensure that you have the [necessary dependencies][espflash-dependencies] installed, and then execute the following command:
`espflash`를 설치하려면, [필요한 종속성][cargo-espflash-dependencies]이 설치되어 있는지 확인한 다음, 다음 명령을 실행하십시오:

```shell
cargo install espflash
```

Assuming you have built an ELF binary by other means already, `espflash` can be used to download it to your device and monitor the serial port. For example, if you have built the `getting-started/blinky` example from [ESP-IDF][esp-idf] using `idf.py`, you might run something like:
이미 다른 방법으로 ELF 바이너리를 구축했다고 가정하면, 특히 `espflash`를 사용하여 장치에 다운로드하고 시리얼 포트를 모니터링할 수 있습니다. 예를 들어, `idf.py`를 사용하여 [ESP-IDF][esp-idf]에서 `getting-started/blinky`예제를 구축했다면, 다음과 같은 것을 실행할 수 있습니다:

```shell
espflash flash build/blinky --monitor
```

For more information, please see the [`espflash` README][espflash-readme].
자세한 내용은 [`espflash` README][espflash-readme]를 참조하십시오.

`espflash`는 프로젝트의 `.cargo/config.toml` 파일에 다음을 추가하여 Cargo runner로 사용할 수 있습니다.

`espflash` can be used as a Cargo runner by adding the following to your project's `.cargo/config.toml` file:
```toml
[target.'cfg(any(target_arch = "riscv32", target_arch = "xtensa"))']
runner = "espflash flash --monitor"
```
With this configuration, you can flash and monitor your application using `cargo run`.
이 구성을 사용하면 `cargo run`을 사용하여 애플리케이션을 플래시하고 모니터링할 수 있습니다.

[esp-idf]: https://github.com/espressif/esp-idf
[espflash-readme]: https://github.com/esp-rs/espflash/blob/master/espflash/README.md
Expand Down
9 changes: 3 additions & 6 deletions src/tooling/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Tooling
# 개발도구

Now that we have our required dependencies installed, and we know how to generate a
template project, we will cover, in more detail, some tools. These tools will make
developing Rust applications for Espressif chips a lot easier.
이제 필요한 종속성을 설치했고, 템플릿 프로젝트를 생성하는 방법을 알고 있기 때문에, 몇 가지 도구를 더 자세히 다룰 것입니다. 이 도구들은 Espressif chips을 위한 Rust 애플리케이션을 훨씬 쉽게 개발할 것이다.

In this chapter, we will present `espflash`/`cargo-espflash`, suggest Visual Studio Code as IDE and, dig into the
currently available simulation and debugging methods.
이 장에서, 우리는 `espflash`/`cargo-espflash`를 제시하고, Visual Studio Code를 IDE로 제안하고, 현재 사용 가능한 시뮬레이션 및 디버깅 방법을 파헤칠 것입니다.
10 changes: 5 additions & 5 deletions src/tooling/simulating/index.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Simulating
# 시뮬레이팅

Simulating projects can be handy. It allows users to test projects using CI, try projects without having hardware available, and many other scenarios.
프로젝트를 시뮬레이션하는 것은 편리할 수 있다. 그것은 사용자가 CI를 사용하여 프로젝트를 테스트하고, 하드웨어를 사용할 수 없는 프로젝트와 다른 많은 시나리오를 시도할 수 있게 해준다.

At the moment, there are a few ways of simulating Rust projects on Espressif chips. Every way has some limitations, but it's quickly evolving and getting better every day.
현재, Espressif 칩에서 Rust 프로젝트를 시뮬레이션하는 몇 가지 방법이 있다. 모든 방법에는 몇 가지 한계가 있지만, 빠르게 진화하고 매일 나아지고 있다.

In this chapter, we will discuss currently available simulation tools.
이 장에서, 우리는 현재 사용 가능한 시뮬레이션 도구에 대해 논의할 것이다.

Refer to the table below to see which chip is supported in every simulating method:
모든 시뮬레이션 방법에서 어떤 칩이 지원되는지 보려면 아래 표를 참조하십시오:

| | **[Wokwi][wokwi]** | **QEMU** |
| :----------: | :----------------: | :------: |
Expand Down
17 changes: 8 additions & 9 deletions src/tooling/simulating/qemu.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
# QEMU

Espressif maintains a fork of QEMU in [espressif/QEMU][espressif-qemu] with the necessary patches to make it work on Espressif chips.
See the [QEMU wiki][qemu-wiki] for instructions on how to build QEMU and emulate projects with it.
Espressif는 Espressif 칩에서 작동하도록 필요한 패치와 함께 [espressif/QEMU][espressif-qemu]에서 QEMU 포크를 유지합니다. QEMU를 구축하고 프로젝트를 에뮬레이트하는 방법에 대한 지침은 [QEMU wiki][qemu-wiki]를 참조하십시오.

Once you have built QEMU, you should have the `qemu-system-xtensa` file.
QEMU를 구축하면, `qemu-system-xtensa` 파일이 있어야 합니다.

[espressif-qemu]: https://github.com/espressif/qemu
[qemu-wiki]: https://github.com/espressif/qemu/wiki

## Running Your Project Using QEMU
## 프로젝트를 QEMU에서 실행하기

> ⚠️ **Note**: Only ESP32 is currently supported, so make sure you are compiling for `xtensa-esp32-espidf` target.
> ⚠️ **Note**: 현재 ESP32만 지원되므로, `xtensa-esp32-espidf` 대상을 위해 컴파일하고 있는지 확인하세요.
For running our project in QEMU, we need a firmware/image with bootloader and partition table merged in it.
We can use [`cargo-espflash`][cargo-espflash] to generate it:
QEMU에서 프로젝트를 실행하려면 부트로더와 파티션 테이블이 병합된 펌웨어/이미지가 필요합니다. 우리는 그것을 생성하기 위해 [`cargo-espflash`][cargo-espflash]를 사용할 수 있습니다:

```shell
cargo espflash save-image --chip esp32 --merge <OUTFILE> --release
```

If you prefer to use [`espflash`][espflash], you can achieve the same result by building the project first and then generating image:
[`espflash`][espflash]를 사용하는 것을 선호한다면, 먼저 프로젝트를 구축한 다음 이미지를 생성하여 동일한 결과를 얻을 수 있습니다.

```shell
cargo build --release
espflash save-image --merge ESP32 target/xtensa-esp32-espidf/release/<NAME> <OUTFILE>
```

Now, run the image in QEMU:
이제, QEMU에서 이미지를 실행하세요:
```shell
/path/to/qemu-system-xtensa -nographic -machine esp32 -drive file=<OUTFILE>,if=mtd,format=raw
```
Expand Down
25 changes: 10 additions & 15 deletions src/tooling/simulating/wokwi.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
# Wokwi

[Wokwi][wokwi] is an online simulator that supports simulating Rust projects (both `std` and `no_std`) in Espressif Chips.
See [wokwi.com/rust][wokwi-rust] for a list of examples and a way to start new projects.
[Wokwi][wokwi]는 Espressif Chips에서 Rust 프로젝트(`std``no_std` 모두) 시뮬레이션을 지원하는 온라인 시뮬레이터입니다. 예시 목록과 새로운 프로젝트를 시작하는 방법은 [wokwi.com/rust][wokwi-rust]를 참조하십시오.

Wokwi offers Wi-Fi simulation, Virtual Logic Analyzer, and [GDB debugging][gdb-debugging] among many other features, see
[Wokwi documentation][wokwi-documentation] for more details. For ESP chips, there is a table of [simulation features][wokwi-simulation-features] that are currently supported.
Wokwi는 다른 많은 기능 중에서 Wi-Fi 시뮬레이션, 가상 로직 분석기 및 [GDB debugging][gdb-debugging]을 제공합니다. 자세한 내용은 [Wokwi 문서][wokwi-documentation]를 참조하십시오. ESP 칩의 경우, 현재 지원되는 [시뮬레이션 기능][wokwi-simulation-features] 표가 있습니다.

[wokwi]: https://wokwi.com/
[wokwi-rust]: https://wokwi.com/rust
[gdb-debugging]: https://docs.wokwi.com/gdb-debugging
[wokwi-documentation]: https://docs.wokwi.com/
[wokwi-simulation-features]: https://docs.wokwi.com/guides/esp32#simulation-features

## Using Wokwi for VS Code extension
Wokwi offers a VS Code extension that allows you to simulate a project directly in the code editor by only adding a few files.
For more information, see [Wokwi documentation][wokwi-vscode].
You can also debug your code using the VS Code debugger, see [Debugging your code][wokwi-debugging].
## Wokwi VS Code 확장프로그램 사용하기
Wokwi는 몇 개의 파일만 추가하여 코드 편집기에서 직접 프로젝트를 시뮬레이션할 수 있는 VS 코드 확장 프로그램을 제공합니다. 자세한 내용은 [Wokwi 문서][wokwi-vscode]를 참조하십시오. VS 코드 디버거를 사용하여 코드를 디버깅할 수도 있습니다. [코드 디버깅][wokwi-debugging]을 참조하십시오.

When using any of the [templates][templates] and not using the default values, there is a prompt (`Configure project to support Wokwi simulation with Wokwi VS Code extension?`) that generates the required files to use Wokwi VS Code extension.
[templates][templates]을 사용하고 기본값을 사용하지 않을 때, 프롬프트가 있습니다 (`Wokwi VS Code 확장으로 Wokwi 시뮬레이션을 지원하는 프로젝트 구성`) Wokwi VS Code 확장자를 사용하는 데 필요한 파일을 생성합니다.

![Wokwi VS Code example](../../assets/wokwi-vscode.png)

Expand All @@ -27,18 +23,17 @@ When using any of the [templates][templates] and not using the default values, t

## Using `wokwi-server`

[`wokwi-server`][wokwi-server] is a CLI tool for launching a Wokwi simulation of your project. I.e., it allows you
to build a project on your machine, or in a container, and simulate the resulting binary.
[`wokwi-server`][wokwi-server]는 프로젝트의 Wokwi 시뮬레이션을 시작하기 위한 CLI 도구입니다. 즉, 기계나 컨테이너에 프로젝트를 구축하고 결과 바이너리를 시뮬레이션할 수 있습니다.

[`wokwi-server`][wokwi-server] also allows simulating your resulting binary on other Wokwi projects, with more hardware parts other than the chip itself. See the corresponding [section of the `wokwi-server`][wokwi-server-custom] README for detailed instructions.
[`wokwi-server`][wokwi-server]는 또한 칩 자체 이외의 더 많은 하드웨어 부품으로 다른 Wokwi 프로젝트에서 결과 바이너리를 시뮬레이션할 수 있습니다. 자세한 지침은 `wokwi-server` README의 해당 [섹션][wokwi-server-custom]을 참조하십시오.

[wokwi-server]: https://github.com/MabezDev/wokwi-server
[wokwi-server-custom]: https://github.com/MabezDev/wokwi-server#simulating-your-binary-on-a-custom-wokwi-project

## Custom Chips
Wokwi allows generating custom chips that let you program the behavior of a component not supported in Wokwi. For more details, see the official [Wokwi documentation][wokwi-custom-chip].
## 커스텀 칩들
Wokwi는 Wokwi에서 지원되지 않는 구성 요소의 동작을 프로그래밍할 수 있는 사용자 지정 칩을 생성할 수 있습니다. 자세한 내용은 공식 [Wokwi 문서][wokwi-custom-chip]를 참조하십시오.

Custom chips can also be written in Rust! See [Wokwi Custom Chip API][rust-chip-api] for more information. For example, custom [inverter chip][custom-chip-example] in Rust.
커스텀 칩은 Rust로도 쓸 수 있습니다! 자세한 내용은 [Wokwi Custom Chip API][rust-chip-api]를 참조하십시오. 예를 들어, Rust의 커스텀 [inverter chip][custom-chip-example].

[wokwi-custom-chip]: https://docs.wokwi.com/chips-api/getting-started
[rust-chip-api]: https://github.com/wokwi/wokwi_chip_ll
Expand Down
Loading

0 comments on commit 3b8fb79

Please sign in to comment.