/keyboard

Primary LanguageRust

rumcake-template

About

This template builds a firmware for a keyboard that has:

  • USB host communication
  • Via support
  • WS2812 Underglow (using a bitbang driver)
  • PCB with a duplex matrix
  • STM32F303CBx MCU

Toolchain requirements

This template assumes that you have rustup and cargo available in your $PATH, and that you have the latest nightly Rust toolchain.

Target

Since this keyboard uses an STM32F303CBx, we need to add the thumbv7em-none-eabihf target to our rust toolchain.

rustup target add thumbv7em-none-eabihf

Building and Flashing

The following instructions are specific to this MCU (STM32F303CBx).

Note that .cargo/config.toml specifies thumbv7em-none-eabihf as our build target.

With a probe (e.g. ST-LINK or J-LINK)

If you have a probe, make sure you install probe-run.

Then, you can simply call cargo run --release to build and flash the firmware onto your keyboard (and debug!)

Without a probe

If you don't have access to a probe, first install cargo-binutils:

cargo install cargo-binutils
rustup component add llvm-tools-preview

Then, you can build your firmware:

cargo objcopy --release -- -O binary firmware.bin

Then, flash it to your keyboard (make sure it is in DFU mode already):

dfu-util -d 0483:df11 -a 0 -s 0x80000000:leave -D keyboard.bin