<re_irc> <@9names:matrix.org> oh if we're sharing silly jokes, here's one that was featured recently by the Rust Trending twitter bot:
<re_irc> <@9names:matrix.org> https://github.com/mTvare6/hello-world.rs
<re_irc> <@firefrommoonlight:matrix.org> Love it
<re_irc> <@josfemova:matrix.org> has someone here used lexical-core 8.0 in a project? followed what the repo said for configuring the thing for no std, but lexical-util pulls std for some reason
starblue1 has quit [Ping timeout: 252 seconds]
starblue1 has joined #rust-embedded
<re_irc> <@firefrommoonlight:matrix.org> jordens: Re the chat earlier from yatekii : Is there no FIR? Is the module labeled IIR really FIR mislabeled? Thank you.
PyroPeter has quit [Ping timeout: 268 seconds]
PyroPeter has joined #rust-embedded
fabic has joined #rust-embedded
<re_irc> <@korken89:matrix.org> firefrommoonlight:matrix.org: Check the regenerated to target/rtic-expansion.rs file, it does only expand the RTIC macro and not other macros you have used such as info! while cargo-expand expands all macros :)
<re_irc> <@korken89:matrix.org> Just run cargo format on the file, it's not formatted when we write it
<re_irc> <@korken89:matrix.org> Plus if you have questions on something the codegen does, ping me :)
GenTooMan has quit [Ping timeout: 260 seconds]
emerent_ has joined #rust-embedded
emerent has quit [Killed (mercury.libera.chat (Nickname regained by services))]
emerent_ is now known as emerent
GenTooMan has joined #rust-embedded
<re_irc> <@jorgeig:matrix.org> dkhayes117:matrix.org: it's 1000000x better when you understand the guy 🀣🀣
fabic has quit [Ping timeout: 260 seconds]
gsalazar has joined #rust-embedded
<re_irc> <@jorgeig:matrix.org> QQ: is there any way I can create a `GenericArray<u8, U16>` that is u32 aligned? I have to pass it around to APIs that ingest a `&mut [u32; 4]` and then feed it back as a `&mut [u8; 16]`
<re_irc> <@jorgeig:matrix.org> but if I use something like `let (_left, plaintext, _right) = unsafe { block.as_mut_slice().align_to_mut::<u32>() };` where `block` is the GenericArray that some other library generated
<re_irc> <@jorgeig:matrix.org> sometimes the block is not u32 aligned so I get 2 bytes on the left, 2 bytes on the right, and 3 u32 in the middle
<re_irc> <@jorgeig:matrix.org> so if I could ensure in the library that the GenericArray is aligned, it'd be awesome
<re_irc> <@jorgeig:matrix.org> alternatively I can change the API (probably the better approach), but I'm curious if what I want to do above is possible (i.e. access a [u8] as a [u32], but the u8 start address is not u32 aligned)
<re_irc> <@jorgeig:matrix.org> in cortex-m4
<re_irc> <@korken89:matrix.org> You can make a wrapper that has alignment requirements
<re_irc> <@korken89:matrix.org> https://crates.io/crates/aligned
<re_irc> <@korken89:matrix.org> There is a helper crate to do alignment
<re_irc> <@korken89:matrix.org> Maybe a bit outdated now
<re_irc> <@korken89:matrix.org> I think you can just take the alignment code
<re_irc> <@korken89:matrix.org> Nah it was updated recently, just use the crate :)
<re_irc> <@jorgeig:matrix.org> :D Cheers
fabic has joined #rust-embedded
<re_irc> <@henrik_alser:matrix.org> jorgeig: Or if you don’t wanna pull in a dependency, it’s just a few lines of code https://github.com/nrf-rs/nrf-hal/blob/23adfc53b8d14b3b3513a9455fbdb49c89f82d14/examples/i2s-peripheral-demo/src/main.rs#L23
<re_irc> <@jorgeig:matrix.org> yes, that's what I'm thinking to PR to the upstream library, though it may not work because we are accessing parts of a buffer with this API and I can't guarantee the alignment for all possible accesses - I was wondering if I could _read u32 from an u8 slice that is not u32 aligned_
<re_irc> <@jorgeig:matrix.org> in any case, for the 23 bytes that this thing will exchange every 2 hours, no one cares if I just copy them around :D
<re_irc> <@jorgeig:matrix.org> it was more curiosity than practical
<re_irc> <@henrik_alser:matrix.org> jorgeig:matrix.org: Nerds just wanna have fun
<re_irc> <@henrik_alser:matrix.org> πŸ₯³
<re_irc> <@henrik_alser:matrix.org> What are you working on today out there?
<re_irc> <@jorgeig:matrix.org> just integrating a lorawan crate with the stm32wl
fabic has quit [Ping timeout: 268 seconds]
<re_irc> <@jorgeig:matrix.org> so we use lorawan instead of our own (not very robust) MAC
<re_irc> <@henrik_alser:matrix.org> Ohh!
<re_irc> <@henrik_alser:matrix.org> For any specific project?
<re_irc> <@jorgeig:matrix.org> shameless plug: https://www.munin.space
<re_irc> <@jorgeig:matrix.org> we also need a web designer if you know a good one haha
<re_irc> <@henrik_alser:matrix.org> Cool stuff! ✨
<re_irc> <@jorgeig:matrix.org> thanks!
<re_irc> <@korken89:matrix.org> jorgeig:matrix.org: Yes you can
<re_irc> <@korken89:matrix.org> Use `core::ptr::read_unaligned`
<re_irc> <@korken89:matrix.org> I use that frequently
<re_irc> <@jorgeig:matrix.org> πŸ‘οΈπŸ‘οΈπŸ™Œ
<re_irc> <@jorgeig:matrix.org> thanks!
<re_irc> <@korken89:matrix.org> Super unsafe
<re_irc> <@korken89:matrix.org> Buuuut eh
<re_irc> <@henrik_alser:matrix.org> Yolo
<re_irc> <@henrik_alser:matrix.org> #holdmybeer
<re_irc> <@korken89:matrix.org> :D
<re_irc> <@korken89:matrix.org> My experiments with more efficient serde uses that a lot
<re_irc> <@korken89:matrix.org> So far 100% winning
<re_irc> <@korken89:matrix.org> It even does the correct thing for M0s
<re_irc> <@korken89:matrix.org> Which does not support unaligned reads
<re_irc> <@henrik_alser:matrix.org> πŸ™Œ
<re_irc> <@korken89:matrix.org> (M3 and up does at the cost of 2 bus cycles=
<re_irc> <@korken89:matrix.org> If it is unaligned
<re_irc> <@henrik_alser:matrix.org> Great!
<re_irc> <@jorgeig:matrix.org> korken89:matrix.org: that was the follow-up question!
<re_irc> <@jorgeig:matrix.org> great stuff
<re_irc> <@korken89:matrix.org> Here you can try just to see it https://rust.godbolt.org/z/x99E7xvrT
<re_irc> <@korken89:matrix.org> Switch the target to a thumbv7
<re_irc> <@korken89:matrix.org> Only LDR
<re_irc> <@korken89:matrix.org> M0 byte reads
<re_irc> <@korken89:matrix.org> (which is what e.g. `ssmarshal` and `postcard` already does)
<re_irc> <@korken89:matrix.org> I hope this can be ported to both in the end
<re_irc> <@korken89:matrix.org> (and you need to check the `endian` compiler flag so you get correct with little and big)
<re_irc> <@korken89:matrix.org> And it it is big you do `ptr::read_unaligned(a as *const _).swap_bytes()` if you want LE
<re_irc> <@korken89:matrix.org> 1 extra instruction in M3 and up, no extra for M0
<re_irc> <@korken89:matrix.org> Badabing badaboom
<re_irc> <@jorgeig:matrix.org> *micdrop*
gsalazar_ has joined #rust-embedded
gsalazar has quit [Ping timeout: 240 seconds]
fabic has joined #rust-embedded
fabic has quit [Ping timeout: 252 seconds]
hifi has quit [Remote host closed the connection]
hifi has joined #rust-embedded
gsalazar_ is now known as gsalazar
Foxyloxy has quit [Quit: Textual IRC Client: www.textualapp.com]
Foxyloxy has joined #rust-embedded
<re_irc> <@firefrommoonlight:matrix.org> korken89:matrix.org: Awesome. Will take a look
Foxyloxy has quit [Quit: Textual IRC Client: www.textualapp.com]
<re_irc> <@firefrommoonlight:matrix.org> jorgeig: in coding for WL, have you noticed any SVD/PAC issue, eg regarding GPIO? I've found several things, like Port C missing several pins, and and the EXTI configuration for triggers missing most fields. Haven't tried an issue or PR yet.
<re_irc> <@firefrommoonlight:matrix.org> I remember at once point you and/or newAM were using a custom PAC, but when I looked at stm32wl HAL just now, it was using the crates.io one
<re_irc> <@firefrommoonlight:matrix.org> Also missing alternate setting
<re_irc> <@firefrommoonlight:matrix.org> Before I sent an issue or PR, I'm looking for a confirmation from the guys who've been using WL
<re_irc> <@firefrommoonlight:matrix.org> https://docs.rs/stm32wl/0.13.0/stm32wl/stm32wle5/gpiob/afrh/index.html (Note missing fields in the middle)
<re_irc> <@firefrommoonlight:matrix.org> *Upon closer inspection: The WL HAL is using bit arithmetic to get around this
<re_irc> <@firefrommoonlight:matrix.org> It sounds like this is a PAC issue which y'all have been working around
<re_irc> <@firefrommoonlight:matrix.org> newam:
<re_irc> <@firefrommoonlight:matrix.org> NVM on the AFRL; error on my part, it just uses the AFSEL temrinology
<re_irc> <@newam:matrix.org> firefrommoonlight:matrix.org: Yeah the GPIOs are entirely custom with `read_volatile`/`write_volatile`. I wasn't aware there was any issue πŸ˜…
<re_irc> <@firefrommoonlight:matrix.org> *AFRL
<re_irc> <@firefrommoonlight:matrix.org> For some context, I tried to implement WL in HAL a few months ago, but hit enough PAC issues that I gave up
<re_irc> <@firefrommoonlight:matrix.org> Out of laziness lol. They're all easy YAML fixes
<re_irc> <@firefrommoonlight:matrix.org> I was just curious seeing all the WL chat how y'all did it
<re_irc> <@firefrommoonlight:matrix.org> OK, got it to compile by ommitting port C and interrupt functionality, and changing the alt fn code
fabic has joined #rust-embedded
<re_irc> <@thejpster:matrix.org> Good news! 42 Technology has agreed a contract with a client which provides one day a week of my time dedicated to improving Rust on Raspberry Pi Silicon. I will start next week.
<re_irc> <@newam:matrix.org> jorgeig:matrix.org: I'm a little late to the party, but I have been using `[u32]` buffers and transmuting them into `[u8]`, you can use `bytemuck::bytes_of` to make it safe. Also not a great solution.
<re_irc> <@newam:matrix.org> Reason I didn't put the copy in the AES code is that it was really bad for performance with large data transfers, though after this discussion it looks like `read_unaligned` could solve a lot of those problems πŸ€”
Foxyloxy has joined #rust-embedded
<re_irc> <@newam:matrix.org> firefrommo d donlight do you plan to make a PR? I will fix it this weekend if you're not planning to.
<re_irc> <@firefrommoonlight:matrix.org> I'll throw down an issue today or tmw. Probably not PR for a bit
<re_irc> <@firefrommoonlight:matrix.org> So far the only bugs I've confirmed are the EXI and port C IDR
<re_irc> <@9names:matrix.org> usbd-hid passes all tests in CI, but half of them fail on my PC on a clean git clone. anyone got any hints about what could be going wrong?
<re_irc> <@firefrommoonlight:matrix.org> Most of the other issues I ran into were WL using a different convention from what I expected, but have seem on other variants
<re_irc> <@jordens:matrix.org> firefrommoonlight:matrix.org: IIR is an IIR. There is no FIR.
<re_irc> <@yatekii:matrix.org> oh god what did I start
<re_irc> <@firefrommoonlight:matrix.org> Thanks. I may take a stab at FIR
<re_irc> <@firefrommoonlight:matrix.org> *I think RTC on WL PAC is SR instead of ISR
OutreEE has joined #rust-embedded
fabic has quit [Ping timeout: 260 seconds]
<re_irc> <@firefrommoonlight:matrix.org> newam Is the Radio able to be decoupled from HAL as a library? Eg how there are standalone bxCan and USB libs?
<re_irc> <@newam:matrix.org> Not anymore :/
<re_irc> <@newam:matrix.org> The protocol layer for LoRaWAN and sigfox will likely be the point of separation.
<re_irc> <@newam:matrix.org> There was too much coupling between the chip and the radio.
<re_irc> <@jamesmunns:matrix.org> Quick note, I released new versions of `blinq` (with support for new heapless), and `panic-persist` (with a couple of features that were hanging out unreleased forever)
<re_irc> <@jamesmunns:matrix.org> If I ever leave you hanging in my issues or PRs: Always feel free to ping me here. My GH notifications are... a nightmare.
<re_irc> <@daja_2:matrix.org> Hello everyone!
<re_irc> <@daja_2:matrix.org> error: linking with `cc` failed: exit status: 1
<re_irc> <@daja_2:matrix.org> |
<re_irc> <@daja_2:matrix.org> I have the worst linker error:
<re_irc> <@jamesmunns:matrix.org> looks like you are trying to compile an embedded binary for your desktop
<re_irc> <@jamesmunns:matrix.org> are you missing a `--target` or defining a target in your `.cargo/config.toml`?
<re_irc> <@jamesmunns:matrix.org> You don't see this with `cargo check` because it doesn't actually link an executable.
<re_irc> <@jamesmunns:matrix.org> You can check the app-template for a good example: https://github.com/knurling-rs/app-template/blob/main/.cargo/config.toml
<re_irc> <@jamesmunns:matrix.org> (also πŸ‘‹ hey Aissata, I owe you a message! I'll follow up privately :D )
<re_irc> <@daja_2:matrix.org> jamesmunns:matrix.org: (no worries I know you are buuuuuusy!)
<re_irc> <@daja_2:matrix.org> jamesmunns:matrix.org: It is a pseudo embedded binary, like it's simulated.
<re_irc> <@jamesmunns:matrix.org> Hmm, you might need to post the full error then. You might be trying to link in something that got confused
<re_irc> <@jamesmunns:matrix.org> (it looks like your error got cut off in the copy and paste)
<re_irc> <@daja_2:matrix.org> jamesmunns:matrix.org: Ah wait I get what you are saying. The program is a simulation of hardware, BUT I did try to import defmt! Maybe because of that, it believes that the target is an embedded platform.
<re_irc> <@daja_2:matrix.org> jamesmunns:matrix.org: Yes, it was so long that I took only the head of the hydra.
<re_irc> <@jamesmunns:matrix.org> defmt also doesn't compile/link well on mac os as well
<re_irc> <@jamesmunns:matrix.org> (because of how we abuse elf sections)
<re_irc> <@daja_2:matrix.org> jamesmunns:matrix.org: The transfer to linux is overdue...
<re_irc> <@dirbaio:matrix.org> on linux it builds but it doesn't work
<re_irc> <@daja_2:matrix.org> Thank you jamesmunns it was the issue. I removed defmt, the compiler is not confused anymore.
<re_irc> <@dirbaio:matrix.org> if you want to build the same program/lib for both std and embedded you'll want some way to switch between `defmt` and `log`
<re_irc> <@firefrommoonlight:matrix.org> newam:matrix.org: Gotcha. What HAL periphs does it use that cause this?
<re_irc> <@firefrommoonlight:matrix.org> I should probably just dive in to the code
<re_irc> <@jamesmunns:matrix.org> Turns out mac's linker REALLY doesn't it like it when you use JSON for sections names πŸ˜†
fabic has joined #rust-embedded
<re_irc> <@jamesmunns:matrix.org> jamesmunns:matrix.org: CC Danilo and ryan-summers, sorry to leave you hanging :D
<re_irc> <@firefrommoonlight:matrix.org> Is the radio code confined to the subghz folder? https://github.com/newAM/stm32wl-hal/tree/main/hal/src/subghz
<re_irc> <@firefrommoonlight:matrix.org> So many files!
<re_irc> <@newam:matrix.org> firefrommoonlight:matrix.org: Yup, and all the imports are `super` relative. There are some imports from the crate-level, but not many.
<re_irc> <@newam:matrix.org> firefrommoonlight:matrix.org: There are a ton of types for each command, most are smallish.
<re_irc> <@dirbaio:matrix.org> the radio/protocol layer could be async 🀩🀩🀩
<re_irc> <@newam:matrix.org> lulf is working on that 😁
<re_irc> <@newam:matrix.org> If you go back far enough in the git history there was a full async implementation of the radio. I just abandoned it because I realized you need a whole ecosystem like embassy to reasonably do async.
<re_irc> <@lulf_:matrix.org> Yup, the majority of that work is to be done in rust-lorawan ("link layer") so it can use async radios, i'm slowly prototyping something for that. Then, adding async variant of the subghz (based on stm32wl-hal) to embassy is easy
<re_irc> <@jorgeig:matrix.org> firefrommoonlight:matrix.org: I think we are all using a stm32wl coming from the latest YAMLs in stm32-rs, not the stm32wl from crates.io
<re_irc> <@jorgeig:matrix.org> that's not yet updated
<re_irc> <@jorgeig:matrix.org> newAM is using how own repo in the HAL (https://github.com/newAM/stm32wl-rs.git) and I'm using my own which does not allow cortex-m-rt >= 0.7 (https://github.com/jorgeig-space/stm32wl) because it doesn't work with RTIC
<re_irc> <@jorgeig:matrix.org> at least as far as I saw this morning!
<re_irc> <@newam:matrix.org> Oh I missed that part. Yeah, jorgeig added all the YAML for the STM32WL which hasn't made it into a crates.io release yet so we are all on git forks.
<re_irc> <@firefrommoonlight:matrix.org> Are there any examples with radio? The first lib only has basics like GPIO, and the second has none
<re_irc> <@jorgeig:matrix.org> the radio is not an MCU peripheral per se
<re_irc> <@jorgeig:matrix.org> it works through the SPI3
<re_irc> <@firefrommoonlight:matrix.org> Oh weird!
<re_irc> <@newam:matrix.org> In the main readme there's a full example of the radio usage in a separate repo
<re_irc> <@jorgeig:matrix.org> it's basically an sx12xx attached to the MCU
<re_irc> <@firefrommoonlight:matrix.org> Sweet
<re_irc> <@newam:matrix.org> Yeah, instead of an AXI mesh the radio uses an internal SPI mesh πŸ˜‚
<re_irc> <@newam:matrix.org> It is a little weird to say the least, but it works.
<re_irc> <@newam:matrix.org> Though there is also some hidden coupling, you can setup the PWR regs to put the radio into certain modes when entering WFI.
<re_irc> <@jorgeig:matrix.org> btw, have you noticed that on the nucleo board
<re_irc> <@jorgeig:matrix.org> you can ignore the rf switch
<re_irc> <@jorgeig:matrix.org> and everything works normally?
<re_irc> <@jorgeig:matrix.org> like, you don't have to switch to RX or TX
<re_irc> <@jorgeig:matrix.org> it just works
<re_irc> <@newam:matrix.org> jorgeig:matrix.org: Yeah! You won't be getting the 10km range, but definitely works indoors
<re_irc> <@jorgeig:matrix.org> I feel like all my RF profs are yelling at me
<re_irc> <@jorgeig:matrix.org> hahaha
<re_irc> <@newam:matrix.org> I'm more impressed I have not fried a radio yet! The two that run on-target CI were originally so that I had spares after I blew out the PA on the others 😁
<re_irc> <@jorgeig:matrix.org> they're definitely sturdy!!
gsalazar_ has joined #rust-embedded
gsalazar has quit [Ping timeout: 252 seconds]
gsalazar_ is now known as gsalazar
<re_irc> <@thejpster:matrix.org> I have found with RF developments that works != pass CE/FCC certification
<re_irc> <@thejpster:matrix.org> And the manufacturers rarely put an item in the Bill of Materials if they could get away with deleting it (profit++)
<re_irc> <@adamgreig:matrix.org> jorgeig:matrix.org: I'm back from holiday this evening so hopefully new release in next couple days
<re_irc> <@adamgreig:matrix.org> Get PRs in v soon if you want them firefrommoonlight
fabic has quit [Ping timeout: 252 seconds]
<re_irc> <@firefrommoonlight:matrix.org> Thx. Don't think I have time for this one; will have to wait until next time
<re_irc> <@dirbaio:matrix.org> if I have a bunch of 10BASE-T devices what's the cheapest way to wire them together?
<re_irc> <@dirbaio:matrix.org> obvious way is ethernet switches but that's not cheap
<re_irc> <@dirbaio:matrix.org> I guess "dumb" repeater hubs, but can't find much info on them
<re_irc> <@dirbaio:matrix.org> or does something like wiring all devices in parallel work? probably in half-duplex mode but I'm ok with that
<re_irc> <@jorgeig:matrix.org> It's cheaper to buy the switch πŸ˜…
<re_irc> <@dirbaio:matrix.org> less headaches? 🀣
<re_irc> <@dirbaio:matrix.org> off-the-shelf switches also have their headaches
<re_irc> <@dirbaio:matrix.org> ideally I want all devices to be powered from the bus. I can go with "real" PoE but then switches get expenssssive
<re_irc> <@dirbaio:matrix.org> since 10base-t only uses 2 pairs I was hoping to use the other 2 for power, but off-the-shelf switches don't work with that..
<re_irc> <@adamgreig:matrix.org> Depends what you wanna do but ethernet was made for shared mediums and hubs, you can literally parallel them
<re_irc> <@adamgreig:matrix.org> Even 100baseT is only two pairs and works shared
<re_irc> <@adamgreig:matrix.org> 100baseTX I mean
<re_irc> <@dirbaio:matrix.org> if there's tx/rx pairs how do you wire them up?
<re_irc> <@dirbaio:matrix.org> or you're supposed to use half duplex so there's just 1 pair in use?
<re_irc> <@adamgreig:matrix.org> Sorry, slightly inaccurate, yes you need to use half duplex, but you also need to make sure the device doesn't hear itself transmitting otherwise it detects a collision
<re_irc> <@adamgreig:matrix.org> Usually I think diodes are used in passive hubs, otherwise the tx from one would eventually work its way back to the same rx
<re_irc> <@dirbaio:matrix.org> "Seriously, shell out the $10." 🀣
<re_irc> <@adamgreig:matrix.org> But yea an ethernet switch ic is like a buck on lcsc
<re_irc> <@jorgeig:matrix.org> For the poe you could buy a 2md hand hub and diy some power on the unused pins
<re_irc> <@jorgeig:matrix.org> Then see the pretty fireworks
<re_irc> <@dirbaio:matrix.org> wow that diode maze
<re_irc> <@jorgeig:matrix.org> πŸ˜‚πŸ˜‚
<re_irc> <@jorgeig:matrix.org> If Spain is as I left it, there should be plenty of people that have old network hubs/switches at home selling them for 5 bucks
<re_irc> <@jorgeig:matrix.org> So you could get one of those
<re_irc> <@dirbaio:matrix.org> I see, so smart, it makes stuff on rx go to tx but to the two other ports only. scaling it to N ports requires O(n^2) diodes though right?
<re_irc> <@jorgeig:matrix.org> And fry it without remorse
<re_irc> <@dirbaio:matrix.org> this thing is for a legit product
<re_irc> <@jorgeig:matrix.org> Ahhhhh
<re_irc> <@dirbaio:matrix.org> intercom system, the kinda things where there's a bunch of buttons in a panel at the street and you can buzz a flat and the person from the flat can then open the door
<re_irc> <@dirbaio:matrix.org> lots of these use something like rs485 so they can wire everything in parallel, makes it cheaper, and easier to install (hence even cheaper)
<re_irc> <@dirbaio:matrix.org> so I was wondering whether ethernet is a viable replacement while not increasing cost too much
<re_irc> <@dirbaio:matrix.org> since we already ahve other ethernet-based products
<re_irc> <@dirbaio:matrix.org> dunno
<re_irc> <@adamgreig:matrix.org> If you don't have literal 10baseT stuff yet you could check out things like 10baseT1S which is multidrop on one pair
<re_irc> <@adamgreig:matrix.org> Bit more specialist but still ethernet the other side of the phy
gsalazar has quit [Ping timeout: 265 seconds]
<re_irc> <@firefrommoonlight:matrix.org> Just released a stm2-hal version with WL support. It's useless in its current form due to no radio support. Might be a good ref for support of other periphs and API