I'm excited seeing the progress made on this port!
Kamil Duljas via Devel <devel@lists.tockos.org> writes:
> I noticed that GPIO code for F3 F4 and L4 is 80-90% the same. maybe we
> could extract it as a common part like stm32x ? I guess it could be
> done for many pheripherials.
Yes! In general, avoiding such code duplication is desirable, and there
should be plenty of existing examples in the `chips/` folder, like
`nrf5x` or `stmf4xx`.
However, Tock has some particular (and somewhat implicit) conventions
when it comes to code-sharing for multiple targets. For instance, we
generally discourage conditional compilation by means of Cargo features
(`#[cfg(...)]`) in our code, as that makes code harder to test.
For a new target, I think it could be good to first get a chip and board
crate merged (which perhaps duplicates some code that is not completely
identical and thus trivially sharable between chips), and then split out
that common infrastructure in a follow-up PR. This way you won't risk
de-railing the PR to add the board over discussions on how to organize
that shared infrastructure.
-Leon