Skip to content
This repository was archived by the owner on Aug 27, 2024. It is now read-only.

Ota demo #1

Open
wants to merge 33 commits into
base: ota_demo
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1c7009c
Add link to the Matrix channel
ivmarkov Jun 14, 2022
2367e3f
Fix ttgo and kaluga features (#93)
pyaillet Jun 14, 2022
13d6d52
unalloc
ivmarkov Jun 19, 2022
2918d36
unalloc
ivmarkov Jun 19, 2022
626a442
Update esp idf config cfg
MabezDev Jul 19, 2022
236a82c
Fix recent napt cfg id (#107)
mqus Jul 20, 2022
3656007
Change version of `esp-idf-svc`, fixes #108
michidk Jul 27, 2022
b0dc9fe
Fix esp32s2 compilation
ivmarkov Aug 3, 2022
b688961
#101
ivmarkov Aug 4, 2022
354e0b3
Upgrade to latest nightly
ivmarkov Aug 5, 2022
18eecd4
Update ili9341 deps to his last latest version
Paul-Vandell Oct 8, 2022
8170d31
update deps by rev
paul-fanthou Oct 9, 2022
c586804
Fix CI
ivmarkov Nov 2, 2022
9257a4e
Fix CI
ivmarkov Nov 3, 2022
f886b68
Fix CI
ivmarkov Nov 3, 2022
2947d65
Update with latest deps
ivmarkov Nov 20, 2022
e6e9b3d
Fix the MAC periph issue
ivmarkov Nov 20, 2022
09f1a89
Fix out of date comment
ivmarkov Nov 21, 2022
26e821e
Update the section on serial monitors
ivmarkov Nov 21, 2022
ae254ee
Fixed type and added AP IP address
3d-t Nov 23, 2022
2469112
Fixed recommended monitor
3d-t Nov 23, 2022
fb84d6f
Fixed typo
3d-t Nov 23, 2022
d44762e
New eth SPI API; fix hall sensor compat
ivmarkov Nov 23, 2022
7338316
Fix CI
ivmarkov Dec 5, 2022
b1e5d35
Fix CI
ivmarkov Dec 5, 2022
22e64c0
Fix CI
ivmarkov Dec 5, 2022
9ff11de
CS testing code
ivmarkov Dec 7, 2022
4fb7914
Switch to the new crates
ivmarkov Dec 9, 2022
de8ada5
Middleware demo
ivmarkov Dec 12, 2022
3ca587c
Reuse middleware connection after handler was called
ivmarkov Dec 13, 2022
4cc62e3
clippy
ivmarkov Dec 13, 2022
cc20595
Demo of UART RX on interrupt
maximeborges Jun 7, 2022
9f04e5c
Updated to latest upstream esp-idf versions
Dec 14, 2022
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
4 changes: 2 additions & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ build-std = ["std", "panic_abort"]

# Comment out this when using the PlatformIO build (it only supports `v4.3.2`)
ESP_IDF_VERSION = { value = "release/v4.4" }
ESP_IDF = { value = ".embuild/espressif/esp-idf/release-v4.4" }

# These configurations will pick up your custom "sdkconfig.release", "sdkconfig.debug" or "sdkconfig.defaults[.*]" files
# that you might put in the root of the project
# The easiest way to generate a full "sdkconfig" configuration (as opposed to manually enabling only the necessary flags via "sdkconfig.defaults[.*]"
# is by running "cargo pio espidf menuconfig" (that is, if using the pio builder)
#ESP_IDF_SDKCONFIG = { value = "sdkconfig.release;sdkconfig.debug" }
ESP_IDF_SDKCONFIG_DEFAULTS = { value = "sdkconfig.defaults;sdkconfig.defaults.esp32;sdkconfig.defaults.esp32s2" }
ESP_IDF_SDKCONFIG_DEFAULTS = { value = "sdkconfig.defaults;sdkconfig.defaults.esp32;sdkconfig.defaults.esp32s2" }
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- cron: '50 6 * * *'

env:
rust_toolchain: nightly-2022-04-07
rust_toolchain: nightly

jobs:
compile:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
/.espressif
/.embuild
/target
/flasher/target
/messages/target
/Cargo.lock
**/*.rs.bk
85 changes: 20 additions & 65 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,87 +1,42 @@
[workspace]
members = [
"messages",
"flasher",
]

[package]
name = "rust-esp32-std-demo"
version = "0.25.0"
authors = ["ivmarkov"]
edition = "2018"
name = "rust-ota-demo"
authors = ["ivmarkov", "Maxime Borges","MartinBroers"]
version = "0.2.0"
edition = "2021"
categories = ["embedded", "hardware-support"]
keywords = ["embedded", "svc", "idf", "esp-idf", "esp32"]
description = "A demo binary crate for the ESP32 and ESP-IDF, which connects to WiFi, Ethernet, drives a small HTTP server and draws on a LED screen"
repository = "https://github.com/ivmarkov/rust-esp32-std-demo"
description = "A demo app that allows OTA update via UART"
license = "MIT OR Apache-2.0"
readme = "README.md"

[patch.crates-io]
smol = { git = "https://github.com/esp-rs-compat/smol" }
polling = { git = "https://github.com/esp-rs-compat/polling" }
socket2 = { git = "https://github.com/esp-rs-compat/socket2" }
getrandom = { version = "0.2", git = "https://github.com/esp-rs-compat/getrandom.git" }
#getrandom1 = { version = "0.1", git = "https://github.com/esp-rs-compat/getrandom.git", package = "getrandom", branch = "0.1" }

[profile.release]
opt-level = "s"

[profile.dev]
debug = true # Symbols are nice and they don't increase the size on Flash
opt-level = "z"

[features]
default = ["experimental"]

# Enable this feature for the build to use the PlatformIO tooling instead of the native ESP-IDF tooling under the hood
pio = ["esp-idf-sys/pio"]

# Enable this feature if you are building for QEMU
qemu = []

# Enable this feature in case you have a Kaluga board and would like to see a LED screen demo
kaluga = []

# Enable this feature in case you have a TTGO board and would like to see a LED screen demo
ttgo = []

# Enable this feature in case you have an ESP32S3-USB-OTG board and would like to see a LED screen demo
heltec = []

# Enable this feature in case you have a generic SSD1306 Display connected via SPI to pins 3, 4, 5, 16, 18, 23 (SPI3) of your board
ssd1306g_spi = []

# Enable this feature in case you have a generic SSD1306 screen connected to pins 14, 22 and 21 of your board
ssd1306g = []

esp32s3_usb_otg = []

# Enable this feature in case you have an RMII IP101 Ethernet adapter
ip101 = []

# Enable this feature in case you have an SPI W5500 Ethernet adapter
w5500 = []

# Enable this feature in case you have a Waveshare board and 4.2" e-paper
waveshare_epd = []

experimental = ["esp-idf-svc/experimental", "esp-idf-hal/experimental", "embedded-svc/experimental"]

[dependencies]
anyhow = {version = "1", features = ["backtrace"]}
log = "0.4"
url = "2"
esp-idf-sys = { version = "0.31", features = ["binstart"] }
esp-idf-svc = "0.41"
esp-idf-hal = "0.37"
embedded-svc = "0.21"
embedded-hal = "0.2"
embedded-graphics = "0.7"
display-interface = "0.4"
display-interface-spi = "0.4"
st7789 = "0.6"
ili9341 = { version = "0.5", git = "https://github.com/yuri91/ili9341-rs" }
ssd1306 = "0.7"
epd-waveshare = "0.5.0"
smol = "1.2"
embedded-svc = "0.23"
esp-idf-hal = {version = "0.40"}
esp-idf-svc = { version = "0.44", features = ["experimental"] }
esp-idf-sys = { version = "0.32", features = ["binstart"] }
messages = { path = "messages" }
smlang = "0.5.1"

[build-dependencies]
embuild = "0.29"
anyhow = "1"

# Future; might be possible once https://github.com/rust-lang/cargo/issues/9096 hits Cargo nightly:
#rust-esp32-ulp-blink = { git = "https://github.com/ivmarkov/rust-esp32-ulp-blink", artifact = "bin" }
[patch.crates-io]
# https://codesti.com/issue/ivmarkov/rust-esp32-std-demo/123
embedded-io = { git = "https://github.com/embassy-rs/embedded-io.git", tag = "v0.3.0"}
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ A demo STD binary crate for the ESP32[XX] and ESP-IDF, which connects to WiFi, E

![CI](https://github.com/ivmarkov/rust-esp32-std-demo/actions/workflows/ci.yml/badge.svg)

[Join in](https://matrix.to/#/#esp-rs:matrix.org) on the discussion!

Highlights:

- **Pure Rust and pure Cargo build!** No CMake, no PlatformIO, no C helpers
Expand Down Expand Up @@ -34,7 +36,7 @@ Highlights:
- Enter it: `cd rust-esp32-std-demo`
- Export two environment variables that would contain the SSID & password of your wireless network:
- `export RUST_ESP32_STD_DEMO_WIFI_SSID=<ssid>`
- `export RUST_ESP32_STD_DEMO_WIFI_PASS=<ssid>`
- `export RUST_ESP32_STD_DEMO_WIFI_PASS=<password>`
- To configure the demo for your particular board, please uncomment the relevant [Rust target for your board](https://github.com/ivmarkov/rust-esp32-std-demo/blob/main/.cargo/config.toml#L2) and comment the others. Alternatively, just append the `--target <target>` flag to all `cargo build` lines below.
- Build: `cargo build` or `cargo build --release`
- (Only if you happen to have a [TTGO T-Display board](http://www.lilygo.cn/prod_view.aspx?TypeId=50033&Id=1126&FId=t3:50033:3)): Add `ttgo` to the `--features` build flags above (as in `cargo build --features ttgo`) to be greeted with a `Hello Rust!` message on the board's LED screen
Expand Down Expand Up @@ -74,12 +76,18 @@ Highlights:
- (After each cargo build) Convert the elf image to binary: `esptool.py --chip [esp32|esp32s2|esp32c3] elf2image target/xtensa-esp32-espidf/debug/rust-esp32-std-demo`
- (After each cargo build) Flash the resulting binary: `esptool.py --chip [esp32|esp32s2|esp32c3] -p /dev/ttyUSB0 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 4MB 0x10000 target/xtensa-esp32-espidf/debug/rust-esp32-std-demo.bin`

## Preparing an OTA binary

cargo espflash --release --partition-table ./partitions.csv save-image ota.bin

## Flashing the OTA over UART

cargo run -p flasher --target x86_64-unknown-linux-gnu -- ota.bin --uart /dev/ttyUSB0 --baudrate 921600

## Monitor

- Once flashed, the board can be connected with any suitable serial monitor, e.g.:
- ESPMonitor: `espmonitor /dev/ttyUSB0` (you need to `cargo install espmonitor` first)
- Cargo PIO (this one **decodes stack traces**!): `cargo pio espidf monitor /dev/ttyUSB0` (you need to `cargo install cargo-pio` first)
- Please run it from within the `rust-esp32-std-demo` project directory, or else the built ELF file will not be detected, and the stack traces will not be decoded!
- (Recommended) `espflash`: `espflash serial-monitor`
- Built-in Linux/MacOS screen: `screen /dev/ttyUSB0 115200` (use `Ctrl+A` and then type `:quit` to stop it)
- Miniterm: `miniterm --raw /dev/ttyUSB0 115200`

Expand All @@ -91,6 +99,9 @@ Highlights:
- `http://<printed-ip-address>/bar`
- `http://<printed-ip-address>/ulp` (ESP32-S2 only)

- Alternatively you can connect directly to the ESP Accesspoint by connecting to the 'aptest' network using the default IP address:
- `http://192.168.71.1`

- The monitor should output more or less the following:
```
Hello, world from Rust!
Expand Down
Loading