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

Commit afc7d70

Browse files
committed
Merge pull request #293 from mcoffin/fix-289-travis-examples
Fixes #289 Add examples to travis (and fix example fallout from #285)
2 parents 5cfdf12 + ce3c4ac commit afc7d70

14 files changed

+49
-28
lines changed

.travis.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ install:
88
script:
99
- ./configure --host=arm-none-eabi
1010
- cargo build --target=$TARGET --verbose --features $PLATFORM
11+
- ./ci/build-examples.sh
1112
after_script:
1213
- cargo test --lib --verbose
1314
- (cd ./ioreg; cargo build --verbose; cargo test --verbose)
@@ -17,11 +18,13 @@ env:
1718
matrix:
1819
- PLATFORM=lpc17xx
1920
TARGET=thumbv7m-none-eabi
21+
EXAMPLES="blink blink_pt uart dht22 empty"
2022
- PLATFORM=k20
2123
TARGET=thumbv7em-none-eabi
24+
EXAMPLES="blink_k20 blink_k20_isr"
2225
- PLATFORM=stm32f4
2326
TARGET=thumbv7em-none-eabi
27+
EXAMPLES="blink_stm32f4"
2428
- PLATFORM=stm32l1
2529
TARGET=thumbv7m-none-eabi
26-
- PLATFORM=tiva_c
27-
TARGET=thumbv7em-none-eabi
30+
EXAMPLES="blink_stm32l1 bluenrg_stm32l1 usart_stm32l1"

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,5 @@ name = "uart_tiva_c"
9191
path = "examples/app_uart_tiva_c.rs"
9292

9393
[[example]]
94-
name = "uart_stm32l1"
95-
path = "examples/app_uart_stm32l1.rs"
94+
name = "usart_stm32l1"
95+
path = "examples/app_usart_stm32l1.rs"

ci/build-examples.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Zinc, the bare metal stack for rust.
4+
# Copyright 2014 Matt Coffin <[email protected]>
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
set -e
19+
for e in $EXAMPLES; do
20+
EXAMPLE_NAME=$e make build
21+
done

examples/app_blink_stm32l1.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#![feature(no_std, core, start)]
22
#![no_std]
33

4-
extern crate core;
5-
extern crate zinc;
6-
74
#[start]
85
fn start(_: isize, _: *const *const u8) -> isize {
96
main();
107
0
118
}
129

13-
pub unsafe fn main() {
10+
extern crate core;
11+
extern crate zinc;
12+
13+
fn main() {
1414
use core::option::Option;
1515
use zinc::hal::pin::Gpio;
1616
use zinc::hal::stm32l1::{init, pin, timer};

examples/app_blink_tiva_c.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
#![feature(plugin, no_std, core)]
2-
#![crate_type="staticlib"]
1+
#![feature(plugin, no_std, core, start)]
32
#![no_std]
43
#![plugin(macro_platformtree)]
54

65
extern crate core;
76
extern crate zinc;
8-
#[macro_use] #[no_link] extern crate macro_platformtree;
97

108
platformtree!(
119
tiva_c@mcu {
@@ -17,8 +15,7 @@ platformtree!(
1715
}
1816

1917
gpio {
20-
f {
21-
led1@1 { direction = "out"; }
18+
f { led1@1 { direction = "out"; }
2219
led2@2 { direction = "out"; }
2320
}
2421
}
@@ -46,7 +43,7 @@ platformtree!(
4643
}
4744
);
4845

49-
pub fn run(args: &pt::run_args) {
46+
fn run(args: &pt::run_args) {
5047
use zinc::hal::pin::Gpio;
5148
use zinc::hal::timer::Timer;
5249

examples/app_bluenrg_stm32l1.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fn map_byte(s: u8) -> (&'static str, &'static str) {
4646
(map_hex(s>>4), map_hex(s&0xF))
4747
}
4848

49-
pub unsafe fn main() {
49+
pub fn main() {
5050
use core::fmt::Write;
5151
use core::result::Result;
5252
use zinc::drivers::bluenrg;
@@ -92,7 +92,9 @@ pub unsafe fn main() {
9292
spi::Role::Master, spi::DataSize::U8, spi::DataFormat::MsbFirst, 1).
9393
unwrap_or_else(|_| {
9494
let _ = write!(&mut uart, "SPI failed to initialize");
95-
abort()
95+
unsafe {
96+
abort()
97+
}
9698
});
9799

98100
let bnrg_reset = pin::Pin::new(pin::Port::PortA, 8,

examples/app_dht22.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(plugin, no_std, core)]
1+
#![feature(start, plugin, no_std, core)]
22
#![crate_type="staticlib"]
33
#![no_std]
44
#![plugin(macro_platformtree)]

examples/app_empty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(core, plugin, asm, no_std)]
1+
#![feature(core, plugin, asm, no_std, start)]
22
#![crate_type="staticlib"]
33
#![no_std]
44
#![plugin(macro_platformtree)]

examples/app_lcd_tiva_c.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(plugin, no_std, core)]
1+
#![feature(plugin, no_std, core, start)]
22
#![crate_type="staticlib"]
33
#![no_std]
44
#![plugin(macro_platformtree)]

examples/app_uart_tiva_c.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(plugin, no_std, core)]
1+
#![feature(plugin, no_std, core, start)]
22
#![crate_type="staticlib"]
33
#![no_std]
44
#![plugin(macro_platformtree)]

0 commit comments

Comments
 (0)