-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from WyliodrinEmbeddedIoT/microbit_v2_release
Microbit v2 serial bootloader release workflow
- Loading branch information
Showing
3 changed files
with
84 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Micro:bit v2 Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Release version' | ||
required: true | ||
|
||
jobs: | ||
release: | ||
runs-on: "ubuntu-latest" | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 # pulls version from rust-toolchain file | ||
- name: build bootloader | ||
run: | | ||
cd boards/microbit_v2-bootloader | ||
export BOOTLOADER_VERSION="${{ github.event.inputs.version }}" | ||
export BOOTLOADER_HASH="$(git rev-parse HEAD)" | ||
export BOOTLOADER_KERNEL_HASH="$(cat Cargo.lock | grep https://github.com/tock/tock?branch=remove-submodule | uniq | cut -d '#' -f 2 | cut -d '"' -f 1)" | ||
make | ||
- name: Version | ||
run: | | ||
echo "Version: ${{ github.event.inputs.version }}" > tock-bootloader.microbit_v2.version | ||
echo "Toolchain: $(rustc --version)" >> tock-bootloader.microbit_v2.version | ||
echo "Tock Bootloader Hash: $(git rev-parse HEAD)" >> tock-bootloader.microbit_v2.version | ||
echo Tock Hash: $(cat boards/microbit_v2-bootloader/Cargo.lock | grep https://github.com/tock/tock?branch=remove-submodule | uniq | cut -d '#' -f 2 | cut -d '"' -f 1) >> tock-bootloader.microbit_v2.version | ||
echo "Bootloader SHA256: $(sha256sum target/thumbv7em-none-eabi/release/microbit_v2-bootloader.bin | cut -d ' ' -f 1)" >> tock-bootloader.microbit_v2.version | ||
echo "Build Date: $(date)" >> tock-bootloader.microbit_v2.version | ||
- name: Upload bootloader release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
release_name: Micro:bit v2 ${{ github.event.inputs.version }} | ||
prerelease: true | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: target/thumbv7em-none-eabi/release/microbit_v2-bootloader.bin | ||
asset_name: tock-bootloader.microbit_v2.v${{ github.event.inputs.version }}.bin | ||
tag: microbit_v2-v${{ github.event.inputs.version }} | ||
overwrite: true | ||
body: "Bootloader for Micro:bit v2 v${{ github.event.inputs.version }}" | ||
- name: Upload bootloader version | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
release_name: Micro:bit v2 ${{ github.event.inputs.version }} | ||
prerelease: true | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: tock-bootloader.microbit_v2.version | ||
asset_name: tock-bootloader.microbit_v2.v${{ github.event.inputs.version }}.version | ||
tag: microbit_v2-v${{ github.event.inputs.version }} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,24 @@ | ||
extern crate bootloader_attributes; | ||
use std::env; | ||
|
||
fn main() { | ||
println!("cargo:rerun-if-changed=layout.ld"); | ||
println!("cargo:rerun-if-changed=../kernel_layout.ld"); | ||
|
||
let mut f = bootloader_attributes::get_file(); | ||
bootloader_attributes::write_flags(&mut f, "1.1.1", 0x8000); | ||
let version = if let Ok(v) = env::var("BOOTLOADER_VERSION") { | ||
v | ||
} else { | ||
String::from("1.1.1") | ||
}; | ||
bootloader_attributes::write_flags(&mut f, &version, 0x8000); | ||
bootloader_attributes::write_attribute(&mut f, "board", "microbit_v2"); | ||
bootloader_attributes::write_attribute(&mut f, "arch", "cortex-m4"); | ||
bootloader_attributes::write_attribute(&mut f, "appaddr", "0x40000"); | ||
if let Ok(bootloader) = env::var("BOOTLOADER_HASH") { | ||
bootloader_attributes::write_attribute(&mut f, "boothash", &bootloader); | ||
} | ||
if let Ok(bootloader_kernel) = env::var("BOOTLOADER_KERNEL_HASH") { | ||
bootloader_attributes::write_attribute(&mut f, "kernhash", &bootloader_kernel); | ||
} | ||
} |