-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from WyliodrinEmbeddedIoT/microbit_v2
Microbit v2 serial bootloader
- Loading branch information
Showing
9 changed files
with
596 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
[package] | ||
name = "microbit_v2-bootloader" | ||
version = "0.1.0" | ||
authors = ["Tock Project Developers <[email protected]>"] | ||
build = "build.rs" | ||
edition = "2018" | ||
|
||
[dependencies] | ||
cortexm4 = { git = "https://github.com/tock/tock", branch = "master" } | ||
capsules = { git = "https://github.com/tock/tock", branch = "master" } | ||
kernel = { git = "https://github.com/tock/tock", branch = "master" } | ||
nrf52 = { git = "https://github.com/tock/tock", branch = "master" } | ||
nrf52833 = { git = "https://github.com/tock/tock", branch = "master" } | ||
components = { git = "https://github.com/tock/tock", branch = "master" } | ||
|
||
# For Development | ||
# cortexm4 = { path = "../../../tock/arch/cortex-m4" } | ||
# capsules = { path = "../../../tock/capsules" } | ||
# kernel = { path = "../../../tock/kernel" } | ||
# nrf52 = { path = "../../../tock/chips/nrf52" } | ||
# nrf52833 = { path = "../../../tock/chips/nrf52833" } | ||
# components = { path = "../../../tock/boards/components" } | ||
|
||
bootloader = { path = "../../bootloader" } | ||
bootloader_nrf52 = { path = "../../chips/bootloader_nrf52" } | ||
bootloader_cortexm = { path = "../../arch/bootloader_cortexm" } | ||
|
||
|
||
[build-dependencies] | ||
bootloader_attributes = { path = "../../tools/bootloader_attributes" } | ||
|
||
[profile.dev] | ||
panic = "abort" | ||
lto = false | ||
opt-level = "z" | ||
debug = true | ||
|
||
[profile.release] | ||
panic = "abort" | ||
lto = true | ||
opt-level = "z" | ||
debug = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Makefile for building the Tock bootloader for nRF52 platforms using CDC-ACM | ||
# over USB. | ||
|
||
TOCK_ARCH=cortex-m4 | ||
TARGET=thumbv7em-none-eabi | ||
PLATFORM=microbit_v2-bootloader | ||
|
||
include ../Common.mk | ||
|
||
TOCKLOADER=tockloader | ||
|
||
OPENOCD=openocd | ||
OPENOCD_OPTIONS=-f openocd.cfg | ||
|
||
# Upload the kernel over JTAG | ||
.PHONY: flash | ||
flash: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).bin | ||
$(OPENOCD) $(OPENOCD_OPTIONS) -c "program $<; verify_image $<; reset; shutdown;" | ||
|
||
.PHONY: flash | ||
flash-debug: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/debug/$(PLATFORM).bin | ||
$(OPENOCD) $(OPENOCD_OPTIONS) -c "program $<; verify_image $<; reset; shutdown;" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
BBC:MicroBit v2 Tock Bootloader | ||
=================== | ||
|
||
This is the implementation of the Tock bootloader for the BBC:MicroBit v2 | ||
board. The bootloader runs using the Debugger UART. | ||
|
||
Compiling | ||
--------- | ||
|
||
To compile the bootloader, simply run the `make` command. | ||
|
||
``` | ||
make | ||
``` | ||
|
||
Flashing | ||
-------- | ||
|
||
OpenOCD is needed to flash the bootloader. Running `make flash` will compile it and flash it. | ||
|
||
``` | ||
make flash | ||
``` | ||
|
||
Entering | ||
-------- | ||
|
||
Entering the bootloader is done by holding Button A during reset. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
extern crate bootloader_attributes; | ||
|
||
fn main() { | ||
println!("cargo:rerun-if-changed=layout.ld"); | ||
println!("cargo:rerun-if-changed=../kernel_layout.ld"); | ||
|
||
let mut f = bootloader_attributes::get_file(); | ||
bootloader_attributes::write_flags(&mut f, "1.1.1", 0x8000); | ||
bootloader_attributes::write_attribute(&mut f, "board", "microbit_v2"); | ||
bootloader_attributes::write_attribute(&mut f, "arch", "cortex-m4"); | ||
bootloader_attributes::write_attribute(&mut f, "appaddr", "0x40000"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
MEMORY | ||
{ | ||
rom (rx) : ORIGIN = 0x00000000, LENGTH = 32K | ||
prog (rx) : ORIGIN = 0x00008000, LENGTH = 480K | ||
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 128K | ||
} | ||
|
||
MPU_MIN_ALIGN = 8K; | ||
PAGE_SIZE = 4K; | ||
|
||
INCLUDE ../kernel_layout.ld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
source [find interface/cmsis-dap.cfg] | ||
transport select swd | ||
source [find target/nrf52.cfg] | ||
|
||
set WORKAREASIZE 0x40000 | ||
|
||
$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $WORKAREASIZE -work-area-backup 0 | ||
|
||
flash bank $_CHIPNAME.flash nrf51 0x00000000 0 1 1 $_TARGETNAME | ||
flash bank $_CHIPNAME.uicr nrf51 0x10001000 0 1 1 $_TARGETNAME | ||
|
Oops, something went wrong.