<cr1901> https://github.com/rust-embedded/bare-metal/pull/44#issuecomment-1004783045 Does track_caller imply adding information about panicking to the generated docs?
<cr1901> "as an _indication_ (emph mine) that the function might panic"
starblue has quit [Ping timeout: 240 seconds]
starblue has joined #rust-embedded
rardiol has quit [Ping timeout: 240 seconds]
emerent has quit [Read error: Connection reset by peer]
emerent has joined #rust-embedded
starblue has quit [Ping timeout: 240 seconds]
<re_irc> <@dirbaio:matrix.org> `#[track_caller]` will make the panic message show the right file/line, of user's code
<re_irc> <@dirbaio:matrix.org> but it doesn't add anything to the generated docs, not even the fact that it's a track_caller func
<re_irc> <@gauteh:matrix.org> Hi, what is the easiest way to trigger a reset/restart of a cortex-m device from software?
<re_irc> <@gauteh:matrix.org> SCB::sys_reset() ?
<re_irc> <@jamesmunns:beeper.com> Yup, pretty much
starblue has joined #rust-embedded
rardiol has joined #rust-embedded
rardiol has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
<re_irc> <@barafael:matrix.org> i'm adapting the f411 rtic examples for f411 black pill for my personal use. (How) can I view the defmt output, using stlinkv2?
<re_irc> <@dngrs:matrix.org> it should "just work" with the app template; if you're not seeing anything you probably need to adjust the log level
<re_irc> <@dngrs:matrix.org> `DEFMT_LOG=debug cargo rrb your_program`
<re_irc> <@dngrs:matrix.org> (that's for current `defmt`, it used to specify log configuration in `Cargo.toml` but not anymore)
<re_irc> <@barafael:matrix.org> dngrs (spookyvisiongithub): ... that was it. Thanks!
<re_irc> <@dngrs:matrix.org> whoop whoop :)
<re_irc> <@dngrs:matrix.org> silly question time: the stack sizes reported by https://crates.io/crates/stack-sizes ... are they in bytes, kbytes, feet+inches, cups, ...?
<re_irc> <@dngrs:matrix.org> I'm *assuming* KiB but haven't seen it explicitly anywhere
<re_irc> <@xiretza:xiretza.xyz> almost definitely bytes
<re_irc> <@dngrs:matrix.org> wow, ok
<re_irc> <@dngrs:matrix.org> kudos to the optimizer then
<re_irc> <@xiretza:xiretza.xyz> having a stack frame a KiB would be quite remarkable
<re_irc> <@xiretza:xiretza.xyz> well, less so on hosted environments I guess, I'm in an embedded mindset ;)
<re_irc> <@dngrs:matrix.org> just goes to show I've been doing too many years of exclusively high level stuff in my life
<re_irc> <@dkhayes117:matrix.org> dngrs:matrix.org: I was leaning towards metric tons...but bytes does sound more logical 😂
<re_irc> <@jamesmunns:beeper.com> xiretza:xiretza.xyz: With Serde, anything is possible!
<re_irc> <@dkhayes117:matrix.org> It probably wouldn't hurt to submit a PR to add the stack size unit in the docs. I couldn't find it in there either
cr1901 has quit [Read error: Connection reset by peer]
cr1901 has joined #rust-embedded
<re_irc> <@dngrs:matrix.org> I mean, "assume bytes unless stated otherwise" isn't a terrible mindset either
<re_irc> <@dngrs:matrix.org> I was just confused how low the numbers were
<re_irc> <@dngrs:matrix.org> I think it's the default unit for binutils
cr1901_ has joined #rust-embedded
cr1901 has quit [Ping timeout: 240 seconds]
cr1901_ is now known as cr1901
smach has joined #rust-embedded
smach has quit [Quit: Leaving]
<re_irc> <@lkostka:matrix.org> Hi.
<re_irc> <@lkostka:matrix.org> Rust has a conditional compilation with `cfg` and `cfg_attr`. I know how to use it with lines of code. My question is, how to conditionally compile whole file / module. Consider a use case where you want to target your firmware for 10 boards (each can have different MCUs). Boards have different pinouts, peripheral chips etc. How do you approach this problem ?
<re_irc> <@dirbaio:matrix.org> you can put cfg's in `mod` declarations too
<re_irc> <@dirbaio:matrix.org> so the file pointed by the `mod` is included or not
<re_irc> <@dirbaio:matrix.org> you can also use `cfg_attr` with `path` too, I do it exactly for the "multiple boards" use case :)
<re_irc> <@dirbaio:matrix.org> #[cfg_attr(feature="board_foo", path = "boards/foo.rs")]
<re_irc> <@dirbaio:matrix.org> #[cfg_attr(feature="board_bar", path = "boards/bar.rs")]
<re_irc> <@dirbaio:matrix.org> ```rust
<re_irc> <@dirbaio:matrix.org> mod board;
<re_irc> <@lkostka:matrix.org> Thx. Example you've given (with path) is what I was looking for.
<re_irc> <@lkostka:matrix.org> dirbaio: How do you approach "different boards and MCUs" with `Cargo.toml`. ?
<re_irc> <@dirbaio:matrix.org> what MCus are you using?
<re_irc> <@dirbaio:matrix.org> same/different vendors, families..?
<re_irc> <@dirbaio:matrix.org> if it's same familiy you can have your features turn on different features in HALs
<re_irc> <@dirbaio:matrix.org> [features]
<re_irc> <@dirbaio:matrix.org> ```toml
<re_irc> <@dirbaio:matrix.org> board-foo = ["stm32f4xx-hal/stm32f429"]
<re_irc> <@lkostka:matrix.org> different vendors and families
<re_irc> <@dirbaio:matrix.org> if it's different familiies you can use optional dependencies
<re_irc> <@dirbaio:matrix.org> ```toml
<re_irc> <@dirbaio:matrix.org> [features]
<re_irc> <@dirbaio:matrix.org> board-foo = ["stm32f4xx-hal/stm32f429"]
<re_irc> <@lkostka:matrix.org> ok. and how do you tell cargo which board you're targeting / building ?
<re_irc> <@dirbaio:matrix.org> cargo build --features board-foo
<re_irc> <@lkostka:matrix.org> Thx. Out of curiosity. Do you have some project with those use cases e.g. on github ?
<re_irc> <@dirbaio:matrix.org> not me, perhaps someone else has
<re_irc> <@lkostka:matrix.org> no problemo. with examples you've given, it turns out I know so little about rust :D
<re_irc> <@lkostka:matrix.org> My goal is to write firmware for 3d printers (maybe CNC machines in future). It will be just an executor. Accept commands and execute them. Spin motor X 233 steps etc. Whole brains of operation will be on a Rpi / PC. Validate GCODE before executing and other stuff. It's no fun when printer wants to execute 3 hours in a print a command that will crash the carriage.
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded