Skip to content

Commit

Permalink
Merge branch 'master' into update-nightly-feb-2024
Browse files Browse the repository at this point in the history
  • Loading branch information
alevy authored Feb 28, 2024
2 parents 5916dc6 + 8aa6539 commit 795051a
Show file tree
Hide file tree
Showing 94 changed files with 4,654 additions and 364 deletions.
134 changes: 134 additions & 0 deletions .github/workflows/tockbot-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Licensed under the Apache License, Version 2.0 or the MIT License.
# SPDX-License-Identifier: Apache-2.0 OR MIT
# Copyright Tock Contributors 2024.

name: "Tockbot"

on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
inputs:
dispatch-job:
description: 'Which job to execute (choose between "all", "maint-nightly")'
required: true
default: 'all'
dry-run:
description: 'Whether to execute the jobs as dry-run'
required: true
default: true

jobs:
dispatcher:
runs-on: ubuntu-latest

# This job determines which other jobs should be run:
outputs:
run-maint-nightly: ${{ steps.dispatch-logic.outputs.run-maint-nightly }}
dry-run: ${{ steps.dispatch-logic.outputs.dry-run }}

steps:
# On pushes we want to check whether any changes have been made
# to the Tockbot code base. Disabled for now:
- uses: actions/checkout@v4

