Compare commits

...

3 Commits

Author SHA1 Message Date
foosinn 1cc9ba632a add nixos shell 2021-07-11 00:27:17 +02:00
foosinn 5203df9b9b set memory to 128K 2021-07-11 00:24:31 +02:00
foosinn 91f01c0b62 add runner scrip to allow cargo run 2021-07-11 00:24:31 +02:00
7 changed files with 33 additions and 1 deletions

View File

@ -2,6 +2,7 @@
target = "thumbv6m-none-eabi"
[target.thumbv6m-none-eabi]
runner = "./flash.sh"
rustflags = [
"-C", "link-arg=-Tlink.x",
]

1
.envrc Normal file
View File

@ -0,0 +1 @@
eval "$(lorri direnv)"

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
target/
Cargo.lock
firmware.bin

5
flash.sh Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
binary="$1"
arm-none-eabi-objcopy -O binary "$binary" firmware.bin
sudo dfu-util -a 0 -s 0x08000000:leave -D firmware.bin

View File

@ -1,6 +1,6 @@
/* STM32F072CxT6 */
MEMORY
{
FLASH : ORIGIN = 0x08000000, LENGTH = 64K /* change length to 128K for STM32F072CBT6 */
FLASH : ORIGIN = 0x08000000, LENGTH = 128K /* change length to 128K for STM32F072CBT6 */
RAM : ORIGIN = 0x20000000, LENGTH = 16K
}

4
rust-toolchain Normal file
View File

@ -0,0 +1,4 @@
[toolchain]
channel = "stable"
components = [ "rust-src" ]
targets = [ "thumbv6m-none-eabi" ]

20
shell.nix Normal file
View File

@ -0,0 +1,20 @@
# Use nixpkgs with oxalica rust-bin overlay
let
rust_overlay = import (builtins.fetchTarball
"https://github.com/oxalica/rust-overlay/archive/master.tar.gz");
nixpkgs = import <nixpkgs> { overlays = [ rust_overlay ]; };
rust_channel = nixpkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain;
in
# Avoid typing `nixpkgs.` before each package name
with nixpkgs;
# Define the shell
pkgs.mkShell {
buildInputs = [
dfu-util
];
nativeBuildInputs = [
rust_channel # Full rust from overlay, includes cargo
];
}