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
spikespaz[m] has quit [Quit: Idle timeout reached: 172800s]
sroemer has joined #rust-embedded
sroemer has joined #rust-embedded
sroemer has quit [Changing host]
_whitelogger has joined #rust-embedded
thejpster[m] has quit [Quit: Idle timeout reached: 172800s]
<Farooq> @jamesmunns:beeper.com Thank you for the explaination
<Farooq> What is the right way to run something periodically? Currently I'm using a counter and increase it in each iteration of my loop
<Farooq> I'm not sure maybe I could use one of these timers?
okhsunrog[m] has joined #rust-embedded
<okhsunrog[m]> <Farooq> "What is the right way to run..." <- can you show the code?
<Farooq> it's for stm32. `log_counter` increases during each iteration. So I can use it to roughly measure time
<Farooq> s/stm32/stm32f0/
<okhsunrog[m]> Farooq: have you considered using embassy or rtic?
<RobWells[m]> <Farooq> "it's for stm32. `log_counter..." <- Perhaps use the RTC alarm? Eg https://github.com/stm32-rs/stm32f4xx-hal/blob/master/examples/rtc_alarm.rs
<RobWells[m]> Er wrong series, apologies
<RobWells[m]> <Farooq> "it's for stm32. `log_counter..." <- Would the timer interrupt handler work? Eg https://github.com/stm32-rs/stm32f0xx-hal/blob/master/examples/blinky_timer_irq.rs (right series this time!)
<Farooq> <okhsunrog[m]> "have you considered using..." <- nope I want to stay bare metal for now
<Farooq> <RobWells[m]> "Would the timer interrupt..." <- So in general the right way to do something periodically are timers?
<JamesMunns[m]> Farooq: embassy and rtic are still bare metal πŸ™‚
<JamesMunns[m]> Farooq: Yes
<Farooq> JamesMunns[m]: they manage many things for me. Don't day?
<Farooq> s/day/they/
<JamesMunns[m]> They're really just libraries. They're like any library: they do things in a reasonable way. There's no "magic" to them.
<JamesMunns[m]> you certainly don't *have* to use them!
<JamesMunns[m]> But IMO it's easier to learn how to use them than re-invent them from scratch, which is actually a much more challenging thing to do for someone who is learning.
<Farooq> hmm
rafael[m] has joined #rust-embedded
<rafael[m]> Plenty of stuff to learn still with Embassy and hal being used in my experience πŸ™ƒ More rewarding though because things work and then one can dig deeper into stuff in whatever pace fits best.
<JamesMunns[m]> yes, the library/libraries are handling things for you! But honestly in about the way you would want them to do so!
<JamesMunns[m]> The same way using `heapless::Vec` handles logic for pushing/popping data for you - you COULD write it yourself if you wanted to! But you don't *have* to.
<Farooq> hmm thanks
<Farooq> I think I will use RTIC
<okhsunrog[m]> are you worried about binary size or something else?
<okhsunrog[m]> rtic and embassy take almost the same amount of flash, without using them you might save about a couple of KB, I don't think it will help you much, it will make your life miserable. using RTIC or embassy is nicer. if you're a beginner I'd recommend embassy, it has more examples, larger community and the HAL is better supported. although you can use embassy-stm32 hal with RTIC if you want to
andwass[m] has joined #rust-embedded
<andwass[m]> I would just add that it isn't wrong per say to learn about the low-level stuff (peripherals, interrupts etc.), and at some point you will probably have to learn about it, but if you are new to embedded altogether there are so many other things to learn that the lowest-level gory details shouldn't be your priority if you can't help it.
<andwass[m]> s/'t//
rainingmessages has quit [Quit: bye]
firefrommoonligh has joined #rust-embedded
<firefrommoonligh> I don't think pushing RTIC or embassy for this concept is appropriate
<firefrommoonligh> Put the LED on a timer/interrupt
<firefrommoonligh> * I don't think pushing RTIC or embassy (Suggesting a framework switch) for this question is appropriate.
thejpster[m] has joined #rust-embedded
<thejpster[m]> πŸŽ‰
<thejpster[m]> > This means you can now use Rust on Arm Cortex-M4, Cortex-M4F, Cortex-M7, and Cortex-M7F processors in safety-critical contexts. These processors can be found as the primary compute element in a wide variety of industrial- and automotive-grade microcontrollers, but also as additional processing elements focused on safety or low-power efficiency within a larger System-on-Chip.
<thejpster[m]> Which implies that we have found a way to run the Rust compiler test suite on those targets.
<JamesMunns[m]> > Work is ongoing with partners on library certification, particularly of libcore. If you need libcore certified for your use case, and want to be one of the first users, please let us know!
<JamesMunns[m]> Does anyone *not* need libcore for their use cases? :p
M9names[m] has joined #rust-embedded
<M9names[m]> on hardware, or through the cursed qemu stuff you've been talking about?
diondokter[m] has joined #rust-embedded
<diondokter[m]> thejpster[m]: Oh that's great! People have been asking about this and I always just say they should talk to you guys. Now I can just say it's supported :D
<diondokter[m]> * supported :D (And still should talk to you guys :P)
<thejpster[m]> JamesMunns[m]: You do not require a *certified* libcore - you can instead certify your application as a whole, containing the parts of libcore you require.
<JamesMunns[m]> That makes sense!
<thejpster[m]> but obviously having a pre-certified libcore makes that easier. Work in progress.
<JamesMunns[m]> Same as any other crate you pull in, you ship it, you own it
<thejpster[m]> M9names[m]: Well people generally don't like to talk about how they test and qualify their proprietary compilers.
<M9names[m]> doesn
<JamesMunns[m]> That's the Secret Sauce Recipe, I assume :D
<M9names[m]> *'t stop people asking :)
<thejpster[m]> So it would be [absurd if someone put the Testing Procedures](https://public-docs.ferrocene.dev/main/qualification/internal-procedures/testing-other-targets.html#armv7e-m-bare-metal-hard-float-thumbv7em-none-eabihf-armv7e-m-bare-metal-soft-float-thumbv7em-none-eabi) online in a publicly readable format for everyone to go and read
<JamesMunns[m]> "secret open sauce", I suppose
<diondokter[m]> Nobody reads docs anyways :P
dirbaio[m] has joined #rust-embedded
<dirbaio[m]> > In order to test this target, the build process will acquire a copy of our secret sauce from AWS. Ensure you’re authenticated, following the section in Setting up a local development environment if your environment is not yet set up.
<thejpster[m]> if you haven't met userspace QEMU, it executes linux binaries compiled for an alien architecture, but running the userspace code in QEMU's emulation and then dispatches syscalls to your actual kernel
<thejpster[m]> the kernel is clearly Linux - we've giving you Linux commands to install qemu. The alien CPU is Cortex-M4 - you can see that.
<thejpster[m]> so look at the dependencies for libstd on Linux and you tell me which ones need changing to run on Cortex-M4.
<thejpster[m]> In nightly releases (so, post 25.05) I will even ship you the pre-compiled thumbv7em-ferrocenecoretest-eabi libstd. So you can cargo run --target=thumbv7em-ferrocenecoretest-eabi and it just executes the binary and gives you standard out and everything. Or, you know, cargo test --target=thumbv7em-ferrocenecoretest-eabi.
whitequark[cis] has joined #rust-embedded
<whitequark[cis]> thejpster[m]: (all of them?)
<Farooq> @andwass:matrix.org @okhsunrogm:matrix.org the flash size is only 16KB. So yeah binary size is important. But the reason I'm trying an MCU is learning about low level hardware details. Not just do a project. STM32F0 is simple. So it won't be very hard to learn about low level stuff. I am also interested in coding directly in Assembly to directly talk to the hardware.
<diondokter[m]> If you're 'just' learning and don't need to be productive, then just do what interests you the most!
<diondokter[m]> But using embassy and/or rtic is what professional people do too
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #rust-embedded
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #rust-embedded
extrafofo has quit [Remote host closed the connection]
<Farooq> Alright new nerd hole found: Run Evolutionary Machine Learning on STM32F0. As in directly train on the MCU
<Farooq> or maybe F1
jfsimon has quit [Remote host closed the connection]
rom4ik has quit [Quit: bye]
jfsimon has joined #rust-embedded
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #rust-embedded
sroemer has quit [Quit: WeeChat 4.5.2]
cr1901_ has joined #rust-embedded
cr1901 has quit [Ping timeout: 252 seconds]
cr1901_ has quit [Ping timeout: 245 seconds]
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #rust-embedded
<dirbaio[m]> this is a bit offtopic but
<dirbaio[m]> has anyone ever seen cargo install failing to replace a binary when running in CI?
cr1901 has joined #rust-embedded
<dirbaio[m]> cache is from a previous build that had an old version of the binary
<dirbaio[m]> then cargo install happily says "Replaced package blahblahblah"
<dirbaio[m]> but it's a lie, the binary is the exact same
<JamesMunns[m]> Wrong cargo bin dir?
<diondokter[m]> Huh, no, never seen that
<dirbaio[m]> also cargo install is instant, it's not building anyhting :(
<JamesMunns[m]> like, what does ci think your bin dir is?
<dirbaio[m]> JamesMunns[m]: I don't think so, it explicitly says "Replacing /builds/firmware/firmware/cache/cargo/bin/java-spaghetti-gen"
<JamesMunns[m]> ahh, I see, yeah
<dirbaio[m]> which is the path which java-spaghetti-gen finds. and the hash and mtime is the same before and after :(
<JamesMunns[m]> that's not like a weird mapped dir or something is it?
<JamesMunns[m]> dunno if you're doing weird docker/overlay things
<dirbaio[m]> no.. it's a regular dir, ci downloads and extracts the cache to it
<diondokter[m]> I feel like something's up with the insta build
jfsimon has quit [Max SendQ exceeded]
<dirbaio[m]> it's gitlab ci
<dirbaio[m]> it's suuuuuuper weird! :(
<JamesMunns[m]> diondokter[m]: I think maybe cargo install dirs can get cached too?
<diondokter[m]> Maybe try delete the .cargo folder in your user folder?
<diondokter[m]> Idk if that breaks things really hard though
<diondokter[m]> diondokter[m]: Just to see what happens I mean
jfsimon has joined #rust-embedded
<dirbaio[m]> i'm setting CARGO_HOME=$PWD/cache/cargo then telling gitlab to cache ./cache
<dirbaio[m]> there's nothing in ~/.cargo
<dirbaio[m]> not caching $CARGO_HOME fixes it, of course
<dirbaio[m]> but then build is slower
jfsimon has quit [Remote host closed the connection]
<diondokter[m]> I feel like the cargo install target dir is not really meant to be cached...
<diondokter[m]> Isn't it a temp directory?
jfsimon has joined #rust-embedded
<dirbaio[m]> normally it's in ~/.cargo
<diondokter[m]> Well, when I do e.g. a probe-rs install, stop it and try again, I think it'll just start over
<dirbaio[m]> outside CI it works
<diondokter[m]> Does it get fixed if you do cargo install blah --force?
<dirbaio[m]> there's something about the CI env that makes it think it's always up to date
<dirbaio[m]> diondokter[m]: yes but then it always rebuilds, which is slow
<dirbaio[m]> cargo install is a terrible, terrible package manager
<diondokter[m]> You can also specify the target dir: https://doc.rust-lang.org/cargo/commands/cargo-install.html#compilation-options
<diondokter[m]> Maybe only that should be in cache?
<JamesMunns[m]> instead of cargo install, can you publish your tool in some way cargo-binstall can figure out?
<JamesMunns[m]> I think it's mostly just "put the binary in a github release"
<dirbaio[m]> haha nope --force doesn't fix it, it's still instant build
<diondokter[m]> Oh, that's mega weird!
<dirbaio[m]> yeah i'll end up doing that 😭
<dirbaio[m]> HAHAHA it's due to setting CARGO_TARGET_DIR when running cargo-install
<dirbaio[m]> * HAHAHA it's due to setting CARGO_TARGET_DIR when running cargo install
<diondokter[m]> Surely this is a cargo bug then, right?
<dirbaio[m]> actully no, wtf
<dirbaio[m]> yeah doing this fixed it CARGO_TARGET_DIR=/tmp/cargo-install-target cargo install --git https://github.com/Dirbaio/java-spaghetti --locked --rev 469dc3570ad76753b61e8c9760eaaada5a16f16d
<dirbaio[m]> * yeah doing this fixed it CARGO_TARGET_DIR=/tmp/cargo-install-target cargo install --git https://github.com/Dirbaio/java-spaghetti --locked --rev 469dc3570ad76753b61e8c9760eaaada5a16f16d no it didn't
d34db33f has joined #rust-embedded
<dirbaio[m]> * yeah doing this fixed it CARGO_TARGET_DIR=/tmp/cargo-install-target cargo install --git https://github.com/Dirbaio/java-spaghetti --locked --rev 469dc3570ad76753b61e8c9760eaaada5a16f16d no it didn't yes it did, just turns out there was another issue aside from this one
norineko has quit [Remote host closed the connection]
norineko has joined #rust-embedded
norineko has quit [Remote host closed the connection]
norineko has joined #rust-embedded
<dngrs[m]> have you tried cargo binstall? (not sure if that helps but I usually default to using that)
<dngrs[m]> oh wait nvm you're installing your own binary
Foxyloxy_ has quit [Read error: Connection reset by peer]