Skip to content

Commit 896bedd

Browse files
authored
Merge pull request #16 from Neotron-Compute/build-releases
Build for all targets, and make releases when tagged.
2 parents 051bb8a + e9022a2 commit 896bedd

File tree

3 files changed

+63
-10
lines changed

3 files changed

+63
-10
lines changed

.github/workflows/rust.yml

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,46 @@ on: [push, pull_request]
44

55
jobs:
66
build:
7-
7+
name: Build (and Release)
88
runs-on: ubuntu-latest
9-
109
steps:
11-
- name: Checkout
12-
uses: actions/checkout@v1
13-
with:
14-
submodules: true
15-
- name: Add Target
16-
run: rustup target add thumbv7em-none-eabi
17-
- name: Build
18-
run: cargo build --verbose --target=thumbv7em-none-eabi
10+
- name: Checkout
11+
uses: actions/checkout@v3
12+
with:
13+
submodules: true
14+
- name: Check Syntax
15+
run: |
16+
cargo check
17+
- name: Install Targets and Tools
18+
run: |
19+
rustup target add thumbv7em-none-eabi
20+
rustup target add thumbv7m-none-eabi
21+
rustup target add thumbv6m-none-eabi
22+
rustup component add llvm-tools-preview
23+
cargo install cargo-binutils
24+
- name: Build
25+
run: ./build.sh
26+
- name: Upload files to Release
27+
if: github.event_name == 'push' && startswith(github.ref, 'refs/tags/')
28+
uses: softprops/action-gh-release@v1
29+
with:
30+
files: |
31+
./release/thumbv6m-none-eabi-flash0002-libneotron_os.bin
32+
./release/thumbv6m-none-eabi-flash0002-libneotron_os.elf
33+
./release/thumbv6m-none-eabi-flash0802-libneotron_os.bin
34+
./release/thumbv6m-none-eabi-flash0802-libneotron_os.elf
35+
./release/thumbv6m-none-eabi-flash1002-libneotron_os.bin
36+
./release/thumbv6m-none-eabi-flash1002-libneotron_os.elf
37+
./release/thumbv7em-none-eabi-flash0002-libneotron_os.bin
38+
./release/thumbv7em-none-eabi-flash0002-libneotron_os.elf
39+
./release/thumbv7em-none-eabi-flash0802-libneotron_os.bin
40+
./release/thumbv7em-none-eabi-flash0802-libneotron_os.elf
41+
./release/thumbv7em-none-eabi-flash1002-libneotron_os.bin
42+
./release/thumbv7em-none-eabi-flash1002-libneotron_os.elf
43+
./release/thumbv7m-none-eabi-flash0002-libneotron_os.bin
44+
./release/thumbv7m-none-eabi-flash0002-libneotron_os.elf
45+
./release/thumbv7m-none-eabi-flash0802-libneotron_os.bin
46+
./release/thumbv7m-none-eabi-flash0802-libneotron_os.elf
47+
./release/thumbv7m-none-eabi-flash1002-libneotron_os.bin
48+
./release/thumbv7m-none-eabi-flash1002-libneotron_os.elf
49+
./release/x86_64-unknown-linux-gnu-libneotron_os.so

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/target
22
**/*.rs.bk
33
Cargo.lock
4+
/release

build.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
RELEASE_DIR=./release
6+
7+
mkdir -p ${RELEASE_DIR}
8+
9+
# Build the embedded binaries for each core type and each flash layout
10+
for TARGET_ARCH in thumbv6m-none-eabi thumbv7m-none-eabi thumbv7em-none-eabi; do
11+
for BINARY in flash0002 flash0802 flash1002; do
12+
# objcopy will do the build for us first
13+
cargo objcopy --verbose --release --target=${TARGET_ARCH} --bin ${BINARY} -- -O binary ${RELEASE_DIR}/${TARGET_ARCH}-${BINARY}-libneotron_os.bin
14+
# Keep the ELF file too (for debugging)
15+
cp ./target/${TARGET_ARCH}/release/${BINARY} ${RELEASE_DIR}/${TARGET_ARCH}-${BINARY}-libneotron_os.elf
16+
done
17+
done
18+
19+
# Build the host version
20+
cargo build --verbose --lib --release --target=x86_64-unknown-linux-gnu
21+
cp ./target/x86_64-unknown-linux-gnu/release/libneotron_os.so ${RELEASE_DIR}/x86_64-unknown-linux-gnu-libneotron_os.so

0 commit comments

Comments
 (0)