!LdaNPfUfvefOLewEIM:matrix.org

esp-rs

1375 Members
Using Rust on the ESP series microcontrollers. https://github.com/esp-rs | https://matrix.to/#/#esp-rs-community-meetins:matrix.org | https://esp-rs.github.io/book/134 Servers

Load older messages


SenderMessageTime
31 May 2023
@ivmarkov:matrix.orgivmarkovBut it can also fail, right? Which we don't want18:55:44
@bugadani:matrix.orgdanielbonly if the channel is full, and we know the capacity it needs18:56:22
@ivmarkov:matrix.orgivmarkovIf it is of size N, it will always succeed, you are right. I think we need to prototype something18:56:31
@nereuxofficial:matrix.orgnereuxofficialOn an esp32c3 there is only one clock control, meaning i probably cannot share the peripheral_cc between say a sensor using an ADC and another one using i2c(because both would take &mut peripheral_cc) without unsafe crimes?(Although it should be fine since there is never a case where there is concurrent access to it). Another Approach would probably involve an Arc<Mutex but i don't think esp-hal allows that20:11:58
@nereuxofficial:matrix.orgnereuxofficial * On an esp32c3 there is only one clock control, meaning i probably cannot share the peripheral_cc between say a sensor using an ADC and another one using i2c(because both would take &mut peripheral_cc) without unsafe crimes?(Although it should be fine since there is never a case where there is concurrent access to it) Another Approach would probably involve an Arc<Mutex but i don't think esp-hal allows that 20:12:25
@nereuxofficial:matrix.orgnereuxofficial * On an esp32c3 there is only one clock control, meaning i probably cannot share the peripheral_cc between say a sensor using an ADC and another one using i2c(because both would take &mut peripheral_cc) without unsafe crimes?(Although it should be fine since there is never a case where there is concurrent access to it) Another Approach would probably involve an Rc but i don't think esp-hal allows that as of now 20:16:05
@nereuxofficial:matrix.orgnereuxofficial * On an esp32c3 there is only one clock control, meaning i probably cannot share the peripheral_cc between say a sensor using an ADC and another one using i2c(because both would take &mut peripheral_cc) without unsafe crimes?(Although it should be fine since there is never a case where there is concurrent access to it) Another Approach would probably involve an Rc but i don't think esp-hal allows that as of now Edit: After reading the code i have more questions. Not because it's bad but probably because i understand none of the underlying hardware 20:24:57
@nereuxofficial:matrix.orgnereuxofficial * On an esp32c3 there is only one clock control, meaning i probably cannot share the peripheral_cc between say a sensor using an ADC and another one using i2c(because both would take &mut peripheral_cc) without unsafe crimes?(Although it should be fine since there is never a case where there is concurrent access to it) Another Approach would probably involve an Rc but i don't think esp-hal allows that as of now Edit: After reading the code i have more questions. Not because it's bad but because i understand none of the underlying hardware 20:27:52
@bugadani:matrix.orgdanielb
In reply to @nereuxofficial:matrix.org
On an esp32c3 there is only one clock control, meaning i probably cannot share the peripheral_cc between say a sensor using an ADC and another one using i2c(because both would take &mut peripheral_cc) without unsafe crimes?(Although it should be fine since there is never a case where there is concurrent access to it) Another Approach would probably involve an Rc but i don't think esp-hal allows that as of now Edit: After reading the code i have more questions. Not because it's bad but because i understand none of the underlying hardware
If I understand correctly, the peripherals don't hold onto the clock control, they just need it to do their setup. Do I understand your question correctly?
20:43:29
@simlay:matrix.orgsimlay

How might I debug an allocator error with an esp32? I decided to try and add esp32 support to the hap crate - https://github.com/ewilken/hap-rs/pull/89. There's a good chance it won't work at all but I wanted to try and worst case I learn things. Anyway, when I simply call into some of the configuration objects in the hap crate (which I don't think use network, async or random) I get a stacktrace that doesn't have many results on github or google:

0x40082fca - panic_abort
    at /home/simlay/projects/rust-embedded/blinky/.embuild/espressif/esp-idf/release-v4.4/components/esp_system/panic.c:408
