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
astapleton[m] has quit [Quit: Idle timeout reached: 172800s]
sroemer has joined #rust-embedded
rainingmessages has quit [Quit: bye]
rainingmessages has joined #rust-embedded
sroemer has quit [Quit: WeeChat 4.5.2]
sroemer has joined #rust-embedded
sroemer has quit [Changing host]
sroemer has joined #rust-embedded
_whitelogger has joined #rust-embedded
_whitelogger has joined #rust-embedded
jason-kairos[m] has quit [Quit: Bridge terminating on SIGTERM]
sourcebox[m] has quit [Quit: Bridge terminating on SIGTERM]
whitequark[cis] has quit [Quit: Bridge terminating on SIGTERM]
_catircservices has quit [Quit: Bridge terminating on SIGTERM]
adamgreig[m] has quit [Quit: Bridge terminating on SIGTERM]
dngrs[m] has quit [Quit: Bridge terminating on SIGTERM]
dirbaio[m] has quit [Quit: Bridge terminating on SIGTERM]
PatrickLloyd[m]1 has quit [Quit: Bridge terminating on SIGTERM]
thejpster[m] has quit [Quit: Bridge terminating on SIGTERM]
JonathanKeller[m has quit [Quit: Bridge terminating on SIGTERM]
JamesMunns[m] has quit [Quit: Bridge terminating on SIGTERM]
Ralph[m] has quit [Quit: Bridge terminating on SIGTERM]
U007D[m] has quit [Quit: Bridge terminating on SIGTERM]
korbin[m] has quit [Quit: Bridge terminating on SIGTERM]
danielb[m] has quit [Quit: Bridge terminating on SIGTERM]
burrbull[m] has quit [Quit: Bridge terminating on SIGTERM]
diondokter[m] has quit [Quit: Bridge terminating on SIGTERM]
KevinPFleming[m] has quit [Quit: Bridge terminating on SIGTERM]
chrysn[m] has quit [Quit: Bridge terminating on SIGTERM]
bartmassey[m] has quit [Quit: Bridge terminating on SIGTERM]
i509vcb[m] has quit [Quit: Bridge terminating on SIGTERM]
jannic[m] has quit [Quit: Bridge terminating on SIGTERM]
therealprof[m] has quit [Quit: Bridge terminating on SIGTERM]
rmsyn[m] has quit [Quit: Bridge terminating on SIGTERM]
EricSeppanen[m] has quit [Quit: Bridge terminating on SIGTERM]
Koen[m] has quit [Quit: Bridge terminating on SIGTERM]
rafael[m] has quit [Quit: Bridge terminating on SIGTERM]
_catircservices has joined #rust-embedded
_whitelogger has joined #rust-embedded
bitts[m] has joined #rust-embedded
<bitts[m]> Huh, I'm trying to include some c-files into a rust (cortex-a53) project using cc. It compiles fine when I build locally on my (arm) Mac, but if I try to build in a Docker, I get a `rust-lld: error: /<snip>/target/aarch64-unknown-none/debug/build/int_test-3e1a21ae7e1a8a49/out/libweetest.a(db3b6bfb95261072-weetest.o) is incompatible with /tmp/rustcSdBeHS/symbols.o`. Anybody know what is going on?
<bitts[m]> * project using the cc, * cc crate. It
thejpster[m] has joined #rust-embedded
<thejpster[m]> Your Mac will have clang, which is a cross compiler. What C compilers does your docker container have?
<thejpster[m]> Here’s an example that works on Mac and Linux. The CI pipeline on Linux installs gnu-arm-none-eabi, which cc finds automatically.
<bitts[m]> The docker has both aarch64-none-elf-gcc, tiarmclang, arm-none-eabi (and more). I guess cc needs some more hints on which compiler to choose..
whitequark[cis] has joined #rust-embedded
<whitequark[cis]> folks, what would you use for structured-ish data exchange between Rust and Python code? deserialization perf Python-side matters a lot to me
<whitequark[cis]> (asking here since I think my preferences for this project are typical for an embedded one, although it all runs on a PC)
ben[m] has joined #rust-embedded
<ben[m]> <whitequark[cis]> "folks, what would you use for..." <- You could look into postcard-rpc. But as far as I know you need to write you own python side for it.
<ben[m]> James Munns might have some thoughts on this
<ben[m]> * You could look into postcard-rpc. But as far as I know you need to write you own python side for it.
<ben[m]> James Munns might have some thoughts on this
<ben[m]> * You could look into postcard-rpc. But as far as I know you need to write you own python side for it. Perhaps a better solution would be to let postcard-rpc do the deserialisation and call that from within python.
<ben[m]> James Munns might have some thoughts on this
jason-kairos[m] has joined #rust-embedded
<jason-kairos[m]> design question: in a multithreaded system it can be nice to append the name of the thread "battery management thread: starting charge cycle" to serial port println!()s (it's plain ascii, no fancy precomputed defmt etc... (full message at
<thejpster[m]> I’d call it “tprintln!”
<bitts[m]> <ben[m]> "You could look into postcard-rpc..." <- We used postcard + PyO3 a while back, but I would not call the experience smooth. There were quite a few gotchas and things that did not work quite as you would expect. Possible, but I am hesitant to recommend it..
dne has quit [Remote host closed the connection]
dne has joined #rust-embedded
JamesMunns[m] has joined #rust-embedded
<JamesMunns[m]> <ben[m]> "You could look into postcard-rpc..." <- Happy to chat about postcard-rpc, it could definitely work through FFI/pyO3, there's definitely no official non-Rust bindings yet.
<JamesMunns[m]> I'm very open to Python bindings for postcard/postcard-rpc, and have some ideas, but it's definitely not ready to use outside of Rust-to-Rust
korbin[m] has joined #rust-embedded
<korbin[m]> <whitequark[cis]> "folks, what would you use for..." <- the new postcard IDL probably
<JamesMunns[m]> <ben[m]> "You could look into postcard-rpc..." <- Yeah, the new IDL would be one way to generate python bindings, it's still a work in progress tho, and doesn't really do codegen yet. I got pulled off on other things
<jason-kairos[m]> I noticed when interfacing with a C library using autogenerated bindings that the bindings work if the C library is compiled with llvm/clang and it breaks if it is compiled with GCC.
<jason-kairos[m]> for certain reasons, I'd prefer to build the C library with GCC but am somewhat mystified that it matters
<jason-kairos[m]> * for certain reasons, I'd prefer to build the C library with GCC but am somewhat mystified that choice of compiler matters at all for bindings
<JamesMunns[m]> you probably want to check your build flags for both GCC and LLVM. There are sometimes some subtle differences that will cause problems
<JamesMunns[m]> off the top of my head, gcc defaults to -fshort-enums for embedded targets, while llvm doesn't
<JamesMunns[m]> * llvm doesn't (I think?)
<jason-kairos[m]> that sounds almost exactly like what I was running into (fields of nested unions/structs emulating a dataful enum)
<JamesMunns[m]> also make sure you are fully configuring bindgen for the specific target you are using
<JamesMunns[m]> it's been a while since I've had to do it, so I don't remember all the settings off the top of my head, but maybe someone has done bindgen things more recently
<JamesMunns[m]> https://github.com/nrf-rs/nrfxlib-sys/blob/develop/build.rs might be a reasonable place to start
<JamesMunns[m]> but in general, it would be good to verify your ABI-sensitive parts, like struct sizes, alignment, float mode, etc.
<jason-kairos[m]> s/info/into/, s/./.\/
<jason-kairos[m]> s/info/into/
<JamesMunns[m]> yes, all those things. I've done spot checking manually before, I think bindgen will spit out layout tests for you which you can cross check as well
<jason-kairos[m]> now that I think about it, the proper way might be to inspect the binaries with a script as part of compilation. Pull out the C structure layout and compare it to the rust one using debug symbols. But that would be a great deal of work.
<jason-kairos[m]> * the binaries in `target/` with a
<jason-kairos[m]> * the binaries in `target/` with a, * of work. Debug symbols are not fun to work with.
<JamesMunns[m]> in the past I've very much just stored stuff like `sizeof` in a variable and did gdb stepping to spot check
<JamesMunns[m]> or printf or whatever
<JamesMunns[m]> there are probably smarter ways to do it
<jason-kairos[m]> surely any test performed in a rust file must implicitly assume that the C library was also compiled with LLVM and probably with certain flags, right?
richardeoin has quit [Ping timeout: 252 seconds]
dngrs[m] has joined #rust-embedded
<dngrs[m]> you should be able to rely on the C ABI
richardeoin has joined #rust-embedded
<jason-kairos[m]> maybe GCC does noncompliant things by default without certain flags (for example James mentioned `-fshort-enums` which I think is true)
<jason-kairos[m]> while rust might have a well defined/behaved expectation - it seems the generated library can easily not meet that expectation, and it possibly seems it can go undetected
<jason-kairos[m]> * maybe GCC does noncompliant things by default without certain flags (for example James mentioned `-fshort-enums` which I think is true)
<jason-kairos[m]> while rust might have a well defined/behaved expectations of what the ABI "should be" - it seems the generated library can easily not meet that expectation, and it possibly seems it can go undetected
<jason-kairos[m]> * maybe GCC does noncompliant things by default without certain flags (for example James mentioned `-fshort-enums` which I think is true)
<jason-kairos[m]> while rust might have a well defined/behaved expectations of what the ABI "should be" - it seems the generated library can easily not meet that expectation, and it possibly seems it can go undetected. At least, that has been my experience with a certain library running a product I'm developing.
<dngrs[m]> you might find this interesting (unsure if helpful tho): https://faultlore.com/blah/abi-puns/
<jason-kairos[m]> '“everyone pretends to be C, even though C has the worst and wobbliest ABIs of all time”.'
<jason-kairos[m]> I like this article - it might just be helpful
<jason-kairos[m]> it says that rustc, clang, and gcc all generate different incompatible ABIs for certain cases (i128 - which doesn't apply to me). This is shattering my view that compilng the C library with LLVM instead of GCC was automatically safe (it isn't).
<JamesMunns[m]> it's like all C abis: it's dependent on a lot of unspecified platform things
<JamesMunns[m]> it's definitely possible to get working, but it does require some care
<jason-kairos[m]> I think what I have to do is find out what compiler flags this tool uses for it's abi tests.
<jason-kairos[m]> edit: I guess that ideal is flawed. I'd doubt anyone has tried testing ABI compatibility on ARM Cortex M0+ using this tool - so it wouldn't necessarily know the flags (because it varies by playform/targeT)
<jason-kairos[m]> and I suppose nrxlib is for ARM Cortex M33 - not necessarily the same, although it is closer
pcs38 has quit [Quit: leaving]
<jason-kairos[m]> * I think what I have to do is find out what compiler flags this tool uses for it's abi tests.
<jason-kairos[m]> edit: I guess that idea is flawed. I'd doubt anyone has tried testing ABI compatibility on ARM Cortex M0+ using this tool - so it wouldn't necessarily know the flags (because it varies by playform/targeT)
sroemer has quit [Quit: WeeChat 4.5.2]
<dngrs[m]> the one thing I can say from experience is that stuff like [the cmsis-dsp Rust bindings](https://github.com/samcrow/cmsis_dsp.rs) has worked for me, and from what I can tell it uses prebuilt libraries that were made with GCC, see https://github.com/samcrow/cmsis_dsp.rs/blob/master/cmsis_dsp_sys_pregenerated/build.rs#L73
<jason-kairos[m]> that's interesting
<jason-kairos[m]> I wonder if any manufacturers have done this work already (in a way that is publicly visible) but I don't necessarily know who or what.
<jason-kairos[m]> I think math functions have relatively simple function signatures / types / etc. - not many structs, unions, enums, etc. which probably makes the task of "getting it right for the subset of things that the DSP library uses" a lot easier than getting everything correct in general
ello_ has quit [Quit: ZNC 1.9.1 - https://znc.in]
exark has quit [Quit: quit]
exark has joined #rust-embedded
ello has joined #rust-embedded
ello- has quit [Quit: ZNC 1.9.1 - https://znc.in]
ello_ has joined #rust-embedded
pcs38 has joined #rust-embedded
<whitequark[cis]> <korbin[m]> "the new postcard IDL probably" <- thanks, this is the kind of answer I am interested in! I'm considering this as an alternative to a fully homegrown serialization format, so having to implement a bunch of stuff doesn't scare me
<whitequark[cis]> whitequark[cis]: basically what I want is a way for gateware to produce byte streams that can be easily consumed by both Rust and Python code
<JamesMunns[m]> <korbin[m]> "the new postcard IDL probably" <- https://github.com/jamesmunns/postcard-idl is here, the wire spec for `postcard` is here: https://postcard.jamesmunns.com/
<JamesMunns[m]> I've started writing out a more formal description of postcard-rpc here: https://postcard.rs/, the top level docs of postcard-rpc also aren't a bad example of how things currently work: https://docs.rs/postcard-rpc/latest/postcard_rpc/
<JamesMunns[m]> <korbin[m]> "the new postcard IDL probably" <- https://matrix.to/#/#onevariable:matrix.org is usually where I chat about postcard-specific stuff, happy to answer any questions here or there tho!
<whitequark[cis]> <whitequark[cis]> "basically what I want is a way..." <- I wonder if I should adopt the postcard-rpc architecture wholesale for Glasgow internals
<whitequark[cis]> whitequark[cis]: it's solving more or less the same problem
<JamesMunns[m]> <korbin[m]> "the new postcard IDL probably" <- ooh, very cool!
<JamesMunns[m]> <korbin[m]> "the new postcard IDL probably" <- My current research area is actually trying to formalize more of a "net stack" based on the concepts from postcard-rpc, so I can also handle things like "bridged nodes", where you have a PC talking to a device over USB, which is then connected to another device over UART
<JamesMunns[m]> <korbin[m]> "the new postcard IDL probably" <- I have some hacky limited "bridging" capability for this, but it's a very "network stack and routing" shaped problem
<JamesMunns[m]> <korbin[m]> "the new postcard IDL probably" <- and then, eventually, I'd like to use it as the basis of the kernel message passing interface for mnemos, but, that's more "eventually" :D
ello has quit [Read error: Connection reset by peer]
ello_ has quit [Read error: Connection reset by peer]
ello has joined #rust-embedded
ello_ has joined #rust-embedded
ello_ has quit [Read error: Connection reset by peer]
ello has quit [Read error: Connection reset by peer]
ello has joined #rust-embedded
ello_ has joined #rust-embedded
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #rust-embedded
pcs38 has quit [Quit: leaving]
ivche_ has joined #rust-embedded
ivche has quit [Ping timeout: 272 seconds]
ivche_ is now known as ivche
KevinPFleming[m] has joined #rust-embedded
<KevinPFleming[m]> <whitequark[cis]> "it's solving more or less the..." <- I am using protobuf, with the micropb crate on the Rust side.