Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi SoC embedded runner #114

Closed
wants to merge 70 commits into from
Closed

Conversation

daringer
Copy link

hey hey,

we wanted to share our current state of what we call the embedded runner, which introduces nRF52 support with an infrastructure capable of even more SoC implementations. LPC55 is also included (although not every detail was ported yet).

  • based on the current solo2 upstream
  • the init phase is now modularized with src/bin/app-nrf.rs and src/bin/app-lpc.rs representing the "entry-point"
  • building is now driven by profiles/ to create essential build-constants.rs and memory.x during compile-time
  • within embedded/src/ (excluding soc_* and bin/) all sources are generic for all SoCs (still some things might be pulled out from the specific SoC dirs)
  • please ignore nrf-bootloader, this builds the nRF52 bootloader my feeling is this should not be there, although I also don't see where it should fit better, the bottom part of the Makefile is also therefore WIP
  • deployment is essentially for dev/testing, so also please ignore

looking forward for your feedback how you think about this approach and if this might be something you would like to upstream at some point

Jan Nordholz and others added 30 commits April 19, 2022 23:24
* The envisioned structure of the new firmware is:

[app-nrf, app-lpc]
-> SoC-specific RTIC App crates
[librunner]
-> generic library (initialization, glue towards Trussed etc.)
[librunner::soc_*]
-> SoC-specific types and defines for generic components

* Start pulling in fragments of existing NRF runner code.
* Use #[cfg_attr] instead of #[cfg].
* Reshuffle definitions.
* Rewrite generic<->SoC interface into a trait.
Our NRF flash implementation suffers from a subtle Trait API difference
between littlefs2::driver::Storage and nrf52840_hal::nvmc::Nvmc - one
has read() with a mutable self, the other expects a non-mutable self.
I would side with the NRF view here (&mut self), as the object may want
to modify internal state even though the actual flash contents won't.
So fix this incompatibility by patching littlefs2 instead.

This commit brings in littlefs2 0.3.2 as a monorepo component, applies
the necessary fixes to its Storage trait, and adds a [patch] section
to the embedded runner so it picks up the local version.
This commit brings in the scaffolding for building LPC55 alongside NRF52.
The following list is a rough summary of the changes:
  * The conflicting-trait fix for the NRF external flash was actually
    not enough - lpc55_hal provides littlefs2_*_filesystem!() macros
    which also implement the (now modified) Storage trait. Added and
    fixed lpc55-hal as well.
    - new monorepo component (-> components/lpc55_hal)
    - added to Cargo.toml [patch] section
  * Fixed the provisioner-app to only depend on one HAL/PAC depending
    on the chosen SoC.
  * Removed build.target from the embedded runner .cargo/config.
    We are building a single crate for different triplets - which is not
    supported by cargo.
    - Add "--target" parameters to cargo invocations in the Makefile.
    - Guard against invalid SoC/--target combinations in build.rs.
  * Added the LPC55 runner target and its dependencies to Cargo.toml.
  * Remove the hardcoded filesystem boundary from build.rs. With the
    new resolver, cargo now supports different feature flags on build
    dependencies and target dependencies.

Unrelated (could be factored out):
  * Actually implemented NRF extflash.rs (uses spi_memory::series25).

Bonus:
For laughs, check out the block comment in src/soc_lpc55/mod.rs.
* restructured Fido crate etc.
* sort out linker script business
* renamed nk3mini to nk3am / NK3AM
* removed obsolete lpc nk3am references
* include UICR programming (REGOUT, NFCPINS) into Makefile for nrf52
* fork cfg.toml into nrf52_cfg.toml and lpc55_cfg.toml
* use soc specific *_cfg.toml inside build.rs
* include and adapt board_nk3am.rs
* unify identifiers: codebase, _cfg.toml
* no more usb-serial
* update memory.x related constants
* cleanup/improve flash size calc
* adapt build.rs
* re-write Makefile
* apply newly acquired flexibility
* nrf52: pass delay_timer down into TrustedUI
* touch (button) press is now a 2-step timer-supported approach
* some safeguarding against other unwanted button-presses
* design bootloader interactictions (reboot-styles)
* remove unused imports
* remove unused (led)-members
* fix unused variables
* fix various minor warnings
@nyabinary
Copy link

Is this dead? I mean Solokeys as a whole. What's going on exactly?

@jans23
Copy link

jans23 commented Nov 5, 2022

You may be interested in this work.

@daringer daringer closed this Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants