-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a20ea75
Showing
8 changed files
with
916 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[target.'cfg(target_arch = "xtensa")'] | ||
rustflags = [ | ||
# Tell the `core` library that we have atomics, even though it's not | ||
# specified in the target definition | ||
"--cfg", 'target_has_atomic="8"', | ||
"--cfg", 'target_has_atomic="16"', | ||
"--cfg", 'target_has_atomic="32"', | ||
"--cfg", 'target_has_atomic="ptr"', | ||
|
||
"-C", "link-arg=-nostartfiles", | ||
# Enable the atomic codegen option for Xtensa | ||
"-C", "target-feature=+s32c1i", | ||
"-C", "link-arg=-Wl,-Tlinkall.x", | ||
] | ||
|
||
[target.riscv32imac-unknown-none-elf] | ||
rustflags = [ | ||
"-C", "link-arg=-Tlinkall.x", | ||
] | ||
|
||
# Uncomment the target if you'd like to use automatic code hinting in your IDE | ||
# target = "xtensa-esp32-none-elf" | ||
# target = "xtensa-esp32s2-none-elf" | ||
# target = "riscv32imac-unknown-none-elf" | ||
|
||
[unstable] | ||
build-std = ["alloc", "core"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/.vscode | ||
/.embuild | ||
/target | ||
/Cargo.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
[package] | ||
name = "esp-gallery" | ||
version = "0.1.0" | ||
authors = ["Kirill Mikhailov <[email protected]>"] | ||
edition = "2021" | ||
license = "MIT OR Apache-2.0" | ||
|
||
|
||
[target.xtensa-esp32-none-elf.dependencies] | ||
xtensa-atomic-emulation-trap = "0.2.0" | ||
esp32-hal = { package = "esp32-hal", git = "https://github.com/esp-rs/esp-hal.git" } | ||
xtensa-lx-rt = { version = "0.13.0", features = ["esp32"], optional = true } | ||
esp-println = { version = "0.3.0", features = ["esp32"] } | ||
esp-backtrace = { git = "https://github.com/esp-rs/esp-backtrace", version = "0.4.0", features = [ | ||
"esp32", | ||
"panic-handler", | ||
"print-uart", | ||
] } | ||
|
||
[target.xtensa-esp32s2-none-elf.dependencies] | ||
xtensa-atomic-emulation-trap = "0.2.0" | ||
esp32s2-hal = "0.4.0" | ||
esp-backtrace = { git = "https://github.com/esp-rs/esp-backtrace", features = [ | ||
"esp32s2", | ||
"panic-handler", | ||
"print-uart", | ||
] } | ||
xtensa-lx-rt = { version = "0.13.0", features = ["esp32s2"], optional = true } | ||
esp-println = { version = "0.2.1", features = [ "esp32s2" ] } | ||
|
||
[target.xtensa-esp32s3-none-elf.dependencies] | ||
xtensa-atomic-emulation-trap = "0.2.0" | ||
esp32s3-hal = "0.4.0" | ||
esp-backtrace = { git = "https://github.com/esp-rs/esp-backtrace", features = [ | ||
"esp32s3", | ||
"panic-handler", | ||
"print-uart", | ||
] } | ||
xtensa-lx-rt = { version = "0.12.0", features = ["esp32s3"], optional = true } | ||
esp-println = { version = "0.2.1", features = [ "esp32s3" ] } | ||
|
||
[target.riscv32imac-unknown-none-elf.dependencies] | ||
esp32c3-hal = { package = "esp32c3-hal", git = "https://github.com/esp-rs/esp-hal.git" } | ||
esp-backtrace = { git = "https://github.com/esp-rs/esp-backtrace", features = [ | ||
"esp32c3", | ||
"panic-handler", | ||
"print-uart", | ||
] } | ||
riscv-rt = { version = "0.8", optional = true } | ||
esp-println = { version = "0.2.1", features = [ "esp32c3" ] } | ||
|
||
|
||
[dependencies] | ||
mipidsi = { git = "https://github.com/almindor/mipidsi" } | ||
display-interface = "0.4" | ||
display-interface-spi = "0.4.1" | ||
embedded-graphics = "0.7.1" | ||
embedded-graphics-core = "0.3.3" | ||
embedded-hal = "0.2.7" | ||
profont = "0.6.1" # font with extended signs and options of sizing (unlike fonts in embedded-graphics) | ||
libm = "0.2.5" | ||
|
||
|
||
[features] | ||
default = [ "rt", "eh1" ] | ||
# rt = ["xtensa-lx-rt"] # for esp32 and esp32s2 chips | ||
rt = ["riscv-rt"] # for esp32c3 chip | ||
# eh1 = ["esp32s3"] | ||
# eh1 = ["esp32-hal/eh1", "esp32"] | ||
# eh1 = ["esp32s2-hal/eh1", "esp32s2"] | ||
eh1 = ["esp32c3-hal/eh1", "esp32c3"] | ||
|
||
esp32 = [] | ||
esp32s2 = [] | ||
esp32s3 = [] | ||
esp32c3 = [] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# esp-gallery :crab: | ||
Wokwi-example with usage of my colegue's, Samuel Benko's, beautiful graphic examples (check [here]https://github.com/sambenko/esp32s3-box-examples), but adapted for famous `ili9341` display) | ||
|
||
## Instructions | ||
|
||
``` | ||
cargo build --target riscv32imac-unknown-none-elf --release | ||
``` | ||
|
||
### Execution with VSCode Wokwi extension | ||
|
||
Except of extension itself, you will need two files to execute the simulatuion inside of your VSCode IDE: | ||
* wokwi.toml | ||
* diagram.json | ||
|
||
Both of them are already provided in this repo and you can edit them as needed. | ||
|
||
``` | ||
F1 -> Wokwi: Start simulation | ||
``` | ||
In case you will have additional questions - feel free to open an issue :wink: | ||
|
||
|
||
|
||
## Description | ||
There's a short example for newcomers that shows, how 8x8 LED Matrix display is initialised on different Espressif boards (ESP32, ESP32S2, ESP32C3) in bare-metal, this config is for ESP32 in terms of example, you can find brief instructions for other chips below<br> | ||
|
||
|
||
>### **P.S.** : Buttons on left are `up` and `down` correspondingly, button on top is `ok`. After image finished rendering press `ok` button to return back to main menu :wink: | ||
## Tips for other chips | ||
For `esp32` board target (and corresponding changes for paths in `wokwi.toml`) is: | ||
``` | ||
xtensa-esp32-none-elf | ||
``` | ||
|
||
Board type in `diagram.toml` is: | ||
``` | ||
"type": "wokwi-esp32-devkit-v1" | ||
``` | ||
--- | ||
For `esp32s2` board target (and corresponding changes for paths in `wokwi.toml`) is: | ||
``` | ||
xtensa-esp32s2-none-elf | ||
``` | ||
|
||
Board type in `diagram.toml` is: | ||
``` | ||
"type": "board-esp32-s2-devkitm-1"" | ||
``` | ||
--- | ||
For `esp32s3` board target (and corresponding changes for paths in `wokwi.toml`) is: | ||
``` | ||
xtensa-esp32s3-none-elf | ||
``` | ||
|
||
Board type in `diagram.toml` is: | ||
``` | ||
"type": "board-esp32-s3-devkitc-1" | ||
``` | ||
|
||
## Troubleshooting | ||
|
||
* For `xtensa` targets you need to have `esp-idf` exported in your terminal | ||
* In case of errors, related to `esp-hal` driver - try to play with dependencies versions on Cargo.toml. Sometimes there're a lot of breaking or light changes, that can affect building process | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"version": 1, | ||
"author": "Kirill Mikhailov <[email protected]>", | ||
"editor": "wokwi", | ||
"parts": [ | ||
{ | ||
"type": "board-esp32-c3-devkitm-1", | ||
"id": "esp", | ||
"top": -305.03, | ||
"left": -54.29, | ||
"attrs": { "builder": "rust-nostd-esp" } | ||
}, | ||
{ | ||
"type": "wokwi-ili9341", | ||
"id": "lcd1", | ||
"top": -348.99, | ||
"left": -375.2, | ||
"rotate": 270, | ||
"attrs": { "flipVertical": "1" } | ||
}, | ||
{ | ||
"type": "wokwi-pushbutton", | ||
"id": "btn1", | ||
"top": -258.77, | ||
"left": -553.08, | ||
"attrs": { "color": "yellow", "bounce": "1" } | ||
}, | ||
{ | ||
"type": "wokwi-pushbutton", | ||
"id": "btn2", | ||
"top": -182.69, | ||
"left": -552.83, | ||
"rotate": 180, | ||
"attrs": { "color": "blue" } | ||
}, | ||
{ | ||
"type": "wokwi-pushbutton", | ||
"id": "btn3", | ||
"top": -389.75, | ||
"left": -331.23, | ||
"attrs": { "color": "green" } | ||
} | ||
], | ||
"connections": [ | ||
[ "esp:TX", "$serialMonitor:RX", "", [] ], | ||
[ "esp:RX", "$serialMonitor:TX", "", [] ], | ||
[ "esp:7", "lcd1:MOSI", "white", [ "h25.67", "v-128.97", "h-182.01", "v129.83" ] ], | ||
[ "esp:2", "lcd1:CS", "green", [ "h-48.18", "v59.43" ] ], | ||
[ "esp:10", "lcd1:RST", "yellow", [ "v0" ] ], | ||
[ "esp:3", "lcd1:D/C", "purple", [ "h-21.57", "v47.08" ] ], | ||
[ "esp:6", "lcd1:SCK", "blue", [ "h39.74", "v-150.63", "h-211.92", "v-1.93" ] ], | ||
[ "esp:4", "lcd1:LED", "magenta", [ "v-0.39", "h52.29", "v-184.89", "h-216.27", "v149.17" ] ], | ||
[ "esp:GND.1", "lcd1:GND", "black", [ "v-0.77", "h-35.66", "v130" ] ], | ||
[ "esp:3V3.1", "lcd1:VCC", "limegreen", [ "h-28.99", "v115.64" ] ], | ||
[ "btn1:1.r", "esp:GND.1", "red", [ "v-80.9", "h435.57" ] ], | ||
[ | ||
"btn1:2.r", | ||
"esp:0", | ||
"cyan", | ||
[ "h11.31", "v-83.23", "h170.71", "v-0.21", "h240.01", "v101.48" ] | ||
], | ||
[ "btn2:1.r", "btn1:1.l", "red", [ "h-88.94", "v-77.41" ] ], | ||
[ "esp:1", "btn2:2.r", "green", [ "h-20.26", "v111.79", "h-496", "v-82" ] ], | ||
[ "btn3:1.r", "esp:8", "yellow", [ "v-12.41", "h375.46", "v151.81" ] ], | ||
[ "btn2:1.l", "btn3:2.l", "red", [ "h29.72", "v-216.06" ] ] | ||
], | ||
"serialMonitor": { "display": "terminal" }, | ||
"dependencies": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[toolchain] | ||
channel = "nightly" |
Oops, something went wrong.