From 2f7e2ba881fa1ec420850eacd6efaac4a87ba541 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 14 Aug 2021 17:13:45 +0200 Subject: [PATCH] init commit --- .cargo/config.toml | 4 ++++ .gitignore | 1 + Cargo.lock | 5 +++++ Cargo.toml | 9 +++++++++ README.md | 14 ++++++++++++++ deploy-q7s.sh | 7 +++++++ src/main.rs | 3 +++ 7 files changed, 43 insertions(+) create mode 100644 .cargo/config.toml create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 README.md create mode 100755 deploy-q7s.sh create mode 100644 src/main.rs diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..420c1bd --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,4 @@ +[build] + +[target.armv7-unknown-linux-gnueabihf] +linker = "arm-linux-gnueabihf-gcc" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..c9aa982 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "q7s-rs-crosscompile" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..ea8c98c --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "q7s-rs-crosscompile" +version = "0.1.0" +authors = ["Robin Mueller "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/README.md b/README.md new file mode 100644 index 0000000..8e17097 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +Cross-compiling Rust for the Raspberry PI +====== + +# Prerequisites + +1. Install standard library + + ```sh + rustup target add armv7-unknown-linux-gnueabihf + ``` + +2. Install a cross-compile toolchain and add it to your path. + You can download one built with crosstool-ng from + [here](https://www.dropbox.com/sh/hkn4lw87zr002fh/AAAO-HxFQzfmmPQQ9KVmoooGa?dl=0). diff --git a/deploy-q7s.sh b/deploy-q7s.sh new file mode 100755 index 0000000..fb907ad --- /dev/null +++ b/deploy-q7s.sh @@ -0,0 +1,7 @@ +#!/bin/bash -i +echo $PATH +target="armv7-unknown-linux-gnueabihf" + +cargo build --target ${target} + +sshpass -e q7s-cp.py ./target/${target}/debug/q7s-rs-crosscompile diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +}