Merge branch 'develop' into keystore

This commit is contained in:
Julien Cretin
2022-07-01 10:33:58 +02:00
5 changed files with 54 additions and 11 deletions

View File

@@ -270,7 +270,7 @@ class OpenSKInstaller:
jlink_speed=1200, jlink_speed=1200,
openocd=self.args.programmer == "openocd", openocd=self.args.programmer == "openocd",
openocd_board=board.openocd_board, openocd_board=board.openocd_board,
openocd_cmd="openocd", openocd_cmd=self.args.openocd_cmd,
openocd_commands=copy.copy(board.openocd_commands), openocd_commands=copy.copy(board.openocd_commands),
openocd_options=copy.copy(board.openocd_options), openocd_options=copy.copy(board.openocd_options),
jtag=False, jtag=False,
@@ -1005,6 +1005,14 @@ if __name__ == "__main__":
help=("Sets the method to be used to flash Tock OS or the application " help=("Sets the method to be used to flash Tock OS or the application "
"on the target board."), "on the target board."),
) )
main_parser.add_argument(
"--openocd_cmd",
dest="openocd_cmd",
metavar="CMD",
default="openocd",
help=("Specifies a custom command to use when calling openocd. Can be "
"used to pass arguments i.e. 'openocd -s /tmp/openocd_scripts'."),
)
main_parser.add_argument( main_parser.add_argument(
"--no-tockos", "--no-tockos",

View File

@@ -59,14 +59,48 @@ Follow these steps:
![Nordic dongle retainer clip](../img/dongle_clip.jpg) ![Nordic dongle retainer clip](../img/dongle_clip.jpg)
1. Depending on the programmer you're using, you may have to adapt the next #### JLink
command line. Run our script for compiling/flashing Tock OS on your device:
Run our script for compiling/flashing Tock OS on your device:
```shell
$ ./deploy.py --board=nrf52840_dongle --programmer=jlink
```
#### OpenOCD
1. Create your openocd config, named `nordic_nrf52840_dongle.cfg` in the
appropriate location:
```shell ```shell
$ ./deploy.py --board=nrf52840_dongle_opensk --programmer=jlink mkdir -p ${HOME}/.openocd/board
touch ${HOME}/.openocd/board/nordic_nrf52840_dongle.cfg
``` ```
1. Remove the programming cable and the USB-A extension cable. Paste the following st-link example and edit the specific setup to your needs:
```
# Specific setup
source [find interface/stlink-dap.cfg]
transport select dapdirect_swd
# The rest should be kept the same
set CHIPNAME nrf52840
source [find target/nrf52.cfg]
```
1. Test your config:
```shell
openocd -f board/nordic_nrf52840_dongle.cfg
```
1. Run the deploy script with the appropriate options, i.e.:
```shell
./deploy.py --board=nrf52840_dongle --opensk --programmer=openocd
```
Finally, remove the programming cable and the USB-A extension cable.
### Buttons and LEDs ### Buttons and LEDs

View File

@@ -1,5 +1,5 @@
diff --git a/chips/nrf52/src/nvmc.rs b/chips/nrf52/src/nvmc.rs diff --git a/chips/nrf52/src/nvmc.rs b/chips/nrf52/src/nvmc.rs
index adbc2a2b5..7594ec867 100644 index adbc2a2b5..4092cf346 100644
--- a/chips/nrf52/src/nvmc.rs --- a/chips/nrf52/src/nvmc.rs
+++ b/chips/nrf52/src/nvmc.rs +++ b/chips/nrf52/src/nvmc.rs
@@ -3,15 +3,19 @@ @@ -3,15 +3,19 @@
@@ -68,7 +68,7 @@ index adbc2a2b5..7594ec867 100644
let word: u32 = (data[i + 0] as u32) << 0 let word: u32 = (data[i + 0] as u32) << 0
| (data[i + 1] as u32) << 8 | (data[i + 1] as u32) << 8
| (data[i + 2] as u32) << 16 | (data[i + 2] as u32) << 16
@@ -387,3 +399,236 @@ impl hil::flash::Flash for Nvmc { @@ -387,3 +399,237 @@ impl hil::flash::Flash for Nvmc {
self.erase_page(page_number) self.erase_page(page_number)
} }
} }
@@ -139,6 +139,7 @@ index adbc2a2b5..7594ec867 100644
+ apps: Grant<App>, + apps: Grant<App>,
+ deferred_caller: &'static DynamicDeferredCall, + deferred_caller: &'static DynamicDeferredCall,
+ ) -> SyscallDriver { + ) -> SyscallDriver {
+ nvmc.configure_readonly();
+ SyscallDriver { + SyscallDriver {
+ nvmc, + nvmc,
+ apps, + apps,

View File

@@ -156,7 +156,7 @@ index f7899d8c5..6956523c6 100644
hil::usb::CtrlSetupResult::ErrGeneric hil::usb::CtrlSetupResult::ErrGeneric
} }
diff --git a/capsules/src/usb/usbc_ctap_hid.rs b/capsules/src/usb/usbc_ctap_hid.rs diff --git a/capsules/src/usb/usbc_ctap_hid.rs b/capsules/src/usb/usbc_ctap_hid.rs
index 642039120..41d69752c 100644 index 642039120..adb7fde14 100644
--- a/capsules/src/usb/usbc_ctap_hid.rs --- a/capsules/src/usb/usbc_ctap_hid.rs
+++ b/capsules/src/usb/usbc_ctap_hid.rs +++ b/capsules/src/usb/usbc_ctap_hid.rs
@@ -44,21 +44,59 @@ static CTAP_REPORT_DESCRIPTOR: &'static [u8] = &[ @@ -44,21 +44,59 @@ static CTAP_REPORT_DESCRIPTOR: &'static [u8] = &[

View File

@@ -1,6 +1,6 @@
diff --git a/capsules/src/usb/app.rs b/capsules/src/usb/app.rs diff --git a/capsules/src/usb/app.rs b/capsules/src/usb/app.rs
new file mode 100644 new file mode 100644
index 000000000..28dff3575 index 000000000..c2f434f12
--- /dev/null --- /dev/null
+++ b/capsules/src/usb/app.rs +++ b/capsules/src/usb/app.rs
@@ -0,0 +1,65 @@ @@ -0,0 +1,65 @@
@@ -79,7 +79,7 @@ index 3f3a4f646..cb5e0af97 100644
pub mod descriptors; pub mod descriptors;
pub mod usb_ctap; pub mod usb_ctap;
diff --git a/capsules/src/usb/usb_ctap.rs b/capsules/src/usb/usb_ctap.rs diff --git a/capsules/src/usb/usb_ctap.rs b/capsules/src/usb/usb_ctap.rs
index da3d16d85..3a709aab5 100644 index da3d16d85..e8f1a87a4 100644
--- a/capsules/src/usb/usb_ctap.rs --- a/capsules/src/usb/usb_ctap.rs
+++ b/capsules/src/usb/usb_ctap.rs +++ b/capsules/src/usb/usb_ctap.rs
@@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
@@ -262,7 +262,7 @@ index da3d16d85..3a709aab5 100644
if !app.waiting { if !app.waiting {
// The call to receive_packet() collected a pending packet. // The call to receive_packet() collected a pending packet.
diff --git a/capsules/src/usb/usbc_ctap_hid.rs b/capsules/src/usb/usbc_ctap_hid.rs diff --git a/capsules/src/usb/usbc_ctap_hid.rs b/capsules/src/usb/usbc_ctap_hid.rs
index 41d69752c..cf17d7942 100644 index adb7fde14..f6762b4b9 100644
--- a/capsules/src/usb/usbc_ctap_hid.rs --- a/capsules/src/usb/usbc_ctap_hid.rs
+++ b/capsules/src/usb/usbc_ctap_hid.rs +++ b/capsules/src/usb/usbc_ctap_hid.rs
@@ -11,6 +11,7 @@ use super::descriptors::HIDSubordinateDescriptor; @@ -11,6 +11,7 @@ use super::descriptors::HIDSubordinateDescriptor;