Merge #208 208: linker: add sram origin symbol r=bradjc a=bradjc This allows elf2tab to determine what the start of RAM address is when generating a fixed address header in the TBF. See https://github.com/tock/elf2tab/pull/23 and https://github.com/tock/tock/pull/1845. Co-authored-by: Brad Campbell <bradjc5@gmail.com>
diff --git a/.github/workflows/size-diff.yml b/.github/workflows/size-diff.yml new file mode 100644 index 0000000..6f8c7d0 --- /dev/null +++ b/.github/workflows/size-diff.yml
@@ -0,0 +1,56 @@ +# Calculates the size diffs for the each example binary. Runs when a pull +# request is created or modified. + +name: size-diff +on: pull_request + +jobs: + size-diff: + # Using ubuntu-latest can cause breakage when ubuntu-latest is updated to + # point at a new Ubuntu version. Instead, explicitly specify the version, so + # we can update when we need to. This *could* break if we don't update it + # until support for 18.04 is dropped, but it is likely we'll have a reason + # to update to a newer Ubuntu before then anyway. + runs-on: ubuntu-18.04 + + steps: + # Clones a single commit from the libtock-rs repository. The commit cloned + # is a merge commit between the PR's target branch and the PR's source. + # We'll later add another commit (the pre-merge target branch) to the + # repository. + - name: Clone repository + uses: actions/checkout@v2.3.0 + + # Install a Rust toolchain with the components necessary to run + # `print-sizes`. This action doesn't seem to be able to install toolchains + # for multiple targets, so I add the targets later in the "size report" + # step. + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1.0.6 + with: + profile: minimal + + # The main diff script. Stores the sizes of the example binaries for both + # the merge commit and the target branch. We display the diff in a + # separate step to make it easy to navigate to in the GitHub Actions UI. + - name: Compute sizes + run: | + UPSTREAM_REMOTE_NAME="${UPSTREAM_REMOTE_NAME:-origin}" + GITHUB_BASE_REF="${GITHUB_BASE_REF:-master}" + cd "${GITHUB_WORKSPACE}" + rustup target add riscv32imc-unknown-none-elf thumbv7em-none-eabi + make -j2 examples # The VM this runs on has 2 logical cores. + cargo run --release -p print_sizes >'${{runner.temp}}/merge-sizes' + git remote set-branches "${UPSTREAM_REMOTE_NAME}" "${GITHUB_BASE_REF}" + git fetch --depth=1 "${UPSTREAM_REMOTE_NAME}" "${GITHUB_BASE_REF}" + git checkout "${UPSTREAM_REMOTE_NAME}/${GITHUB_BASE_REF}" + rustup target add riscv32imc-unknown-none-elf thumbv7em-none-eabi + make -j2 examples + cargo run --release -p print_sizes >'${{runner.temp}}/base-sizes' + + # Computes and displays the size diff. diff returns a nonzero status code + # if the files differ, and GitHub interprets a nonzero status code as an + # error. To avoid GitHub interpreting a difference as an error, we add + # || exit 0 to the command. + - name: Size diff + run: diff '${{runner.temp}}/base-sizes' '${{runner.temp}}/merge-sizes' || exit 0
diff --git a/Cargo.toml b/Cargo.toml index b8e0bec..f5cb932 100644 --- a/Cargo.toml +++ b/Cargo.toml
@@ -6,13 +6,13 @@ edition = "2018" [features] -alloc = ["libtock-core/alloc"] -custom_panic_handler = ["libtock-core/custom_panic_handler"] -custom_alloc_error_handler = ["libtock-core/custom_alloc_error_handler"] +alloc = ["libtock_core/alloc"] +custom_panic_handler = ["libtock_core/custom_panic_handler"] +custom_alloc_error_handler = ["libtock_core/custom_alloc_error_handler"] __internal_disable_gpio_in_integration_test = [] [dependencies] -libtock-core = { path = "core" } +libtock_core = { path = "core" } libtock_codegen = { path = "codegen" } futures = { version = "0.3.1", default-features = false, features = ["unstable", "cfg-target-has-atomic"] } @@ -62,6 +62,6 @@ members = [ "codegen", "core", - "test-runner", - "tools/print-sizes", + "test_runner", + "tools/print_sizes", ]
diff --git a/Makefile b/Makefile index d205cc7..5218010 100644 --- a/Makefile +++ b/Makefile
@@ -11,9 +11,12 @@ @echo "libtock-rs currently includes support for the following platforms:" @echo " - hail" @echo " - nrf52840" + @echo " - nucleo_f429zi" + @echo " - nucleo_f446re" @echo " - opentitan" @echo " - hifive1" @echo " - nrf52" + @echo " - imxrt1050" @echo " - apollo3" @echo @echo "Run 'make setup' to setup Rust to build libtock-rs." @@ -57,23 +60,23 @@ # Prints out the sizes of the example binaries. .PHONY: print-sizes print-sizes: examples - cargo run --release -p print-sizes + cargo run --release -p print_sizes # Runs the libtock_test tests in QEMU on a simulated HiFive board. .PHONY: test-qemu-hifive test-qemu-hifive: kernel-hifive setup-qemu PLATFORM=hifive1 cargo rrv32imac --example libtock_test --features=alloc \ --features=__internal_disable_gpio_in_integration_test - cargo run -p test-runner + cargo run -p test_runner .PHONY: examples examples: - PLATFORM=nrf52 cargo build --release --target=thumbv7em-none-eabi --examples -p libtock -p libtock-core + PLATFORM=nrf52 cargo build --release --target=thumbv7em-none-eabi --examples -p libtock -p libtock_core PLATFORM=nrf52 cargo build --release --target=thumbv7em-none-eabi --examples --features=alloc PLATFORM=nrf52 cargo build --release --target=thumbv7em-none-eabi --example panic --features=custom_panic_handler,custom_alloc_error_handler PLATFORM=nrf52 cargo build --release --target=thumbv7em-none-eabi --example alloc_error --features=alloc,custom_alloc_error_handler # Important: This tests a platform without atomic instructions. - PLATFORM=opentitan cargo build --release --target=riscv32imc-unknown-none-elf --examples -p libtock -p libtock-core + PLATFORM=opentitan cargo build --release --target=riscv32imc-unknown-none-elf --examples -p libtock -p libtock_core .PHONY: test test: examples test-qemu-hifive @@ -102,6 +105,22 @@ flash-hail: PLATFORM=hail cargo run $(release) --target=thumbv7em-none-eabi --example $(EXAMPLE) $(features) +.PHONY: nucleo_f429zi +nucleo_f429zi: + PLATFORM=nucleo_f429zi cargo build $(release) --target=thumbv7em-none-eabi --examples $(features) + +.PHONY: flash-nucleo_f429zi +flash-nucleo_f429zi: + PLATFORM=nucleo_f429zi cargo run $(release) --target=thumbv7em-none-eabi --example $(EXAMPLE) $(features) + +.PHONY: nucleo_f446re +nucleo_f446re: + PLATFORM=nucleo_f446re cargo build $(release) --target=thumbv7em-none-eabi --examples $(features) + +.PHONY: flash-nucleo_f446re +flash-nucleo_f446re: + PLATFORM=nucleo_f446re cargo run $(release) --target=thumbv7em-none-eabi --example $(EXAMPLE) $(features) + .PHONY: nrf52840 nrf52840: PLATFORM=nrf52840 cargo build $(release) --target=thumbv7em-none-eabi --examples $(features) @@ -134,6 +153,15 @@ flash-nrf52: PLATFORM=nrf52 cargo run $(release) --target=thumbv7em-none-eabi --example $(EXAMPLE) $(features) +.PHONY: imxrt1050 +imxrt1050: + PLATFORM=imxrt1050 cargo build $(release) --target=thumbv7em-none-eabi --examples $(features) + +.PHONY: flash-imxrt1050 +flash-imxrt1050: + PLATFORM=imxrt1050 cargo run $(release) --target=thumbv7em-none-eabi --example $(EXAMPLE) $(features) + + .PHONY: clean clean: cargo clean
diff --git a/boards/layout_imxrt1050.ld b/boards/layout_imxrt1050.ld new file mode 100644 index 0000000..56ecf11 --- /dev/null +++ b/boards/layout_imxrt1050.ld
@@ -0,0 +1,17 @@ +/* Layout for the iMX.RT1050 board, used by the examples in this repository. */ + +MEMORY { + /* The application region is 64 bytes (0x40) */ + FLASH (rx) : ORIGIN = 0x63002040, LENGTH = 0xFFFFC0 + SRAM (rwx) : ORIGIN = 0x20004000, LENGTH = 112K +} + +/* + * Any change to STACK_SIZE should be accompanied by a corresponding change to + * `elf2tab`'s `--stack` option + */ +STACK_SIZE = 2048; + +MPU_MIN_ALIGN = 8K; + +INCLUDE layout_generic.ld
diff --git a/boards/layout_nucleo_f429zi.ld b/boards/layout_nucleo_f429zi.ld new file mode 100644 index 0000000..8261e9c --- /dev/null +++ b/boards/layout_nucleo_f429zi.ld
@@ -0,0 +1,17 @@ +/* Layout for the Nucleo F429zi, used by the examples in this repository. */ + +MEMORY { + /* The application region is 64 bytes (0x40) */ + FLASH (rx) : ORIGIN = 0x08040040, LENGTH = 255K + SRAM (rwx) : ORIGIN = 0x20004000, LENGTH = 112K +} + +/* + * Any change to STACK_SIZE should be accompanied by a corresponding change to + * `elf2tab`'s `--stack` option + */ +STACK_SIZE = 2048; + +MPU_MIN_ALIGN = 8K; + +INCLUDE layout_generic.ld
diff --git a/boards/layout_nucleo_f446re.ld b/boards/layout_nucleo_f446re.ld new file mode 100644 index 0000000..6536b30 --- /dev/null +++ b/boards/layout_nucleo_f446re.ld
@@ -0,0 +1,17 @@ +/* Layout for the Nucleo F446re, used by the examples in this repository. */ + +MEMORY { + /* The application region is 64 bytes (0x40) */ + FLASH (rx) : ORIGIN = 0x08040040, LENGTH = 255K + SRAM (rwx) : ORIGIN = 0x20004000, LENGTH = 176K +} + +/* + * Any change to STACK_SIZE should be accompanied by a corresponding change to + * `elf2tab`'s `--stack` option + */ +STACK_SIZE = 2048; + +MPU_MIN_ALIGN = 8K; + +INCLUDE layout_generic.ld
diff --git a/core/Cargo.toml b/core/Cargo.toml index 94f3c8f..bfa9570 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml
@@ -1,11 +1,12 @@ [package] -name = "libtock-core" +name = "libtock_core" version = "0.1.0" authors = ["Tock Project Developers <tock-dev@googlegroups.com>"] edition = "2018" [features] -alloc = [ "linked_list_allocator" ] +alloc = ["alloc_init", "linked_list_allocator"] +alloc_init = [] custom_panic_handler = [] custom_alloc_error_handler = []
diff --git a/core/README.md b/core/README.md index ba9602a..839c9ed 100644 --- a/core/README.md +++ b/core/README.md
@@ -1,4 +1,4 @@ -# libtock-core +# libtock\_core Core crate of `libtock-rs`. It contains the architecture specific code of `libtock-rs`. In particular:
diff --git a/core/examples/empty_main.rs b/core/examples/empty_main.rs index dd062bc..1179b43 100644 --- a/core/examples/empty_main.rs +++ b/core/examples/empty_main.rs
@@ -1,13 +1,13 @@ -// The most minimal libtock-core example possible. This file primarily exists +// The most minimal libtock_core example possible. This file primarily exists // for code size measurement, as this should create the smallest-possible -// libtock-core app. +// libtock_core app. #![no_std] -// If you don't *use* anything from libtock-core directly, cargo will not link +// If you don't *use* anything from libtock_core directly, cargo will not link // it into the executable. However, we still need the runtime and lang items. -// Therefore a libtock-core app that doesn't directly mention anything in -// libtock-core needs to explicitly declare its dependency on libtock-core as +// Therefore a libtock_core app that doesn't directly mention anything in +// libtock_core needs to explicitly declare its dependency on libtock_core as // follows. extern crate libtock_core;
diff --git a/core/src/alloc.rs b/core/src/alloc.rs index 05e9669..f971849 100644 --- a/core/src/alloc.rs +++ b/core/src/alloc.rs
@@ -4,7 +4,12 @@ use core::ptr::NonNull; use linked_list_allocator::Heap; -pub static mut HEAP: Heap = Heap::empty(); +static mut HEAP: Heap = Heap::empty(); + +#[no_mangle] +unsafe fn libtock_alloc_init(app_heap_start: usize, app_heap_size: usize) { + HEAP.init(app_heap_start, app_heap_size); +} struct TockAllocator;
diff --git a/core/src/debug/platform_arm.rs b/core/src/debug/platform_arm.rs index 46211b3..a777334 100644 --- a/core/src/debug/platform_arm.rs +++ b/core/src/debug/platform_arm.rs
@@ -1,5 +1,5 @@ pub fn get_stack_pointer() -> usize { let stack_pointer; - unsafe { asm!("mov $0, sp" : "=r"(stack_pointer) : : : "volatile") }; + unsafe { llvm_asm!("mov $0, sp" : "=r"(stack_pointer) : : : "volatile") }; stack_pointer }
diff --git a/core/src/debug/platform_riscv32.rs b/core/src/debug/platform_riscv32.rs index 7f4a4e0..c276442 100644 --- a/core/src/debug/platform_riscv32.rs +++ b/core/src/debug/platform_riscv32.rs
@@ -1,5 +1,5 @@ pub fn get_stack_pointer() -> usize { let stack_pointer; - unsafe { asm!("mv $0, sp" : "=r"(stack_pointer) : : : "volatile") }; + unsafe { llvm_asm!("mv $0, sp" : "=r"(stack_pointer) : : : "volatile") }; stack_pointer }
diff --git a/core/src/entry_point/mod.rs b/core/src/entry_point/mod.rs index 40bdb62..850c213 100644 --- a/core/src/entry_point/mod.rs +++ b/core/src/entry_point/mod.rs
@@ -104,10 +104,8 @@ ); // Zero .bss (specified by the linker script). - let bss_end = layout_header.bss_start + layout_header.bss_size; // 1 past the end of .bss - for i in layout_header.bss_start..bss_end { - core::ptr::write(i as *mut u8, 0); - } + let bss_start = layout_header.bss_start as *mut u8; + core::ptr::write_bytes(bss_start, 0u8, layout_header.bss_size); // TODO: Wait for rustc to have working ROPI-RWPI relocation support, then // implement dynamic relocations here. At the moment, rustc does not have @@ -127,8 +125,8 @@ // Tell the kernel the new app heap break. memop::set_brk(app_heap_end as *const u8); - #[cfg(feature = "alloc")] - crate::alloc::HEAP.init(app_heap_start, app_heap_size); + #[cfg(feature = "alloc_init")] + crate::libtock_alloc_init(app_heap_start, app_heap_size); main(0, ptr::null());
diff --git a/core/src/entry_point/start_item_arm.rs b/core/src/entry_point/start_item_arm.rs index c9390f6..894088e 100644 --- a/core/src/entry_point/start_item_arm.rs +++ b/core/src/entry_point/start_item_arm.rs
@@ -12,7 +12,7 @@ _memory_len: usize, app_heap_break: usize, ) -> ! { - asm!(" + llvm_asm!(" // Because ROPI-RWPI support in LLVM/rustc is incomplete, Rust // applications must be statically linked. An offset between the // location the program is linked at and its actual location in flash @@ -23,7 +23,7 @@ // the Program Counter) will match the intended location of .start. We // don't have an easy way to signal an error, so for now we just yield // if the location is wrong. - sub r4, pc, #4 // r4 = pc + subw r4, pc, #4 // r4 = pc ldr r5, =.start // r5 = address of .start cmp r4, r5 beq .Lstack_init // Jump to stack initialization if pc was correct
diff --git a/core/src/entry_point/start_item_riscv32.rs b/core/src/entry_point/start_item_riscv32.rs index 347400c..f8a0e19 100644 --- a/core/src/entry_point/start_item_riscv32.rs +++ b/core/src/entry_point/start_item_riscv32.rs
@@ -14,7 +14,7 @@ // Due to Rust issue: https://github.com/rust-lang/rust/issues/42779 we can't have // args to the function pub unsafe extern "C" fn _start() -> ! { - asm!( + llvm_asm!( // Compute the stack top. // // struct hdr* myhdr = (struct hdr*) app_start; @@ -105,7 +105,7 @@ #[export_name = "abort"] pub extern "C" fn abort() { unsafe { - asm! (" + llvm_asm! (" // Simply go back to the start as if we had just booted. j _start "
diff --git a/core/src/lib.rs b/core/src/lib.rs index e465f4d..3bdfe5b 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs
@@ -1,4 +1,4 @@ -#![feature(asm, lang_items, naked_functions)] +#![feature(lang_items, llvm_asm, naked_functions)] #![cfg_attr(any(target_arch = "arm", target_arch = "riscv32"), no_std)] #![cfg_attr(feature = "alloc", feature(alloc_error_handler))] @@ -8,6 +8,11 @@ #[cfg(any(target_arch = "arm", target_arch = "riscv32"))] mod lang_items; +#[cfg(feature = "alloc_init")] +extern "Rust" { + fn libtock_alloc_init(app_heap_start: usize, app_heap_size: usize); +} + pub mod callback; pub mod debug; pub mod memop;
diff --git a/core/src/syscalls/platform_arm.rs b/core/src/syscalls/platform_arm.rs index 4ff146a..066459e 100644 --- a/core/src/syscalls/platform_arm.rs +++ b/core/src/syscalls/platform_arm.rs
@@ -22,7 +22,7 @@ // registers r4-r8, r10, r11 and SP (and r9 in PCS variants that designate // r9 as v6) As our compilation flags mark r9 as the PIC base register, it // does not need to be saved. Thus we must clobber r0-3, r12, and LR - asm!( + llvm_asm!( "svc 0" : : @@ -40,7 +40,7 @@ ud: usize, ) -> isize { let res; - asm!("svc 1" : "={r0}"(res) + llvm_asm!("svc 1" : "={r0}"(res) : "{r0}"(major) "{r1}"(minor) "{r2}"(cb) "{r3}"(ud) : "memory" : "volatile"); @@ -52,7 +52,7 @@ #[allow(clippy::missing_safety_doc)] pub unsafe fn command(major: usize, minor: usize, arg1: usize, arg2: usize) -> isize { let res; - asm!("svc 2" : "={r0}"(res) + llvm_asm!("svc 2" : "={r0}"(res) : "{r0}"(major) "{r1}"(minor) "{r2}"(arg1) "{r3}"(arg2) : "memory" : "volatile"); @@ -64,7 +64,7 @@ #[allow(clippy::missing_safety_doc)] pub unsafe fn command1(major: usize, minor: usize, arg: usize) -> isize { let res; - asm!("svc 2" : "={r0}"(res) + llvm_asm!("svc 2" : "={r0}"(res) : "{r0}"(major) "{r1}"(minor) "{r2}"(arg) : "memory" : "volatile"); @@ -76,7 +76,7 @@ #[allow(clippy::missing_safety_doc)] pub unsafe fn allow(major: usize, minor: usize, slice: *mut u8, len: usize) -> isize { let res; - asm!("svc 3" : "={r0}"(res) + llvm_asm!("svc 3" : "={r0}"(res) : "{r0}"(major) "{r1}"(minor) "{r2}"(slice) "{r3}"(len) : "memory" : "volatile"); @@ -88,7 +88,7 @@ #[allow(clippy::missing_safety_doc)] pub unsafe fn memop(major: u32, arg1: usize) -> isize { let res; - asm!("svc 4" : "={r0}"(res) + llvm_asm!("svc 4" : "={r0}"(res) : "{r0}"(major) "{r1}"(arg1) : "memory" : "volatile");
diff --git a/core/src/syscalls/platform_riscv32.rs b/core/src/syscalls/platform_riscv32.rs index f7d1858..f2c49fe 100644 --- a/core/src/syscalls/platform_riscv32.rs +++ b/core/src/syscalls/platform_riscv32.rs
@@ -3,7 +3,7 @@ #[allow(clippy::missing_safety_doc)] pub unsafe fn yieldk() { /* TODO: Stop yielding */ - asm! ( + llvm_asm! ( "li a0, 0 ecall" : @@ -23,7 +23,7 @@ ud: usize, ) -> isize { let res; - asm!("li a0, 1 + llvm_asm!("li a0, 1 ecall" : "={x10}" (res) : "{x11}" (major), "{x12}" (minor), "{x13}" (cb), "{x14}" (ud) @@ -37,7 +37,7 @@ #[allow(clippy::missing_safety_doc)] pub unsafe fn command(major: usize, minor: usize, arg1: usize, arg2: usize) -> isize { let res; - asm!("li a0, 2 + llvm_asm!("li a0, 2 ecall" : "={x10}" (res) : "{x11}" (major), "{x12}" (minor), "{x13}" (arg1), "{x14}" (arg2) @@ -51,7 +51,7 @@ #[allow(clippy::missing_safety_doc)] pub unsafe fn command1(major: usize, minor: usize, arg: usize) -> isize { let res; - asm!("li a0, 2 + llvm_asm!("li a0, 2 ecall" : "={x10}" (res) : "{x11}" (major), "{x12}" (minor), "{x13}" (arg) @@ -65,7 +65,7 @@ #[allow(clippy::missing_safety_doc)] pub unsafe fn allow(major: usize, minor: usize, slice: *mut u8, len: usize) -> isize { let res; - asm!("li a0, 3 + llvm_asm!("li a0, 3 ecall" : "={x10}" (res) : "{x11}" (major), "{x12}" (minor), "{x13}" (slice), "{x14}" (len) @@ -79,7 +79,7 @@ #[allow(clippy::missing_safety_doc)] pub unsafe fn memop(major: u32, arg1: usize) -> isize { let res; - asm!("li a0, 4 + llvm_asm!("li a0, 4 ecall" : "={x10}" (res) : "{x11}" (major), "{x12}" (arg1)
diff --git a/doc/Dependencies.md b/doc/Dependencies.md index f157049..77da194 100644 --- a/doc/Dependencies.md +++ b/doc/Dependencies.md
@@ -25,5 +25,5 @@ ## Avoiding Optional Dependencies -To avoid pulling in optional dependencies, users should use `libtock-core` -instead of `libtock`. `libtock-core` is in the `core/` directory. +To avoid pulling in optional dependencies, users should use `libtock_core` +instead of `libtock`. `libtock_core` is in the `core/` directory.
diff --git a/rust-toolchain b/rust-toolchain index 8bd4ff0..4aec5c6 100644 --- a/rust-toolchain +++ b/rust-toolchain
@@ -1 +1 @@ -nightly-2020-04-06 +nightly-2020-06-10
diff --git a/src/ble_composer.rs b/src/ble_composer.rs index 0bb96d8..589dfc3 100644 --- a/src/ble_composer.rs +++ b/src/ble_composer.rs
@@ -21,7 +21,7 @@ self.bytes[self.occupied] = (content.len() + 1) as u8; self.bytes[self.occupied + 1] = kind; let write = &mut self.bytes[self.occupied + 2..(self.occupied + content.len() + 2)]; - write.clone_from_slice(content); + write.copy_from_slice(content); self.occupied += 2 + content.len(); Ok(()) } @@ -44,7 +44,7 @@ self.bytes[self.occupied + 3] = uuid[1]; let write = &mut self.bytes[self.occupied + 4..(self.occupied + content.len() + 4)]; - write.clone_from_slice(content); + write.copy_from_slice(content); self.occupied += 4 + content.len(); Ok(()) }
diff --git a/src/ble_parser.rs b/src/ble_parser.rs index 1d12b19..216d974 100644 --- a/src/ble_parser.rs +++ b/src/ble_parser.rs
@@ -53,7 +53,7 @@ 0x02, 0x02, 0x01, 0x02, 0x01, 0x03, 0x03, 0x16, 0x01, 0x02, 0x04, 0xFF, 0x01, 0x02, 0x03, ]; - slice.clone_from_slice(data); + slice.copy_from_slice(data); } assert_eq!(find(&buf, 0x02), Some(&[0x01][0..1])); assert_eq!(find(&buf, 0x01), Some(&[0x03][0..1])); @@ -67,7 +67,7 @@ { let slice = &mut buf[8..18]; let data = &[0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x0, 0x16, 0x01, 0x02]; - slice.clone_from_slice(data); + slice.copy_from_slice(data); } } @@ -77,7 +77,7 @@ { let slice = &mut buf[8..10]; let data = &[0x04, 0x02]; - slice.clone_from_slice(data); + slice.copy_from_slice(data); } assert_eq!(find(&buf, 0xF2), None); }
diff --git a/src/hmac.rs b/src/hmac.rs index e5475cc..5185128 100644 --- a/src/hmac.rs +++ b/src/hmac.rs
@@ -99,7 +99,7 @@ syscalls::allow(DRIVER_NUMBER, allow_nr::DEST, &mut buffer.buffer).map_err(Into::into) } - pub fn subscribe<CB: FnMut(usize, usize) -> () + FnMut(usize, usize)>( + pub fn subscribe<CB: FnMut(usize, usize)>( &self, callback: &'a mut CB, ) -> TockResult<CallbackSubscription> {
diff --git a/test-runner/Cargo.toml b/test_runner/Cargo.toml similarity index 95% rename from test-runner/Cargo.toml rename to test_runner/Cargo.toml index b9769b9..133ff23 100644 --- a/test-runner/Cargo.toml +++ b/test_runner/Cargo.toml
@@ -1,5 +1,5 @@ [package] -name = "test-runner" +name = "test_runner" version = "0.1.0" authors = ["torfmaster <briefe@kebes.de>"] edition = "2018"
diff --git a/test-runner/src/main.rs b/test_runner/src/main.rs similarity index 100% rename from test-runner/src/main.rs rename to test_runner/src/main.rs
diff --git a/tools/flash.sh b/tools/flash.sh index ea75dee..cee7571 100755 --- a/tools/flash.sh +++ b/tools/flash.sh
@@ -20,6 +20,11 @@ binary_name=cortex-m4.elf tockload=n ;; + "nucleo_f429zi"|"nucleo_f446re") + tockloader_flags="" + binary_name=cortex-m4.elf + tockload=n + ;; "nrf52"|"nrf52840") tockloader_flags="--jlink --arch cortex-m4 --board nrf52dk --jtag-device nrf52" binary_name=cortex-m4.elf @@ -35,6 +40,11 @@ binary_name=rv32imac.elf tockload=n ;; + "imxrt1050") + tockloader_flags="" + binary_name=cortex-m7.elf + tockload=n + ;; "opentitan") tockloader_flags="" binary_name=rv32imc.elf
diff --git a/tools/print-sizes/Cargo.toml b/tools/print_sizes/Cargo.toml similarity index 61% rename from tools/print-sizes/Cargo.toml rename to tools/print_sizes/Cargo.toml index 97bdc48..12f76de 100644 --- a/tools/print-sizes/Cargo.toml +++ b/tools/print_sizes/Cargo.toml
@@ -1,12 +1,12 @@ -# Finds all the libtock-core and libtock-rs examples and prints the sizes of +# Finds all the libtock_core and libtock examples and prints the sizes of # several of their sections. Searches the target/$ARCH/release directory. Note -# that print-sizes will not build the examples; that is done by the +# that print_sizes will not build the examples; that is done by the # `print-sizes` Makefile action. [package] authors = ["Tock Project Developers <tock-dev@googlegroups.com>"] edition = "2018" -name = "print-sizes" +name = "print_sizes" version = "0.1.0" [dependencies]
diff --git a/tools/print-sizes/src/main.rs b/tools/print_sizes/src/main.rs similarity index 100% rename from tools/print-sizes/src/main.rs rename to tools/print_sizes/src/main.rs