Revamp deploy.py

Now the script supports more flashing methods:
- JLink (with tockloader)
- OpenOCD (with tockloader)
- pyOCD
- Nordic DFU
- none (will produce an IntelHex file)

Also merged the contributions from:
- Yihui Xiong to support the Makerdiary USB dongle board
- Dennis Geurts to support Nordic DFU

Doc updated accordingly.

Imported 2 patches for Tock kernel:
- 06-add-set_vector_table_offset.patch (upstream tock/tock#1579)
- 07-nrf52-bootloader.patch (upstream tock/tock#1681)
This commit is contained in:
Jean-Michel Picod
2020-03-11 16:51:26 +01:00
parent 8b146440a5
commit e63482af1c
14 changed files with 861 additions and 226 deletions

View File

@@ -0,0 +1,23 @@
diff --git a/arch/cortex-m/src/scb.rs b/arch/cortex-m/src/scb.rs
index 8107f16..a271db9 100644
--- a/arch/cortex-m/src/scb.rs
+++ b/arch/cortex-m/src/scb.rs
@@ -9,7 +9,7 @@ use kernel::common::StaticRef;
struct ScbRegisters {
cpuid: VolatileCell<u32>,
icsr: VolatileCell<u32>,
- vtor: VolatileCell<u32>,
+ vtor: VolatileCell<*const ()>,
aircr: VolatileCell<u32>,
scr: VolatileCell<u32>,
ccr: VolatileCell<u32>,
@@ -54,3 +54,8 @@ pub unsafe fn reset() {
let reset = (0x5FA << 16) | (aircr & (0x7 << 8)) | (1 << 2);
SCB.aircr.set(reset);
}
+
+/// relocate interrupt vector table
+pub unsafe fn set_vector_table_offset(offset: *const ()) {
+ SCB.vtor.set(offset);
+}

View File

@@ -0,0 +1,21 @@
diff --git a/chips/nrf52/src/crt1.rs b/chips/nrf52/src/crt1.rs
index 9703aac..281ceeb 100644
--- a/chips/nrf52/src/crt1.rs
+++ b/chips/nrf52/src/crt1.rs
@@ -1,4 +1,4 @@
-use cortexm4::{generic_isr, hard_fault_handler, nvic, svc_handler, systick_handler};
+use cortexm4::{generic_isr, hard_fault_handler, nvic, scb, svc_handler, systick_handler};
use tock_rt0;
/*
@@ -168,5 +168,9 @@ pub unsafe extern "C" fn init() {
tock_rt0::init_data(&mut _etext, &mut _srelocate, &mut _erelocate);
tock_rt0::zero_bss(&mut _szero, &mut _ezero);
+ // Ensure that we are compatible with a bootloader.
+ // For this we need to offset our vector table
+ scb::set_vector_table_offset(BASE_VECTORS.as_ptr() as *const ());
+
nvic::enable_all();
}