-
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 #24 from WyliodrinEmbeddedIoT/clue_nrf52840
Enable bootloader for Adafruit CLUE nRF52840
- Loading branch information
Showing
6 changed files
with
516 additions
and
0 deletions.
There are no files selected for viewing
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,44 @@ | ||
[package] | ||
name = "clue_nrf52840-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" } | ||
# nrf52840 = { git = "https://github.com/tock/tock", branch = "master" } | ||
# components = { git = "https://github.com/tock/tock", branch = "master" } | ||
# nrf52_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" } | ||
nrf52840 = { path = "../../../tock/chips/nrf52840" } | ||
components = { path = "../../../tock/boards/components" } | ||
nrf52_components = { path = "../../../tock/boards/nordic/nrf52_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,27 @@ | ||
# Makefile for building the Tock bootloader for nRF52 platforms using CDC-ACM | ||
# over USB. | ||
|
||
TOCK_ARCH=cortex-m4 | ||
TARGET=thumbv7em-none-eabi | ||
PLATFORM=clue_nrf52840-bootloader | ||
|
||
include ../Common.mk | ||
|
||
TOCKLOADER=tockloader | ||
|
||
# Where in the flash to load the kernel with `tockloader` | ||
KERNEL_ADDRESS=0x26000 | ||
|
||
ifdef PORT | ||
TOCKLOADER_GENERAL_FLAGS += --port $(PORT) | ||
endif | ||
|
||
# Upload the kernel over JTAG | ||
.PHONY: flash | ||
flash: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).bin | ||
$(TOCKLOADER) $(TOCKLOADER_GENERAL_FLAGS) flash --address $(KERNEL_ADDRESS) --board nrf52dk --jlink $< | ||
|
||
# Upload the kernel over JTAG using OpenOCD | ||
.PHONY: flash-openocd | ||
flash-openocd: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).bin | ||
$(TOCKLOADER) $(TOCKLOADER_GENERAL_FLAGS) flash --address $(KERNEL_ADDRESS) --board nrf52dk --openocd $< |
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,24 @@ | ||
Adafruit CLUE - nRF52840 Express with Bluetooth LE Tock Bootloader | ||
=================== | ||
|
||
This is the implementation of the Tock bootloader for the Adafruit CLUE - nRF52840 Express with Bluetooth LE | ||
board. The bootloader runs using the CDC-ACM over USB stack. | ||
|
||
Compiling | ||
--------- | ||
|
||
Here are the steps: | ||
|
||
``` | ||
make | ||
cp ../../target/thumbv7em-none-eabi/release/clue_nrf52840-bootloader.bin ./clue_nrf52840-bootloader.bin | ||
``` | ||
|
||
Converting to UF2 | ||
----------- | ||
|
||
Install [uf2conf](https://github.com/microsoft/uf2/blob/master/utils/uf2conv.py) | ||
|
||
``` | ||
uf2conv clue_nrf52840-bootloader.bin -f 0xADA52840 --base 0x26000 --output clue_nrf52840-bootloader.uf2 | ||
``` |
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.0", 0x36000); | ||
bootloader_attributes::write_attribute(&mut f, "board", "clue_nrf52840"); | ||
bootloader_attributes::write_attribute(&mut f, "arch", "cortex-m4"); | ||
bootloader_attributes::write_attribute(&mut f, "appaddr", "0x80000"); | ||
} |
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 = 0x00026000, LENGTH = 64K | ||
prog (rx) : ORIGIN = 0x00036000, LENGTH = 808K | ||
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 128K | ||
} | ||
|
||
MPU_MIN_ALIGN = 8K; | ||
PAGE_SIZE = 4K; | ||
|
||
INCLUDE ../kernel_layout.ld |
Oops, something went wrong.