Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 27 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ name: Build PineTime Firmware
# When to run this Workflow...
on:

# Run this Workflow if a user presses the "Run workflow" button on GitHub
workflow_dispatch:
branches: [ master, nan_fix_build, develop ]

# Run this Workflow when files are updated (Pushed) in the "master" Branch
push:
branches: [ master ]
branches: [ develop, master ]

# Also run this Workflow when a Pull Request is created or updated in the "master" Branch
pull_request:
branches: [ master ]
branches: [ develop, master ]

# Steps to run for the Workflow
jobs:
Expand All @@ -28,7 +32,7 @@ jobs:

#########################################################################################
# Download and Cache Dependencies

- name: Install cmake
uses: lukka/get-cmake@v3.18.3

Expand All @@ -45,11 +49,14 @@ jobs:
- name: Install Embedded Arm Toolchain arm-none-eabi-gcc
if: steps.cache-toolchain.outputs.cache-hit != 'true' # Install toolchain if not found in cache
uses: fiam/arm-none-eabi-gcc@v1.0.2
with:
with:
# GNU Embedded Toolchain for Arm release name, in the V-YYYY-qZ format (e.g. "9-2019-q4")
release: 9-2020-q2
# Directory to unpack GCC to. Defaults to a temporary directory.
directory: ${{ runner.temp }}/arm-none-eabi
env:
# needed for set-env (https://github.com/actions/toolkit/issues/641)
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'

- name: Check cache for nRF5 SDK
id: cache-nrf5sdk
Expand Down Expand Up @@ -83,10 +90,16 @@ jobs:
if: steps.cache-mcuboot.outputs.cache-hit != 'true' # Install MCUBoot if not found in cache
run: |
cd ${{ runner.temp }}
git clone --branch v1.5.0 https://github.com/JuulLabs-OSS/mcuboot
git clone --branch v1.5.0 https://github.com/mcu-tools/mcuboot

- name: Install imgtool dependencies
run: pip3 install --user -r ${{ runner.temp }}/mcuboot/scripts/requirements.txt
run: |
pip3 install --user -r ${{ runner.temp }}/mcuboot/scripts/requirements.txt

# cbor is a dependency that is not currently included in mcuboot requirements.txt
- name: Install imgtool dependencies (cbor)
run: |
pip3 install --user cbor

- name: Install adafruit-nrfutil
run: |
Expand All @@ -99,6 +112,8 @@ jobs:

- name: Checkout source files
uses: actions/checkout@v2
with:
submodules: 'true'

- name: Show files
run: set ; pwd ; ls -l
Expand All @@ -124,12 +139,17 @@ jobs:
run: |
cd build
make pinetime-mcuboot-app
echo ""

- name: Create firmware image
Copy link
Contributor

Choose a reason for hiding this comment

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

this step should be deleted -- make pinetime-mcuboot-app already does this (except the file name is image instead of img)

Copy link
Collaborator

Choose a reason for hiding this comment

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

@DavidVentura which step are you talking about here ? Make pinetime-mcuboot-app or Create firmware image

run: |
# The generated firmware binary looks like "pinetime-mcuboot-app-0.8.2.bin"
ls -l build/src/pinetime-mcuboot-app*.bin
${{ runner.temp }}/mcuboot/scripts/imgtool.py create --align 4 --version 1.0.0 --header-size 32 --slot-size 475136 --pad-header build/src/pinetime-mcuboot-app*.bin build/src/pinetime-mcuboot-app-img.bin
IMGTOOL_INPUT_ARGUMENT=$( ls build/src | grep "pinetime-mcuboot-app-[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.bin" )
echo ""
echo -e "\u001b[32m ${IMGTOOL_INPUT_ARGUMENT} \u001b[0m"
echo ""
${{ runner.temp }}/mcuboot/scripts/imgtool.py create --align 4 --version 1.0.0 --header-size 32 --slot-size 475136 --pad-header build/src/${IMGTOOL_INPUT_ARGUMENT} build/src/pinetime-mcuboot-app-img.bin
${{ runner.temp }}/mcuboot/scripts/imgtool.py verify build/src/pinetime-mcuboot-app-img.bin

- name: Create DFU package
Copy link
Contributor

Choose a reason for hiding this comment

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

this one also could be removed by enabling DFU in the Cmake step

Copy link
Collaborator

Choose a reason for hiding this comment

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

Right! It was not the case before, but now, images and DFU files are generated directly by CMake so that you don't need to add custom step after the build. You can have a look at the docker file to see how it's done :

Previously, the post build script generated images and DFU, but now it just copies the binaries into the output folder.

Basically, all you have to do is add -DBUILD_DFU=1 to your cmake command line.

Expand Down