
Rust on Espressif chips Q1 2022
This is the next quarterly change of esp-rs effort, detailing the progress over Q1 2022.
Popular library
Construct map modifications
The final put up talked about we had been engaging towards the utilization of the constructed-in esp-idf accomplish map to assemble esp-idf (dubbed “native” accomplish) rather than PlatformIO. I’m satisfied to verbalize we have got completed this step, going forward the native method is the default, and platformIO is decide-in by process of the pio
operate of esp-idf-sys
.
Original default version
The default esp-idf version we target within the Rust world changed into once v4.3 (indicate that this is in a position to be configured on a per-project foundation), we have got now bumped this to now default to v4.4. Model 4.4 has some superb of existence fixes, to boot as some components.
- Atomic Emulation as much as 64 bits for
espidf
targets – esp-rs/rust#107. - A
realpath
implementation to salvage usable dismay messages forespidf
targets. - Toolchain change to crimson meat up growing on Windows – espressif/esp-idf#7864.
Compiler & Xtensa code skills
Rust has been an actual stress take a look at for the Xtensa LLVM backend. We own noticed just a few bugs over the final quarter which would be critical to squash as in the end esp-idf may maybe be compiled with clang rather than GCC (With any luck by that time, clang
may maybe be on hand as a rustup
element). We own furthermore fastened just a few components with our approved library port.
- LLVM compilation error when optimizing loops for the hardware loop assistance registers of the esp32 – esp-rs/rust#95.
- LLVM atomic swap code skills broken on Xtensa targets for atomics smaller than 32 bits – esp-rs/rust#106.
- Add implementations for
lstat
&ftruncate
in esp-idf – esp-rs/rust#100. - Fix the size of obvious c varieties for
espidf
targets such thatstat
works precisely – esp-rs/rust#92.
Goodbye esp-rs/esp32-hal, hello esp-rs/esp-hal
The novel esp-hal is coming alongside very well, it already has crimson meat up for GPIO, TIMG, UART, I2C, SPI, and RNG for esp32, esp32s2, esp32s3, and esp32c3. Please search for this tracking topic to appear at the chip crimson meat up station. This multi-chip HAL is now the utilization of the professional SVDs from Espressif rather than the hacked collectively SVD mature within the usual esp32 peripheral salvage entry to crate (PAC), search for the esp-rs/esp-pacs repository. We own added a transient birth template repository esp-rs/esp-template to birth with the novel bare metal HAL.
The usual HAL for the esp32 is now in repairs mode, and must mute soon be deprecated once all drivers are ported to the novel multi-chip HAL. There is mute a series of drivers to be ported to the novel HAL. Porting them would be an actual first topic for someone because the implementation would mostly quit the identical, gorgeous just a few API & form modifications. Please search for this topic whenever you wish to support out.
Preliminary WiFi crimson meat up
This is one thing I’m in my thought very mad by. We own had WiFi crimson meat up for the approved library (espidf
) targets for a long while now, but gorgeous these days we have managed to salvage WiFi going in pure Rust! Or no longer it’s doable to scan
for Rep admission to Parts (APs) and join to an AP, and exhaust smoltcp
to talk over the network! Test out the dhcp instance. The repository is at this time in a proof of belief recount and may maybe maybe furthermore be found here. It will maybe maybe well be moved into the esp-rs
org once we easy it up and add xtensa crimson meat up.
Tooling
espflash
For the reason that final put up we have got launched 1.3.0 and the 1.4.0 originate is attributable to be revealed very soon which boasts some good components and fixes.
- Better partition table crimson meat up. We now successfully take care of partitions rather then
factory
(OTA, and heaps others). - USB Serial JTAG crimson meat up. Or no longer it’s now doable to flash over the serial section of onboard the USB Serial JTAG peripheral.
- The flexibility to change firmware header by process of the account for line. Configure custom flash sizes, flash speeds, and flash modes.
- Exercise
espmonitor
because the--visual display unit
interiorespflash
.espmonitor
can decode addresses to offer features, providing a stack hint on abort over the serial port.
Github actions
Are making an strive to envision your Xtensa based entirely projects in CI? We these days launched xtensa-toolchain, a Github motion for putting in our forked Rust compiler with Xtensa crimson meat up. Instructions on the accurate choice to make exhaust of may maybe maybe furthermore be found here.
esp-rs devcontainer for Visible Studio Code
To focal level on Xtensa based entirely chips (esp32, esp32s2, esp32s3, and heaps others) we desire a custom rust compiler, with a custom LLVM backend for Xtensa. This provides some friction to getting started with Xtensa based entirely chips. We already provide scripts to download pre-constructed compiler toolchains, but we’re satisfied to verbalize esp-rs-devcontainer. This integrates into Visible Studio Code the utilization of the distant containers operate, permitting straightforward setup for developers already aware of containers. Please search for the setup portion for supported configurations and initialization steps.
The ESP Rust Board
We own developed an open offer pattern board with a focal level on being ready for Rust pattern! Or no longer it’s in step with the RISCV esp32c3, so a identical outdated Rust compiler will work. Even as the boards are no longer yet on sale, the provision files are on hand here whenever you wish to carry out one your self.
Ferrous working towards
We own collaborated with Ferrous Systems to provide a working towards workshop to support advise developers the accurate choice to salvage productive with Rust on Espressif chips! Please search for the e-newsletter originate for the stout minute print.
What’s next?
Proceed the quick progress on the bare metal multi-chip HAL, esp-hal
and add bare metal WiFi crimson meat up for Xtensa chips. The esp-idf series of crates are starting to stabilize nevertheless, there are mute quite loads of drivers and libraries no longer yet covered by advantageous Rust abstractions, so heaps mute to attain here!