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

Commit a561cff

Browse files
committed
Merge pull request #351 from posborne/doc-fixes
Documentation updates and fixes
2 parents 4133c33 + 6dba1c1 commit a561cff

File tree

8 files changed

+103
-3432
lines changed

8 files changed

+103
-3432
lines changed

.cargo/config

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[target.thumbv6-none-eabi]
2+
linker = "arm-none-eabi-gcc"
3+
ar = "arm-none-eabi-ar"
4+
5+
[target.thumbv7m-none-eabi]
6+
linker = "arm-none-eabi-gcc"
7+
ar = "arm-none-eabi-ar"
8+
9+
[target.thumbv7em-none-eabi]
10+
linker = "arm-none-eabi-gcc"
11+
ar = "arm-none-eabi-ar"

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
.DS_Store
44
Cargo.lock
55
target
6-
.cargo
76
*.o
87
*.bin
98
*.lst

Makefile.in

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

README.md

Lines changed: 92 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,60 @@
1-
[![Build Status](https://travis-ci.org/hackndev/zinc.svg)](https://travis-ci.org/hackndev/zinc) [![Stories in Ready](https://badge.waffle.io/hackndev/zinc.png?label=ready&title=Ready)](https://waffle.io/hackndev/zinc)
1+
[![Build Status](https://travis-ci.org/hackndev/zinc.svg)](https://travis-ci.org/hackndev/zinc)
2+
[![Stories in Ready](https://badge.waffle.io/hackndev/zinc.png?label=ready&title=Ready)](https://waffle.io/hackndev/zinc)
23
Zinc, the bare metal stack for rust
34
===================================
45

56
## About zinc.rs
67

7-
Zinc is an experimental attempt to write an ARM stack that would be similar to CMSIS or mbed in capabilities but would show rust's best safety features applied to embedded development.
8+
Zinc is an experimental attempt to write an ARM stack that would be
9+
similar to CMSIS or mbed in capabilities but would show rust's best
10+
safety features applied to embedded development.
811

9-
Zinc is mostly assembly-free and completely C-free at the moment. One of the goals of zinc is to figure out, how much of the usual RTOS stack is it possible to write in rust in a safe manner, while keeping the resource usage profile low enough (comparable to C/C++ code).
12+
Zinc is mostly assembly-free and completely C-free at the moment. One
13+
of the goals of zinc is to figure out, how much of the usual RTOS
14+
stack is it possible to write in rust in a safe manner, while keeping
15+
the resource usage profile low enough (comparable to C/C++ code).
1016

1117
Useful links:
1218

1319
* [blog](http://zinc.rs/blog)
14-
* [build stats](http://zinc.rs/stats) (output binary size change over time)
20+
* [build stats](http://zinc.rs/stats) (output binary size change over
21+
time)
1522
* [api docs](http://zinc.rs/apidocs/zinc)
1623

1724
## Main features
1825

19-
Zinc provides you with *safe* code in terms of rust code safety; accessing hardware directly is *unsafe*, but you can do that as well if you want.
26+
Zinc provides you with *safe* code in terms of rust code safety;
27+
accessing hardware directly is *unsafe*, but you can do that as well
28+
if you want.
2029

21-
In addition to *software safety*, zinc provides *hardware safety* with Platform Tree specification; you define the hardware configuration right in the code in simple key-value DSL and compiler verifies that all hardware is configured properly; that also allows to optimize the code to much bigger extent than with conventional RTOSes.
30+
In addition to *software safety*, zinc provides *hardware safety* with
31+
Platform Tree specification; you define the hardware configuration
32+
right in the code in simple key-value DSL and compiler verifies that
33+
all hardware is configured properly; that also allows to optimize the
34+
code to much bigger extent than with conventional RTOSes.
35+
36+
There is also an effort to generate platform tree specifications for
37+
new platforms from
38+
[ARM CMSIS SVDs](http://www.keil.com/pack/doc/CMSIS/SVD/html/index.html)
39+
such as those aggregated by the
40+
[cmsis-svd](http://www.keil.com/pack/doc/CMSIS/SVD/html/index.html)
41+
project.
2242

2343
## Supported hardware
2444

25-
Zinc supports only ARM at the moment. The primary development is focused on two test boards with NXP LPC1768 and ST STM32F407. Other MCUs will follow when core API is stabilized.
45+
Some level of support is currently provided for the following
46+
processor families. Not all peripherals are supported for all
47+
processors at this time.
48+
49+
* NXP lpc11xx
50+
* NXP lpc17xx
51+
* Freescale k20
52+
* ST STM32f4
53+
* ST STM32l1
54+
55+
In the future, a better story will be available that will allow for
56+
additional processor families, procesors, and boards using those
57+
processors to be defined more easily.
2658

2759
## License
2860

@@ -32,21 +64,63 @@ Zinc is distributed under Apache-2.0, see LICENSE for more details.
3264

3365
### Environment Setup
3466

35-
Get a gcc cross-toolchain for arm and make sure it is accessible.
67+
For the time being, Zinc makes use unstable features of the Rust
68+
language. As such, we recommend using the latest nightly version of
69+
Rust for development. As features of the language stabilize over
70+
time, it is the goal of Zinc to eventually be able to target stable
71+
versions of the compiler.
72+
[Multirust](https://github.com/brson/multirust) may be used to manage
73+
installations of multiple versions of rust on single machine.
74+
75+
In addition to rust itself, a GCC cross-toolchain for ARM must be
76+
installed. Although LLVM is used for a majority of compilation, the
77+
GCC Linker is still used at this time. The
78+
[GCCM ARM Embedded toolchain](https://launchpad.net/gcc-arm-embedded/+download)
79+
works well for most people.
80+
81+
### Building Examples Within Zinc
82+
83+
There are several examples available within the Zinc source itself.
84+
Zinc makes use of Cargo for its build system, but it is still necesary
85+
to provide the build system with a few pieces of information for it to
86+
properly compile for your target.
3687

37-
### Examples
88+
Namely, cargo must know about and have access to:
3889

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-
````
90+
1. The target specification for the machine being specified (consumed
91+
by the compiler)
92+
2. A feature telling the code what platform is being targetted. These
93+
features are defined in the form `mcu_<platform>`.
4494

45-
To build an application from examples/ use the following command after having
46-
run `configure`:
95+
Suppose we are targetting the `k20` platform. In that case, I could
96+
build the `blink_k20` example program by doing the following. Refer
97+
to (build-jenkins.sh)[support/build-jenkins.sh] for a mapping of
98+
platforms to targets.
4799

48100
```
49-
EXAMPLE_NAME=<example> make build
101+
$ cd examples/blink_k20
102+
$ ln -s ../../thumbv7em-none-eabi.json
103+
$ cargo build --target=thumbv7em-none-eabi --features mcu_k20 --release
104+
105+
$ file target/thumbv7em-none-eabi/release/blink
106+
target/thumbv7em-none-eabi/release/blink: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, not stripped
107+
```
108+
109+
If you receive link errors, you probably need to tell Cargo to use
110+
your cross-compilers linker. You can do this by adding a
111+
`.cargo/config` to either your home directory or the root of the Zinc
112+
project:
113+
114+
```toml
115+
[target.thumbv7em-none-eabi]
116+
linker = "arm-none-eabi-gcc"
117+
ar = "arm-none-eabi-ar"
50118
```
51119

52-
Ouput will go to `target/<target-triple>/release/examples`.
120+
### Using Zinc for your Project
121+
122+
Sinc Zinc uses cargo for its build system, using Zinc from your own
123+
project just requires setting up your Cargo.toml correctly.
124+
125+
You can find an example of how to do that here:
126+
https://github.com/posborne/zinc-example-lpc1768

cargo_config.in

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

0 commit comments

Comments
 (0)