Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Lichtman committed Apr 8, 2020
0 parents commit b4f0f1f
Show file tree
Hide file tree
Showing 15 changed files with 900 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[target.thumbv6m-none-eabi]
runner = 'arm-none-eabi-gdb'

rustflags = [
"-C", "link-arg=-Tlink.x",
# "-C", "link-arg=-s",
]

[build]
target = "thumbv6m-none-eabi"
6 changes: 6 additions & 0 deletions .gdbinit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
target remote :3333
monitor arm semihosting enable
set print asm-demangle on
load
break main
continue
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target
**/*.rs.bk
306 changes: 306 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[package]
name = "uart-buster"
version = "0.1.0"
authors = ["Ben Lichtman"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# panic-halt = "0.2.0"
panic-semihosting = "0.5.3"
embedded-hal = "0.2.3"
nrf51-hal = "0.7.1"
cortex-m-rt = "0.6.12"
cortex-m-semihosting = "0.3.5"
cortex-m = "0.6.1"
nb = "0.1.2"
alloc-cortex-m = "0.3.5"

[profile.dev]
debug = true
opt-level = 3

[profile.release]
debug = false
lto = "fat"
opt-level = 3
18 changes: 18 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use std::env;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;

fn main() {
// Put the linker script somewhere the linker can find it
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
File::create(out.join("memory.x"))
.unwrap()
.write_all(include_bytes!("memory.x"))
.unwrap();
println!("cargo:rustc-link-search={}", out.display());

// Only re-run the build script when memory.x is changed,
// instead of when any part of the source code changes.
println!("cargo:rerun-if-changed=memory.x");
}
1 change: 1 addition & 0 deletions debug_client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
arm-none-eabi-gdb -q target/thumbv6m-none-eabi/debug/microbit-rust
1 change: 1 addition & 0 deletions debug_server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
openocd -f interface/cmsis-dap.cfg -f target/nrf51.cfg
11 changes: 11 additions & 0 deletions memory.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
MEMORY
{
/* NOTE K = KiBi = 1024 bytes */
FLASH : ORIGIN = 0x00000000, LENGTH = 256K
RAM : ORIGIN = 0x20000000, LENGTH = 16K
}

/* This is where the call stack will be allocated. */
/* The stack is of the full descending type. */
/* NOTE Do NOT modify `_stack_start` unless you know what you are doing */
_stack_start = ORIGIN(RAM) + LENGTH(RAM);
5 changes: 5 additions & 0 deletions microbit.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source [find interface/cmsis-dap.cfg]
source [find target/nrf51.cfg]

init
flash probe 0
Loading

0 comments on commit b4f0f1f

Please sign in to comment.