Skip to content

Commit

Permalink
Merge pull request #17 from RusPiRo/development
Browse files Browse the repository at this point in the history
Prepare Release and crates.io publishing
  • Loading branch information
2ndTaleStudio authored Jan 24, 2021
2 parents 7513ef4 + d299d31 commit 8037720
Show file tree
Hide file tree
Showing 14 changed files with 335 additions and 150 deletions.
5 changes: 5 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[build]
target = "aarch64-ruspiro.json"

[unstable]
build-std = ["core", "compiler_builtins", "alloc"]
2 changes: 2 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# use a default of 2 spaces for indention levels
tab_spaces = 2
26 changes: 5 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# build only master branch on commit's
# build only development branch on commit's
# all other branches build on PullRequest creation
branches:
only:
- master
- development
- release

language: rust
Expand All @@ -17,10 +17,9 @@ cache: cargo
# define the stages and their order
stages:
- compile
- test
- publish_dry
- name: prepare_release
if: branch = master AND type != pull_request
if: branch = development AND type != pull_request
- name: deploy
if: branch = release AND type != pull_request
- name: publish
Expand All @@ -41,21 +40,6 @@ jobs:
- 'if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then sed -i "/{^\[patch\.crates-io\] /{:a;N;/\Z}/!ba};/^ruspiro-.*\(git\|path\).*/d" Cargo.toml; fi'
script: cargo make --profile travis pi3

- stage: test
name: "Run Doc Tests"
install:
- cargo install cargo-make
# if we not build a PR we remove the patch of the dependencies to their github repo's
- 'if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then sed -i "/{^\[patch\.crates-io\] /{:a;N;/\Z}/!ba};/^ruspiro-.*\(git\|path\).*/d" Cargo.toml; fi'
script: cargo make doctest --profile dummy
- stage: test
name: "Run Unit Tests"
install:
- cargo install cargo-make
# if we not build a PR we remove the patch of the dependencies to their github repo's
- 'if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then sed -i "/{^\[patch\.crates-io\] /{:a;N;/\Z}/!ba};/^ruspiro-.*\(git\|path\).*/d" Cargo.toml; fi'
script: cargo make unittest --profile dummy

- stage: publish_dry
name: "Run Cargo Publish Dry-Run"
install:
Expand All @@ -70,11 +54,11 @@ jobs:
- stage: prepare_release
name: "Create PR against the release branch"
script:
- 'curl -H ''Authorization: Token ''"$GIT_API_TOKEN"'''' -X POST -H ''Content-type: application/json'' --data ''{"title":"Prepare Release and crates.io publishing", "head":"master", "base":"release", "draft":false, "body":"Automatic PR to the release branch as preperation to publish the library"}'' https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls > /dev/null'
- 'curl -H ''Authorization: Token ''"$GIT_API_TOKEN"'''' -X POST -H ''Content-type: application/json'' --data ''{"title":"Prepare Release and crates.io publishing", "head":"development", "base":"release", "draft":false, "body":"Automatic PR to the release branch as preperation to publish the library"}'' https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls > /dev/null'

- stage: deploy
name: "Create GitHub release"

script: echo "creating github release"
before_deploy:
# extract current crate version from argo.toml
- export CRATE_VERSION=v`sed -En 's/^version.*=.*\"(.*)\".*$/\1/p' < Cargo.toml`
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## :cat: v0.5.0

Incorporate the basic excpetion handling within the boot loading crate instead of delegating the whole stuff to the `ruspiro-interrupt` crate. Now only the interrupt and fast-interrupt related exeptions will be delegated to an external crate that implements and exports this function: `extern "C" fn __isr_default() {}`.

- ### :bulb: Features

- Bake the basic exception handling into this crate (e.g. aborts, SVCor HVC calls, instruction exceptions etc)
- Delegate IRQ and FIQ to an external crate
- Use the `log` crate to use it's logging macros to create log entries in case of exception events.

## :strawberry: v0.4.2

