<re_irc> <@jacobrosenthal:matrix.org> firefrommoonlight:matrix.org: I did just linking like this https://crates.io/crates/cmsis-dsp-sys
<re_irc> <@jacobrosenthal:matrix.org> Also some guy asked me to give him that crate name and wouldn't pr me. So he published this https://crates.io/crates/cmsis_dsp
<re_irc> <@jacobrosenthal:matrix.org> Translate sounds really interesting with the work adamgreig ? I think? Was doing cleaning up last intrinsics + new asm nightly
<re_irc> <@firefrommoonlight:matrix.org> This looks great! Diving into both examples
<re_irc> <@firefrommoonlight:matrix.org> (Importing the C lib through FFI seems like the best approach if there are no caveats; I mentioned translate in the case of needing only a few functions from it, and the C compiling sounding intimidating)
<re_irc> <@firefrommoonlight:matrix.org> *it sounds like you've already solved the C compiling/FFI piece
<re_irc> <@jacobrosenthal:matrix.org> I'm just bindgen the headers and linking the .a file if I recall
<re_irc> <@firefrommoonlight:matrix.org> NVM; you're readme is pretty clear about compiling/FFI not being simple :(
<re_irc> <@jacobrosenthal:matrix.org> It might be easier now. Haven't looked at it a while
<re_irc> <@firefrommoonlight:matrix.org> Do you remember how you build it? This link has a few options, but I'm not sure which is appropriate for FFI: https://arm-software.github.io/CMSIS_5/Build/html/CmdLineBuild.html
<re_irc> <@firefrommoonlight:matrix.org> And if let's say, it turns it into a big binary the compiler can't split up if I only need a few fns etc?
<re_irc> <@jacobrosenthal:matrix.org> It just comes with usually
<re_irc> <@firefrommoonlight:matrix.org> Ideally, you'd have a small Rust lib with some glue code that lets you just call any CMSIS function. The aips are generally array or float based (or integer based), so the API could map 1:1 with C
<re_irc> <@firefrommoonlight:matrix.org> Oh!
<re_irc> <@jacobrosenthal:matrix.org> They bundle one for each cortex
<re_irc> <@firefrommoonlight:matrix.org> Oh nice!
<re_irc> <@jacobrosenthal:matrix.org> For better or worse I download for you under the hood if I recall
<re_irc> <@jacobrosenthal:matrix.org> So occasionally you have 10 of them taking up gigs but that's a common cargo prob anyway :shrug:
<re_irc> <@firefrommoonlight:matrix.org> Oh nice!
<re_irc> <@firefrommoonlight:matrix.org> Yea - I just assume coding with Rust needs ampl HD space, or frequent deletions of target. Hopefully they fix that eventually
<re_irc> <@firefrommoonlight:matrix.org> I think I'm going to just use your lib
<re_irc> <@firefrommoonlight:matrix.org> Looks full up
<re_irc> <@firefrommoonlight:matrix.org> Is there a way to make your lib work on nostd?
<re_irc> <@firefrommoonlight:matrix.org> Currently getting `can't find crate for std` if I import it
<re_irc> <@firefrommoonlight:matrix.org> Under the `compiling base64` step
<re_irc> <@jacobrosenthal:matrix.org> I had a project with it no std unless something rotted
<re_irc> <@jacobrosenthal:matrix.org> Maybe resolver 2?
<re_irc> <@firefrommoonlight:matrix.org> More info: ``std` is required by `byteorder` because it does not declare `#![no_std]``\
<re_irc> <@jacobrosenthal:matrix.org> Note the resolver 2 for the build deps
<re_irc> <@firefrommoonlight:matrix.org> What's a resolver 2?
<re_irc> <@jacobrosenthal:matrix.org> Will be default for edition 2021
<re_irc> <@firefrommoonlight:matrix.org> Oh nice
<re_irc> <@jacobrosenthal:matrix.org> Could also do that instead
<re_irc> <@firefrommoonlight:matrix.org> I'm going to put that in all my projects!
<re_irc> <@firefrommoonlight:matrix.org> Sounds like a win in all cases
<re_irc> <@jacobrosenthal:matrix.org> Yeah was a huge pain point forever colloquially know as good old 5730
<re_irc> <@jacobrosenthal:matrix.org> https://github.com/rust-lang/cargo/issues/5730
<re_irc> <@firefrommoonlight:matrix.org> Gets past that step now. Now it's an Error 101 with lots of words!
<re_irc> <@firefrommoonlight:matrix.org> *exit code 101
<re_irc> <@firefrommoonlight:matrix.org> f\release\build\cmsis-dsp-sys-584e46604e7e1a13\out\CMSIS/CMSIS/DSP/Lib/GCC
<re_irc> <@firefrommoonlight:matrix.org> cargo:rustc-link-lib=static=arm_cortexM4lf_math
<re_irc> <@firefrommoonlight:matrix.org> ``` etc
<re_irc> <@firefrommoonlight:matrix.org> thread 'main' panicked at 'Unable to find libclang: "couldn't find any valid shared libraries matching: ['clang.dll', 'libclang.dll'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"
<re_irc> <@firefrommoonlight:matrix.org> ```rust
<re_irc> <@firefrommoonlight:matrix.org> It appears this is the sort of thing I was worried about; getting flashbacks about installing Linux programs
<re_irc> <@jacobrosenthal:matrix.org> looks like something from bindgen maybe they have something? https://crates.io/crates/bindgen
<re_irc> <@firefrommoonlight:matrix.org> Thanks. I'll check that out
starblue has quit [Ping timeout: 252 seconds]
starblue has joined #rust-embedded
<re_irc> <@firefrommoonlight:matrix.org> Fixed via installing LLVM, from the instructions here: https://github.com/rust-lang/rust-bindgen/blob/master/book/src/requirements.md
<re_irc> <@firefrommoonlight:matrix.org> I think it would be worth putting that link, or the instructions in it, on your Readme
<re_irc> <@firefrommoonlight:matrix.org> Dude. It works. The sin hello world works after those 2 changes (Resolution 2, and installing LLVM / setting up the LIBCLANG PATH (sp?) env var
<re_irc> <@firefrommoonlight:matrix.org> Thank you
<re_irc> <@firefrommoonlight:matrix.org> I can't believe I was considering a rust translation
<re_irc> <@firefrommoonlight:matrix.org> I'll tackle your LIBM note later if/when it comes up
GenTooMan has quit [Ping timeout: 260 seconds]
GenTooMan has joined #rust-embedded
DepthDeluxe has quit [Ping timeout: 252 seconds]
fabic has joined #rust-embedded
dcz has joined #rust-embedded
dcz_ has joined #rust-embedded
dcz has quit [Ping timeout: 260 seconds]
emerent has quit [Ping timeout: 252 seconds]
emerent_ has joined #rust-embedded
emerent_ is now known as emerent
fabic has quit [Ping timeout: 260 seconds]
<re_irc> <@korken89:matrix.org> Does anyone know of a crate that works (is as easy as) `python-can` for PC side applications using CAN?
<re_irc> <@korken89:matrix.org> https://crates.io/crates/socketcan seems to be about the same, but has a "being rewritten" warning in the readme
<re_irc> <@therealprof:matrix.org> jacobrosenthal:matrix.org: If we just had a a crate supporting Q types and arithmetic we could pretty easily RIIR and even let LLVM do some of the heavy lifting of using DSP instructions rather than doing it manually in assembly.
fabic has joined #rust-embedded
PyroPeter has joined #rust-embedded
fabic_ has joined #rust-embedded
fabic has quit [Ping timeout: 265 seconds]
<re_irc> <@braincode:matrix.org> korken89:matrix.org: Despite the warnings, it worked well for me so far, what’s your use case?
GenTooMan has quit [Ping timeout: 260 seconds]
<re_irc> <@braincode:matrix.org> I used socketcan-isotp recently and found a few reliability issues with Cantact Pro from Eric Evenchick: https://github.com/linklayer/cantact/issues/19, but ymmv with other CAN dongles, which one are you using?
GenTooMan has joined #rust-embedded
starblue has quit [Ping timeout: 265 seconds]
starblue has joined #rust-embedded
<re_irc> <@korken89:matrix.org> braincode:matrix.org: Nice
<re_irc> <@korken89:matrix.org> I'm writing a production tool to read data from a panel of sensors and error some calibration data back
<re_irc> <@korken89:matrix.org> But then someone has used it successfully, I'll give it a proper try and see:)
DepthDeluxe has joined #rust-embedded
<re_irc> <@jacobrosenthal:matrix.org> therealprof:matrix.org: Dont appear to be Q, but thoughts on those no_std 32bit fixed crates on cargo? https://crates.io/crates/fixed https://crates.io/crates/ufix
<re_irc> <@therealprof:matrix.org> jacobrosenthal:matrix.org: Sweet. Indeed `FixedI32<U32>` seems to be the same a `Q31` and FixedI16<U16>` the same as Q15. Not sure how good the internal implementation is in terms of generating ideal code for those special cases. Also I find the description a bit iffy since the formulas don't mention the sign bit.
starblue has quit [Ping timeout: 265 seconds]
fabic_ has quit [Ping timeout: 252 seconds]
starblue has joined #rust-embedded
DepthDeluxe has quit [Ping timeout: 245 seconds]
fabic_ has joined #rust-embedded
<re_irc> <@firefrommoonlight:matrix.org> I'm hoping to use just the f32 variants for now, but it would certainly be nice to have support for fixed too, to support the full CMSIS API
fabic_ has quit [Ping timeout: 260 seconds]
GenTooMan has quit [Ping timeout: 252 seconds]
GenTooMan has joined #rust-embedded
dcz_ has quit [Ping timeout: 260 seconds]
nohit has quit [Ping timeout: 256 seconds]
nohit has joined #rust-embedded
troth has quit [Quit: Leaving.]
bpye has quit [Quit: The Lounge - https://thelounge.chat]
bpye has joined #rust-embedded
<re_irc> <@oddstr13:matrix.org> Alright, so, I'm a bit stuck attempting to translate this example to no_std…
<re_irc> <@oddstr13:matrix.org> I can't quite figure out what I'm supposed to replace the Vec! and BTreeMap stuff with.
<re_irc> <@oddstr13:matrix.org> It looks like the ManagedSlice wants something like `let mut rxps: [u8; 64];` UdpSocketBuffer::new(&mut rxps);`, but that doesn't do the trick https://crates.io/crates/managed#usage
<re_irc> <@dirbaio:matrix.org> this example works on nostd https://github.com/smoltcp-rs/smoltcp/blob/master/examples/loopback.rs
<re_irc> <@dirbaio:matrix.org> perhaps the issue is `&mut rxps` -> `&mut rxps[..]`
<re_irc> <@dirbaio:matrix.org> without the `[..]` you're passing a `&mut [u8; 64]`, and it wants a `&mut [u8]`
<re_irc> <@oddstr13:matrix.org> Should've checked all the examples 🙄 Thanks 😅
GenTooMan has quit [Ping timeout: 260 seconds]
GenTooMan has joined #rust-embedded
DepthDeluxe has joined #rust-embedded
<re_irc> <@oddstr13:matrix.org> I just love helpful error messages!
<re_irc> <@oddstr13:matrix.org> It's missing `#[derive(Debug)]` apparently.
GenTooMan has quit [Ping timeout: 245 seconds]
<re_irc> <@jamesmunns:matrix.org> Today I am excited because my RS-485 hardware works :D
<re_irc> <@jamesmunns:matrix.org> I haven't gotten it plugged into my network stack yet, but it can receive bytes, and that means the physical layer works as expected!
GenTooMan has joined #rust-embedded
GenTooMan has quit [Ping timeout: 260 seconds]
<re_irc> <@oddstr13:matrix.org> the method `finalize` exists for struct `InterfaceBuilder<'_, IEEE802154Socket<'_>>`, but its trait bounds were not satisfied
<re_irc> <@oddstr13:matrix.org> How do I go about actually debugging this error in any meaningful way?
<re_irc> <@oddstr13:matrix.org> the error is due to me not implementing `smoltcp::phy::Device` properly, but how do I tell what I did wrong?
<re_irc> <@dirbaio:matrix.org> doesn't it have more info on *which* trait bound is not satisfied?
<re_irc> <@oddstr13:matrix.org> not really?
<re_irc> <@dirbaio:matrix.org> wut
<re_irc> <@oddstr13:matrix.org> if that does say anything more about it, then I'm not seeing it
<re_irc> <@dirbaio:matrix.org> OK, it's this one then https://github.com/smoltcp-rs/smoltcp/blob/master/src/iface/interface.rs#L68
<re_irc> <@dirbaio:matrix.org> that lifetime is very cursed indeed
<re_irc> <@dirbaio:matrix.org> you probably don't want the `'a` in Ieee82154Socket
<re_irc> <@dirbaio:matrix.org> ```rust
<re_irc> <@dirbaio:matrix.org> struct Ieee82154Socket { .. }
<re_irc> <@dirbaio:matrix.org> impl<'a> Device<'a> for Ieee82154Socket { ... }
<re_irc> <@dirbaio:matrix.org> unless you need Ieee82154Socket to actually borrow things? in that case I think you may be in trouble...
<re_irc> <@dirbaio:matrix.org> can you post the code?
<re_irc> <@dirbaio:matrix.org> hmmhmhm
<re_irc> <@dirbaio:matrix.org> try to make it so IEEE802154Socket doesn't have any lifetime yeah
<re_irc> <@dirbaio:matrix.org> pub struct IEEE802154Socket {
<re_irc> <@dirbaio:matrix.org> ```rust
<re_irc> <@dirbaio:matrix.org> lower: ieee802154::Radio<'static>,
<re_irc> <@oddstr13:matrix.org> Is this when I go back to my 🐍? 😆
<re_irc> <@dirbaio:matrix.org> the lifetime on Radio is just for the clocks? wtf
<re_irc> <@oddstr13:matrix.org> …don't ask me, I'm new to this 😎
<re_irc> <@oddstr13:matrix.org> I'm also giving the clocks to USB, so how that doesn't clash I dunno
<re_irc> <@oddstr13:matrix.org> oh, nice! I wondered why I wasn't seeing that one earlier…
<re_irc> <@oddstr13:matrix.org> right, so, uh, static clocks?
<re_irc> <@dirbaio:matrix.org> you're already making the clocks static
<re_irc> <@dirbaio:matrix.org> you need a `&*` in here
<re_irc> <@dirbaio:matrix.org> ` let clocks = &*unsafe { CLOCKS.get_or_insert(_clocks) };`
<re_irc> <@dirbaio:matrix.org> to convert from `&mut` to `&`
<re_irc> <@oddstr13:matrix.org> That did the trick, but what exactly did that do?
<re_irc> <@dirbaio:matrix.org> uh
<re_irc> <@dirbaio:matrix.org> if you have a `&'static mut Foo` and you pass it to a function that requires `&Foo`
<re_irc> <@dirbaio:matrix.org> rust will borrow first, breaking the `'static`, and *after* it will convert `&mut` to `&`
<re_irc> <@dirbaio:matrix.org> if you convert to `&'static Foo` manually first, then you can borrow two `&'static Foo` from that no problem, because `&` can be copied all youw ant
<re_irc> <@dirbaio:matrix.org> it's a bit weird :S
<re_irc> <@oddstr13:matrix.org> in C, * would be get value at address, and & would be get address of value iirc, so &* would do pretty much nothing
<re_irc> <@dirbaio:matrix.org> here it converts from `&mut` to `&`
<re_irc> <@oddstr13:matrix.org> this feels like a hack to get rust to behave 😆
<re_irc> <@dirbaio:matrix.org> `&mut *` would indeed do nothing