tree: 54c6e4de6dd2491597276c5b9f9f70895c88d6c3 [path history] [tgz]
  1. .cargo/
  2. blinky/
  3. toolchain/
  4. .gitignore
  5. BUILD.bazel
  6. Cargo.lock
  7. Cargo.toml
  8. Embed.toml
  9. MODULE.bazel
  10. MODULE.bazel.lock
  11. 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.