mirror of
https://github.com/FeitianTech/OpenSK.git
synced 2026-08-28 10:41:01 -07:00
Merge branch 'master' into master
This commit is contained in:
@@ -27,15 +27,11 @@ jobs:
|
||||
- name: Set up OpenSK
|
||||
run: ./setup.sh
|
||||
|
||||
- name: Building board nrf52840dk
|
||||
run: ./deploy.py --board=nrf52840dk --no-app --programmer=none
|
||||
- name: Building board nrf52840_dongle
|
||||
run: ./deploy.py --board=nrf52840_dongle --no-app --programmer=none
|
||||
- name: Building board nrf52840_dongle_dfu
|
||||
run: ./deploy.py --board=nrf52840_dongle_dfu --no-app --programmer=none
|
||||
- name: Building board nrf52840_mdk_dfu
|
||||
run: ./deploy.py --board=nrf52840_mdk_dfu --no-app --programmer=none
|
||||
|
||||
- name: Create a long build directory
|
||||
run: mkdir this-is-a-long-build-directory-0123456789abcdefghijklmnopqrstuvwxyz && mv third_party this-is-a-long-build-directory-0123456789abcdefghijklmnopqrstuvwxyz/
|
||||
|
||||
- name: Building board nrf52840dk
|
||||
run: make -C this-is-a-long-build-directory-0123456789abcdefghijklmnopqrstuvwxyz/third_party/tock/boards/nordic/nrf52840dk
|
||||
- name: Building board nrf52840_dongle
|
||||
run: make -C this-is-a-long-build-directory-0123456789abcdefghijklmnopqrstuvwxyz/third_party/tock/boards/nordic/nrf52840_dongle
|
||||
|
||||
@@ -64,17 +64,23 @@ jobs:
|
||||
command: check
|
||||
args: --target thumbv7em-none-eabi --release --features ram_storage
|
||||
|
||||
- name: Check OpenSK verbose
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
args: --target thumbv7em-none-eabi --release --features verbose
|
||||
|
||||
- name: Check OpenSK debug_ctap,with_ctap1
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
args: --target thumbv7em-none-eabi --release --features debug_ctap,with_ctap1
|
||||
|
||||
- name: Check OpenSK debug_ctap,with_ctap1,panic_console,debug_allocations
|
||||
- name: Check OpenSK debug_ctap,with_ctap1,panic_console,debug_allocations,verbose
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
args: --target thumbv7em-none-eabi --release --features debug_ctap,with_ctap1,panic_console,debug_allocations
|
||||
args: --target thumbv7em-none-eabi --release --features debug_ctap,with_ctap1,panic_console,debug_allocations,verbose
|
||||
|
||||
- name: Check examples
|
||||
uses: actions-rs/cargo@v1
|
||||
|
||||
@@ -20,6 +20,7 @@ jobs:
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
target: thumbv7em-none-eabi
|
||||
components: rustfmt
|
||||
- uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.7
|
||||
|
||||
+5
-4
@@ -18,12 +18,13 @@ arrayref = "0.3.6"
|
||||
subtle = { version = "2.2", default-features = false, features = ["nightly"] }
|
||||
|
||||
[features]
|
||||
std = ["cbor/std", "crypto/std", "crypto/derive_debug"]
|
||||
debug_ctap = ["crypto/derive_debug"]
|
||||
with_ctap1 = ["crypto/with_ctap1"]
|
||||
panic_console = ["libtock/panic_console"]
|
||||
debug_allocations = ["libtock/debug_allocations"]
|
||||
debug_ctap = ["crypto/derive_debug"]
|
||||
panic_console = ["libtock/panic_console"]
|
||||
std = ["cbor/std", "crypto/std", "crypto/derive_debug"]
|
||||
ram_storage = []
|
||||
verbose = ["debug_ctap"]
|
||||
with_ctap1 = ["crypto/with_ctap1"]
|
||||
|
||||
[dev-dependencies]
|
||||
elf2tab = "0.4.0"
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
[package]
|
||||
name = "nrf52840_dongle_dfu"
|
||||
version = "0.1.0"
|
||||
authors = ["Tock Project Developers <tock-dev@googlegroups.com>"]
|
||||
build = "build.rs"
|
||||
edition = "2018"
|
||||
|
||||
[[bin]]
|
||||
path = "../nrf52840_dongle/src/main.rs"
|
||||
name = "nrf52840_dongle_dfu"
|
||||
|
||||
[dependencies]
|
||||
components = { path = "../../components" }
|
||||
cortexm4 = { path = "../../../arch/cortex-m4" }
|
||||
capsules = { path = "../../../capsules" }
|
||||
kernel = { path = "../../../kernel" }
|
||||
nrf52840 = { path = "../../../chips/nrf52840" }
|
||||
nrf52dk_base = { path = "../nrf52dk_base" }
|
||||
@@ -4,7 +4,7 @@ TOCK_ARCH=cortex-m4
|
||||
TARGET=thumbv7em-none-eabi
|
||||
PLATFORM=nrf52840_dongle_dfu
|
||||
|
||||
include ../../third_party/tock/boards/Makefile.common
|
||||
include ../../Makefile.common
|
||||
|
||||
TOCKLOADER=tockloader
|
||||
|
||||
@@ -20,10 +20,10 @@ TOCKLOADER_JTAG_FLAGS = --jlink --arch $(TOCK_ARCH) --board $(PLATFORM) --page-s
|
||||
|
||||
# Upload the kernel over JTAG
|
||||
.PHONY: flash
|
||||
flash: target/$(TARGET)/release/$(PLATFORM).bin
|
||||
flash: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).bin
|
||||
$(TOCKLOADER) $(TOCKLOADER_GENERAL_FLAGS) flash --address $(KERNEL_ADDRESS) $(TOCKLOADER_JTAG_FLAGS) $<
|
||||
|
||||
# Upload the kernel over serial/bootloader
|
||||
.PHONY: program
|
||||
program: target/$(TARGET)/release/$(PLATFORM).hex
|
||||
program: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).hex
|
||||
$(error Cannot program nRF52 Dongle over USB. Use \`make flash\` and JTAG)
|
||||
@@ -0,0 +1,4 @@
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=layout.ld");
|
||||
println!("cargo:rerun-if-changed=../../kernel_layout.ld");
|
||||
}
|
||||
@@ -7,4 +7,4 @@ MEMORY
|
||||
|
||||
MPU_MIN_ALIGN = 8K;
|
||||
|
||||
INCLUDE ../../third_party/tock/boards/kernel_layout.ld
|
||||
INCLUDE ../../kernel_layout.ld
|
||||
@@ -0,0 +1,14 @@
|
||||
[package]
|
||||
name = "nrf52840_mdk_dfu"
|
||||
version = "0.1.0"
|
||||
authors = ["Yihui Xiong <yihui.xiong@hotmail.com>"]
|
||||
build = "build.rs"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
components = { path = "../../components" }
|
||||
cortexm4 = { path = "../../../arch/cortex-m4" }
|
||||
capsules = { path = "../../../capsules" }
|
||||
kernel = { path = "../../../kernel" }
|
||||
nrf52840 = { path = "../../../chips/nrf52840" }
|
||||
nrf52dk_base = { path = "../nrf52dk_base" }
|
||||
@@ -4,7 +4,7 @@ TOCK_ARCH=cortex-m4
|
||||
TARGET=thumbv7em-none-eabi
|
||||
PLATFORM=nrf52840_mdk_dfu
|
||||
|
||||
include ../../third_party/tock/boards/Makefile.common
|
||||
include ../../Makefile.common
|
||||
|
||||
TOCKLOADER=tockloader
|
||||
|
||||
@@ -20,10 +20,10 @@ TOCKLOADER_JTAG_FLAGS = --jlink --arch $(TOCK_ARCH) --board $(PLATFORM) --page-s
|
||||
|
||||
# Upload the kernel over JTAG
|
||||
.PHONY: flash
|
||||
flash: target/$(TARGET)/release/$(PLATFORM).bin
|
||||
flash: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).bin
|
||||
$(TOCKLOADER) $(TOCKLOADER_GENERAL_FLAGS) flash --address $(KERNEL_ADDRESS) $(TOCKLOADER_JTAG_FLAGS) $<
|
||||
|
||||
# Upload the kernel over serial/bootloader
|
||||
.PHONY: program
|
||||
program: target/$(TARGET)/release/$(PLATFORM).hex
|
||||
$(error Cannot program nRF52 Dongle over USB. Use \`make flash\` and JTAG)
|
||||
program: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).hex
|
||||
$(error Cannot program nRF52840-MDK over USB. Use \`make flash\` and JTAG)
|
||||
@@ -0,0 +1,4 @@
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=layout.ld");
|
||||
println!("cargo:rerun-if-changed=../../kernel_layout.ld");
|
||||
}
|
||||
@@ -7,4 +7,4 @@ MEMORY
|
||||
|
||||
MPU_MIN_ALIGN = 8K;
|
||||
|
||||
INCLUDE ../../third_party/tock/boards/kernel_layout.ld
|
||||
INCLUDE ../../kernel_layout.ld
|
||||
@@ -1,30 +0,0 @@
|
||||
[package]
|
||||
name = "nrf52840_dongle_dfu"
|
||||
version = "0.1.0"
|
||||
authors = ["Tock Project Developers <tock-dev@googlegroups.com>"]
|
||||
build = "build.rs"
|
||||
edition = "2018"
|
||||
|
||||
[profile.dev]
|
||||
panic = "abort"
|
||||
lto = false
|
||||
opt-level = "z"
|
||||
debug = true
|
||||
|
||||
[profile.release]
|
||||
panic = "abort"
|
||||
lto = true
|
||||
opt-level = "z"
|
||||
debug = true
|
||||
|
||||
[[bin]]
|
||||
path = "../../third_party/tock/boards/nordic/nrf52840_dongle/src/main.rs"
|
||||
name = "nrf52840_dongle_dfu"
|
||||
|
||||
[dependencies]
|
||||
components = { path = "../../third_party/tock/boards/components" }
|
||||
cortexm4 = { path = "../../third_party/tock/arch/cortex-m4" }
|
||||
capsules = { path = "../../third_party/tock/capsules" }
|
||||
kernel = { path = "../../third_party/tock/kernel" }
|
||||
nrf52840 = { path = "../../third_party/tock/chips/nrf52840" }
|
||||
nrf52dk_base = { path = "../../third_party/tock/boards/nordic/nrf52dk_base" }
|
||||
@@ -1,4 +0,0 @@
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=layout.ld");
|
||||
println!("cargo:rerun-if-changed=../../third_party/tock/boards/kernel_layout.ld");
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
[package]
|
||||
name = "nrf52840_mdk_dfu"
|
||||
version = "0.1.0"
|
||||
authors = ["Yihui Xiong <yihui.xiong@hotmail.com>"]
|
||||
build = "build.rs"
|
||||
edition = "2018"
|
||||
|
||||
[profile.dev]
|
||||
panic = "abort"
|
||||
lto = false
|
||||
opt-level = "z"
|
||||
debug = true
|
||||
|
||||
[profile.release]
|
||||
panic = "abort"
|
||||
lto = true
|
||||
opt-level = "z"
|
||||
debug = true
|
||||
|
||||
[dependencies]
|
||||
components = { path = "../../third_party/tock/boards/components" }
|
||||
cortexm4 = { path = "../../third_party/tock/arch/cortex-m4" }
|
||||
capsules = { path = "../../third_party/tock/capsules" }
|
||||
kernel = { path = "../../third_party/tock/kernel" }
|
||||
nrf52840 = { path = "../../third_party/tock/chips/nrf52840" }
|
||||
nrf52dk_base = { path = "../../third_party/tock/boards/nordic/nrf52dk_base" }
|
||||
@@ -1,4 +0,0 @@
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=layout.ld");
|
||||
println!("cargo:rerun-if-changed=../../third_party/tock/boards/kernel_layout.ld");
|
||||
}
|
||||
@@ -115,7 +115,7 @@ SUPPORTED_BOARDS = {
|
||||
),
|
||||
"nrf52840_dongle_dfu":
|
||||
OpenSKBoard(
|
||||
path="boards/nrf52840_dongle_dfu",
|
||||
path="third_party/tock/boards/nordic/nrf52840_dongle_dfu",
|
||||
arch="thumbv7em-none-eabi",
|
||||
page_size=4096,
|
||||
kernel_address=0x1000,
|
||||
@@ -132,7 +132,7 @@ SUPPORTED_BOARDS = {
|
||||
),
|
||||
"nrf52840_mdk_dfu":
|
||||
OpenSKBoard(
|
||||
path="boards/nrf52840_mdk_dfu",
|
||||
path="third_party/tock/boards/nordic/nrf52840_mdk_dfu",
|
||||
arch="thumbv7em-none-eabi",
|
||||
page_size=4096,
|
||||
kernel_address=0x1000,
|
||||
@@ -304,7 +304,8 @@ class OpenSKInstaller:
|
||||
def build_tockos(self):
|
||||
info("Building Tock OS for board {}".format(self.args.board))
|
||||
props = SUPPORTED_BOARDS[self.args.board]
|
||||
out_directory = os.path.join(props.path, "target", props.arch, "release")
|
||||
out_directory = os.path.join("third_party", "tock", "target", props.arch,
|
||||
"release")
|
||||
os.makedirs(out_directory, exist_ok=True)
|
||||
self.checked_command_output(["make"], cwd=props.path)
|
||||
|
||||
@@ -418,8 +419,9 @@ class OpenSKInstaller:
|
||||
|
||||
def install_tock_os(self):
|
||||
board_props = SUPPORTED_BOARDS[self.args.board]
|
||||
kernel_file = os.path.join(board_props.path, "target", board_props.arch,
|
||||
"release", "{}.bin".format(self.args.board))
|
||||
kernel_file = os.path.join("third_party", "tock", "target",
|
||||
board_props.arch, "release",
|
||||
"{}.bin".format(self.args.board))
|
||||
info("Flashing file {}.".format(kernel_file))
|
||||
with open(kernel_file, "rb") as f:
|
||||
kernel = f.read()
|
||||
@@ -481,8 +483,9 @@ class OpenSKInstaller:
|
||||
|
||||
if self.args.tockos:
|
||||
# Process kernel
|
||||
kernel_path = os.path.join(board_props.path, "target", board_props.arch,
|
||||
"release", "{}.bin".format(self.args.board))
|
||||
kernel_path = os.path.join("third_party", "tock", "target",
|
||||
board_props.arch, "release",
|
||||
"{}.bin".format(self.args.board))
|
||||
with open(kernel_path, "rb") as kernel:
|
||||
kern_hex = intelhex.IntelHex()
|
||||
kern_hex.frombytes(kernel.read(), offset=board_props.kernel_address)
|
||||
@@ -705,6 +708,15 @@ if __name__ == "__main__":
|
||||
"output messages before starting blinking the LEDs on the "
|
||||
"board."),
|
||||
)
|
||||
main_parser.add_argument(
|
||||
"--debug",
|
||||
action="append_const",
|
||||
const="debug_ctap",
|
||||
dest="features",
|
||||
help=("Compiles and installs the OpenSK application in debug mode "
|
||||
"(i.e. more debug messages will be sent over the console port "
|
||||
"such as hexdumps of packets)."),
|
||||
)
|
||||
main_parser.add_argument(
|
||||
"--debug-allocations",
|
||||
action="append_const",
|
||||
@@ -713,6 +725,14 @@ if __name__ == "__main__":
|
||||
help=("The console will be used to output allocator statistics every "
|
||||
"time an allocation/deallocation happens."),
|
||||
)
|
||||
main_parser.add_argument(
|
||||
"--verbose",
|
||||
action="append_const",
|
||||
const="verbose",
|
||||
dest="features",
|
||||
help=("The console will be used to output verbose information about the "
|
||||
"OpenSK application. This also automatically activates --debug."),
|
||||
)
|
||||
main_parser.add_argument(
|
||||
"--no-u2f",
|
||||
action=RemoveConstAction,
|
||||
@@ -731,15 +751,6 @@ if __name__ == "__main__":
|
||||
"This is useful to allow flashing multiple OpenSK authenticators "
|
||||
"in a row without them being considered clones."),
|
||||
)
|
||||
main_parser.add_argument(
|
||||
"--debug",
|
||||
action="append_const",
|
||||
const="debug_ctap",
|
||||
dest="features",
|
||||
help=("Compiles and installs the OpenSK application in debug mode "
|
||||
"(i.e. more debug messages will be sent over the console port "
|
||||
"such as hexdumps of packets)."),
|
||||
)
|
||||
main_parser.add_argument(
|
||||
"--no-persistent-storage",
|
||||
action="append_const",
|
||||
|
||||
+3
-2
@@ -50,8 +50,9 @@ In order to compile and flash a working OpenSK firmware, you will need the
|
||||
following:
|
||||
|
||||
* rustup (can be installed with [Rustup](https://rustup.rs/))
|
||||
* python3 and pip
|
||||
* the OpenSSL command line tool
|
||||
* python3 and pip (can be installed with the `python3-pip` package on Debian)
|
||||
* the OpenSSL command line tool (can be installed with the `libssl-dev`
|
||||
package on Debian)
|
||||
|
||||
The scripts provided in this project have been tested under Linux and OS X. We
|
||||
haven't tested them on Windows and other platforms.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user