0x4008801d - esp_system_abort
    at /home/simlay/projects/rust-embedded/blinky/.embuild/espressif/esp-idf/release-v4.4/components/esp_system/esp_system.c:137
0x4008e4ca - abort
    at /home/simlay/projects/rust-embedded/blinky/.embuild/espressif/esp-idf/release-v4.4/components/newlib/abort.c:46
0x4011c056 - std::sys::unix::abort_internal
    at /home/simlay/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/sys/unix/mod.rs:350
0x401062c2 - std::process::abort
    at /home/simlay/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/process.rs:2184
0x4011efa1 - std::alloc::rust_oom
    at /home/simlay/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/alloc.rs:356
0x4011efb8 - __rg_oom
    at /home/simlay/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/alloc.rs:351
0x400d7ae2 - __rust_alloc_error_handler
    at ??:??
0x4012d29a - alloc::alloc::handle_alloc_error::rt_error
    at /home/simlay/.rustup/toolchains/esp/lib/rustlib/src/rust/library/alloc/src/alloc.rs:379
0x4012d28a - alloc::alloc::handle_alloc_error
    at /home/simlay/.rustup/toolchains/esp/lib/rustlib/src/rust/library/alloc/src/alloc.rs:383
0x400e5944 - alloc::alloc::exchange_malloc
    at /home/simlay/.rustup/toolchains/esp/lib/rustlib/src/rust/library/alloc/src/alloc.rs:??
0x400e5962 - hap::characteristic::generated::configured_name::ConfiguredNameCharacteristic::new
    at /home/simlay/projects/rust-embedded/hap-rs/src/characteristic/generated/configured_name.rs:41
0x400dba1e - hap::service::generated::accessory_information::AccessoryInformationService::new
    at /home/simlay/projects/rust-embedded/hap-rs/src/service/generated/accessory_information.rs:82
0x400d9ffa - hap::accessory::AccessoryInformation::to_service
    at /home/simlay/projects/rust-embedded/hap-rs/src/accessory/mod.rs:139
0x400d7c37 - hap::accessory::generated::air_purifier::AirPurifierAccessory::new
    at /home/simlay/projects/rust-embedded/hap-rs/src/accessory/generated/air_purifier.rs:27
0x400d6cdd - blinky::main
    at /home/simlay/projects/rust-embedded/blinky/src/main.rs:61
0x4019b25f - core::ops::function::FnOnce::call_once
    at /home/simlay/.rustup/toolchains/esp/lib/rustlib/src/rust/library/core/src/ops/function.rs:250
0x400d64a0 - std::rt::lang_start::{{closure}}
    at /home/simlay/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/rt.rs:166
0x40106f26 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
    at /home/simlay/.rustup/toolchains/esp/lib/rustlib/src/rust/library/core/src/ops/function.rs:287
0x400d6490 - std::rt::lang_start
    at /home/simlay/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/rt.rs:165
0x400d708b - main
    at ??:??
0x4010218f - app_main
    at /home/simlay/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-idf-sys-0.33.0/src/start.rs:46
0x4019fe4b - main_task
    at /home/simlay/projects/rust-embedded/blinky/.embuild/espressif/esp-idf/release-v4.4/components/freertos/port/port_common.c:141
