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

Getting Started chapter #181

Open
wants to merge 2 commits into
base: esp-hal@1
Choose a base branch
from

Conversation

SergioGasquez
Copy link
Member

No description provided.

Comment on lines 36 to 39
The above command downloads the rust source code. `rust-src` contains things like the std-lib, core-lib and build-config files.
Downloading the `rust-src` is important because of two reasons :
- **Determinism** - You get the chance to inspect the internals of the core and std library. If you are building software that needs to be determinate, you may need to inspect the libraries that you are using.
- **Building custom targets** - The `rustc` uses the `rust-src` to create the components of a new custom-target. If you are targeting a triple-target that is not yet supported by rust, it becomes essential to download the `rust-src`.
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if this paragraph adds value, shall we just remove it?

This is automatically done when the project is generated via [`esp-generate`][esp-generate].

[esp-generate]: esp-generate.md


## VS Code Extension
Copy link
Member Author

Choose a reason for hiding this comment

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

Shall I remove the debugging stuff? As there is an advanced/debugging chapter

@SergioGasquez SergioGasquez changed the base branch from main to esp-hal@1 March 10, 2025 13:32
@SergioGasquez SergioGasquez linked an issue Mar 10, 2025 that may be closed by this pull request
@SergioGasquez SergioGasquez marked this pull request as ready for review March 10, 2025 13:46
Copy link
Member

@jessebraham jessebraham left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Just skimmed quickly though the toolchain section so far, but left a handful of nitpicky comments :)

Will continue reviewing the remaining sections soon.

[rustup-book-windows]: https://rust-lang.github.io/rustup/installation/windows.html
[rust-lang-org]: https://www.rust-lang.org/

### `RISC-V` Devices
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
### `RISC-V` Devices
### RISC-V Devices

Don't think we need to use code blocks when mentioning RISC-V, personally.

Copy link
Member Author

Choose a reason for hiding this comment

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

Then, we should update https://github.com/esp-rs/book/blob/main/rust-doc-style-guide.md#using-monospace. I dont have a hard opinion as long as we are consistent


### `RISC-V` Devices

To build Rust applications for the Espressif chips based on `RISC-V` architecture, do the following:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
To build Rust applications for the Espressif chips based on `RISC-V` architecture, do the following:
To build Rust applications for the Espressif chips based on RISC-V architecture, do the following:

See above.


The above command downloads the rust source code. `rust-src` contains things like the std-lib, core-lib and build-config files.
Downloading the `rust-src` is important because of two reasons :
- **Determinism** - You get the chance to inspect the internals of the core and std library. If you are building software that needs to be determinate, you may need to inspect the libraries that you are using.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- **Determinism** - You get the chance to inspect the internals of the core and std library. If you are building software that needs to be determinate, you may need to inspect the libraries that you are using.
- **Determinism** - You get the chance to inspect the internals of the core and std library. If you are building software that needs to be deterministic, you may need to inspect the libraries that you are using.

The above command downloads the rust source code. `rust-src` contains things like the std-lib, core-lib and build-config files.
Downloading the `rust-src` is important because of two reasons :
- **Determinism** - You get the chance to inspect the internals of the core and std library. If you are building software that needs to be determinate, you may need to inspect the libraries that you are using.
- **Building custom targets** - The `rustc` uses the `rust-src` to create the components of a new custom-target. If you are targeting a triple-target that is not yet supported by rust, it becomes essential to download the `rust-src`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- **Building custom targets** - The `rustc` uses the `rust-src` to create the components of a new custom-target. If you are targeting a triple-target that is not yet supported by rust, it becomes essential to download the `rust-src`.
- **Building custom targets** - The `rustc` uses the `rust-src` to create the components of a new custom-target. If you are targeting a triple-target that is not yet supported by Rust, it becomes essential to download the `rust-src`.

I think it can probably be removed, but no strong feelings. If kept, we should capitalize Rust.

rustup target add riscv32imac-unknown-none-elf # For ESP32-C6 and ESP32-H2
```

Those targets are currently [Tier 2][rust-lang-book--platform-support-tier2]. Note the different flavors of `riscv32` target in Rust covering different [`RISC-V` extensions][wiki-riscv-standard-extensions].
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Those targets are currently [Tier 2][rust-lang-book--platform-support-tier2]. Note the different flavors of `riscv32` target in Rust covering different [`RISC-V` extensions][wiki-riscv-standard-extensions].
Those targets are currently [Tier 2][rust-lang-book--platform-support-tier2]. Note the different flavors of `riscv32` target in Rust covering different [RISC-V extensions][wiki-riscv-standard-extensions].

To enable support for Espressif targets, `espup` installs:

- [Espressif Rust fork][esp-rs/rust] with support for Espressif targets
- `stable` toolchain with support for `RISC-V` targets
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- `stable` toolchain with support for `RISC-V` targets
- `stable` toolchain with support for RISC-V targets


- [Espressif Rust fork][esp-rs/rust] with support for Espressif targets
- `stable` toolchain with support for `RISC-V` targets
- `LLVM` [fork][llvm-github-fork] with support for `Xtensa` targets
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- `LLVM` [fork][llvm-github-fork] with support for `Xtensa` targets
- LLVM [fork][llvm-github-fork] with support for Xtensa targets

Don't need code blocks for LLVM either, IMO.

The forked compiler can coexist with the standard Rust compiler, allowing both to be installed on your system. The forked compiler is invoked when using any of the available [overriding methods][rustup-overrides].

> ⚠️ **Note**: We are actively working to upstream our forks. Below is the current status:
> 1. `LLVM` fork: We've made significant progress recently. For details, refer to the [tracking issue][llvm-github-fork-upstream issue].
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
> 1. `LLVM` fork: We've made significant progress recently. For details, refer to the [tracking issue][llvm-github-fork-upstream issue].
> 1. LLVM fork: We've made significant progress recently. For details, refer to the [tracking issue][llvm-github-fork-upstream issue].

#### Other Installation Methods for `Xtensa` Targets

- Using [`rust-build`][rust-build] installation scripts. This was the recommended way in the past, but now the installation scripts are feature frozen, and all new features will only be included in `espup`. See the repository README for instructions.
- Building the Rust compiler with `Xtensa` support from source. This process is computationally expensive and can take one or more hours to complete depending on your system. It isn't recommended unless there is a major reason to go for this approach. Here is the repository to build it from source: [`esp-rs/rust` repository][esp-rs-rust].
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- Building the Rust compiler with `Xtensa` support from source. This process is computationally expensive and can take one or more hours to complete depending on your system. It isn't recommended unless there is a major reason to go for this approach. Here is the repository to build it from source: [`esp-rs/rust` repository][esp-rs-rust].
- Building the Rust compiler with Xtensa support from source. This process is computationally expensive and can take one or more hours to complete depending on your system. It isn't recommended unless there is a major reason to go for this approach. Here is the repository to build it from source: [`esp-rs/rust` repository][esp-rs-rust].

@SergioGasquez SergioGasquez linked an issue Mar 11, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Getting started Flashing from with WSL is also possible
2 participants