Skip to content

Set up GitHub Actions #276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/bors.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
block_labels = ["needs-decision"]
delete_merged_branches = true
required_approvals = 1
status = ["continuous-integration/travis-ci/push"]
status = [
"ci-linux (stable)",
"ci-linux (1.38.0)",
"rustfmt",
]
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
push:
branches: [ staging, trying, master ]
pull_request:

name: CI

jobs:
ci-linux:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental || false }}
strategy:
matrix:
# All generated code should be running on stable now
rust: [stable]

include:
# Test MSRV
- rust: 1.38.0

# Test nightly but don't fail
- rust: nightly
experimental: true
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- name: Run tests
run: cargo test --all

# FIXME: test on macOS and Windows
20 changes: 20 additions & 0 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
on:
push:
branches: [ staging, trying, master ]
pull_request:

name: Clippy check
jobs:
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/rustfmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
push:
branches: [ staging, trying, master ]
pull_request:

name: Code formatting check

jobs:
fmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
34 changes: 0 additions & 34 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions asm/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! All of these functions should be blanket-`unsafe`. `cortex-m` provides safe wrappers where
//! applicable.

use core::sync::atomic::{Ordering, compiler_fence};
use core::sync::atomic::{compiler_fence, Ordering};

#[inline(always)]
pub unsafe fn __bkpt() {
Expand Down Expand Up @@ -187,7 +187,7 @@ pub unsafe fn __syscall(mut nr: u32, arg: u32) -> u32 {
pub use self::v7m::*;
#[cfg(any(armv7m, armv8m_main))]
mod v7m {
use core::sync::atomic::{Ordering, compiler_fence};
use core::sync::atomic::{compiler_fence, Ordering};

#[inline(always)]
pub unsafe fn __basepri_max(val: u8) {
Expand Down
Binary file modified bin/thumbv6m-none-eabi-lto.a
Binary file not shown.
Binary file modified bin/thumbv7em-none-eabi-lto.a
Binary file not shown.
Binary file modified bin/thumbv7em-none-eabihf-lto.a
Binary file not shown.
Binary file modified bin/thumbv7m-none-eabi-lto.a
Binary file not shown.
Binary file modified bin/thumbv8m.base-none-eabi-lto.a
Binary file not shown.
Binary file modified bin/thumbv8m.main-none-eabi-lto.a
Binary file not shown.
Binary file modified bin/thumbv8m.main-none-eabihf-lto.a
Binary file not shown.
9 changes: 3 additions & 6 deletions cortex-m-semihosting/src/hio.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Host I/O

use core::{fmt, slice};
use crate::nr;
use core::{fmt, slice};

/// A byte stream to the host (e.g., host's stdout or stderr).
#[derive(Clone, Copy)]
Expand Down Expand Up @@ -38,8 +38,7 @@ pub fn hstdout() -> Result<HostStream, ()> {

fn open(name: &str, mode: usize) -> Result<HostStream, ()> {
let name = name.as_bytes();
match unsafe { syscall!(OPEN, name.as_ptr(), mode, name.len() - 1) } as
isize {
match unsafe { syscall!(OPEN, name.as_ptr(), mode, name.len() - 1) } as isize {
-1 => Err(()),
fd => Ok(HostStream { fd: fd as usize }),
}
Expand All @@ -53,9 +52,7 @@ fn write_all(fd: usize, mut buffer: &[u8]) -> Result<(), ()> {
// `n` bytes were not written
n if n <= buffer.len() => {
let offset = (buffer.len() - n) as isize;
buffer = unsafe {
slice::from_raw_parts(buffer.as_ptr().offset(offset), n)
}
buffer = unsafe { slice::from_raw_parts(buffer.as_ptr().offset(offset), n) }
}
#[cfg(feature = "jlink-quirks")]
// Error (-1) - should be an error but JLink can return -1, -2, -3,...
Expand Down
4 changes: 1 addition & 3 deletions cortex-m-semihosting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,7 @@ pub unsafe fn syscall1(_nr: usize, _arg: usize) -> usize {
}

#[cfg(all(thumb, feature = "no-semihosting"))]
() => {
0
}
() => 0,

#[cfg(not(thumb))]
() => unimplemented!(),
Expand Down
9 changes: 5 additions & 4 deletions cortex-m-semihosting/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ macro_rules! syscall {
$crate::syscall($crate::nr::$nr, &[$a1 as usize, $a2 as usize])
};
($nr:ident, $a1:expr, $a2:expr, $a3:expr) => {
$crate::syscall($crate::nr::$nr, &[$a1 as usize, $a2 as usize,
$a3 as usize])
$crate::syscall($crate::nr::$nr, &[$a1 as usize, $a2 as usize, $a3 as usize])
};
($nr:ident, $a1:expr, $a2:expr, $a3:expr, $a4:expr) => {
$crate::syscall($crate::nr::$nr, &[$a1 as usize, $a2 as usize,
$a3 as usize, $a4 as usize])
$crate::syscall(
$crate::nr::$nr,
&[$a1 as usize, $a2 as usize, $a3 as usize, $a4 as usize],
)
};
}

Expand Down
5 changes: 4 additions & 1 deletion src/delay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ impl Delay {
pub fn new(mut syst: SYST, ahb_frequency: u32) -> Self {
syst.set_clock_source(SystClkSource::Core);

Delay { syst, ahb_frequency }
Delay {
syst,
ahb_frequency,
}
}

/// Releases the system timer (SysTick) resource.
Expand Down
6 changes: 5 additions & 1 deletion src/interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ pub unsafe trait InterruptNumber: Copy {

/// Implement InterruptNumber for the old bare_metal::Nr trait.
/// This implementation is for backwards compatibility only and will be removed in cortex-m 0.8.
#[deprecated(since="0.7.0", note="Please update your PAC to one using the latest svd2rust")]
#[deprecated(
since = "0.7.0",
note = "Please update your PAC to one using the latest svd2rust"
)]
unsafe impl<T: Nr + Copy> InterruptNumber for T {
#[inline]
fn number(self) -> u16 {
self.nr() as u16
}
Expand Down
4 changes: 1 addition & 3 deletions src/itm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,7 @@ pub fn write_all(port: &mut Stim, buffer: &[u8]) {
/// ```
#[allow(clippy::missing_inline_in_public_items)]
pub fn write_aligned(port: &mut Stim, buffer: &Aligned<[u8]>) {
unsafe {
write_aligned_impl(port, &buffer.0)
}
unsafe { write_aligned_impl(port, &buffer.0) }
}

/// Writes `fmt::Arguments` to the ITM `port`
Expand Down
2 changes: 1 addition & 1 deletion src/peripheral/dcb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

use volatile_register::{RW, WO};

use core::ptr;
use crate::peripheral::DCB;
use core::ptr;

const DCB_DEMCR_TRCENA: u32 = 1 << 24;

Expand Down
20 changes: 15 additions & 5 deletions src/peripheral/scb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,9 @@ impl SCB {
// NOTE(unsafe): The asm routine manages exclusive access to the SCB
// registers and applies the proper barriers; it is technically safe on
// its own, and is only `unsafe` here because it's `extern "C"`.
unsafe { __enable_icache(); }
unsafe {
__enable_icache();
}
}

/// Disables I-cache if currently enabled.
Expand Down Expand Up @@ -412,7 +414,9 @@ impl SCB {
// NOTE(unsafe): The asm routine manages exclusive access to the SCB
// registers and applies the proper barriers; it is technically safe on
// its own, and is only `unsafe` here because it's `extern "C"`.
unsafe { __enable_dcache(); }
unsafe {
__enable_dcache();
}
}

/// Disables D-cache if currently enabled.
Expand Down Expand Up @@ -960,7 +964,7 @@ impl SCB {

// NOTE(unsafe): Index is bounded to [4,15] by SystemHandler design.
// TODO: Review it after rust-lang/rust/issues/13926 will be fixed.
let priority_ref = unsafe {(*Self::ptr()).shpr.get_unchecked(usize::from(index - 4))};
let priority_ref = unsafe { (*Self::ptr()).shpr.get_unchecked(usize::from(index - 4)) };

priority_ref.read()
}
Expand All @@ -971,7 +975,11 @@ impl SCB {

// NOTE(unsafe): Index is bounded to [11,15] by SystemHandler design.
// TODO: Review it after rust-lang/rust/issues/13926 will be fixed.
let priority_ref = unsafe {(*Self::ptr()).shpr.get_unchecked(usize::from((index - 8) / 4))};
let priority_ref = unsafe {
(*Self::ptr())
.shpr
.get_unchecked(usize::from((index - 8) / 4))
};

let shpr = priority_ref.read();
let prio = (shpr >> (8 * (index % 4))) & 0x0000_00ff;
Expand Down Expand Up @@ -1008,7 +1016,9 @@ impl SCB {
{
// NOTE(unsafe): Index is bounded to [11,15] by SystemHandler design.
// TODO: Review it after rust-lang/rust/issues/13926 will be fixed.
let priority_ref = (*Self::ptr()).shpr.get_unchecked(usize::from((index - 8) / 4));
let priority_ref = (*Self::ptr())
.shpr
.get_unchecked(usize::from((index - 8) / 4));

priority_ref.modify(|value| {
let shift = 8 * (index % 4);
Expand Down