crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
cr1901_ has joined #rust-embedded
cr1901 has quit [Ping timeout: 264 seconds]
explore has quit [Quit: Connection closed for inactivity]
cr1901_ is now known as cr1901
explore has joined #rust-embedded
Darius has quit [Quit: Bye]
Darius has joined #rust-embedded
Darius has quit [Remote host closed the connection]
Darius has joined #rust-embedded
fabic_ has quit [Ping timeout: 240 seconds]
fabic_ has joined #rust-embedded
gsalazar has quit [Ping timeout: 240 seconds]
<re_irc>
<Jan Bronicki> I have a question about CI jobs
<re_irc>
<Jan Bronicki> any tips for setting up CI pipelines for embedded projects?
<re_irc>
<Jan Bronicki> like what should i include
<re_irc>
<James Munns> Often embedded CI is limited to building your projects, and running any checkers (like formatting, clippy)
<re_irc>
<James Munns> in most cases, you'll just need to do a build like: "cargo build --target thumbv7em-none-eabihf"
<re_irc>
<James Munns> There are some ways to either use an emulator, like QEMU, or physical hardware, but those end up being quite a bit more involved.
<Lumpio->
Also if your project has parts (maths, logic, whatever) that are reasonably refactored out of hardware-related stuff, you can always run unit tests
<re_irc>
<James Munns> If you are building a library, instead of a binary, you can often do your unit testing in CI as well, as long as you don't need to interface with physical hardware.
<re_irc>
it's common to mark no-std libraries with:
<re_irc>
"#![cfg_attr(not(test), no_std)]"
<Lumpio->
Depending on the build.rs trickery and whatnot in your dependencies, you might need to jump through some hoops through to get them to build for something that's not a microcontroller
<re_irc>
<James Munns> that way you still have the standard library when running unit tests, like Lumpio- said.
<Lumpio->
like e.g. separate them into a different crate
<re_irc>
<Jan Bronicki> unfortunately the start of the project will be in C++ altho i plan on introducing more Rust later
<re_irc>
<James Munns> Are you making the rust part a static library?
<re_irc>
<Jan Bronicki> its more like the device we are building has many mcontrolelrs
<re_irc>
<Jan Bronicki> and some of them I plan to program using rust
<re_irc>
<Jan Bronicki> its a university science club project
<re_irc>
<James Munns> Gotcha!
creich has joined #rust-embedded
<re_irc>
<James Munns> As for CI, just building, and running "cargo +nightly clippy" or checking that "cargo fmt" is clean, is a good first step!
<re_irc>
<James Munns> Then if you have any specific questions on how to test certain things, feel free to ask for more help then!
<re_irc>
<James Munns> https://github.com/actions-rs should work with no-std just as well, if you are using GH actions for CI
<re_irc>
<Jan Bronicki> I had some experience in embedded but that was some time ago and right now as one of the senior students im mainly responsible for project management side of things given that i have profesional experience. But because its been so long and I havent been learning embedded for quite some time Im trying to basically gather the tools I would normally use aka testing, mocking, some simulation. For example I once used a...
<re_irc>
Its made to emulate boards etc so you can debug them and whatnot but I dont know if better projects than this one exist. So im really looking for guidance here ☺️
<re_irc>
<James Munns> I think renode should work with Rust if it supports your hardware!
<re_irc>
<James Munns> This is similar to what I said w/ QEMU
<re_irc>
<James Munns> I haven't used Renode, but I've heard good things!
<re_irc>
<James Munns> But honestly, if you can test WITHOUT simulating/emulating, you'll have a better time!
<re_irc>
<Jan Bronicki> James Munns: For normal Rust projects i do rustfmt, clippy, builds for all toolchains i need and stable, nightly and beta, crate creation check, tests, crate publishing dry run, doc creation (i use some packages that for example add latex so in my case docs can actually fail) etc
<re_irc>
<James Munns> e.g. isolating logic into crates, and unit testing them independently, rather than on hardware or in a simulator.
<re_irc>
<Jan Bronicki> Hm yeah thats the catch I dont have exp in this stuff so I cant tell
<re_irc>
<Jan Bronicki> also im looking for tools that will also play with C++
<re_irc>
<Jan Bronicki> as for now this is the focus
<re_irc>
<Jan Bronicki> also do you know forums like this one or discord servers where i could ask the same question about C++?
<re_irc>
<James Munns> This is the typical split between "unit", "integration", and "system" tests
<re_irc>
<James Munns> unit tests are easier, because you don't need to pull in the whole world
<re_irc>
<Jan Bronicki> sure but i have no idea about any of it for C++
<re_irc>
<Jan Bronicki> i worked as a QA intern so i dont have a problem in general with testing, got some good exp there
<re_irc>
<Jan Bronicki> but in C++? damn
<re_irc>
<Jan Bronicki> i dont know the actual production ecosystem
creich has quit [Quit: Leaving]
<re_irc>
<James Munns> Also can't help with C++
<re_irc>
<James Munns> The memfault slack is actually really good and helpful
<re_irc>
<James Munns> and has more non-rust folks there
<Lumpio->
I was recently asked about unit testing embedded C... I couldn't even name a unit testing library for C
<re_irc>
<James Munns> I tend to use CMocka
<re_irc>
<James Munns> Have also used whatever the throwtheswitch tooling is
<re_irc>
<James Munns> ceedling?
<re_irc>
<James Munns> CMocka is a fork of the old, C version of googletest, before it went all C++
<re_irc>
<James Munns> That being said, today, I'd probably just use rust + cargo
<re_irc>
<James Munns> it'd honestly be easier to instrument everything in Rust, mocks and all.
<re_irc>
<James Munns> but that might be a "if your only tool is a hammer, every problem looks like a nail" answer
<re_irc>
<James Munns> But honestly, a build-rs+cc-rs for compilation (instead of a make file), and std::collections for writing mocks is going to be 100x easier than doing it all in C.
<re_irc>
<James Munns> If Uber can use zig just for cross compilation, I don't see why it wouldn't be legit to use Rust just for unit testing :D
<Lumpio->
"but nobody knows rust at the company"
<re_irc>
<James Munns> Yeah, then it's a bad choice
<Lumpio->
I guess I'll find out what their tool of choice is soon
<Lumpio->
Well, hopefully anyways.
<re_irc>
<James Munns> CMocka is good (pretty opinion-less, it's just asserts and some basic test organization stuff), Ceedling is much more involved (it has a ruby/rake based build system), which is more complicated, but does some nice stuff like auto-generating dependency mocks
<re_irc>
<James Munns> ceedling also has a ton more docs/resources available, Grenning's Embedded TDD book uses it IIRC
causal has quit [Quit: WeeChat 3.5]
fabic_ has quit [Ping timeout: 260 seconds]
fabic_ has joined #rust-embedded
funsafe has quit [Ping timeout: 244 seconds]
<cr1901>
I use minunit.h
rtypo_bot has joined #rust-embedded
rtypo_bot has left #rust-embedded [#rust-embedded]
funsafe has joined #rust-embedded
seer has quit [Quit: quit]
seer has joined #rust-embedded
fabic_ has quit [Ping timeout: 272 seconds]
Socke has quit [Quit: WeeChat 3.5]
Socke has joined #rust-embedded
GenTooMan has quit [Ping timeout: 240 seconds]
GenTooMan has joined #rust-embedded
Socke has quit [Quit: WeeChat 3.5]
Socke has joined #rust-embedded
dc740 has quit [Remote host closed the connection]