From 662dcb67d23d96764a35bac2c75ca8984ddc181d Mon Sep 17 00:00:00 2001 From: Vadim Kaushan Date: Sun, 17 Mar 2019 16:27:41 +0300 Subject: [PATCH 1/8] Update Travis build matrix --- .travis.yml | 39 ++++++++++----------------------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/.travis.yml b/.travis.yml index 78d1336..c3d5d2e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,29 +1,17 @@ language: rust +env: + - TARGET=x86_64-unknown-linux-gnu + - TARGET=riscv32imac-unknown-none-elf + +rust: + - nightly + - stable + +if: (branch = staging OR branch = trying OR branch = master) OR (type = pull_request AND branch = master) + matrix: include: - #- env: TARGET=x86_64-unknown-linux-gnu - # if: (branch = staging OR branch = trying OR branch = master) OR (type = pull_request AND branch = master) - - #- env: TARGET=riscv32imac-unknown-none-elf - # if: (branch = staging OR branch = trying OR branch = master) OR (type = pull_request AND branch = master) - - #- env: TARGET=x86_64-unknown-linux-gnu - # rust: beta - # if: (branch = staging OR branch = trying OR branch = master) OR (type = pull_request AND branch = master) - - #- env: TARGET=riscv32imac-unknown-none-elf - # rust: beta - # if: (branch = staging OR branch = trying OR branch = master) OR (type = pull_request AND branch = master) - - - env: TARGET=x86_64-unknown-linux-gnu - rust: nightly - if: (branch = staging OR branch = trying OR branch = master) OR (type = pull_request AND branch = master) - - - env: TARGET=riscv32imac-unknown-none-elf - rust: nightly - if: (branch = staging OR branch = trying OR branch = master) OR (type = pull_request AND branch = master) - - env: TARGET=riscv64imac-unknown-none-elf rust: nightly if: (branch = staging OR branch = trying OR branch = master) OR (type = pull_request AND branch = master) @@ -32,13 +20,6 @@ matrix: rust: nightly if: (branch = staging OR branch = trying OR branch = master) OR (type = pull_request AND branch = master) - - env: TARGET=x86_64-unknown-linux-gnu - rust: stable - if: (branch = staging OR branch = trying OR branch = master) OR (type = pull_request AND branch = master) - - - env: TARGET=riscv32imac-unknown-none-elf - rust: stable - if: (branch = staging OR branch = trying OR branch = master) OR (type = pull_request AND branch = master) before_install: set -e From 41b4c1c1e69d05fa34d3f1a684bca9b6bb807647 Mon Sep 17 00:00:00 2001 From: Vadim Kaushan Date: Sun, 17 Mar 2019 16:28:53 +0300 Subject: [PATCH 2/8] Remove useless 'set' commands --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index c3d5d2e..616db9a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,8 +21,6 @@ matrix: if: (branch = staging OR branch = trying OR branch = master) OR (type = pull_request AND branch = master) -before_install: set -e - install: - bash ci/install.sh - export PATH="$PATH:$PWD/gcc/bin" @@ -30,7 +28,6 @@ install: script: - bash ci/script.sh -after_script: set +e cache: cargo before_cache: From 9352831150b4c66d95c03b07fabe2fe86a596834 Mon Sep 17 00:00:00 2001 From: Vadim Kaushan Date: Sun, 17 Mar 2019 16:30:23 +0300 Subject: [PATCH 3/8] Simplify CI scripts --- .travis.yml | 4 ++-- ci/install.sh | 14 +++++--------- ci/script.sh | 20 +++++++++----------- 3 files changed, 16 insertions(+), 22 deletions(-) mode change 100644 => 100755 ci/install.sh mode change 100644 => 100755 ci/script.sh diff --git a/.travis.yml b/.travis.yml index 616db9a..55c6227 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,11 +22,11 @@ matrix: install: - - bash ci/install.sh + - ci/install.sh - export PATH="$PATH:$PWD/gcc/bin" script: - - bash ci/script.sh + - ci/script.sh cache: cargo diff --git a/ci/install.sh b/ci/install.sh old mode 100644 new mode 100755 index fa98970..153fbd4 --- a/ci/install.sh +++ b/ci/install.sh @@ -1,12 +1,8 @@ +#!/usr/bin/env bash + set -euxo pipefail -main() { - if [ $TARGET != x86_64-unknown-linux-gnu ]; then - rustup target add $TARGET - fi +rustup target add $TARGET - mkdir gcc - curl -L https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.1.0-2018.12.0-x86_64-linux-ubuntu14.tar.gz | tar --strip-components=1 -C gcc -xz -} - -main +mkdir gcc +curl -L https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.1.0-2018.12.0-x86_64-linux-ubuntu14.tar.gz | tar --strip-components=1 -C gcc -xz diff --git a/ci/script.sh b/ci/script.sh old mode 100644 new mode 100755 index dc0be46..89f4f19 --- a/ci/script.sh +++ b/ci/script.sh @@ -1,15 +1,13 @@ +#!/usr/bin/env bash + set -euxo pipefail -main() { - cargo check --target $TARGET +cargo check --target $TARGET - if [ $TRAVIS_RUST_VERSION = nightly ]; then - cargo check --target $TARGET --features inline-asm - fi +if [ $TRAVIS_RUST_VERSION = nightly ]; then + cargo check --target $TARGET --features inline-asm +fi - if [ $TARGET = x86_64-unknown-linux-gnu ]; then - ./check-blobs.sh - fi -} - -main +if [ $TARGET = x86_64-unknown-linux-gnu ]; then + ./check-blobs.sh +fi From a8040bd24bd705f515852767a4d640cbb643b41c Mon Sep 17 00:00:00 2001 From: Vadim Kaushan Date: Sun, 17 Mar 2019 16:45:28 +0300 Subject: [PATCH 4/8] Check blobs in separate target --- .travis.yml | 4 ++++ ci/install.sh | 10 +++++++--- ci/script.sh | 10 ++++++---- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 55c6227..40ae176 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,10 @@ matrix: rust: nightly if: (branch = staging OR branch = trying OR branch = master) OR (type = pull_request AND branch = master) + - env: CHECK_BLOBS=1 + rust: stable + if: (branch = staging OR branch = trying OR branch = master) OR (type = pull_request AND branch = master) + install: - ci/install.sh diff --git a/ci/install.sh b/ci/install.sh index 153fbd4..6ceddbb 100755 --- a/ci/install.sh +++ b/ci/install.sh @@ -2,7 +2,11 @@ set -euxo pipefail -rustup target add $TARGET +if [ -n "${TARGET:-}" ]; then + rustup target add $TARGET +fi -mkdir gcc -curl -L https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.1.0-2018.12.0-x86_64-linux-ubuntu14.tar.gz | tar --strip-components=1 -C gcc -xz +if [ -n "${CHECK_BLOBS:-}" ]; then + mkdir gcc + curl -L https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.1.0-2018.12.0-x86_64-linux-ubuntu14.tar.gz | tar --strip-components=1 -C gcc -xz +fi diff --git a/ci/script.sh b/ci/script.sh index 89f4f19..e9a7f10 100755 --- a/ci/script.sh +++ b/ci/script.sh @@ -2,12 +2,14 @@ set -euxo pipefail -cargo check --target $TARGET +if [ -n "${TARGET:-}" ]; then + cargo check --target $TARGET -if [ $TRAVIS_RUST_VERSION = nightly ]; then - cargo check --target $TARGET --features inline-asm + if [ $TRAVIS_RUST_VERSION = nightly ]; then + cargo check --target $TARGET --features inline-asm + fi fi -if [ $TARGET = x86_64-unknown-linux-gnu ]; then +if [ -n "${CHECK_BLOBS:-}" ]; then ./check-blobs.sh fi From 87453e6b0a33b00520faaacfd5ced0b82e9cbb8c Mon Sep 17 00:00:00 2001 From: Vadim Kaushan Date: Sun, 17 Mar 2019 16:52:15 +0300 Subject: [PATCH 5/8] Change PATH in CI script --- .travis.yml | 1 - ci/script.sh | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 40ae176..2308733 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,6 @@ matrix: install: - ci/install.sh - - export PATH="$PATH:$PWD/gcc/bin" script: - ci/script.sh diff --git a/ci/script.sh b/ci/script.sh index e9a7f10..376bd73 100755 --- a/ci/script.sh +++ b/ci/script.sh @@ -11,5 +11,6 @@ if [ -n "${TARGET:-}" ]; then fi if [ -n "${CHECK_BLOBS:-}" ]; then + PATH="$PATH:$PWD/gcc/bin" ./check-blobs.sh fi From 698cb306ea54e6ec67179f948c31b2cf6a3799f4 Mon Sep 17 00:00:00 2001 From: Vadim Kaushan Date: Sun, 17 Mar 2019 16:57:16 +0300 Subject: [PATCH 6/8] Enable gcc caching --- .travis.yml | 8 ++++++-- ci/install.sh | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2308733..5517c2c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,8 @@ matrix: if: (branch = staging OR branch = trying OR branch = master) OR (type = pull_request AND branch = master) - env: CHECK_BLOBS=1 - rust: stable + rust: + language: bash if: (branch = staging OR branch = trying OR branch = master) OR (type = pull_request AND branch = master) @@ -32,7 +33,10 @@ script: - ci/script.sh -cache: cargo +cache: + cargo: true + directories: + - gcc before_cache: # Travis can't cache files that are not readable by "others" - chmod -R a+r $HOME/.cargo diff --git a/ci/install.sh b/ci/install.sh index 6ceddbb..0130ccd 100755 --- a/ci/install.sh +++ b/ci/install.sh @@ -7,6 +7,8 @@ if [ -n "${TARGET:-}" ]; then fi if [ -n "${CHECK_BLOBS:-}" ]; then - mkdir gcc - curl -L https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.1.0-2018.12.0-x86_64-linux-ubuntu14.tar.gz | tar --strip-components=1 -C gcc -xz + if [ ! -d gcc/bin ]; then + mkdir -p gcc + curl -L https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.1.0-2018.12.0-x86_64-linux-ubuntu14.tar.gz | tar --strip-components=1 -C gcc -xz + fi fi From 799cdaf6d2bcac183cf45aa2b527cbcd38240113 Mon Sep 17 00:00:00 2001 From: Vadim Kaushan Date: Sun, 17 Mar 2019 17:28:05 +0300 Subject: [PATCH 7/8] Fix docs --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index f1c0fe5..b4c7df3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,7 @@ //! //! This crate provides: //! -//! - Access to core registers like mstatus or mcause. +//! - Access to core registers like `mstatus` or `mcause`. //! - Interrupt manipulation mechanisms. //! - Wrappers around assembly instructions like `WFI`. From 7d4919a67c4ecae980921789b76b40f337623818 Mon Sep 17 00:00:00 2001 From: Vadim Kaushan Date: Sun, 17 Mar 2019 17:29:48 +0300 Subject: [PATCH 8/8] Add MSRV policy --- .travis.yml | 1 + src/lib.rs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/.travis.yml b/.travis.yml index 5517c2c..8810abe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ env: rust: - nightly - stable + - 1.30.0 # MSRV if: (branch = staging OR branch = trying OR branch = master) OR (type = pull_request AND branch = master) diff --git a/src/lib.rs b/src/lib.rs index b4c7df3..4c3d76d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,14 @@ //! Low level access to RISC-V processors //! +//! # Minimum Supported Rust Version (MSRV) +//! +//! This crate is guaranteed to compile on stable Rust 1.30 and up. It *might* +//! compile with older versions but that may change in any new patch release. +//! Note that `riscv64imac-unknown-none-elf` and `riscv64gc-unknown-none-elf` targets +//! are not supported on stable yet. +//! +//! # Features +//! //! This crate provides: //! //! - Access to core registers like `mstatus` or `mcause`.