20:46:24
@simlay:matrix.orgsimlayThere's also a reasonable chance that the cheap ESP32 I got off amazon doesn't have enough memory to do any of this... The listing lacked a lot of useful details. One comment said it has 320KB of memory which I could believe20:49:29
@bugadani:matrix.orgdanielb 0x4011efb8 - __rg_oom you are looking at an out of memory error 20:50:50
@bugadani:matrix.orgdanielbwhich esp32 do you have, exactly? does it have external PSRAM (that you can then enable for malloc?)20:51:22
@simlay:matrix.orgsimlay
In reply to @bugadani:matrix.org
which esp32 do you have, exactly? does it have external PSRAM (that you can then enable for malloc?)
https://www.amazon.com/dp/B08246MCL5 - ESP32S ESP32 ESP-WROOM-32 Development Board
20:52:34
@simlay:matrix.orgsimlayHmm, now that I look at the specific version, ESP32-D0WD-V3 - https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf, I think it does not have external PSRAM if I read the datasheet correctly.20:55:09
@nereuxofficial:matrix.orgnereuxofficialyup, that is correct. I realized this only upon looking further into the ClockControl20:57:13
@nereuxofficial:matrix.orgnereuxofficialthanks for your help!20:57:19
@bugadani:matrix.orgdanielbLooks like it, though the D0WD is just the MCU itself, not the module (other modules may use the same MCU but other flash/PSRAM configurations). So, you have about 520K RAM minus whatever esp-idf takes up, minus what you have allocated for tasks, etc.21:01:56
@bugadani:matrix.orgdanielbRedacted or Malformed Event21:02:31
@IvanSanchez:matrix.orgIvanSanchezAaaand there I go. https://github.com/esp-rs/esp-idf-svc/pull/26221:04:02
@simlay:matrix.orgsimlayGotcha. Thanks for the help! 21:06:49
@bugadani:matrix.orgdanielbI know it's not exactly helpful. It looks like hap wasn't built with embedded devices in mind, but I don't think it's impossible for a simpler example to work21:13:13
@bugadani:matrix.orgdanielb * I know it's not exactly what you wanted. It looks like hap wasn't built with embedded devices in mind, but I don't think it's impossible for a simpler example to work21:13:25
@bugadani:matrix.orgdanielbI'm not sure if tokio fits, but some smaller async runtime may (e.g. embassy). If the library isn't extremely deeply tied to tokio, you might look into replacing that but I don't know if it's a red herring or if it's way too much effort21:14:55
@vollbrecht:matrix.orgvollbrecht simlay: you can have a look at https://github.com/ivmarkov/ruwm project. it uses the edge-executor as an async-runtime and gives a pretty brought overview at what can be done. 23:12:16
@vollbrecht:matrix.orgvollbrechtits has wss / mqtt uses yew for a frontend app. and does some other interesting stuff23:13:51
@vollbrecht:matrix.orgvollbrechtedge-executor is a wrapper around async-task23:15:09
1 Jun 2023
@barafael:matrix.orgbarafael
In reply to @vollbrecht:matrix.org
its has wss / mqtt uses yew for a frontend app. and does some other interesting stuff
Interesting, I'm trying to do something similar right now - creating a wss client using yew. I actually would like to get away without edge-frame. I couldn't see anywhere the support for wss, only was, or is it covered implicitly somehow?
05:54:50
@ivmarkov:matrix.orgivmarkov
In reply to @barafael:matrix.org
Interesting, I'm trying to do something similar right now - creating a wss client using yew. I actually would like to get away without edge-frame. I couldn't see anywhere the support for wss, only was, or is it covered implicitly somehow?
You don't need edge-frame neither for wss, nor for web assembly (=was?) support. edge-frame gives you only a few custom yew components based on Bulma CSS styling that might be useful to you in an embedded context, that's all. Web assembly support you'll have anyway for your app, if you use async execution and split your app into a platform agnostic portion and a platform-specific one (relying on esp idf). For wss support, you can currently use the wss support in esp-idf-svc. That is, until the HTTP server in edge-net becomes a thing. But in general this stuff is difficult as there are a lot of moving parts, and then you also need to optimize for embedded.As for STD crates, these which are optimized w.r.t. memory and have reduced number of dependencies tend to work. But a lot don't as they assume you have megabytes or even gigs of ram, which is obviously not the case on embedded.
06:22:40
@ivmarkov:matrix.orgivmarkov* You don't need edge-frame neither for wss, nor for web assembly (=was?) support. edge-frame gives you only a few custom yew components based on Bulma CSS styling that might be useful to you in an embedded context, that's all. Web assembly support you'll have anyway for your app, if you use async execution and split your app into a platform agnostic portion and a platform-specific one (relying on esp idf). For wss support, you can currently use the wss support in esp-idf-svc. That is, until the HTTP server in `edge-net` becomes a thing. But in general this stuff is difficult as there are a lot of moving parts, and then you also need to optimize for embedded. As for STD crates, these which are optimized w.r.t. memory and have reduced number of dependencies tend to work. But a lot don't as they assume you have megabytes or even gigs of ram, which is obviously not the case on embedded.06:22:57

There are no newer messages yet.


Back to Room ListRoom Version: 5