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
<M9names[m]> <slabity[m]> "Is there something I'm missing?" <- please share your project. it's going to be very hard to anyone to diagnose an issue like this without being able to observe the problem firsthand
<slabity[m]> Yea, sure. It's pretty straight-forward: https://gist.github.com/Slabity/feba4721928b557d5b117beec684d284
<slabity[m]> The main.rs file just contains setup code to spawn the adc_task on CORE1 and then it just flashes the LED
<slabity[m]> The ADC code isn't really too fancy either. It's just doing some readings of an ADC over an I2C connection. The issue is that when I upload the code after plugging in my programmer/debugger it just reports this:... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/ghrJpCfoupzQOJEPcLuwtOdW>)
<slabity[m]> The code *does* successfully flash. If I power it off and on the new code runs without any issue. However, in order for the log statements to appear on the debugger I need to:... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/gCZTtRPRWLgTaOtjzZQrPaUh>)
<M9names[m]> you're not resetting the spinlock used by the rp2040 critical-section on startup, that's going to be one potential cause of lack of logs (because it will deadlock a lot of the time)
<slabity[m]> Hmm... I'm not seeing that in the multicore.rs example in the embassy_rp crate.
<M9names[m]> it's not in any of the examples, but it is still required
<M9names[m]> embassy_rp::pac::SIO.spinlock(31).write_value(1);
<M9names[m]> put it as the first line in main
<trinhtuan[m]> Does anyone successfully use sleep() in a bare metal esp32 (no-std) program? I have tried and searched google but no success. A sample working code is really appriciated also. By the way what are the differences behind the scenes between sleep() and delay()? Thank you.
<M9names[m]> #esp-rs:matrix.org is a good place for that question, everyone who knows how it's implemented will be there
<slabity[m]> Oh, I think I am missing a feature
<M9names[m]> yeah, you need "unstable-pac"
<slabity[m]> Okay, so that compiled and uploaded. Still same issue though. Program is not executing
<slabity[m]> And if I disable the CORE1 program and reupload...
<slabity[m]> Restart the power, then re-enable CORE and upload...
<slabity[m]> And now it executes
<M9names[m]> could you share your cargo.toml as well? i can't get the code you posted to compile, not sure if it's crate versions or because the code is broken
<slabity[m]> Sure, give me one moment and I should be able to upload the entire Git repo
<M9names[m]> i would recommend doing it this way in the future. having to RE someone else's project config is tedious
<slabity[m]> Yea, I just haven't actually committed anything because I was just messing around and didn't have a particular goal in mind. Just have a bunch of files to clean up first
<slabity[m]> Can ignore the flake.* and .direnv files if you don't use Nix or direnv
<slabity[m]> * Can ignore the flake.* and .direnv/.envrc files if you don't use Nix or direnv
<slabity[m]> s//`/, s/.*/.*`/, s/.direnv/`.envrc`/
<slabity[m]> Oh, also I made some changes to use assign-resources because I was told it makes things a lot cleaner for passing clear delimination of resources
<slabity[m]> My suspicion is that core 1 isn't getting paused or reset when flashed, and so it could be just trying to pick up where it left off for some reason?
<M9names[m]> seems to reliably print logging info on my end, though obviously it is panicking when trying to do i2c reads.
<M9names[m]> yeah, maybe? you can manually reset core1 on startup to ensure it's in a good state.
<M9names[m]> spawn_core1 already does this, but maybe it needs to happen earlier
<slabity[m]> Well the strange thing is it doesn't even get to the "Starting program" state before the core1 process even spawns. It just doesn't print anything unless I remove the core 1 process, upload it, then reset the entire thing and upload the new program again
<slabity[m]> Hmm... I tried simplifying it by removing the ADC process entirely and making it just an LED flasher on Core 1:... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/ZUxeSsuiYutgLSIEzoIfZvRc>)
<M9names[m]> one other thing you're doing that's not recommended is relying on git master versions of embassy things.... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/zTtKNYyqRZZpMgPqFuqNmZyc>)
<slabity[m]> Yea, that's definitely an issue. I was told a new update will remove some of the generics issues I was having so I just wanted to rollover to master until that was fixed.
<slabity[m]> Honestly the entire thing has been kind of me just kicking stuff around to see how embedded rust works.
<slabity[m]> So I have not been following best practices
<M9names[m]> are you running release builds?
<slabity[m]> Well I just updated to debugprobe-v2.0.1 and that doesn't seem to have helped. Wasn't sure if maybe there was some bug there causing it to not reset properly
<slabity[m]> No, I was hoping to keep debug symbols for the debugger to use
<slabity[m]> Oh wait, there was a solution for that somewhere
<slabity[m]> So that I could use DWARF symbols or something in release builds?
<slabity[m]> Thanks, I'll use release builds in case the debug builds were causing any issues
<slabity[m]> Though after updating and everything it still seems to be the same exact issue for some reason.
<slabity[m]> Also that timer panic seems suspicious
<M9names[m]> yes, it does
<slabity[m]> Looks like people using OpenOCD have been having issues with multicore programs as well:
<slabity[m]> Well I think I'm just going to not use the second core until I can figure out what's going on with that. I'll just be happy embassy easily lets me move tasks around without needing to rewrite a ton of code
<M9names[m]> i'm not able to reproduce any issues replacing your adc task with a blinky on my end, so i'm afraid i won't be much more help
<slabity[m]> Yea, maybe it's literally my RP2040 having an issue.
adamgreig[m] has quit [Quit: Idle timeout reached: 172800s]
<slabity[m]> I did have a faulty ADC, so maybe some other weird stuff is going on
<slabity[m]> I have to give credit where it's due though, the issues I've been running into with embassy have been way minor compared to needing to manually set up interrupts and entire state machines to get things working asynchronously in C++.
<M9names[m]> just had a bit of a struggle trying to install the latest git version of probe-rs (the cli tools).... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/LCOtRCzrQYaTtLcCgsjmKKyh>)
<M9names[m]> latest git probe-rs locks up exactly as you described @slabity - is that what version you are using?
<M9names[m]> release versions 23 and 22 work fine.
<slabity[m]> $ probe-rs --version
<slabity[m]> probe-rs 0.23.0
<slabity[m]> git commit: crates.io
<M9names[m]> oh no, it's not a probe-rs issue, it is the firmware. it just locks up after running for a while. cool cool, that's something debuggable.
<M9names[m]> reproduced. it's rtt buffer being full and blocking the second core. recovery requires that the spinlock is cleared before main.... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/QiRuxJmloushJbGplsMFuqNQ>)
<M9names[m]> actually doesn't require 2nd core. just spinning in a loop on core0 defmt::printing is sufficient to encounter this issue.
<M9names[m]> ah no, this issue only happens on git probe-rs not 23, your issue must be different to this one.
pflanze has quit [Read error: Connection reset by peer]
pflanze has joined #rust-embedded
cr1901 has quit [Read error: Connection reset by peer]
cr1901 has joined #rust-embedded
bomb has joined #rust-embedded
<slabity[m]> <M9names[m]> "reproduced. it's rtt buffer..." <- > <@9names:matrix.org> reproduced. it's rtt buffer being full and blocking the second core. recovery requires that the spinlock is cleared before main.... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/DHIaihKJMFKJagDZQFqjUHdo>)
<slabity[m]> I do get these warnings when I stop `probe-rs` now though... But they're completely benign for me.... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/SNwiJyQJYbmmBFXSIAYoHCgA>)
<slabity[m]> <M9names[m]> "ah no, this issue only happens..." <- Oh, just read this... But it seems to have fixed it on my end, so possibly related?
<M9names[m]> different issue but same solution i think
badyjoke[m] has quit [Quit: Idle timeout reached: 172800s]
IlPalazzo-ojiisa has joined #rust-embedded
GuineaWheek[m] has quit [Quit: Idle timeout reached: 172800s]
bomb has quit [Quit: 💣]
cesnel[m] has quit [Quit: Idle timeout reached: 172800s]
jannic[m] has joined #rust-embedded
<jannic[m]> <M9names[m]> "reproduced. it's rtt buffer..." <- > <@9names:matrix.org> reproduced. it's rtt buffer being full and blocking the second core. recovery requires that the spinlock is cleared before main.... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/CFfGSquKmqRGIWfcYpDSfwWK>)
<JamesMunns[m]> jannic[m]: I'd imagine the second core might be running with access to resources and memory it shouldn't have, so pre-init ensure it happens before any memory init possibly happen
<JamesMunns[m]> JamesMunns[m]: agreed pre_init is Not Great, tho, but probably fine for a single volatile op.
<JamesMunns[m]> s/happen/happens/
<M9names[m]> > Shouldn't it be sufficient to do it at the first command within main... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/xcQsgsXsAlQmfMOptNcaqfnv>)
<JamesMunns[m]> Yeah, idk how much it's POSSIBLE to have miscompilations in `pre_init`, but it's definitely breaking the environmental contract with the rust abstract machine (e.g., some invariants hold true before Rust "starts", e.g. statics will be initialized either to zero or their initial value).... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/GYNKvNxzPhRJCkUgxdYtISya>)
<JamesMunns[m]> Using statics in pre-init would be a big red flag to me (even/especially read access of statics!), and any writes to statics that aren't uninit/in other sections would be another big red flag.
<JamesMunns[m]> that being said, "ub is ub and all bets are off and you can't reason logically about it over time", but I can't particularly imagine what the compiler would burn us with outside of static access.
<JamesMunns[m]> that being said that being said, the optimizer doesn't super mess with volatile ops, so this usage doesn't spook me, personally, for what that's worth.
AtleoS has quit [Ping timeout: 255 seconds]
AtleoS has joined #rust-embedded
<jannic[m]> Yes, I agree it's probably fine. And for a firmware with limited scope and no intention of long-term maintainability, that should be enough. So just to get things running, I'd probably do the same. I'm just a bit wary of any general advice short of "avoid rust code in pre_init".
<jannic[m]> <M9names[m]> "> Shouldn't it be sufficient..." <- > <@9names:matrix.org> > Shouldn't it be sufficient to do it at the first command within main... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/PXJJubrSeUGfmAoZWlTHcmIt>)
ello has quit [Quit: ZNC 1.8.2 - https://znc.in]
ello has joined #rust-embedded
AtleoS has quit [Ping timeout: 252 seconds]
dirbaio[m] has joined #rust-embedded
<dirbaio[m]> A custom entry macro composes badly. For example embassy-executor or rtic have their own entry macros too, you can't use both at the same time 
<dirbaio[m]> Perhaps the hal can put a pre_init for you. That'll mean the user won't be able to use pre_init themselves tho. 
<JamesMunns[m]> yeah, extern unmangled pre_init global asm, behind a default feature, on the rp-hal or embassy-rp crates would be pretty slick, IMO
<JamesMunns[m]> (pre_init usage is rare, and having a feature to disable it would cover any complaints, imo)
therealprof[m] has quit [Quit: Idle timeout reached: 172800s]
AdamHott[m] has quit [Quit: Idle timeout reached: 172800s]
Seth[m] has joined #rust-embedded
<Seth[m]> ppl
<Seth[m]> I could use some help
<Seth[m]> yo
<Seth[m]> I can't get Joshuto to work with Ueberzugpp
xiretza[cis] has joined #rust-embedded
<xiretza[cis]> <Seth[m]> "I can't get Joshuto to work with..." <- how is that related to using Rust on embedded devices?
<Seth[m]> ...oh that's what this room is about 💀
<Seth[m]> well
<Seth[m]> Joshuto is written in Rust
<Seth[m]> and...
<Seth[m]> okay fine nvm
starblue has quit [Ping timeout: 268 seconds]
AtleoS has joined #rust-embedded
starblue has joined #rust-embedded
esden[cis] has quit [Quit: Idle timeout reached: 172800s]
starblue has quit [Ping timeout: 268 seconds]
starblue has joined #rust-embedded
<whitequark[cis]> none of these words are in the bible
sirhcel[m] has joined #rust-embedded
<sirhcel[m]> Has anyone a good example/best practices for how to diable some tests requiring actual hardware in ci? Feature, environment variable, ... I'm working on cleaning up tests for serialport-rs and encountered that some of them always suceed due to ignoring Results. Fixing this will cause our ci to fail due to not having any serial devices there and i want to disable tests actually using a serial device in ci.
<sirhcel[m]> * Has anyone a good example/best practices for how to diable some tests requiring actual hardware in ci? Feature, environment variable, ... I'm working on cleaning up tests for serialport-rs and encountered that some of them always suceed due to ignoring Results. 😅 Fixing this will cause our ci to fail due to not having any serial devices there and i want to disable tests actually using a serial device in ci.
cr1901 has quit [Read error: Connection reset by peer]
cr1901_ has joined #rust-embedded
cr1901__ has joined #rust-embedded
cr1901_ has quit [Read error: Connection reset by peer]
cr1901__ is now known as cr1901