ChanServ changed the topic of #rust-embedded to: Welcome to the Rust Embedded IRC channel! Bridged to #rust-embedded:matrix.org and logged at https://libera.irclog.whitequark.org/rust-embedded, code of conduct at https://www.rust-lang.org/conduct.html
firefrommoonligh has joined #rust-embedded
<firefrommoonligh> <chrysn[m]> "t-moe, before I do a full PR..." <- Yes please!
<firefrommoonligh> Have been wanting this for a while; apeing what std::print etc do to format things in different ways
feespay[m] has joined #rust-embedded
feespay[m] has left #rust-embedded [#rust-embedded]
sroemer has joined #rust-embedded
sroemer has quit [Changing host]
sroemer has joined #rust-embedded
ian_rees[m] has joined #rust-embedded
<ian_rees[m]> I'm working on an ESP32 firmware that needs to persist some state across deep sleep, just want to double check that this approach looks sound to y'all: [playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=2a3d789a7f6bf6c1c1cf3d11ea0bdc2e)
<ian_rees[m]> * looks sound and reasonable to y'all:
rainingmessages has quit [Quit: bye]
rainingmessages has joined #rust-embedded
jistr has quit [Read error: Connection reset by peer]
jistr has joined #rust-embedded
<ian_rees[m]> <ian_rees[m]> "I'm working on an ESP32 firmware..." <- I guess one problem is that if somehow the data gets corrupted (discussed in [Persistable docs](https://docs.espressif.com/projects/rust/esp-hal/1.0.0-beta.1/esp32c6/esp_hal/trait.Persistable.html)) then the enum might explode
<Ralph[m]> has anyone else noticed that `cargo binstall` in GitHub workflows sometimes gets 403 responses from the GH API when checking for releases to download and then has to fall back to compiling from source (... (full message at <https://catircservices.org/_irc/v1/media/download/ASBpa8LDXluzuk4jK0VxQMMQPjmaS65m3csf6wWJRK998qGLgtwYEUQoIBEJmlkeDAG_mqaeoTGKgWsXnrBjcn2_8AAAAAAAAGNhdGlyY3NlcnZpY2VzLm9yZy9YeVlaSklJTEZCWGJGbGNPSHpLQUV4ZkY>)
GuineaWheek[m] has joined #rust-embedded
<GuineaWheek[m]> i somehow managed to get cortex_m::peripheral::NVIC::mask(...); inlined into .data
<GuineaWheek[m]> this, of course, caused an instant HardFault before even reaching main
<GuineaWheek[m]> u would think that core::ptr::write_volatile would, yknow, not be inlineable like that
<GuineaWheek[m]> take it back, it's actually...the fpu access mode register
<GuineaWheek[m]> at 0xe00ed88
<GuineaWheek[m]> wait this isn't .uninit
<GuineaWheek[m]> wait it's supposed to do that why is it hardfaulting
extrafofo has quit [Ping timeout: 252 seconds]
AdamHorden has joined #rust-embedded
AdamHorden has quit [Remote host closed the connection]
AdamHorden has joined #rust-embedded
<Ralph[m]> i by chance came across this rant about async/await in rust (and it even mentions embedded in passing): https://users.rust-lang.org/t/state-of-async-await-unrestrained-cooperation-is-not-cooperative/131119
<Ralph[m]> might be an interesting read to some (or a waste of time - don't blame me 😅)
extrafofo has joined #rust-embedded
jason-kairos[m] has joined #rust-embedded
<jason-kairos[m]> silly question: a while back I wrote my own custom floating point type using generics with N bits of fraction (mantissa) M bits of exponent and an arbitrary base for use in a radio protocol.
<jason-kairos[m]> Are there any libraries that do this?
<Ralph[m]> <jason-kairos[m]> "silly question: a while back I..." <- i've never used it, but i've come across https://crates.io/crates/fixed on crates.io before
<Ralph[m]> and if you search for "mantissa" on crates.io you find some others, though with low download numbers (which might not mean anything)
therealprof[m] has quit [Quit: Idle timeout reached: 172800s]
sroemer has quit [Quit: WeeChat 4.5.2]
<JamesMunns[m]> Any chance anyone here has written a driver for an ILI9488 display?
<jason-kairos[m]> how do you prevent the compiler from reordering a function call between two breakpoint asm instructions?
<jason-kairos[m]> I guess I could make the function act upon some variable, and core::hint::black_box the variable?
<jason-kairos[m]> I finally found the answer, call the function inside black_box, even if it returns nothing
adamgreig[m] has quit [Quit: Idle timeout reached: 172800s]
<thejpster[m]> In general, compiler fences are what you use to stop the optimiser moving instructions relative to a fence.
<thejpster[m]> But also I thought inline asm acted as a fence. Maybe only if you pass the right options.
<jason-kairos[m]> What are the options? I've see the magic incantations for GCC and clang to pit a memory barrier on asm, but have not seen it for rustc
<jason-kairos[m]> * are the asm options? I've
<vollbrecht[m]> <JamesMunns[m]> "Any chance anyone here has..." <- isn't the mipidsi driver capable of using it? Maybe have a look they claim support for the 9486
<vollbrecht[m]> vollbrecht[m]: on the gh readme they also claim 9488 support
<JamesMunns[m]> vollbrecht[m]: Nice! Thanks
<jason-kairos[m]> JamesMunns[m]: I don't see any mention of the LLVM barrier intrinsic in there
<jason-kairos[m]> I guess that means there may be no option pertaining to barriers
<vollbrecht[m]> <JamesMunns[m]> "Nice! Thanks" <- if it works maybe its a good idea to add it to the driver to the section in https://github.com/embedded-graphics/embedded-graphics?tab=readme-ov-file#display-drivers since i think its hard to discover because you need to search for the display protocol, and i think many people (outside of the display world) are not aware of the standard
<vollbrecht[m]> s/to the//
AdamHorden has quit [Ping timeout: 248 seconds]
RyanStreur[m] has quit [Quit: Idle timeout reached: 172800s]
LeandroMarceddu[ has quit [Quit: Idle timeout reached: 172800s]
mali[m] has quit [Quit: Idle timeout reached: 172800s]
reto[m] has quit [Quit: Idle timeout reached: 172800s]
jannic[m] has quit [Quit: Idle timeout reached: 172800s]
bartmassey[m] has quit [Quit: Idle timeout reached: 172800s]
romancardenas[m] has quit [Quit: Idle timeout reached: 172800s]
towynlin[m] has quit [Quit: Idle timeout reached: 172800s]
<chrysn[m]> <firefrommoonligh> "Yes please!" <- It's already done and released :-)
jannic[m] has joined #rust-embedded
<jannic[m]> <jason-kairos[m]> "I guess that means there may..." <- What's the `asm` statement you are using? The one in `cortex_m::asm::bkpt`? That one has the `nomem` option set. Which is documented as "The assembly code does not read from or write to any memory accessible outside of the assembly code. This allows the compiler to cache the values of modified global variables in registers across execution of the assembly code since it knows that
<jannic[m]> they are not read from or written to by it. The compiler also assumes that the assembly code does not perform any kind of synchronization with other threads, e.g. via fences."
<jannic[m]> This is not literally saying that the `asm` block does not act as a barrier, but it's close. Perhaps removing the `nomem` option would help?
<jason-kairos[m]> <jannic[m]> "What's the `asm` statement you..." <- I always use core::arch::asm!
<jason-kairos[m]> three black_boxes containing code blocks or function calls (that discard the result) appears to be the canonical way to do what I wanted (preserve ordering)
<jason-kairos[m]> s/black_boxes/core::hint::black\_box()s/