Skip to content

Commit 62a58d1

Browse files
author
Jorge Aparicio
committed
whole device generation
Fixes #60 Closes #40
1 parent d38e45e commit 62a58d1

File tree

9 files changed

+1735
-1287
lines changed

9 files changed

+1735
-1287
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Support for whole device generation
13+
14+
### Changed
15+
16+
- [breaking-change] The CLI have been totally changed. There's only one option
17+
now: whole device generation.
18+
1019
## [v0.3.0] - 2017-02-18
1120

1221
### Changed

Cargo.lock

Lines changed: 119 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ keywords = ["arm", "cortex-m", "register", "map", "generator"]
77
license = "MIT OR Apache-2.0"
88
name = "svd2rust"
99
repository = "https://github.com/japaric/svd2rust"
10-
version = "0.3.0"
10+
version = "0.4.0"
1111

1212
[dependencies]
13-
clap = "2.14.0"
14-
either = "1.0.2"
13+
cast = "0.2.0"
14+
clap = "2.20.5"
15+
either = "1.0.3"
16+
error-chain = "0.10.0"
1517
inflections = "1.0.0"
16-
quote = "0.3.3"
17-
svd-parser = "0.3.0"
18-
syn = "0.9"
18+
quote = "0.3.15"
19+
svd-parser = "0.4.0"
20+
syn = "0.11.9"

ci/script.sh

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
set -ex
22

3-
test_gen() {
4-
target/$TARGET/release/svd2rust -i $td/$svd $1 > $td/src/lib.rs
5-
echo 'extern crate volatile_register;' >> $td/src/lib.rs
3+
test_svd() {
4+
curl -L \
5+
https://raw.githubusercontent.com/posborne/cmsis-svd/python-0.4/data/$1/${2}.svd \
6+
> $td/${2}.svd
7+
target/$TARGET/release/svd2rust -i $td/${2}.svd > $td/src/lib.rs
68
cargo build --manifest-path $td/Cargo.toml
79
}
810

@@ -24,35 +26,13 @@ main() {
2426
esac
2527

2628
# test crate
27-
cross init --name foo $td
28-
echo 'volatile-register = "0.1.0"' >> $td/Cargo.toml
29-
30-
curl -L \
31-
https://raw.githubusercontent.com/posborne/cmsis-svd/python-0.4/data/STMicro/STM32F30x.svd \
32-
> $td/STM32F30x.svd
29+
cargo init --name foo $td
30+
echo 'cortex-m = { git = "https://github.com/japaric/cortex-m", branch = "ng" }' >> $td/Cargo.toml
31+
echo 'vcell = "0.1.0"' >> $td/Cargo.toml
3332

34-
curl -L \
35-
https://raw.githubusercontent.com/posborne/cmsis-svd/python-0.4/data/Nordic/nrf51.svd \
36-
> $td/nrf51.svd
37-
38-
# test the generated code
39-
svd=STM32F30x.svd
40-
test_gen
41-
test_gen dbgmcu
42-
test_gen gpioa
43-
test_gen gpioc
44-
test_gen i2c1
45-
test_gen rcc
46-
test_gen spi1
47-
test_gen tim2
48-
test_gen tim3
49-
test_gen tim6
50-
51-
# Test register arrays
52-
svd=nrf51.svd
53-
test_gen
54-
test_gen gpio
55-
test_gen timer
33+
test_svd Nordic nrf51
34+
test_svd STMicro STM32F103xx
35+
test_svd STMicro STM32F30x
5636

5737
rm -rf $td
5838
}

src/errors.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
error_chain!();

0 commit comments

Comments
 (0)