Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💬 add all in one option #184

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ For more check out the links in the additional [information section](#additional

```sh
cargo generate esp-rs/esp-idf-template cargo
cd <your-project-name>
```

The command will display a few prompts:
Expand All @@ -40,16 +41,24 @@ The command will display a few prompts:
- [GitHub Codespaces](https://docs.github.com/en/codespaces/developing-in-codespaces/creating-a-codespace)
Dev Containers also allow flashing from the container using [web flash](https://github.com/bjoernQ/esp-web-flash-server) and have the [VS Code Wokwi extension](https://marketplace.visualstudio.com/items?itemName=wokwi.wokwi-vscode) already installed.

## Build
## Run the Project
### Option a) All in one command
```sh
cargo run
```
This command picks up the `.cargo/config.toml` file and runs the `espflash` command with the correct arguments for your target.

### Option b) Step by step

#### Build

```sh
cd <your-project-name>
cargo build
```

- Replace `<your-project-name>` with the name of the generated project
This will build the elf file and place it in the `target/<mcu-target>/debug` directory.

## Flash
#### Flash

In the root of the generated project:

Expand All @@ -74,14 +83,13 @@ the desired port, if it detectes multiple boards.
- You can include the `--monitor` argument to the `espflash` command to open a serial monitor after flashing the device.
- For more details on [`espflash` usage see the README](https://github.com/esp-rs/espflash/tree/main/espflash#usage)

## Monitor
#### Monitor
```sh
espflash monitor /dev/ttyUSB0
espflash monitor
```

- Replace `dev/ttyUSB0` above with the USB port where you've connected the board. If you do not
specify any USB port, `cargo-espflash`/`espflash` will print a list of the recognized USB ports for you to select
the desired port.
If you do not specify any USB port, `cargo-espflash`/`espflash` will print a list of the recognized USB ports for you to select
the desired port. Otherwise you can optionally add it as an argument to the `espflash` command.

The monitor should output more or less the following:
```
Expand Down Expand Up @@ -122,6 +130,12 @@ I (272) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
Hello, world!
```
##### Backtrace
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we open the topic of backtrace decoding, shouldn't we mention that decoding for riscv chips is incorrect or maybe even wrong by using this approach? And point the reader to the EH frame setup?

Copy link
Collaborator Author

@Vollbrecht Vollbrecht Feb 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i could add a footnote, and add a little section on what to add to the bottom?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything would work as long as it is clear for the users that what is suggested in this paragraph won't work well on anything but xtensa...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or else we would be opening even more statements of "it does not work as per the documentation"

To decode a backtrace when using `espflash monitor` you can use the optional `--elf` argument to specify the path to the ELF file. This will allow `espflash` to decode the backtrace and display the file and line number of the panic. For example:

```sh
espflash monitor --elf target/xtensa-esp32-espidf/debug/<your-project-name>
```

## Additional information

Expand Down