Skip to content

Commit

Permalink
Merge pull request #22 from WyliodrinEmbeddedIoT/microbit_v2_release
Browse files Browse the repository at this point in the history
Microbit v2 serial bootloader release workflow
  • Loading branch information
bradjc authored Feb 17, 2021
2 parents 0d3504d + 962e14f commit d07821e
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 14 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
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 }}
32 changes: 19 additions & 13 deletions boards/microbit_v2-bootloader/Cargo.lock

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

14 changes: 13 additions & 1 deletion boards/microbit_v2-bootloader/build.rs
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);
}
}

0 comments on commit d07821e

Please sign in to comment.