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

Commit 8cae12c

Browse files
committed
Merge pull request #285 from mcoffin/new-build
Refactored build system and fixed issues with current nightly
2 parents 82e33ba + ab15e3f commit 8cae12c

File tree

168 files changed

+4640
-1143
lines changed

Some content is hidden

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

168 files changed

+4640
-1143
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
/build/
22
/thirdparty/
33
.DS_Store
4+
Cargo.lock
5+
target
6+
.cargo
7+
*.o
8+
*.bin
9+
*.lst
10+
autom4te.cache

.travis.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
language: rust
2+
rust: nightly
23
before_install:
34
- sudo add-apt-repository -y ppa:terry.guo/gcc-arm-embedded
45
- sudo apt-get update -o Dir::Etc::sourcelist="sources.list.d/terry_guo-gcc-arm-embedded-precise.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
56
install:
67
- sudo apt-get install gcc-arm-none-eabi
7-
- (mkdir -p ./thirdparty/rust)
8-
- (cd ./thirdparty/rust; wget -O rust.tar.gz https://github.com/rust-lang/rust/tarball/`rustc --version|awk '{sub(/\\(/, "", $3); print $3}'`; tar -zx --strip-components=1 -f rust.tar.gz)
98
script:
10-
- rake build_all test
9+
- ./configure --host=arm-none-eabi
10+
- cargo build --target=$TARGET --verbose --features $PLATFORM
11+
after_script:
12+
- cargo test --lib --verbose
13+
- (cd ./platformtree; cargo build --verbose; cargo test --verbose)
14+
- (cd ./macro_platformtree; cargo build --verbose; cargo test --verbose)
1115
env:
1216
matrix:
1317
- PLATFORM=lpc17xx
18+
TARGET=thumbv7m-none-eabi
19+
- PLATFORM=k20
20+
TARGET=thumbv7em-none-eabi
1421
- PLATFORM=stm32f4
22+
TARGET=thumbv7em-none-eabi
1523
- PLATFORM=stm32l1
16-
- PLATFORM=k20
24+
TARGET=thumbv7m-none-eabi
1725
- PLATFORM=tiva_c
26+
TARGET=thumbv7em-none-eabi

Cargo.toml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
[package]
2+
name = "zinc"
3+
version = "0.1.0"
4+
authors = ["Zinc Developers <[email protected]>"]
5+
build = "build.rs"
6+
7+
[lib]
8+
name = "zinc"
9+
crate-type = ["lib"]
10+
11+
[features]
12+
lpc17xx = []
13+
stm32f4 = []
14+
stm32l1 = []
15+
k20 = []
16+
tiva_c = []
17+
18+
[target.thumbv7m-none-eabi.dependencies.core]
19+
git = "https://github.com/hackndev/rust-libcore"
20+
21+
[target.thumbv7em-none-eabi.dependencies.core]
22+
git = "https://github.com/hackndev/rust-libcore"
23+
24+
[dependencies.ioreg]
25+
path = "./ioreg"
26+
27+
[dependencies.rlibc]
28+
git = "https://github.com/mcoffin/rlibc"
29+
branch = "zinc"
30+
31+
[dev-dependencies.platformtree]
32+
path = "./platformtree"
33+
34+
[dev-dependencies.macro_platformtree]
35+
path = "./macro_platformtree"
36+
37+
[[example]]
38+
name = "nothing"
39+
path = "examples/app_nothing.rs"
40+
41+
[[example]]
42+
name = "blink"
43+
path = "examples/app_blink.rs"
44+
45+
[[example]]
46+
name = "blink_k20"
47+
path = "examples/app_blink_k20.rs"
48+
49+
[[example]]
50+
name = "blink_k20_isr"
51+
path = "examples/app_blink_k20_isr.rs"
52+
53+
[[example]]
54+
name = "blink_pt"
55+
path = "examples/app_blink_pt.rs"
56+
57+
[[example]]
58+
name = "blink_stm32f4"
59+
path = "examples/app_blink_stm32f4.rs"
60+
61+
[[example]]
62+
name = "blink_stm32l1"
63+
path = "examples/app_blink_stm32l1.rs"
64+
65+
[[example]]
66+
name = "blink_tiva_c"
67+
path = "examples/app_blink_tiva_c.rs"
68+
69+
[[example]]
70+
name = "bluenrg_stm32l1"
71+
path = "examples/app_bluenrg_stm32l1.rs"
72+
73+
[[example]]
74+
name = "dht22"
75+
path = "examples/app_dht22.rs"
76+
77+
[[example]]
78+
name = "empty"
79+
path = "examples/app_empty.rs"
80+
81+
[[example]]
82+
name = "lcd_tiva_c"
83+
path = "examples/app_lcd_tiva_c.rs"
84+
85+
[[example]]
86+
name = "uart"
87+
path = "examples/app_uart.rs"
88+
89+
[[example]]
90+
name = "uart_tiva_c"
91+
path = "examples/app_uart_tiva_c.rs"
92+
93+
[[example]]
94+
name = "uart_stm32l1"
95+
path = "examples/app_uart_stm32l1.rs"

Makefile.in

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
STRIP=@STRIP@
2+
OBJCOPY=@OBJCOPY@
3+
OBJDUMP=@OBJDUMP@
4+
5+
CARGO_ROOT=@srcdir@
6+
7+
PLATFORM=@PLATFORM@
8+
TARGET=@TARGET@
9+
10+
$(if $(value EXAMPLE_NAME),, \
11+
$(error EXAMPLE_NAME must be set))
12+
13+
# Output directory
14+
OUT_DIR=$(CARGO_ROOT)/target/$(TARGET)/release
15+
EXAMPLE_DIR=$(OUT_DIR)/examples
16+
17+
BIN_FILE=$(EXAMPLE_DIR)/$(EXAMPLE_NAME).bin
18+
LST_FILE=$(EXAMPLE_DIR)/$(EXAMPLE_NAME).lst
19+
EXAMPLE_FILE=$(EXAMPLE_DIR)/$(EXAMPLE_NAME)
20+
21+
.PHONY: build clean listing $(EXAMPLE_FILE)
22+
23+
build: $(BIN_FILE)
24+
25+
clean:
26+
cargo clean
27+
28+
listing: $(LST_FILE)
29+
30+
# Target is PHONY so cargo can deal with dependencies
31+
$(EXAMPLE_FILE):
32+
cd $(CARGO_ROOT)
33+
cargo build --example $(EXAMPLE_NAME) --release --target=$(TARGET) --verbose --features $(PLATFORM)
34+
35+
$(BIN_FILE): $(EXAMPLE_FILE)
36+
$(OBJCOPY) -O binary $< $@
37+
38+
$(LST_FILE): $(EXAMPLE_FILE)
39+
$(OBJDUMP) -D $< > $@

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,23 @@ Zinc is distributed under Apache-2.0, see LICENSE for more details.
3030

3131
## Usage
3232

33-
Get a gcc cross-toolchain for arm and configure `TOOLCHAIN` and `RUNTIME_LIB` in
34-
Rakefile header as appropriate. `RUNTIME_LIB` should be either libgcc or
35-
libcompiler-rt ar archive, compiled for appropriate architecture.
33+
### Environment Setup
3634

37-
To build an application from apps/ use the following rake command:
35+
Get a gcc cross-toolchain for arm and make sure it is accessible.
36+
37+
### Examples
38+
39+
First, generate a `Makefile` and `.cargo/config` with `configure` so cargo
40+
can find your toolchain. Your toolchain triple is probably `arm-none-eabi`
41+
````
42+
./configure PLATFORM=<platform> --host=<toolchain-triple>
43+
````
44+
45+
To build an application from examples/ use the following command after having
46+
run `configure`:
3847

3948
```
40-
rake PLATFORM=<platform> build_all # or build_<appname>
49+
EXAMPLE_NAME=<example> make build
4150
```
51+
52+
Ouput will go to `target/<target-triple>/release/examples`.

Rakefile

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

0 commit comments

Comments
 (0)