Skip to content
This repository was archived by the owner on Jul 6, 2019. It is now read-only.

Commit a569832

Browse files
committed
Merge pull request #318 from farcaller/lpc111x
Build fixes; basic lpc11xx support; better tests for zinc crate
2 parents 395220f + 8d1e1a2 commit a569832

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+21577
-162
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ autom4te.cache
1313
Makefile
1414
/cov
1515
*.pyc
16+
/examples/*/*.json

.travis.yml

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,12 @@ before_install:
77
- wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz && tar xzf master.tar.gz
88
- (mkdir kcov-master/build && cd kcov-master/build && cmake .. && make && make install DESTDIR=../tmp)
99
script:
10-
- ./configure --host=arm-none-eabi
11-
- cargo build --target=$TARGET --verbose --features mcu_$PLATFORM
12-
- ./support/build-examples.sh
13-
after_script:
14-
- cargo test --lib --verbose
15-
- (cd ./ioreg; cargo build --verbose; cargo test --verbose)
16-
- (kcov-master/tmp/usr/local/bin/kcov --coveralls-id=$TRAVIS_JOB_ID --exclude-pattern=/.cargo,ioreg/tests target/kcov ioreg/target/debug/test-*)
17-
- (cd ./platformtree; cargo build --verbose; cargo test --verbose)
18-
- (cd ./macro_platformtree; cargo build --verbose; cargo test --verbose)
19-
- (cd ./macro_zinc; cargo test --verbose)
20-
- (kcov-master/tmp/usr/local/bin/kcov --coveralls-id=$TRAVIS_JOB_ID --exclude-pattern=/.cargo target/kcov target/debug/zinc-*)
21-
10+
- ./support/build-jenkins.sh
2211
env:
2312
matrix:
13+
- PLATFORM=native
14+
- PLATFORM=lpc11xx
2415
- PLATFORM=lpc17xx
25-
TARGET=thumbv7m-none-eabi
26-
EXAMPLES="blink blink_pt uart dht22 empty"
2716
- PLATFORM=k20
28-
TARGET=thumbv7em-none-eabi
29-
EXAMPLES="blink_k20 blink_k20_isr empty"
3017
- PLATFORM=stm32f4
31-
TARGET=thumbv7em-none-eabi
32-
EXAMPLES="blink_stm32f4 empty"
3318
- PLATFORM=stm32l1
34-
TARGET=thumbv7m-none-eabi
35-
EXAMPLES="blink_stm32l1 bluenrg_stm32l1 usart_stm32l1 empty"

Cargo.toml

Lines changed: 11 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,23 @@ name = "zinc"
99
crate-type = ["lib"]
1010

1111
[features]
12+
test = ["volatile_cell/replayer"]
13+
14+
cpu_cortex-m0 = []
1215
cpu_cortex-m3 = []
1316
cpu_cortex-m4 = []
1417

18+
mcu_lpc11xx = ["cpu_cortex-m0"]
1519
mcu_lpc17xx = ["cpu_cortex-m3"]
1620
mcu_stm32f4 = ["cpu_cortex-m4"]
1721
mcu_stm32l1 = ["cpu_cortex-m3"]
1822
mcu_k20 = ["cpu_cortex-m4"]
1923
mcu_tiva_c = ["cpu_cortex-m4"]
2024
multitasking = ["cpu_cortex-m4"]
2125

26+
[target.thumbv6-none-eabi.dependencies.core]
27+
git = "https://github.com/hackndev/rust-libcore"
28+
2229
[target.thumbv7m-none-eabi.dependencies.core]
2330
git = "https://github.com/hackndev/rust-libcore"
2431

@@ -32,9 +39,12 @@ path = "./ioreg"
3239
path = "./volatile_cell"
3340

3441
[dependencies.rlibc]
35-
git = "https://github.com/mcoffin/rlibc"
42+
git = "https://github.com/hackndev/rlibc"
3643
branch = "zinc"
3744

45+
[dev-dependencies]
46+
expectest = "*"
47+
3848
[dev-dependencies.platformtree]
3949
path = "./platformtree"
4050

@@ -43,63 +53,3 @@ path = "./macro_platformtree"
4353

4454
[dev-dependencies.macro_zinc]
4555
path = "./macro_zinc"
46-
47-
[[example]]
48-
name = "nothing"
49-
path = "examples/nothing.rs"
50-
51-
[[example]]
52-
name = "blink"
53-
path = "examples/blink.rs"
54-
55-
[[example]]
56-
name = "blink_k20"
57-
path = "examples/blink_k20.rs"
58-
59-
[[example]]
60-
name = "blink_k20_isr"
61-
path = "examples/blink_k20_isr.rs"
62-
63-
[[example]]
64-
name = "blink_pt"
65-
path = "examples/blink_pt.rs"
66-
67-
[[example]]
68-
name = "blink_stm32f4"
69-
path = "examples/blink_stm32f4.rs"
70-
71-
[[example]]
72-
name = "blink_stm32l1"
73-
path = "examples/blink_stm32l1.rs"
74-
75-
[[example]]
76-
name = "blink_tiva_c"
77-
path = "examples/blink_tiva_c.rs"
78-
79-
[[example]]
80-
name = "bluenrg_stm32l1"
81-
path = "examples/bluenrg_stm32l1.rs"
82-
83-
[[example]]
84-
name = "dht22"
85-
path = "examples/dht22.rs"
86-
87-
[[example]]
88-
name = "empty"
89-
path = "examples/empty.rs"
90-
91-
[[example]]
92-
name = "lcd_tiva_c"
93-
path = "examples/lcd_tiva_c.rs"
94-
95-
[[example]]
96-
name = "uart"
97-
path = "examples/uart.rs"
98-
99-
[[example]]
100-
name = "uart_tiva_c"
101-
path = "examples/uart_tiva_c.rs"
102-
103-
[[example]]
104-
name = "usart_stm32l1"
105-
path = "examples/usart_stm32l1.rs"

build.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,17 @@ fn get_platform() -> Option<String> {
1515
}
1616

1717
fn copy_linker_scripts<P: AsRef<Path>, Q: AsRef<Path>>(target: P, out_path: Q) -> io::Result<()> {
18+
let path_prefix = if env::var("CARGO_MANIFEST_DIR").unwrap().find("/examples/").is_none() {
19+
Path::new(".")
20+
} else {
21+
Path::new("./../..")
22+
};
1823
// Try copying the linker scripts
1924
let target_dir = Path::new("src/hal").join(target);
2025
let out_dir: &Path = out_path.as_ref();
21-
try!(fs::copy("src/hal/layout_common.ld", out_dir.join("layout_common.ld")));
22-
try!(fs::copy(target_dir.join("iomem.ld"), out_dir.join("iomem.ld")));
23-
try!(fs::copy(target_dir.join("layout.ld"), out_dir.join("layout.ld")));
26+
try!(fs::copy(path_prefix.join("src/hal/layout_common.ld"), out_dir.join("layout_common.ld")));
27+
try!(fs::copy(path_prefix.join(target_dir.join("iomem.ld")), out_dir.join("iomem.ld")));
28+
try!(fs::copy(path_prefix.join(target_dir.join("layout.ld")), out_dir.join("layout.ld")));
2429

2530
Ok(())
2631
}

configure

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2146,6 +2146,9 @@ CC=$GCC
21462146
21472147
21482148
case $PLATFORM in
2149+
lpc11xx)
2150+
platform_target=thumbv6-none-eabi
2151+
;;
21492152
lpc17xx | stm32l1)
21502153
platform_target=thumbv7m-none-eabi
21512154
;;

configure.ac

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ AC_SUBST(CC, $GCC)
1313
AC_ARG_VAR(PLATFORM, [Platform for which to build])
1414

1515
case $PLATFORM in
16+
lpc11xx)
17+
platform_target=thumbv6-none-eabi
18+
;;
1619
lpc17xx | stm32l1)
1720
platform_target=thumbv7m-none-eabi
1821
;;

examples/blink_k20/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "blink"
3+
version = "0.0.1"
4+
5+
[features]
6+
default = ["mcu_k20"]
7+
mcu_k20 = ["zinc/mcu_k20"]
8+
9+
[dependencies]
10+
zinc = { path = "../.." }
11+
macro_zinc = { path = "../../macro_zinc" }
12+
core = { git = "https://github.com/hackndev/rust-libcore" }

examples/blink_k20.rs renamed to examples/blink_k20/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ extern crate core;
66
extern crate zinc;
77

88
use core::option::Option::Some;
9+
10+
use zinc::hal::cortex_m4::systick;
911
use zinc::hal::k20::{pin, watchdog};
1012
use zinc::hal::pin::Gpio;
11-
use zinc::hal::cortex_m4::systick;
1213

1314
/// Wait the given number of SysTick ticks
1415
pub fn wait(ticks: u32) {

examples/blink_k20_isr/Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "blink_k20_isr"
3+
version = "0.0.1"
4+
5+
[features]
6+
default = ["mcu_k20"]
7+
mcu_k20 = ["zinc/mcu_k20"]
8+
9+
[dependencies]
10+
zinc = { path = "../.." }
11+
core = { git = "https://github.com/hackndev/rust-libcore" }
File renamed without changes.

examples/blink_lpc17xx/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "blink"
3+
version = "0.0.1"
4+
5+
[features]
6+
default = ["mcu_lpc17xx"]
7+
mcu_lpc17xx = ["zinc/mcu_lpc17xx"]
8+
9+
[dependencies]
10+
zinc = { path = "../.." }
11+
macro_zinc = { path = "../../macro_zinc" }
12+
core = { git = "https://github.com/hackndev/rust-libcore" }

examples/blink.rs renamed to examples/blink_lpc17xx/src/main.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
extern crate core;
66
extern crate zinc;
77

8-
use zinc::hal::timer::Timer;
8+
use core::option::Option::Some;
9+
910
use zinc::hal::lpc17xx::{pin, timer};
10-
use zinc::hal::pin::GpioDirection;
1111
use zinc::hal::pin::Gpio;
12-
use core::option::Option::Some;
12+
use zinc::hal::pin::GpioDirection;
13+
use zinc::hal::timer::Timer;
1314

1415
#[zinc_main]
1516
pub fn main() {

examples/blink_pt/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "blink"
3+
version = "0.0.1"
4+
5+
[features]
6+
default = ["mcu_lpc17xx"]
7+
mcu_lpc17xx = ["zinc/mcu_lpc17xx"]
8+
9+
[dependencies]
10+
zinc = { path = "../.." }
11+
macro_platformtree = { path = "../../macro_platformtree" }
12+
core = { git = "https://github.com/hackndev/rust-libcore" }
File renamed without changes.

examples/blink_stm32f4/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "blink_stm32f4"
3+
version = "0.0.1"
4+
5+
[features]
6+
default = ["mcu_stm32f4"]
7+
mcu_stm32f4 = ["zinc/mcu_stm32f4"]
8+
9+
[dependencies]
10+
zinc = { path = "../.." }
11+
macro_zinc = { path = "../../macro_zinc" }
12+
core = { git = "https://github.com/hackndev/rust-libcore" }
File renamed without changes.

examples/blink_stm32l1/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "blink_stm32l1"
3+
version = "0.0.1"
4+
5+
[features]
6+
default = ["mcu_stm32l1"]
7+
mcu_stm32l1 = ["zinc/mcu_stm32l1"]
8+
9+
[dependencies]
10+
zinc = { path = "../.." }
11+
macro_zinc = { path = "../../macro_zinc" }
12+
core = { git = "https://github.com/hackndev/rust-libcore" }
File renamed without changes.

examples/blink_tiva_c/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "blink_tiva_c"
3+
version = "0.0.1"
4+
5+
[features]
6+
default = ["mcu_tiva_c"]
7+
mcu_tiva_c = ["zinc/mcu_tiva_c"]
8+
9+
[dependencies]
10+
zinc = { path = "../.." }
11+
macro_platformtree = { path = "../../macro_platformtree" }
12+
core = { git = "https://github.com/hackndev/rust-libcore" }
File renamed without changes.

examples/bluenrg_stm32l1/Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "bluenrg_stm32l1"
3+
version = "0.0.1"
4+
5+
[features]
6+
default = ["mcu_stm32l1"]
7+
mcu_stm32l1 = ["zinc/mcu_stm32l1"]
8+
9+
[dependencies]
10+
zinc = { path = "../.." }
11+
core = { git = "https://github.com/hackndev/rust-libcore" }
File renamed without changes.

examples/dht22/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "dht22"
3+
version = "0.0.1"
4+
5+
[features]
6+
default = ["mcu_lpc17xx"]
7+
mcu_lpc17xx = ["zinc/mcu_lpc17xx"]
8+
9+
[dependencies]
10+
zinc = { path = "../.." }
11+
macro_platformtree = { path = "../../macro_platformtree" }
12+
core = { git = "https://github.com/hackndev/rust-libcore" }
File renamed without changes.

examples/empty/Cargo.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[package]
2+
name = "empty"
3+
version = "0.0.1"
4+
5+
[features]
6+
mcu_lpc11xx = ["zinc/mcu_lpc11xx"]
7+
mcu_lpc17xx = ["zinc/mcu_lpc17xx"]
8+
mcu_stm32f4 = ["zinc/mcu_stm32f4"]
9+
mcu_stm32l1 = ["zinc/mcu_stm32l1"]
10+
mcu_k20 = ["zinc/mcu_k20"]
11+
mcu_tiva_c = ["zinc/mcu_tiva_c"]
12+
13+
[dependencies]
14+
zinc = { path = "../.." }
15+
macro_zinc = { path = "../../macro_zinc" }
16+
core = { git = "https://github.com/hackndev/rust-libcore" }
File renamed without changes.

examples/lcd_tiva_c/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "lcd_tiva_c"
3+
version = "0.0.1"
4+
5+
[features]
6+
default = ["mcu_tiva_c"]
7+
mcu_tiva_c = ["zinc/mcu_tiva_c"]
8+
9+
[dependencies]
10+
zinc = { path = "../.." }
11+
macro_platformtree = { path = "../../macro_platformtree" }
12+
core = { git = "https://github.com/hackndev/rust-libcore" }
File renamed without changes.

examples/nothing.rs

Lines changed: 0 additions & 9 deletions
This file was deleted.

examples/uart/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "uart"
3+
version = "0.0.1"
4+
5+
[features]
6+
default = ["mcu_lpc17xx"]
7+
mcu_lpc17xx = ["zinc/mcu_lpc17xx"]
8+
9+
[dependencies]
10+
zinc = { path = "../.." }
11+
macro_platformtree = { path = "../../macro_platformtree" }
12+
core = { git = "https://github.com/hackndev/rust-libcore" }
File renamed without changes.

examples/uart_tiva_c/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "uart_tiva_c"
3+
version = "0.0.1"
4+
5+
[features]
6+
default = ["mcu_tiva_c"]
7+
mcu_tiva_c = ["zinc/mcu_tiva_c"]
8+
9+
[dependencies]
10+
zinc = { path = "../.." }
11+
macro_platformtree = { path = "../../macro_platformtree" }
12+
core = { git = "https://github.com/hackndev/rust-libcore" }
File renamed without changes.

0 commit comments

Comments
 (0)