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
rardiol has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
dc740 has quit [Remote host closed the connection]
starblue has quit [Ping timeout: 250 seconds]
starblue has joined #rust-embedded
<re_irc> <@paologentili:matrix.org> hi, is there any way to define two memory.x files and pick one using --feature?
<re_irc> <@diondokter:matrix.org> : Yes, kinda. You need to put it in your build.rs then
<re_irc> <@sjm42:matrix.org> https://github.com/sjm42/cortex-m-test2 <-- there is an example
<re_irc> <@thejpster:matrix.org> : I do this on the Neotron os. I have a binary for each linker configuration and switch the linker script based on the binary name in build.rs.
<re_irc> <@thejpster:matrix.org> https://github.com/neotron-compute/neotron-os
<re_irc> <@paologentili:matrix.org> thanks guys, I ended up with something similar to what suggested. I'm matching against the build profile actually.
starblue has quit [Ping timeout: 250 seconds]
starblue has joined #rust-embedded
starblue has quit [Ping timeout: 264 seconds]
starblue has joined #rust-embedded
<re_irc> <@firefrommoonlight:matrix.org> Nice! I'm also going to start using something like this
<re_irc> <@firefrommoonlight:matrix.org> *It works!
<re_irc> <@firefrommoonlight:matrix.org> Can probe-rs's "runner" flag in "config.toml" be feature-gated in a similar way?
<re_irc> <@diondokter:matrix.org> : Only on target triple level I think
<re_irc> <@diondokter:matrix.org> But, it seems you can provide the chip argument by setting an env variable as well: https://github.com/knurling-rs/probe-run/blob/main/src/cli.rs#L27
<re_irc> <@firefrommoonlight:matrix.org> Oh nice!
<re_irc> <@diondokter:matrix.org> You should be able to set that variable in the build.rs
<re_irc> <@firefrommoonlight:matrix.org> That makes sesnse in context
<re_irc> <@firefrommoonlight:matrix.org> Hopefully this works:
<re_irc> [target.'cfg(all(target_arch = "arm", target_os = "none", feature = "h72"))']
<re_irc> runner = "probe-run --chip STM32H743VIHx" # to list chips, run `probe-run --list-chips.`
<re_irc> [target.'cfg(all(target_arch = "arm", target_os = "none", feature = "g42"))']
<re_irc> runner = "probe-run --chip STM32G473CEUx"
<re_irc> <@firefrommoonlight:matrix.org> Hopefully this works:
<re_irc> runner = "probe-run --chip STM32H743VIHx" # to list chips, run `probe-run --list-chips.`
<re_irc> [target.'cfg(all(target_arch = "arm", target_os = "none", feature = "h7"))']
<re_irc> runner = "probe-run --chip STM32G473CEUx"
<re_irc> [target.'cfg(all(target_arch = "arm", target_os = "none", feature = "g4"))']
IlPalazzo-ojiis1 has joined #rust-embedded
IlPalazzo-ojiis1 has quit [Ping timeout: 246 seconds]
<re_irc> <@roy.buitenhuis-tnl:matrix.org> I have a project that has svd2rust as build dependency. Now I am trying to add log (0.4.17) to my project as a dependency, but it won't compile as svd2rust uses the std flag on log. I have no clue why this is an issue, aren't build dependencies build totally separate from your embedded application's binary?
<re_irc> When I rename build.rs to build.rs.bak and comment out svd2rust under build dependencies, it compiles log without issues for no_std.
<re_irc> What am I missing here?
<re_irc> <@roy.buitenhuis-tnl:matrix.org> Actually trying to add gdbstub, which in turn adds log (0.4.17). But both give the same issue.
<re_irc> <@roy.buitenhuis-tnl:matrix.org> Apparently, I was using the old feature resolver because I was on edition 2018 still. 😅
dc740 has joined #rust-embedded
<re_irc> <@dirbaio:matrix.org> : omg, does this work? 👀
IlPalazzo-ojiisa has joined #rust-embedded
<re_irc> <@mciantyre:matrix.org> : I've tried this in the past but had luck. See https://doc.rust-lang.org/cargo/reference/config.html#target
<re_irc> > Do not try to match on debug_assertions or Cargo features like feature="foo".
<re_irc> <@mciantyre:matrix.org> +never
<re_irc> <@dirbaio:matrix.org> :(
<re_irc> <@dirbaio:matrix.org> was too good to be true
<re_irc> <@halfbit:matrix.org> it worked for me when I tried it with the imxrt1060evk I have
<re_irc> <@halfbit:matrix.org> ohhh feature matching the runner, nvm
<re_irc> <@halfbit:matrix.org> I misread :-D
<re_irc> <@halfbit:matrix.org> don't features set some env vars though? maybe a little probe-run wrapper?
<re_irc> <@halfbit:matrix.org> CARGO_CFG_TARGET_FEATURE seems to be the thing, I guess it'd require a little wrapper though to sort out
<re_irc> <@sjm42:matrix.org> Never underestimate the power of a small shell script wrapper :p
<re_irc> <@dirbaio:matrix.org> TIL you can "break" out of a "{}" block:
<re_irc> break 'a 1234;
<re_irc> 5678
<re_irc> let foo = 'a: {
<re_irc> };
<re_irc> assert_eq!(foo, 1234);
<re_irc> <@ryan-summers:matrix.org> Why did I never know that. That's so useful
emerent has quit [Ping timeout: 260 seconds]
<re_irc> let res = match op {
<re_irc> Operation::Read(buf) => self.bus.read(buf).await,
<re_irc> let op_res = 'ops: {
<re_irc> for op in operations {
<re_irc> <@dirbaio:matrix.org> sort of useful to emulate "try" on stable:
<re_irc> Operation::Transfer(read, write) => self.bus.transfer(read, write).await,
<re_irc> Operation::Write(buf) => self.bus.write(buf).await,
<re_irc> Operation::TransferInPlace(buf) => self.bus.transfer_in_place(buf).await,
<re_irc> };
<re_irc> if let Err(e) = res {
<re_irc> break 'ops Err(e);
emerent has joined #rust-embedded
<re_irc> }
<re_irc> }
<re_irc> Ok(())
<re_irc> };
<re_irc> <@therealprof:matrix.org> Hah, I did actually know but couldn't think of any clever use.
<re_irc> <@dirbaio:matrix.org> would be cool to be able to break values out of non-infinite loops too...]
<re_irc> <@dirbaio:matrix.org> * too...\
<re_irc> <@dirbaio:matrix.org> * too...
<re_irc> <@therealprof:matrix.org> Hm, wasn't there a way to desugar a for loop into a while loop?
<re_irc> <@dirbaio:matrix.org> you can't break values out of "while"s either
<re_irc> <@dirbaio:matrix.org> I guess the trouble is: what value would be returned if no break runs
<re_irc> <@dirbaio:matrix.org> for/else? :D
<re_irc> <@dirbaio:matrix.org> let op_res = for op in operations {
<re_irc> Operation::Read(buf) => self.bus.read(buf).await,
<re_irc> Operation::Transfer(read, write) => self.bus.transfer(read, write).await,
<re_irc> let res = match op {
<re_irc> Operation::Write(buf) => self.bus.write(buf).await,
<re_irc> Operation::TransferInPlace(buf) => self.bus.transfer_in_place(buf).await,
<re_irc> };
<re_irc> if let Err(e) = res {
<re_irc> break Err(e);
<re_irc> }
<re_irc> } else {
<re_irc> Ok(())
<re_irc> };
<re_irc> <@therealprof:matrix.org> : https://doc.rust-lang.org/reference/expressions/loop-expr.html claims otherwise.
<re_irc> <@therealprof:matrix.org> And by "while" loop I of course meant "loop" loop. 😉
<re_irc> <@dirbaio:matrix.org> by while loop I meant while loop
<re_irc> <@dirbaio:matrix.org> 😅
<re_irc> <@firefrommoonlight:matrix.org> : Will keep you posted!
rardiol has joined #rust-embedded
richardeoin has quit [Ping timeout: 255 seconds]
richardeoin has joined #rust-embedded
<re_irc> <@paologentili:matrix.org> Hi (again). My project works _perfectly_ fine but now I'm trying to make it work with our bootloader. I changed the flash origin and I enabled cortex-m-rt set-vec feature. As a result I have something that is partially working: I can receive commands over usart (hence interrupts are working), I can run logic but I'm not able to write data anymore. The buffer content is fine but on the other end I only receive one 0x00...
<re_irc> ... byte. The bootloader works fine with the previous version (non rust) of the fw. Any suggestions on how to debug this problem?
rardiol has quit [Ping timeout: 264 seconds]
rardiol has joined #rust-embedded
rardiol has quit [Ping timeout: 246 seconds]
rardiol has joined #rust-embedded
IlPalazzo-ojiisa has quit [Ping timeout: 256 seconds]
IlPalazzo-ojiis1 has joined #rust-embedded
IlPalazzo-ojiis1 has quit [Ping timeout: 255 seconds]
<cr1901> jamesmunns: Thought I'd give an update on postcard-infomem. I ran into a nasty bug on msp430. After several days, I found a (the?) problem: https://github.com/rust-lang/rust/issues/107612#issuecomment-1472377638
<cr1901> So, Idk I guess I'll write docs and file an actual bug report? Siiiiiiiiiigh
<cr1901> How is this relevant to you? Well... https://github.com/jamesmunns/postcard/blob/main/src/de/deserializer.rs#L77 This line is the one that gets miscompiled somehow on msp430. Linked issue is just my minimal repro.
<re_irc> <@jamesmunns:beeper.com> Oof :(
<re_irc> <@firefrommoonlight:matrix.org> : It does, in fact, _not_ work
<re_irc> <@firefrommoonlight:matrix.org> Ah well
<re_irc> <@firefrommoonlight:matrix.org> Open to ideas
<re_irc> <@firefrommoonlight:matrix.org> Also for RTIC interrupt names
<re_irc> <@firefrommoonlight:matrix.org> My process is clunky re commenting and uncommenting these things when changing hardware. The memory.x thing helps though!
rardiol has quit [Ping timeout: 246 seconds]
dc740 has quit [Remote host closed the connection]