Skip to content

Commit 0d3504d

Browse files
authored
Merge pull request #21 from WyliodrinEmbeddedIoT/microbit_v2
Microbit v2 serial bootloader
2 parents 7ba196d + b005893 commit 0d3504d

File tree

9 files changed

+596
-5
lines changed

9 files changed

+596
-5
lines changed

boards/microbit_v2-bootloader/Cargo.lock

Lines changed: 162 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[package]
2+
name = "microbit_v2-bootloader"
3+
version = "0.1.0"
4+
authors = ["Tock Project Developers <[email protected]>"]
5+
build = "build.rs"
6+
edition = "2018"
7+
8+
[dependencies]
9+
cortexm4 = { git = "https://github.com/tock/tock", branch = "master" }
10+
capsules = { git = "https://github.com/tock/tock", branch = "master" }
11+
kernel = { git = "https://github.com/tock/tock", branch = "master" }
12+
nrf52 = { git = "https://github.com/tock/tock", branch = "master" }
13+
nrf52833 = { git = "https://github.com/tock/tock", branch = "master" }
14+
components = { git = "https://github.com/tock/tock", branch = "master" }
15+
16+
# For Development
17+
# cortexm4 = { path = "../../../tock/arch/cortex-m4" }
18+
# capsules = { path = "../../../tock/capsules" }
19+
# kernel = { path = "../../../tock/kernel" }
20+
# nrf52 = { path = "../../../tock/chips/nrf52" }
21+
# nrf52833 = { path = "../../../tock/chips/nrf52833" }
22+
# components = { path = "../../../tock/boards/components" }
23+
24+
bootloader = { path = "../../bootloader" }
25+
bootloader_nrf52 = { path = "../../chips/bootloader_nrf52" }
26+
bootloader_cortexm = { path = "../../arch/bootloader_cortexm" }
27+
28+
29+
[build-dependencies]
30+
bootloader_attributes = { path = "../../tools/bootloader_attributes" }
31+
32+
[profile.dev]
33+
panic = "abort"
34+
lto = false
35+
opt-level = "z"
36+
debug = true
37+
38+
[profile.release]
39+
panic = "abort"
40+
lto = true
41+
opt-level = "z"
42+
debug = true
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Makefile for building the Tock bootloader for nRF52 platforms using CDC-ACM
2+
# over USB.
3+
4+
TOCK_ARCH=cortex-m4
5+
TARGET=thumbv7em-none-eabi
6+
PLATFORM=microbit_v2-bootloader
7+
8+
include ../Common.mk
9+
10+
TOCKLOADER=tockloader
11+
12+
OPENOCD=openocd
13+
OPENOCD_OPTIONS=-f openocd.cfg
14+
15+
# Upload the kernel over JTAG
16+
.PHONY: flash
17+
flash: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).bin
18+
$(OPENOCD) $(OPENOCD_OPTIONS) -c "program $<; verify_image $<; reset; shutdown;"
19+
20+
.PHONY: flash
21+
flash-debug: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/debug/$(PLATFORM).bin
22+
$(OPENOCD) $(OPENOCD_OPTIONS) -c "program $<; verify_image $<; reset; shutdown;"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
BBC:MicroBit v2 Tock Bootloader
2+
===================
3+
4+
This is the implementation of the Tock bootloader for the BBC:MicroBit v2
5+
board. The bootloader runs using the Debugger UART.
6+
7+
Compiling
8+
---------
9+
10+
To compile the bootloader, simply run the `make` command.
11+
12+
```
13+
make
14+
```
15+
16+
Flashing
17+
--------
18+
19+
OpenOCD is needed to flash the bootloader. Running `make flash` will compile it and flash it.
20+
21+
```
22+
make flash
23+
```
24+
25+
Entering
26+
--------
27+
28+
Entering the bootloader is done by holding Button A during reset.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
extern crate bootloader_attributes;
2+
3+
fn main() {
4+
println!("cargo:rerun-if-changed=layout.ld");
5+
println!("cargo:rerun-if-changed=../kernel_layout.ld");
6+
7+
let mut f = bootloader_attributes::get_file();
8+
bootloader_attributes::write_flags(&mut f, "1.1.1", 0x8000);
9+
bootloader_attributes::write_attribute(&mut f, "board", "microbit_v2");
10+
bootloader_attributes::write_attribute(&mut f, "arch", "cortex-m4");
11+
bootloader_attributes::write_attribute(&mut f, "appaddr", "0x40000");
12+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
MEMORY
2+
{
3+
rom (rx) : ORIGIN = 0x00000000, LENGTH = 32K
4+
prog (rx) : ORIGIN = 0x00008000, LENGTH = 480K
5+
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
6+
}
7+
8+
MPU_MIN_ALIGN = 8K;
9+
PAGE_SIZE = 4K;
10+
11+
INCLUDE ../kernel_layout.ld
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
source [find interface/cmsis-dap.cfg]
2+
transport select swd
3+
source [find target/nrf52.cfg]
4+
5+
set WORKAREASIZE 0x40000
6+
7+
$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $WORKAREASIZE -work-area-backup 0
8+
9+
flash bank $_CHIPNAME.flash nrf51 0x00000000 0 1 1 $_TARGETNAME
10+
flash bank $_CHIPNAME.uicr nrf51 0x10001000 0 1 1 $_TARGETNAME
11+

0 commit comments

Comments
 (0)