Skip to content

Commit aedb2fb

Browse files
authored
Merge pull request #24 from WyliodrinEmbeddedIoT/clue_nrf52840
Enable bootloader for Adafruit CLUE nRF52840
2 parents a2f0841 + 65ae43b commit aedb2fb

File tree

6 files changed

+516
-0
lines changed

6 files changed

+516
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[package]
2+
name = "clue_nrf52840-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+
# nrf52840 = { git = "https://github.com/tock/tock", branch = "master" }
14+
# components = { git = "https://github.com/tock/tock", branch = "master" }
15+
# nrf52_components = { git = "https://github.com/tock/tock", branch = "master" }
16+
17+
# For Development
18+
cortexm4 = { path = "../../../tock/arch/cortex-m4" }
19+
capsules = { path = "../../../tock/capsules" }
20+
kernel = { path = "../../../tock/kernel" }
21+
nrf52 = { path = "../../../tock/chips/nrf52" }
22+
nrf52840 = { path = "../../../tock/chips/nrf52840" }
23+
components = { path = "../../../tock/boards/components" }
24+
nrf52_components = { path = "../../../tock/boards/nordic/nrf52_components" }
25+
26+
bootloader = { path = "../../bootloader" }
27+
bootloader_nrf52 = { path = "../../chips/bootloader_nrf52" }
28+
bootloader_cortexm = { path = "../../arch/bootloader_cortexm" }
29+
30+
31+
[build-dependencies]
32+
bootloader_attributes = { path = "../../tools/bootloader_attributes" }
33+
34+
[profile.dev]
35+
panic = "abort"
36+
lto = false
37+
opt-level = "z"
38+
debug = true
39+
40+
[profile.release]
41+
panic = "abort"
42+
lto = true
43+
opt-level = "z"
44+
debug = true
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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=clue_nrf52840-bootloader
7+
8+
include ../Common.mk
9+
10+
TOCKLOADER=tockloader
11+
12+
# Where in the flash to load the kernel with `tockloader`
13+
KERNEL_ADDRESS=0x26000
14+
15+
ifdef PORT
16+
TOCKLOADER_GENERAL_FLAGS += --port $(PORT)
17+
endif
18+
19+
# Upload the kernel over JTAG
20+
.PHONY: flash
21+
flash: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).bin
22+
$(TOCKLOADER) $(TOCKLOADER_GENERAL_FLAGS) flash --address $(KERNEL_ADDRESS) --board nrf52dk --jlink $<
23+
24+
# Upload the kernel over JTAG using OpenOCD
25+
.PHONY: flash-openocd
26+
flash-openocd: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).bin
27+
$(TOCKLOADER) $(TOCKLOADER_GENERAL_FLAGS) flash --address $(KERNEL_ADDRESS) --board nrf52dk --openocd $<
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Adafruit CLUE - nRF52840 Express with Bluetooth LE Tock Bootloader
2+
===================
3+
4+
This is the implementation of the Tock bootloader for the Adafruit CLUE - nRF52840 Express with Bluetooth LE
5+
board. The bootloader runs using the CDC-ACM over USB stack.
6+
7+
Compiling
8+
---------
9+
10+
Here are the steps:
11+
12+
```
13+
make
14+
cp ../../target/thumbv7em-none-eabi/release/clue_nrf52840-bootloader.bin ./clue_nrf52840-bootloader.bin
15+
```
16+
17+
Converting to UF2
18+
-----------
19+
20+
Install [uf2conf](https://github.com/microsoft/uf2/blob/master/utils/uf2conv.py)
21+
22+
```
23+
uf2conv clue_nrf52840-bootloader.bin -f 0xADA52840 --base 0x26000 --output clue_nrf52840-bootloader.uf2
24+
```
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.0", 0x36000);
9+
bootloader_attributes::write_attribute(&mut f, "board", "clue_nrf52840");
10+
bootloader_attributes::write_attribute(&mut f, "arch", "cortex-m4");
11+
bootloader_attributes::write_attribute(&mut f, "appaddr", "0x80000");
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 = 0x00026000, LENGTH = 64K
4+
prog (rx) : ORIGIN = 0x00036000, LENGTH = 808K
5+
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
6+
}
7+
8+
MPU_MIN_ALIGN = 8K;
9+
PAGE_SIZE = 4K;
10+
11+
INCLUDE ../kernel_layout.ld

0 commit comments

Comments
 (0)