Skip to content

Commit

Permalink
Auto merge of #158 - japaric:singletons, r=japaric
Browse files Browse the repository at this point in the history
Peripherals as scoped singletons

See this RFC for details: #157

With this change device crates will need to depend on a version of the cortex-m crate that includes rust-embedded/cortex-m#65

### TODO

- [x] accept the RFC
- [ ] Check that non cortex-m targets still work
- [x] decide on better names for `Peripherals::{all,_all}`
  • Loading branch information
homunkulus committed Dec 9, 2017
2 parents 5cc57ba + 3b27815 commit 227a0b1
Show file tree
Hide file tree
Showing 9 changed files with 383 additions and 462 deletions.
7 changes: 0 additions & 7 deletions .rustfmt.toml

This file was deleted.

2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ matrix:
os: osx

install:
- sh ci/install.sh
- bash ci/install.sh

script:
- bash ci/script.sh
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ keywords = [
license = "MIT OR Apache-2.0"
name = "svd2rust"
repository = "https://github.com/japaric/svd2rust"
version = "0.11.4"
version = "0.12.0"

[[bin]]
doc = false
Expand Down
41 changes: 12 additions & 29 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,38 +33,21 @@ fn commit_info() -> String {
}

fn commit_hash() -> Result<String, IgnoredError> {
Ok(
Ok(try!(String::from_utf8(
try!(
String::from_utf8(
try!(
Command::new("git")
.args(&["rev-parse", "--short", "HEAD"])
.output()
)
.stdout,
)
),
)
Command::new("git")
.args(&["rev-parse", "--short", "HEAD"])
.output()
).stdout,
)))
}

fn commit_date() -> Result<String, IgnoredError> {
Ok(
Ok(try!(String::from_utf8(
try!(
String::from_utf8(
try!(
Command::new("git")
.args(
&[
"log",
"-1",
"--date=short",
"--pretty=format:%cd",
],
)
.output()
)
.stdout,
)
),
)
Command::new("git")
.args(&["log", "-1", "--date=short", "--pretty=format:%cd"])
.output()
).stdout,
)))
}
4 changes: 2 additions & 2 deletions ci/install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set -ex
set -euxo pipefail

main() {
local sort=
Expand All @@ -19,7 +19,7 @@ main() {
--git japaric/cross \
--tag $tag

if [ ! -z $VENDOR ]; then
if [ ! -z ${VENDOR-} ]; then
curl -LSfs https://japaric.github.io/trust/install.sh | \
sh -s -- \
--crate rustfmt \
Expand Down
11 changes: 5 additions & 6 deletions ci/script.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
set -ex
set -o pipefail
set -euxo pipefail

test_svd() {
(
Expand All @@ -15,9 +14,9 @@ test_svd() {
}

main() {
cross build --target $TARGET
cross check --target $TARGET

if [ -z $VENDOR ]; then
if [ -z ${VENDOR-} ]; then
return
fi

Expand All @@ -35,7 +34,7 @@ main() {
# test crate
cargo init --name foo $td
echo 'bare-metal = "0.1.0"' >> $td/Cargo.toml
echo 'cortex-m = "0.3.0"' >> $td/Cargo.toml
echo 'cortex-m = { git = "https://github.com/japaric/cortex-m" }' >> $td/Cargo.toml
echo 'cortex-m-rt = "0.3.0"' >> $td/Cargo.toml
echo 'vcell = "0.1.0"' >> $td/Cargo.toml

Expand Down Expand Up @@ -609,6 +608,6 @@ main() {
rm -rf $td
}

if [ -z $TRAVIS_TAG ]; then
if [ -z ${TRAVIS_TAG-} ]; then
main
fi
Loading

0 comments on commit 227a0b1

Please sign in to comment.