tree: 118ac9f5ffc09c5e159c66a7cdd08a8f5a6a7507
  1. .cargo/
  2. blinky/
  3. toolchain/
  4. .bazelrc
  5. .gitignore
  6. BUILD.bazel
  7. Cargo.lock
  8. Cargo.toml
  9. Embed.toml
  10. MODULE.bazel
  11. MODULE.bazel.lock
  12. README.md
examples/nrf52840/README.md

NRF52840 bazel rust examples

Show how to use bazel to build rust code for the NRF52840.

Building

We can cross compile the code to the NRF52840, using rules_rust for the compiler (rustc) and toolchains_arm_gnu for the linker (arm-none-eabi-gcc).

bazel build //blinky/...

Flashing

We use rules_probe_rs to flash the code to the NRF52840 and enable optional debugging / RTT.

bazel run //blinky:run

Notes

  • build.rs is included just to show cargo equivalence. It is not used by the bazel build system.
  • memory.x is used by cargo, but not by bazel.
  • linker.x file is a linker script used for bazel, this was handwritten to include all the linker scripts that are automatically added to the link path when cargo builds.