diff --git a/.github/workflows/boards_build.yml b/.github/workflows/boards_build.yml new file mode 100644 index 0000000000000000000000000000000000000000..ef71f425d2bf929f569e2932838d7f6ea2be30c0 --- /dev/null +++ b/.github/workflows/boards_build.yml @@ -0,0 +1,35 @@ +--- +name: Build supported boards +on: + push: + paths: + - 'patches/tock/*' + - 'third_party/tock/**' + pull_request: + types: [opened, synchronize, reopened] + +jobs: + build_boards: + strategy: + matrix: + os: [ubuntu-18.04, macos-10.15] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + target: thumbv7em-none-eabi + - uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Install Python dependencies + run: python -m pip install --upgrade pip setuptools wheel + - name: Set up OpenSK + run: ./setup.sh + - 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 diff --git a/patches/tock/01-persistent-storage.patch b/patches/tock/01-persistent-storage.patch index 5aaec063d52d18dcb77d17af092a6500812a5828..ecfb0b0b0f01847f7735d9b3a0d015d137d81242 100644 --- a/patches/tock/01-persistent-storage.patch +++ b/patches/tock/01-persistent-storage.patch @@ -295,7 +295,7 @@ index ece4a443..9a1afc84 100644 } + + pub fn in_writeable_flash_region(&self, ptr: usize, len: usize) -> bool { -+ self.kernel.process_map_or(false, self.idx, |process| { ++ self.kernel.process_map_or(false, *self, |process| { + let ptr = match ptr.checked_sub(process.flash_start() as usize) { + None => return false, + Some(ptr) => ptr, diff --git a/patches/tock/04-fix-dynamic-deferred-call.patch b/patches/tock/04-fix-dynamic-deferred-call.patch deleted file mode 100644 index 4e29004ecfa049b815a79884aeb96c6acf605d8e..0000000000000000000000000000000000000000 --- a/patches/tock/04-fix-dynamic-deferred-call.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff --git a/kernel/src/common/dynamic_deferred_call.rs b/kernel/src/common/dynamic_deferred_call.rs -index 53f5143d..ca349972 100644 ---- a/kernel/src/common/dynamic_deferred_call.rs -+++ b/kernel/src/common/dynamic_deferred_call.rs -@@ -226,23 +226,25 @@ impl DynamicDeferredCall { - /// `call_global_instance_while`. - pub(self) fn call_while<F: Fn() -> bool>(&self, f: F) { - if self.call_pending.get() { -- // Reset call_pending here, as it may be set again in the deferred calls -- self.call_pending.set(false); -+ for (i, client_state) in self.client_states.iter().enumerate() { -+ if !f() { -+ break; -+ } -+ if client_state.scheduled.get() { -+ client_state.client.map(|client| { -+ client_state.scheduled.set(false); -+ client.call(DeferredCallHandle(i)); -+ }); -+ } -+ } - -- self.client_states -- .iter() -- .enumerate() -- .filter(|(_i, client_state)| client_state.scheduled.get()) -- .filter_map(|(i, client_state)| { -- client_state -- .client -- .map(|c| (i, &client_state.scheduled, *c)) -- }) -- .take_while(|_| f()) -- .for_each(|(i, call_reqd, client)| { -- call_reqd.set(false); -- client.call(DeferredCallHandle(i)); -- }); -+ // Recompute call_pending here, as some deferred calls may have been skipped due to the -+ // `f` predicate becoming false. -+ self.call_pending.set( -+ self.client_states -+ .iter() -+ .any(|client_state| client_state.scheduled.get()), -+ ); - } - } - } diff --git a/patches/tock/04-increase-rom-nordic.patch b/patches/tock/04-increase-rom-nordic.patch new file mode 100644 index 0000000000000000000000000000000000000000..83948f80007be9fd12cd351ff27cfe5c50182c26 --- /dev/null +++ b/patches/tock/04-increase-rom-nordic.patch @@ -0,0 +1,24 @@ +diff --git a/boards/nordic/nrf52840_dongle/layout.ld b/boards/nordic/nrf52840_dongle/layout.ld +index 657b0d26..f86b2321 100644 +--- a/boards/nordic/nrf52840_dongle/layout.ld ++++ b/boards/nordic/nrf52840_dongle/layout.ld +@@ -1,6 +1,6 @@ + MEMORY + { +- rom (rx) : ORIGIN = 0x00000000, LENGTH = 128K ++ rom (rx) : ORIGIN = 0x00000000, LENGTH = 192K + prog (rx) : ORIGIN = 0x00030000, LENGTH = 832K + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 256K + } +diff --git a/boards/nordic/nrf52840dk/layout.ld b/boards/nordic/nrf52840dk/layout.ld +index 657b0d26..f86b2321 100644 +--- a/boards/nordic/nrf52840dk/layout.ld ++++ b/boards/nordic/nrf52840dk/layout.ld +@@ -1,6 +1,6 @@ + MEMORY + { +- rom (rx) : ORIGIN = 0x00000000, LENGTH = 128K ++ rom (rx) : ORIGIN = 0x00000000, LENGTH = 192K + prog (rx) : ORIGIN = 0x00030000, LENGTH = 832K + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 256K + } diff --git a/run_desktop_tests.sh b/run_desktop_tests.sh index b8e889620ec90eafaef5916faf291efbf2327f19..33b209014900702be46cf0026d99d9d7b929e41c 100755 --- a/run_desktop_tests.sh +++ b/run_desktop_tests.sh @@ -40,6 +40,10 @@ cargo check --release --target=thumbv7em-none-eabi --examples echo "Checking that CTAP2 builds and links properly (1 set of features)..." cargo build --release --target=thumbv7em-none-eabi --features with_ctap1 +echo "Checking that supported boards build properly..." +make -C third_party/tock/boards/nordic/nrf52840dk +make -C third_party/tock/boards/nordic/nrf52840_dongle + if [ -z "${TRAVIS_OS_NAME}" -o "${TRAVIS_OS_NAME}" = "linux" ] then echo "Running unit tests on the desktop (release mode)..." diff --git a/third_party/tock b/third_party/tock index 3a7d6b775d972798bfd731cba8365b58fab27175..fbc863faf0c9615537ee52dcdccdfcb9204d2467 160000 --- a/third_party/tock +++ b/third_party/tock @@ -1 +1 @@ -Subproject commit 3a7d6b775d972798bfd731cba8365b58fab27175 +Subproject commit fbc863faf0c9615537ee52dcdccdfcb9204d2467