Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raspi example #133

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
3 changes: 3 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@ rustflags = [
"-C", "link-arg=-Tlink.x",
]

[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"

Comment on lines +25 to +27
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really required? I don't have this package installed on my M1 mac and the rpi example compiled with no errors.

[build]
target = "thumbv7m-none-eabi"
41 changes: 41 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,38 @@ target_steps: &target_steps
- ./target
- /usr/local/cargo/registry

cross_steps: &cross_steps
docker:
- image: cimg/rust:1.41.0
steps:
- checkout
- restore_cache:
key: v2-ssd1306-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cargo.toml" }}
- run: sudo apt update
- run: sudo apt install -y gcc-arm-linux-gnueabihf
- run: rustup self update
- run: rustup default ${RUST_VERSION:-stable}
- run: rustup component add rustfmt
- run: cargo update
- run: |
SYSROOT=$(rustc --print sysroot)

if [[ ! "$SYSROOT" =~ "$TARGET" ]]; then
rustup target add $TARGET
else
echo "Target $TARGET is already installed"
fi
- run: |
set -e -x
cd $EXAMPLE_PATH
cargo fmt --all -- --check
cargo build --target $TARGET --all-features --release
- save_cache:
key: v2-ssd1306-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cargo.toml" }}
paths:
- ./target
- /usr/local/cargo/registry

version: 2
jobs:
target-arm-unknown-linux-eabi:
Expand Down Expand Up @@ -73,6 +105,12 @@ jobs:
- TARGET: "thumbv7m-none-eabi"
<<: *target_steps

example-raspi:
environment:
- TARGET: "armv7-unknown-linux-gnueabihf"
- EXAMPLE_PATH: "examples/raspi"
<<: *cross_steps

build_jobs: &build_jobs
jobs:
# Raspberry Pi 1
Expand All @@ -91,6 +129,9 @@ build_jobs: &build_jobs
- target-thumbv7em-none-eabihf
- target-thumbv7m-none-eabi

# Samples
- example-raspi

workflows:
version: 2
build_all:
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ fn HardFault(ef: &ExceptionFrame) -> ! {

```

### Raspberry Pi

A sample project is available under [examples/raspi](./examples/raspi)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit

Suggested change
A sample project is available under [examples/raspi](./examples/raspi)
A sample project is available under [examples/raspi](./examples/raspi).


## License

Licensed under either of
Expand Down
2 changes: 2 additions & 0 deletions examples/raspi/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target
**/*.rs.bk
301 changes: 301 additions & 0 deletions examples/raspi/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading