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
Hallo124 has quit [Remote host closed the connection]
Hallo124 has joined #rust-embedded
Hallo124 has quit [Remote host closed the connection]
Hallo124 has joined #rust-embedded
sroemer has joined #rust-embedded
sroemer has joined #rust-embedded
Foxyloxy has quit [Read error: Connection reset by peer]
_whitelogger has joined #rust-embedded
<Kaspar[m]> Is there a way to get a backtrace on hardfault on cortex-m with probe-rs? The backtrace stops one frame after the hardfault handler (in an unknown function), so that seems corrupted. I did try enabling "force-frame-pointers", and rebuilding core.
<Darius> does the hard fault handler do anything strange?
<Darius> some debuggers (eg the blackmagic probe) let you capture fault vectors which is good for this
<Darius> try --catch-hardfault
<JamesMunns[m]> Ralph ^
<Ralph[m]> thanks! but ugh... that looks painful!
<Ralph[m]> _maybe_ it'd be an option to take a number as an input in either prpc or prpc and embassy-usb and do this there? (to be honest: i have no clue how prevalent serial numbers in numeric format are across different MCUs, so this might purely be RP2040 specific and different for all others?)
<Ralph[m]> i think i'll just leave mine hardcoded at `Some("1")` for now (it's an internal thing with a single device deployed. if it'd have been easy, simple & clean code i'd have quickly thrown it in to follow best practices)
<JamesMunns[m]> My code is not clean enough ๐Ÿ˜ญ
<adamgreig[m]> in embassy-stm32 i wrote this thing to get a static str: https://github.com/embassy-rs/embassy/blob/main/embassy-stm32/src/uid.rs#L9
<adamgreig[m]> so in stm32 you can just call embassy_stm32::uid::uid_hex() and you're done, whcih is what I pass to embassy-usb
<adamgreig[m]> maybe something similar could be added to embassy-rp?
<Ralph[m]> adamgreig[m]: hm, i'm wondering if we could move the num-to-hex part to a more central `embassy-*` crate and then re-use it in others (e.g. `embassy-rp`)?
<JamesMunns[m]> It's a bit more complicated on rp2040, because the chips don't have unique id numbers, so you need to ask your external flash
<JamesMunns[m]> (Which can be of varying length, tho at least 64 bits is pretty common)
Foxyloxy has joined #rust-embedded
<Ralph[m]> <JamesMunns[m]> "My code is not clean enough ๐Ÿ˜ญ" <- sorry ๐Ÿ˜…
<Ralph[m]> what i meant was "if there's a single API i can call to get the value i want and feed that to the consumer i'll take it. but i'm not gonna add a dozen lines to my code if i don't actually really need a unique serial number since i'm not going to ship it"
<JamesMunns[m]> Yeah, I didn't have a better vid/pid, it's probably the same one from the embassy-usb examples
<JamesMunns[m]> btw, starting to triage the state of the Postcard Cinematic Universe, feel free to follow along here: https://github.com/jamesmunns/postcard/issues/241
<Ralph[m]> <JamesMunns[m]> "btw, starting to triage the..." <- i see you mention "ergot" on there and i've seen you mentioning it here before. and i found [your repo](https://github.com/jamesmunns/ergot) with the following README:
<Ralph[m]> > This is a repo just for messing around. There are many other like it, but this is the q2 2025 attempt
<Ralph[m]> i still don't understand what it is / should be ๐Ÿ˜…
<JamesMunns[m]> Ralph[m]: it's a network stack that handles addressing and routing, and in the future might serve as the base for postcard-rpc, or supercede postcard-rpc: https://docs.rs/ergot/latest/ergot/#purpose
<Ralph[m]> JamesMunns[m]: ah, that helps a lot to understand things, thanks! i didn't realise that it was already on crates.io (based on the README i expected it to just be a repo for now). and i see that you got infected by fungi as well, that seems to be taking over ๐Ÿคฃ
<dngrs[m]> commercial USB devices often put nonsense serial numbers, I've seen 0x123456 and also a lot of just "this space intentionally left blank" iirc
<thejpster[m]> Serial numbers are optional but if you have one it must be unique, otherwise Windows gets confused (or XP did, havenโ€™t checked since) if you plug two devices in.
<thejpster[m]> Without a serial number, it would reinstall the driver every time it was plugged into a new usb port (because the path to the port was used as the unique ID instead when thereโ€™s no serial).
<wassasin[m]> Vendor ID is 'just' 6000 USD
<wassasin[m]> * 6000 USD https://www.usb.org/getting-vendor-id
reto[m] has joined #rust-embedded
<reto[m]> <wassasin[m]> "Vendor ID is 'just' 6000 USD" <- but for open source hardware you can get a PID via here: https://pid.codes/
<dngrs[m]> reto[m]: now that looks interesting
<Ralph[m]> <reto[m]> "but for open source hardware you..." <- ah, cool! so that's the "generic" VID 0x1209 which i've found before ๐Ÿ‘๏ธ
mkj[m] has joined #rust-embedded
<Ralph[m]> mkj[m]: oh, so "pick an obsolete vendor" is of course also a convenient option ๐Ÿ‘๏ธ
<Ralph[m]> browsing the list and i just found this: "Nebraska Furniture Mart"... why would they make USB devices? in a B-rate movie that'd be some NSA outfit making spy devices ๐Ÿคฃ
<mkj[m]> 0x1209 is on the list too, so they're all good enough!
<dngrs[m]> four seasons total USB
<Ralph[m]> <mkj[m]> "0x1209 is on the list too, so..." <- i missed the fact that the list is in decimal while everything else always uses hex for this... doh!
<Ralph[m]> <dngrs[m]> "four seasons total USB" <- where'd you spot that one ๐Ÿ˜ฎ
<dngrs[m]> Ralph[m]: I made it up!
<Ralph[m]> <JamesMunns[m]> "btw, starting to triage the..." <- there's no issue for this yet, but you might want to add "update to upcoming `embassy-usb` release" to the list (no issue/PR yet because it hasn't been released yet - PR for that still pending with embassy)
<Ralph[m]> also: thanks for all your work on postcard/postcard-rpc!
Hallo124 has quit [Remote host closed the connection]
Hallo124 has joined #rust-embedded
<Ralph[m]> i'm running some HIL tests where the HIL test is running on linux and talking to the DUT (which runs stock firmware). i implemented the tests as normal rust tests (i.e. you can run `cargo test`).... (full message at <https://catircservices.org/_irc/v1/media/download/AcAUkboa3VznrLRWpDn60G5OQyPdezx_xt-7jPAa9PouXw_QZGxAwdNvAsEEro4cv4wibkZphYCf_CcDHqBhVyW_8AAAAAAAAGNhdGlyY3NlcnZpY2VzLm9yZy9pd2NWRXB6Y3BkQlRZb1RxbFFsenNxSFI>)
<JamesMunns[m]> Does ctrl-c halt the firmware with probe-rs? Or do you mean the Drop impls on the desktop are not being run?
<JamesMunns[m]> If you mean on the desktop, I'm going to GUESS that cargo test has some kind of signal handler for control-c that then aborts the program, rather than unwinding test threads
<JamesMunns[m]> https://github.com/rust-lang/rust/issues/83326 sort of hints at this I think?
<dngrs[m]> haven't used it in tests tho
<dngrs[m]> <JamesMunns[m]> "If you mean on the desktop, I'..." <- it's kind of the other way round, there is *no* special handler and as a result the process is just killed (the crate I linked resolves this by adding said handler)
<dngrs[m]> s/*no*/_no_/, s/killed/terminated/
dirbaio[m] has joined #rust-embedded
<dirbaio[m]> You cant make a thread spontaneously start unwinding on control+c
<dirbaio[m]> The thread has to voluntarily check for control+c periodically and unwind itself
<dirbaio[m]> For example with async you can use sekect() together with Tokio signals
<dirbaio[m]> But even then it will only cancel. Itself at await points
<dngrs[m]> yeah, probably better to use async tests, otherwise it's gonna add a lot of boilerplate
<dirbaio[m]> If your code is blocking there's no way to do it
<dngrs[m]> you can check between blocking statements
<dngrs[m]> unpleasant but it is an option
<dirbaio[m]> Yeah, I mean it's not possible to externally cause blocking code to unwind
<dngrs[m]> anything is possible with w+x memory!
<dirbaio[m]> Like, "cargo test" doesn't unwind on control+c because it has no way to cause blocking test code to unwind without collaboration
<dirbaio[m]> This is why it just aborts
<Ralph[m]> i was talking about a desktop app, not embedded tests. i use tokio (i.e. async, multi-threaded) tests and i actually do `select!` on `tokio::signal::ctrl_c()` just as i do in the `bin` (basically i can use 1:1 the same code in the bin & the test but the `impl Drop` only gets executed in the bin while it seems that it just outright kills the test without dropping anything :(
<dirbaio[m]> Okay.. That's probably because the test runner's control+c handler is still running
<dirbaio[m]> IIRC the test runner runs multiple processes, maybe the control+c is going to the parent which is then killing the children violently?
<Ralph[m]> yeah, looks like it. i was hoping that that wouldn't be the case... it feels odd? i can't be the only one who wants to run the drop handlers in that case? (and i was hoping that others might be found here with the same issue since putting hardware back into a "safe" state after (failed/aborted) tests seems like a common requirement?)
Hallo124 has quit [Remote host closed the connection]
Hallo124 has joined #rust-embedded
<dirbaio[m]> I guess Making tests speak to external hardware is rare...
<dirbaio[m]> And for tests that are software-only, you definitely don't want a buggy test make control+c not work
d34db33f has joined #rust-embedded
d34db33f has quit [Ping timeout: 260 seconds]
d34db33f has joined #rust-embedded
sroemer has quit [Quit: WeeChat 4.5.2]
d34db33f has quit [Ping timeout: 265 seconds]
d34db33f has joined #rust-embedded
d34db33f has quit [Read error: Connection reset by peer]
d34db33f has joined #rust-embedded
d34db33f has quit [Remote host closed the connection]
d34db33f has joined #rust-embedded
d34db33f has quit [Remote host closed the connection]
burrbull[m] has quit [Quit: Idle timeout reached: 172800s]
romancardenas[m] has quit [Quit: Idle timeout reached: 172800s]
Hallo124 has quit [Remote host closed the connection]
Hallo124 has joined #rust-embedded
rmsyn[m] has quit [Quit: Idle timeout reached: 172800s]
bartmassey[m] has quit [Quit: Idle timeout reached: 172800s]
cr1901_ has joined #rust-embedded
kevlan[m] has quit [Quit: Idle timeout reached: 172800s]
jfsimon has quit [Quit: Leaving]
jfsimon has joined #rust-embedded
<therealprof[m]> <Ralph[m]> "i by chance saw James Munns's..." <- Leak it?
Hallo124 has quit [Remote host closed the connection]
Hallo124 has joined #rust-embedded