Skip to content

Commit

Permalink
Fix build against esp32-p4
Browse files Browse the repository at this point in the history
- Bump esp-backtrace for esp32-p4 support, which removes the uart feature and delegates to esp-println
- Added esp-println dependency
- Add mapping for ESP32P4 and other risc-v esp-idf targets to the corresponding rust target triplet.
  Unfortunately there's no generic pattern like for xtensa, as can be seen on
  https://github.com/esp-rs/esp-idf-sys?tab=readme-ov-file#examples
  • Loading branch information
tronical committed Mar 11, 2024
1 parent e541053 commit 76ac137
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions api/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ if (SLINT_BUILD_RUNTIME)
if (SLINT_FEATURE_FREESTANDING)
if (ESP_PLATFORM)
list(APPEND features "esp-backtrace/${IDF_TARGET}")
list(APPEND features "esp-println/${IDF_TARGET}")
endif()
else (SLINT_FEATURE_FREESTANDING)
list(APPEND features std)
Expand Down
3 changes: 2 additions & 1 deletion api/cpp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ raw-window-handle = { version = "0.5", optional = true }
# Enable image-rs' default features to make all image formats to C++ users
image = { version = "0.24.0", optional = true }

esp-backtrace = { version = "0.9.0", features = ["panic-handler", "print-uart"], optional = true }
esp-backtrace = { version = "0.11.0", features = ["panic-handler", "println"], optional = true }
esp-println = { version = "0.9.0", default-features = false, features = ["uart"], optional = true }

[build-dependencies]
anyhow = "1.0"
Expand Down
12 changes: 10 additions & 2 deletions api/cpp/esp-idf/slint/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,17 @@ idf_component_register(

if (CONFIG_IDF_TARGET_ARCH_XTENSA)
set(Rust_CARGO_TARGET "xtensa-${IDF_TARGET}-none-elf")
else(CONFIG_IDF_TARGET_ARCH_XTENSA)
elseif(CONFIG_IDF_TARGET_ARCH_RISCV)
if (CONFIG_IDF_TARGET_ESP32C6 OR CONFIG_IDF_TARGET_ESP32C5 OR CONFIG_IDF_TARGET_ESP32H2)
set(Rust_CARGO_TARGET "riscv32imac-esp-espidf")
elseif (CONFIG_IDF_TARGET_ESP32P4)
set(Rust_CARGO_TARGET "riscv32imafc-esp-espidf")
else ()
set(Rust_CARGO_TARGET "riscv32imc-esp-espidf")
endif()
else()
message(FATAL_ERROR "Architecture currently not supported")
endif(CONFIG_IDF_TARGET_ARCH_XTENSA)
endif()

set(SLINT_FEATURE_FREESTANDING ON)
set(SLINT_FEATURE_RENDERER_SOFTWARE ON)
Expand Down

0 comments on commit 76ac137

Please sign in to comment.