# Dispatcher business logic:
- name: Dispatch Tockbot Jobs
id: dispatch-logic
env:
DISPATCH_JOB: ${{ github.event.inputs.dispatch-job }}
DISPATCH_DRY_RUN: ${{ github.event.inputs.dry-run }}
run: |
if [ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]; then
if [ "$DISPATCH_DRY_RUN" == "true" ]; then
echo "dry-run=true" >> $GITHUB_OUTPUT
elif [ "$DISPATCH_DRY_RUN" == "false" ]; then
echo "dry-run=false" >> $GITHUB_OUTPUT
else
echo "Error: dry-run not a boolean: \"$DISPATCH_DRY_RUN\"" >&2
exit 1
fi
if [ "$DISPATCH_JOB" == "all" ]; then
echo "run-maint-nightly=true" >> $GITHUB_OUTPUT
elif [ "$DISPATCH_JOB" == "maint-nightly" ]; then
echo "run-maint-nightly=true" >> $GITHUB_OUTPUT
else
echo "Error: unknown job \"$DISPATCH_JOB\"" >&2
exit 1
fi
elif [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
echo "dry-run=true" >> $GITHUB_OUTPUT
echo "run-maint-nightly=true" >> $GITHUB_OUTPUT
elif [ "$GITHUB_EVENT_NAME" == "schedule" ]; then
echo "dry-run=false" >> $GITHUB_OUTPUT
echo "run-maint-nightly=true" >> $GITHUB_OUTPUT
else
echo "Error: unknown event name \"$GITHUB_EVENT_NAME\"" >&2
exit 1
fi
maint-nightly:
runs-on: ubuntu-latest

# Only run this job if the dispatcher determined to schedule the
# "maint-nightly" or "dry-run" jobs:
needs: dispatcher
if: ${{ needs.dispatcher.outputs.run-maint-nightly == 'true' && needs.dispatcher.outputs.dry-run != 'true' }}

permissions:
# Give GITHUB_TOKEN write permissions to modify PRs and issues:
pull-requests: write
issues: write

steps:
# Requires a tock checkout to run from:
- uses: actions/checkout@v4

# Setup Python and install dependencies:
- uses: actions/setup-python@v5
- name: Install Python Dependencies
run: pip install -r tools/tockbot/requirements.txt

# Run nightly tockbot maintenance:
- name: Nightly Tockbot Maintenance
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRY_RUN: ${{ needs.dispatcher.outputs.dry-run == 'true' && '-n' || '' }}
run: |
cd tools/tockbot/
./tockbot.py -v $DRY_RUN maint-nightly -c ./maint_nightly.yaml
# We'd like to avoid duplicating this, either by using conditionals in the
# permissions key, or by using YAML anchors, neither of which are supported by
# GH Actions...
maint-nightly-dry-run:
runs-on: ubuntu-latest

# Only run this job if the dispatcher determined to schedule the
# "maint-nightly" or "dry-run" jobs:
needs: dispatcher
if: ${{ needs.dispatcher.outputs.run-maint-nightly == 'true' && needs.dispatcher.outputs.dry-run == 'true' }}

permissions:
# Dry-run, read-only access:
pull-requests: read
issues: read

steps:
# Requires a tock checkout to run from:
- uses: actions/checkout@v4

# Setup Python and install dependencies:
- uses: actions/setup-python@v5
- name: Install Python Dependencies
run: pip install -r tools/tockbot/requirements.txt

# Run nightly tockbot maintenance:
- name: Nightly Tockbot Maintenance
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRY_RUN: ${{ needs.dispatcher.outputs.dry-run == 'true' && '-n' || '' }}
run: |
cd tools/tockbot/
./tockbot.py -v $DRY_RUN maint-nightly -c ./maint_nightly.yaml
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ members = [
"boards/msp_exp432p401r",
"boards/microbit_v2",
"boards/wm1110dev",
"boards/makepython-nrf52840",
"boards/nordic/nrf52840dk",
"boards/nordic/nrf52840_dongle",
"boards/nordic/nrf52dk",
Expand Down
4 changes: 2 additions & 2 deletions arch/cortex-m/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,12 +384,12 @@ pub unsafe fn print_cortexm_state(writer: &mut dyn Write) {
// ARM assembly since it will not compile.
///////////////////////////////////////////////////////////////////

#[cfg(not(any(target_arch = "arm", target_os = "none")))]
#[cfg(not(all(target_arch = "arm", target_os = "none")))]
pub unsafe extern "C" fn unhandled_interrupt() {
unimplemented!()
}

#[cfg(not(any(target_arch = "arm", target_os = "none")))]
#[cfg(not(all(target_arch = "arm", target_os = "none")))]
pub unsafe extern "C" fn initialize_ram_jump_to_main() {
unimplemented!()
}
2 changes: 1 addition & 1 deletion arch/cortex-m/src/scb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ pub unsafe fn disable_fpca() {
}

// Mock implementation for tests on Travis-CI.
#[cfg(not(any(target_arch = "arm", target_os = "none")))]
#[cfg(not(all(target_arch = "arm", target_os = "none")))]
pub unsafe fn disable_fpca() {
// Dummy read register, to satisfy the `Readable` trait import on
// non-ARM platforms.
Expand Down
6 changes: 3 additions & 3 deletions arch/cortex-m/src/support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ where
}

// Mock implementations for tests on Travis-CI.
#[cfg(not(any(target_arch = "arm", target_os = "none")))]
#[cfg(not(all(target_arch = "arm", target_os = "none")))]
/// NOP instruction (mock)
pub fn nop() {
unimplemented!()
}

#[cfg(not(any(target_arch = "arm", target_os = "none")))]
#[cfg(not(all(target_arch = "arm", target_os = "none")))]
/// WFI instruction (mock)
pub unsafe fn wfi() {
unimplemented!()
}

#[cfg(not(any(target_arch = "arm", target_os = "none")))]
#[cfg(not(all(target_arch = "arm", target_os = "none")))]
pub unsafe fn atomic<F, R>(_f: F) -> R
where
F: FnOnce() -> R,
Expand Down
10 changes: 5 additions & 5 deletions arch/cortex-m0/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ unsafe extern "C" fn hard_fault_handler_kernel(faulting_stack: *mut u32) -> ! {
}

// Mock implementation for tests on Travis-CI.
#[cfg(not(any(target_arch = "arm", target_os = "none")))]
#[cfg(not(all(target_arch = "arm", target_os = "none")))]
unsafe extern "C" fn generic_isr() {
unimplemented!()
}
Expand Down Expand Up @@ -167,7 +167,7 @@ global_asm!(
);

// Mock implementation for tests on Travis-CI.
#[cfg(not(any(target_arch = "arm", target_os = "none")))]
#[cfg(not(all(target_arch = "arm", target_os = "none")))]
unsafe extern "C" fn systick_handler_m0() {
unimplemented!()
}
Expand Down Expand Up @@ -210,7 +210,7 @@ global_asm!(
);

// Mock implementation for tests on Travis-CI.
#[cfg(not(any(target_arch = "arm", target_os = "none")))]
#[cfg(not(all(target_arch = "arm", target_os = "none")))]
unsafe extern "C" fn svc_handler() {
unimplemented!()
}
Expand Down Expand Up @@ -249,7 +249,7 @@ svc_handler:
);

// Mock implementation for tests on Travis-CI.
#[cfg(not(any(target_arch = "arm", target_os = "none")))]
#[cfg(not(all(target_arch = "arm", target_os = "none")))]
unsafe extern "C" fn hard_fault_handler() {
unimplemented!()
}
Expand Down Expand Up @@ -365,7 +365,7 @@ impl cortexm::CortexMVariant for CortexM0 {
const HARD_FAULT_HANDLER: unsafe extern "C" fn() = hard_fault_handler;

// Mock implementation for tests on Travis-CI.
#[cfg(not(any(target_arch = "arm", target_os = "none")))]
#[cfg(not(all(target_arch = "arm", target_os = "none")))]
unsafe fn switch_to_user(
_user_stack: *const usize,
_process_regs: &mut [usize; 8],
Expand Down
4 changes: 2 additions & 2 deletions arch/cortex-m0p/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub use cortexm::CortexMVariant;
use cortexm0::CortexM0;

// Mock implementation for tests on Travis-CI.
#[cfg(not(any(target_arch = "arm", target_os = "none")))]
#[cfg(not(all(target_arch = "arm", target_os = "none")))]
pub unsafe extern "C" fn svc_handler_m0p() {
unimplemented!()
}
Expand Down Expand Up @@ -96,7 +96,7 @@ impl cortexm::CortexMVariant for CortexM0P {
CortexM0::switch_to_user(user_stack, process_regs)
}

#[cfg(not(any(target_arch = "arm", target_os = "none")))]
#[cfg(not(all(target_arch = "arm", target_os = "none")))]
unsafe fn switch_to_user(
_user_stack: *const usize,
_process_regs: &mut [usize; 8],
Expand Down
2 changes: 1 addition & 1 deletion arch/cortex-m3/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl cortexm::CortexMVariant for CortexM3 {
cortexv7m::switch_to_user_arm_v7m(user_stack, process_regs)
}

#[cfg(not(any(target_arch = "arm", target_os = "none")))]
#[cfg(not(all(target_arch = "arm", target_os = "none")))]
unsafe fn switch_to_user(
_user_stack: *const usize,
_process_regs: &mut [usize; 8],
Expand Down
2 changes: 1 addition & 1 deletion arch/cortex-m4/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl cortexm::CortexMVariant for CortexM4 {
cortexv7m::switch_to_user_arm_v7m(user_stack, process_regs)
}

#[cfg(not(any(target_arch = "arm", target_os = "none")))]
#[cfg(not(all(target_arch = "arm", target_os = "none")))]
unsafe fn switch_to_user(
_user_stack: *const usize,
_process_regs: &mut [usize; 8],
Expand Down
2 changes: 1 addition & 1 deletion arch/cortex-m7/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl cortexm::CortexMVariant for CortexM7 {
cortexv7m::switch_to_user_arm_v7m(user_stack, process_regs)
}

#[cfg(not(any(target_arch = "arm", target_os = "none")))]
#[cfg(not(all(target_arch = "arm", target_os = "none")))]
unsafe fn switch_to_user(
_user_stack: *const usize,
_process_regs: &mut [usize; 8],
Expand Down
10 changes: 5 additions & 5 deletions arch/cortex-v7m/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,30 +561,30 @@ pub fn ipsr_isr_number_to_str(isr_number: usize) -> &'static str {
// ARM assembly since it will not compile.
///////////////////////////////////////////////////////////////////

#[cfg(not(any(target_arch = "arm", target_os = "none")))]
#[cfg(not(all(target_arch = "arm", target_os = "none")))]
pub unsafe extern "C" fn systick_handler_arm_v7m() {
unimplemented!()
}

#[cfg(not(any(target_arch = "arm", target_os = "none")))]
#[cfg(not(all(target_arch = "arm", target_os = "none")))]
pub unsafe extern "C" fn svc_handler_arm_v7m() {
unimplemented!()
}

#[cfg(not(any(target_arch = "arm", target_os = "none")))]
#[cfg(not(all(target_arch = "arm", target_os = "none")))]
pub unsafe extern "C" fn generic_isr_arm_v7m() {
unimplemented!()
}

#[cfg(not(any(target_arch = "arm", target_os = "none")))]
#[cfg(not(all(target_arch = "arm", target_os = "none")))]
pub unsafe extern "C" fn switch_to_user_arm_v7m(
_user_stack: *const u8,
_process_regs: &mut [usize; 8],
) -> *const usize {
unimplemented!()
}

#[cfg(not(any(target_arch = "arm", target_os = "none")))]
#[cfg(not(all(target_arch = "arm", target_os = "none")))]
pub unsafe extern "C" fn hard_fault_handler_arm_v7m() {
unimplemented!()
}
2 changes: 1 addition & 1 deletion arch/riscv/src/csr/mcycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ register_bitfields![usize,

// `mcycleh` is the higher XLEN bits of the number of elapsed cycles.
// It does not exist on riscv64.
#[cfg(any(target_arch = "riscv32", not(target_os = "none")))]
#[cfg(not(target_arch = "riscv64"))]
register_bitfields![usize,
pub mcycleh [
mcycleh OFFSET(0) NUMBITS(crate::XLEN) []
Expand Down
2 changes: 1 addition & 1 deletion arch/riscv/src/csr/minstret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ register_bitfields![usize,

// `minstreth` is the higher XLEN bits of the number of elapsed instructions.
// It does not exist on riscv64.
#[cfg(any(target_arch = "riscv32", not(target_os = "none")))]
#[cfg(not(target_arch = "riscv64"))]
register_bitfields![usize,
pub minstreth [
minstreth OFFSET(0) NUMBITS(crate::XLEN) []
Expand Down
Loading

0 comments on commit 795051a

Please sign in to comment.