Adjust the linker script to discard specific sections. With the sections in place build on travis for the custom unit test framework lead to a wrong start memory address for the kernel used with *QEMU*.
Expand Down
22 changes: 19 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "ruspiro-boot"
authors = ["André Borrmann <[email protected]>"]
version = "0.4.2" # remember to update html_root_url
version = "0.5.0" # remember to update html_root_url
description = """
Bare metal boot strapper code for the Raspberry Pi 3 to conviniently start a custom kernel within the Rust environment
without the need to deal with all the initial setup like stack pointers, switch to the appropriate exeption level and getting all cores kicked off for processing of code compiled from Rust.
Expand All @@ -13,7 +13,9 @@ readme = "README.md"
keywords = ["RusPiRo", "aarch64", "boot", "baremetal", "multicore"]
categories = ["no-std", "embedded"]
edition = "2018"
# define a linkage name to ensure this crate is ever beeing linked once into a final binary
links = "ruspiro_boot"
# compile the assembler parts before the rust compiler runs on this crate
build = "build.rs"
exclude = [".travis.yml", "Makefile.toml"]

Expand All @@ -25,21 +27,21 @@ is-it-maintained-open-issues = { repository = "RusPiRo/ruspiro-boot" }
[lib]

[build-dependencies]
cc = "1.0.59"
cc = "~1.0"

[dependencies]
ruspiro-register = "0.5"
ruspiro-cache = "0.4"
log = { version = "~0.4", default-features = false }
ruspiro-register = "~0.5"
ruspiro-cache = "~0.4"

[features]
ruspiro_pi3 = [ ]
# activate this feature to get multicore support
multicore = [ ]

# ensure the required features of the crate are active for the doc.rs build
[package.metadata.docs.rs]
targets = ["aarch64-unknown-none", "aarch64-unknown-linux-gnu"]
features = [
"ruspiro_pi3",
"multicore"
]

Expand Down
51 changes: 19 additions & 32 deletions Makefile.toml
Original file line number Diff line number Diff line change
@@ -1,61 +1,48 @@
#***********************************************************************************************************************
# cargo make tasks to build the example for the Raspberry Pi
#***********************************************************************************************************************

# AARCH64 specific profile environment varialbles
[env.development]
CC = "aarch64-none-elf-gcc"
AR = "aarch64-none-elf-ar"
OCOPY = "aarch64-none-elf-objcopy"
CFLAGS = "-march=armv8-a -Wall -O3 -nostdlib -nostartfiles -ffreestanding -mtune=cortex-a53"
RUSTFLAGS = "-C linker=${CC} -C target-cpu=cortex-a53 -C link-arg=-nostartfiles -C link-arg=-T./link64.ld"
BUILD_TARGET = "aarch64-unknown-none"
RUSTFLAGS = "-C target-cpu=cortex-a53 -C target-feature=+strict-align,+a53,+fp-armv8,+neon -C link-arg=-T./link64.ld"

# AARCH64 specific Travis CI env. variables. "aarch64-none-elf" is not available there as it seems
[env.travis]
CC = "aarch64-linux-gnu-gcc"
AR = "aarch64-linux-gnu-ar"
OCOPY = "aarch64-linux-gnu-objcopy"
CFLAGS = "-march=armv8-a -Wall -O3 -nostdlib -nostartfiles -ffreestanding -mtune=cortex-a53"
RUSTFLAGS = "-C linker=${CC} -C target-cpu=cortex-a53 -C link-arg=-nostartfiles -C link-arg=-T./link64.ld"
BUILD_TARGET = "aarch64-unknown-none"
RUSTFLAGS = "-C target-cpu=cortex-a53 -C target-feature=+strict-align,+a53,+fp-armv8,+neon -C link-arg=-T./link64.ld"

[tasks.xbuild]
[tasks.build]
command = "cargo"
args = ["xbuild", "--target", "${BUILD_TARGET}", "--release", "--features", "${FEATURES}"]

[tasks.pi3]
env = { FEATURES = "ruspiro_pi3,multicore" }
run_task = "xbuild"
args = ["build", "--release", "--features", "${FEATURES}"]

[tasks.clippy]
env = { FEATURES = "ruspiro_pi3,multicore" }
env = { FEATURES = "" }
command = "cargo"
args = ["clippy", "--target", "${BUILD_TARGET}", "--features", "${FEATURES}"]
args = ["clippy", "--features", "${FEATURES}"]

[tasks.doc]
env = { FEATURES = "ruspiro_pi3,multicore" }
env = { FEATURES = "" }
command = "cargo"
args = ["doc", "--target", "${BUILD_TARGET}", "--features", "${FEATURES}", "--open"]
args = ["doc", "--features", "${FEATURES}", "--open"]

[tasks.unittest]
env = { FEATURES = "ruspiro_pi3,multicore" }
command = "cargo"
args = ["test", "--tests", "--features", "${FEATURES}"]
[tasks.pi3]
env = { FEATURES = "" }
run_task = "build"

[tasks.doctest]
env = { FEATURES = "ruspiro_pi3,multicore" }
[tasks.clean]
command = "cargo"
args = ["test", "--doc", "--features", "${FEATURES}"]
args = ["clean"]

[tasks.publish_dry]
env = { FEATURES = "ruspiro_pi3" }
env = { FEATURES = "" }
command = "cargo"
args = ["publish", "--dry-run", "--target", "${BUILD_TARGET}", "--features", "${FEATURES}"]
args = ["publish", "--dry-run", "--features", "${FEATURES}"]

[tasks.publish]
env = { FEATURES = "ruspiro_pi3" }
command = "cargo"
args = ["publish", "--token", "${CRATES_TOKEN}", "--allow-dirty", "--target", "${BUILD_TARGET}", "--features", "${FEATURES}"]

[tasks.clean]
env = { FEATURES = "" }
command = "cargo"
args = ["clean"]
args = ["publish", "--token", "${CRATES_TOKEN}", "--allow-dirty", "--features", "${FEATURES}"]
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ both architectures and the execution is tested on a Raspberry Pi 3 B+.
Feature | Purpose
-----------------|--------------------------
`multicore` | Compiles the multi-core version of the crate, kicking off all 4 cores of the Raspberry Pi.
`ruspiro_pi3` | This is passed to the dependend crates to ensure they will be build properly for this target device.

## Usage

Expand Down
34 changes: 34 additions & 0 deletions aarch64-ruspiro.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"arch": "aarch64",
"data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128",
"executables": true,
"is-builtin": false,
"linker-flavor": "ld.lld",
"linker": "rust-lld",
"llvm-target": "aarch64-unknown-none",
"max-atomic-width": 128,
"os": "none",
"pre-link-args": {
"gcc": [
"-Wl,--as-needed",
"-Wl,-z,noexecstack"
]
},
"target-c-int-width": "32",
"target-endian": "little",
"target-family": "unix",
"target-mcount": "\u0001_mcount",
"target-pointer-width": "64",
"unsupported-abis": [
"stdcall",
"fastcall",
"vectorcall",
"thiscall",
"win64",
"sysv64"
],
"vendor": "unknown",
"panic-strategy": "abort",
"disable-redzone": true,
"features": ""
}
34 changes: 17 additions & 17 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ extern crate cc;
use std::env;

fn main() {
let script_location = env::current_dir().unwrap();
let script_location = env::current_dir().unwrap();

if let Some(target_arch) = env::var_os("CARGO_CFG_TARGET_ARCH") {
if target_arch == "aarch64" {
cc::Build::new()
.file("src/asm/aarch64/bootstrap.S")
.flag("-march=armv8-a")
.compile("bootstrap");
cc::Build::new()
.file("src/asm/aarch64/exceptionvector.S")
.flag("-march=armv8-a")
.compile("excvector");
// print the linker file location of the boot crate to the env-variables
println!("cargo:linkerscript={}/link64.ld", script_location.display());
if let Some(target_arch) = env::var_os("CARGO_CFG_TARGET_ARCH") {
if target_arch == "aarch64" {
cc::Build::new()
.file("src/asm/aarch64/bootstrap.S")
.flag("-march=armv8-a")
.compile("bootstrap");
cc::Build::new()
.file("src/asm/aarch64/exceptionvector.S")
.flag("-march=armv8-a")
.compile("excvector");
// print the linker file location of the boot crate to the env-variables
println!("cargo:linkerscript={}/link64.ld", script_location.display());

println!("cargo:rerun-if-changed=link64.ld");
println!("cargo:rerun-if-changed=src/asm/aarch64/bootstrap.S");
println!("cargo:rerun-if-changed=src/asm/aarch64/exceptionvector.S");
}
println!("cargo:rerun-if-changed=link64.ld");
println!("cargo:rerun-if-changed=src/asm/aarch64/bootstrap.S");
println!("cargo:rerun-if-changed=src/asm/aarch64/exceptionvector.S");
}
}
}
6 changes: 2 additions & 4 deletions src/asm/aarch64/exceptionvector.S
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@
* default exception handler that does nothing for the time beeing
* parameter passed: type, esr, spsr, far, elr
**************************************************************************************************/
.weak __exception_handler_default
__exception_handler_default:
nop
ret
.global __exception_handler_default


/***************************************************************************************************
* generic exception handler trampoline
Expand Down
Loading

0 comments on commit 8037720

Please sign in to comment.