<swork[m]>
I'd like to wait on change of state of any of a collection of GPIO pins. I can make a heapless::Vec of x.wait_on_any_edge() futures for each pin and select_slice() on it, but waiting on edges is racy. I want to pick .wait_for_{high,low} instead, depending on last known state for each pin. How can this be done? I'm lost in a maze of Pin/Unpin requirements: the un-awaited futures need to be Pin()'d to get .await'd later (right?), and
<swork[m]>
the pin!() macro in a conditional leads to temporaries with too-short lives; but I can't pin!() the result of a conditional because the if and else clauses have different types (wait_for_high or wait_for_low). This has to be a common beginner problem, resources must be out there, but I haven't found them (or recognized them yet). Can anybody help me get oriented?
starblue has quit [Ping timeout: 265 seconds]
starblue has joined #rust-embedded
starblue has quit [*.net *.split]
LiamKinne[m] has quit [*.net *.split]
danielb[m] has quit [*.net *.split]
drahnr[m] has quit [*.net *.split]
FrreJacques[m] has quit [*.net *.split]
dne has quit [*.net *.split]
nadja has quit [*.net *.split]
Ekho has quit [*.net *.split]
RandomExplosion[ has joined #rust-embedded
<RandomExplosion[>
I'm working on my first custom stm32 board with the stm32f407, just wanted to ask what flashing method you guys recommend, (traditional USB->UART, JTAG, USB OTG etc) I can put whatever connectors on the board that I need to, I just want to know what works best with the embedded rust stack (especially rtic)
starblue has joined #rust-embedded
LiamKinne[m] has joined #rust-embedded
FrreJacques[m] has joined #rust-embedded
drahnr[m] has joined #rust-embedded
nadja has joined #rust-embedded
Ekho has joined #rust-embedded
dne has joined #rust-embedded
danielb[m] has joined #rust-embedded
i509vcb[m] has joined #rust-embedded
<i509vcb[m]>
You probably want to expose the SWCLK and SWDIO pins on the connector
<i509vcb[m]>
Unless you explicitly need JTAG for the scan chain, it's probably not worth the extra pins
<i509vcb[m]>
s/scan/chaining/, s/chain/devices on the board to test/
<RandomExplosion[>
I do need that anyway yeah
<RandomExplosion[>
*JTAG
<i509vcb[m]>
otherwise assuming your debug probe supports driving JTAG, the toolchain at least from a surface level should be able to debug the target
<RandomExplosion[>
I spoke to someone earlier who mentioned that to flash over USB otg you need to flash a USB bootloader to the chip first via UART or jtag
<i509vcb[m]>
Lets see what AN2606 has to say
<RandomExplosion[>
Is JTAG over USB OTG a thing for stm32s like it is for the newer esp32 chips (c3, s3 etc)
<i509vcb[m]>
I know what the esp32c3/c6 include a built-in JTAG debugger
<i509vcb[m]>
* JTAG debugger and expose it over USB
<i509vcb[m]>
AN2606 says that USB DFU should be available, but that would only really apply to a fresh chip and if you need a debugger then you need SWD or JTAG
<i509vcb[m]>
* be available on the F407, but
<swork[m]>
* I'd like to wait on change of state of any of a collection of GPIO pins. I can make a heapless::Vec of x.wait\_on\_any\_edge() futures for each pin and select\_slice() on it, but waiting on edges is racy. I want to pick .wait\_for\_{high,low} instead, depending on last known state for each pin. How can this be done? Cortex-M so no heapless::pool Box::pin - am I forced into using an allocator? Otherwise I'm lost in a maze of
<swork[m]>
Pin/Unpin requirements: the un-awaited futures need to be Pin()'d to get .await'd later (right?), and the pin!() macro in a conditional leads to temporaries with too-short lives; but I can't pin!() the result of a conditional because the if and else clauses have different types (wait\_for\_high or wait\_for\_low). This has to be a common beginner problem, resources must be out there, but I haven't found them (or recognized them yet).
<swork[m]>
Can anybody help me get oriented?
zaven[m] has quit [Quit: Idle timeout reached: 172800s]
cr1901_ has joined #rust-embedded
cr1901 has quit [Ping timeout: 248 seconds]
m5zs7k has quit [Ping timeout: 246 seconds]
m5zs7k has joined #rust-embedded
M9names[m] has quit [Quit: Idle timeout reached: 172800s]
korken89[m] has quit [Quit: Idle timeout reached: 172800s]
Dlaw[m] has quit [Quit: Idle timeout reached: 172800s]
diondokter[m] has joined #rust-embedded
<diondokter[m]>
For an application I'm trying to guestimate if all the firmware will fit in flash. Does anybody have a rough number of how much space a relatively simple UDP smolltcp/embassy-net implementation takes?
<JamesMunns[m]>
I think the last time I looked it was 40-50k? that might have been with USB (ECM) as the transport instead of a hw phy
<diondokter[m]>
Ok, cool, thanks!
<diondokter[m]>
This is not looking good lol
<whitequark[cis]1>
i think maybe 20-30k of those may have been smoltcp, unless smoltcp got much bigger recently
<diondokter[m]>
Yeah, I had that 30k number in mind
<whitequark[cis]1>
(the numbers from my memory are for or1k, i think, so a bit worse than thumb)
<diondokter[m]>
But the 20k isn't gonna be the problem. It's the unexpectedly 209kb big C library we need
<whitequark[cis]1>
oops.
<diondokter[m]>
* But the extra 20k isn't
marmrt[m] has joined #rust-embedded
<marmrt[m]>
Rewrite it in Rust
<diondokter[m]>
<marmrt[m]> "Rewrite it in Rust" <- Ha, ideally yes. But our estimation is that'd cost us almost 700 hours to do
<diondokter[m]>
And it probably won't solve the flash size issue
wassasin[m] has joined #rust-embedded
<wassasin[m]>
If it has XIP redesign the hardware with some extra NOR? :')
<diondokter[m]>
It's an STM32 with an 8MB NOR already hooked up to the QSPI, so I'm looking at whether we can use that
<diondokter[m]>
The qspi can do memory-map mode
<diondokter[m]>
But not sure if that's enough to run code from it
<JamesMunns[m]>
<whitequark[cis]1> "i think maybe 20-30k of those..." <- yeah, I forget exactly what that included. It might have also included a good chunk of embassy-usb as well
<JamesMunns[m]>
(I was looking at what the baseline code size would be to do tcp/ip over usb instead of manual bulk packet handling)
<dirbaio[m]>
you can do `const { assert!(A > B); }`
<bogdan[m]>
in a where clause?!
<dirbaio[m]>
no, in some expression
<dirbaio[m]>
for example inside the method
<dirbaio[m]>
if that method gets monomorphized, these const asserts will run for the particular values of A+B and fail at compile time if they're not right
<bogdan[m]>
ah, runtime check is the thing I'd like to avoid
<dirbaio[m]>
i'm not sure if it's as powerful, because you can't "inspect types" from const, just const generics values
<bogdan[m]>
dirbaio[m]: good point
<dirbaio[m]>
for example you can't "assert XO is not the HfXo type"
<dirbaio[m]>
anyway IMO the most usable design is to not use generics like that at all
<bogdan[m]>
dirbaio[m]: I know your stance on this, but I'm stubborn :)
<dirbaio[m]>
๐
<dirbaio[m]>
imagine you got multiple revisions of the board, and you encode the revision in an eeprom or with 0ohm resistors in unused pins
<dirbaio[m]>
and you discover the HFXO you mounted in revision 1 is fucked up and fails randomly. you want the firmware to read the board revision at boot, then dynamically choose to use HFRC in revision 1 and HFXO in revision 2
<dirbaio[m]>
with these generics designs, you simply can't
<JamesMunns[m]>
Congrats! You'll make ryan-summers very happy with that :D
sourcebox[m] has joined #rust-embedded
<sourcebox[m]>
Not a topic for the meeting, but maybe ryan-summers and eldruin are here this evening: do we have a change to get version 0.4 of `usb-device` out somwwhere in the near future? I'm fully aware of the pain that this introduces for getting all HALs and classes updated, but the current limitation of the control buffer size is a real blocker for some future work.
cgc17[m] has quit [Quit: Idle timeout reached: 172800s]
<adamgreig[m]>
ok, let's begin! the only announcement from me is about RustWeek; I'll start collecting names for people interested in joining the embedded unconf, so please let me know (here, on the github discussion, in DM, etc) if you're interested in attending
<adamgreig[m]>
we can probably have about 20-25 people again
<adamgreig[m]>
currently no word on whether there will be travel sponsorship/accommodation, but the hope is that there will be; it would be useful to know if you'd need this to be able to come or not
<adamgreig[m]>
similarly right now you'd be buying your own ticket to the rustweek conf that's the days before the unconf (there's no cost for the unconf itself), though there may be some ticket sponsorships available if your company wouldn't cover it, please let me know if you'd want that too
<adamgreig[m]>
anything else to say about that, therealprof?
therealprof[m] has joined #rust-embedded
<therealprof[m]>
They're still looking for additional sponsors, so if your company wants to become one, please contact erikjee .
<therealprof[m]>
We'll also start brainstorming topics to discuss in the hopes to put an agenda up beforehand.
<JamesMunns[m]>
(this is only for WG members, fyi)
<JamesMunns[m]>
when in doubt, approvals go to the council for decision, so I'll see it if they aren't sure :)
<therealprof[m]>
And: There's a speaking opportunity we can fill with a review of our work/achievements or highlighting one or more projects.
<therealprof[m]>
(Outside of the CFP process which ends on Jan 19)
<adamgreig[m]>
ah yes, thanks, that was the final thing! there's a slot in the main conference schedule for a talk from someone in the embedded unconf, so if anyone has any thoughts or is interested in that please also let us know :)
<adamgreig[m]>
I left my notes for this at home and had to run today's meeting from work....
bartmassey[m] has joined #rust-embedded
<bartmassey[m]>
I definitely have thoughts and am interested ๐. Big surprise. Let me know how I can help.
<adamgreig[m]>
cool, will do!
<adamgreig[m]>
ok, thejpster do you wanna say anything about defmt 1.0?
<thejpster[m]>
Itโs coming. Please speak know if thereโs anything you think I should not stabilise
<thejpster[m]>
There will never be a defmt 2.0
<thejpster[m]>
1.0 is just 0.3 with a semver-trick
newam[m] has joined #rust-embedded
<newam[m]>
I'm just happy to see a 1.0 coming for such an important crate.
<thejpster[m]>
I just donโt want anyone to point something out post launch thatโs then hard to fix
rmsyn[m] has joined #rust-embedded
<rmsyn[m]>
thejpster[m]: are there any particular places in the code where review would be helpful before launch?
<therealprof[m]>
<thejpster[m]> "There will never be a defmt 2.0" <- ! say !
<bartmassey[m]>
Have to go in a few minutes for class ๐ฆ. I left a thing in the minutes about Not Yet Awesome Embedded Rust. Feel free to discuss without me, or we can try it for a future meeting.
<adamgreig[m]>
we can move on to that right now if you like?
<bartmassey[m]>
Sure!
<adamgreig[m]>
certainly it hasn't seem much love in a while ๐
<adamgreig[m]>
I would say right now we have pretty good solutions for most of those things, and I'm not sure that having the list itself did much to drive solutions
<bartmassey[m]>
I agree.
<bartmassey[m]>
I'm torn between just archiving it and putting a disclaimer, and trying to bring it up to date. Lean toward the former.
<JamesMunns[m]>
+1 to archive
<adamgreig[m]>
yea, sounds fine to me
<bartmassey[m]>
It would be nice to tell whatever story we currently have around sharing state with interrupts somewhere.
<bartmassey[m]>
It's a confusing topic in general.
<bartmassey[m]>
Maybe someone not me wants to volunteer to write a short guide? ๐
<adamgreig[m]>
a more up-to-date version of the concurrency chapter in the book, sort of thing?
<adamgreig[m]>
I mean the story is basically "consider rtic, embassy, or use something that is like critical_section::mutex when you squint" I think?
<adamgreig[m]>
plus a handful of other crates that are neat but not as widely used
<bartmassey[m]>
I guess the book has things, but I'm not sure they are the right things. Somebody more knowledgeable should check and let me know. https://github.com/rust-embedded/discovery-mb2
<bartmassey[m]>
Anyhow, I will add a disclaimer and archive this week unless someone objects.
<adamgreig[m]>
I'll just open an RFC issue on the repo so we can write up why and have resources members vote
<bartmassey[m]>
Thanks all! ๐
<adamgreig[m]>
ok, romancardenas did you want to talk about weak symbols vs lto for riscv?
romancardenas[m] has joined #rust-embedded
<romancardenas[m]>
Yes! Not riscv specific, though
<romancardenas[m]>
We previously had `default_*` functions that could be overwritten via linker script with PROVIDEs.
<romancardenas[m]>
This approach has the drawback of leaving default symbols in the binary
<romancardenas[m]>
So, when moving to global assembly, we decides to use weak symbols directly in the assembly code
<romancardenas[m]>
While this works, apparently it is not possible to perform LTOs when overriding a weak symbol. The PR I shared with you kind of follows the old approach, but I wanted to discuss with you if you have a better solution
<romancardenas[m]>
* the binary even when "overriding" them
<romancardenas[m]>
s/decides/decided/
<adamgreig[m]>
aah, that's annoying
<adamgreig[m]>
i don't know of anything better off the top of my head...
<rmsyn[m]>
could we do something with traits that provide a default implementation?
<romancardenas[m]>
Honestly, I have no idea
<romancardenas[m]>
We can feature-gate default symbols so enabling a `no-mp-hook` removes the default MP hook function and so on
<romancardenas[m]>
But I'm not a big fan of having too many features for such tricks
<adamgreig[m]>
Yea, not the ideal use of features even if it's maybe better than nothing. Seems like ideally the linker should be able to figure this out somehow though huh
<romancardenas[m]>
In the PR I attached (and the related issue) there are pointers for nightly features for weak symbols, but using nightly stuff on core traits is not an option
<romancardenas[m]>
Also there is a .lto_discard option for LLVM, but the folk working on the PR couldn't make it work
<romancardenas[m]>
I can try to investigate further
<romancardenas[m]>
* it work (symbol redefinition errors when linking)
<adamgreig[m]>
sorry i don't have any better ideas! we can copy whatever you do find for c-m though ๐
<romancardenas[m]>
In any case, people with expertise on this stuff are more than welcome ๐
<romancardenas[m]>
Will keep you posted
<adamgreig[m]>
thanks! any other topics anyone wants to discuss this meeting?
<adamgreig[m]>
if not let's finish here, thanks everyone!
tyranicd has quit []
drahnr[m] has quit [Quit: Idle timeout reached: 172800s]
<thejpster[m]>
<rmsyn[m]> "are there any particular..." <- Mainly just looking at the API we expose to crates and in the ELF
AndoThorNando[m] has joined #rust-embedded
<AndoThorNando[m]>
<bartmassey[m]> "Maybe someone not me wants to..." <- Iโm writing a blog post currently on multi-core which will have examples. It might be that I can get that work adapted back into a guide that works for single-core as well.
<thejpster[m]>
Iโm writing a training on how to make a UART a global with a ring buffer
cr1901_ has quit [Read error: Connection reset by peer]
cr1901 has joined #rust-embedded
fisch02 has joined #rust-embedded
fisch02 has quit [Quit: Client closed]
<bartmassey[m]>
That would be good! Let me know if I can help somehow