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
<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)
<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"
<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).
<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]
<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
<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]