Skip to content

Commit 0352acf

Browse files
authored
refactor(examples): improve the esp32-std-demo (#157)
- chore(sdkdefaults): adjust settings and move to workspace root - Increase the stack size to 16kb - Enable tracing for stack overflows - Copy the file to workspace root (to respect it always) - chore(profiles): enable profiles on workspace This is needed for enabling the optimizations for the demos Plus I don't think it would hurt - chore(esp32-std-demo): bump ESP-IDF version to v5.4 - chore(esp32-std-demo): remove unnecessary features of esp-idf-svc dependency - chore(esp32-std-demo): fix the link to the repository - refactor(esp32-std-demo): drop the mousefood- prefix
1 parent 21018ed commit 0352acf

File tree

18 files changed

+61
-74
lines changed

18 files changed

+61
-74
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ jobs:
6767
setup_xtensa: false
6868
# ESP-IDF demo using Xtensa toolchain
6969
- name: esp32-std-demo
70-
dir: examples/mousefood-esp32-std-demo
70+
dir: examples/esp32-std-demo
7171
target: xtensa-esp32-espidf
7272
setup_xtensa: true
73-
# EPD Waveshare demo
73+
# EPD Waveshare demo
7474
- name: epd-waveshare-demo
7575
dir: examples/epd-waveshare-demo
7676
target: ""

Cargo.lock

Lines changed: 14 additions & 58 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@ keywords = ["embedded-graphics", "ratatui", "tui"]
1313
categories = ["embedded"]
1414
exclude = ["/.github", "/assets"]
1515

16+
[profile.dev]
17+
# Symbols are nice and they don't increase the size on Flash
18+
debug = true
19+
opt-level = 3
20+
21+
[profile.release]
22+
# LLVM can perform better optimizations using a single thread
23+
codegen-units = 1
24+
debug = 2
25+
debug-assertions = false
26+
incremental = false
27+
lto = 'fat'
28+
opt-level = 's'
29+
overflow-checks = false
30+
1631
[workspace.dependencies]
1732
ratatui-core = { version = "0.1.0", features = ["underline-color"] }
1833
thiserror = { version = "2.0.18", default-features = false }

examples/mousefood-esp32-std-demo/.cargo/config.toml renamed to examples/esp32-std-demo/.cargo/config.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[build]
22
target = "xtensa-esp32-espidf"
3+
target-dir = "target"
34

45
[target.xtensa-esp32-espidf]
56
linker = "ldproxy"
@@ -12,4 +13,4 @@ build-std = ["std", "panic_abort"]
1213
[env]
1314
MCU = "esp32"
1415
# Note: this variable is not used by the pio builder (`cargo build --features pio`)
15-
ESP_IDF_VERSION = "v5.2.3"
16+
ESP_IDF_VERSION = "v5.4"
File renamed without changes.

examples/mousefood-esp32-std-demo/Cargo.toml renamed to examples/esp32-std-demo/Cargo.toml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,30 @@
11
[package]
2-
name = "mousefood-esp32-std-demo"
2+
name = "esp32-std-demo"
33
version = "0.1.0"
4-
authors = ["Jagoda Estera Ślązak <jslazak@jslazak.com>"]
54
edition = "2024"
6-
rust-version = "1.85.0"
75
publish = false
86

97
[[bin]]
10-
name = "mousefood-esp32-std-demo"
11-
harness = false # do not use the built in cargo test harness -> resolve rust-analyzer errors
8+
name = "esp32-std-demo"
9+
harness = false # do not use the built in cargo test harness -> resolve rust-analyzer errors
1210

1311
# Commented out due to workspace profiles being used
1412
# Feel free to uncomment and adjust if you have copied this outside of a workspace
13+
#
1514
# [profile.release]
1615
# opt-level = 3
1716
#
1817
# [profile.dev]
19-
# debug = true # Symbols are nice and they don't increase the size on Flash
18+
# Symbols are nice and they don't increase the size on Flash
19+
# debug = true
2020
# opt-level = 3
2121

2222
[features]
2323
default = []
2424
experimental = ["esp-idf-svc/experimental"]
2525

2626
[dependencies]
27-
esp-idf-svc = { version = "0.51", features = [
28-
"critical-section",
29-
"embassy-time-driver",
30-
"embassy-sync",
31-
] }
27+
esp-idf-svc = { version = "0.51", features = ["critical-section"] }
3228
time = "0.3.45"
3329
rand = "0.9.1"
3430
mipidsi = "0.9.0"
File renamed without changes.
File renamed without changes.

examples/mousefood-esp32-std-demo/sdkconfig.defaults renamed to examples/esp32-std-demo/sdkconfig.defaults

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Rust often needs a bit of an extra main task stack size compared to C (the default is 3K)
2-
CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192
2+
CONFIG_ESP_MAIN_TASK_STACK_SIZE=16384
3+
4+
# For better backtrace for stack overflows
5+
CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y
36

47
# Use this to set FreeRTOS kernel tick frequency to 1000 Hz (100 Hz by default).
58
# This allows to use 1 ms granularity for thread sleeps (10 ms by default).
File renamed without changes.

0 commit comments

Comments
 (0)