mirror of
https://github.com/oltaco/Adafruit_nRF52_Bootloader_OTAFIX.git
synced 2026-06-03 17:31:17 +00:00
Merge pull request #185 from adafruit/upload-artifacts
Prepare for release
This commit is contained in:
@@ -1,20 +1,55 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
push:
|
||||
repository_dispatch:
|
||||
release:
|
||||
types: [published]
|
||||
types:
|
||||
- created
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
board:
|
||||
# Adafruit Boards
|
||||
- 'circuitplayground_nrf52840'
|
||||
- 'clue_nrf52840'
|
||||
- 'feather_nrf52832'
|
||||
- 'feather_nrf52840_express'
|
||||
- 'feather_nrf52840_sense'
|
||||
- 'itsybitsy_nrf52840_express'
|
||||
- 'metro_nrf52840_express'
|
||||
# Alphabetical order
|
||||
- 'ADM_B_NRF52840_1'
|
||||
- 'ae_bl652_bo'
|
||||
- 'aramcon_badge_2019'
|
||||
- 'arcade_feather_nrf52840_express'
|
||||
- 'arduino_nano_33_ble'
|
||||
- 'bast_ble'
|
||||
- 'bluemicro_nrf52840'
|
||||
- 'electronut_labs_papyr'
|
||||
- 'ikigaisense_vita'
|
||||
- 'mdk_nrf52840_dongle'
|
||||
- 'nice_nano'
|
||||
- 'nrf52840_m2'
|
||||
- 'ohs2020_badge'
|
||||
- 'particle_argon'
|
||||
- 'particle_boron'
|
||||
- 'particle_xenon'
|
||||
- 'pca10056'
|
||||
- 'pca10059'
|
||||
- 'pca10100'
|
||||
- 'pitaya_go'
|
||||
- 'raytac_mdbt50q_rx'
|
||||
- 'waveshare_nrf52840_eval'
|
||||
|
||||
steps:
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
# 3.9 has issue with intelhex https://github.com/python-intelhex/intelhex/issues/45
|
||||
python-version: '3.8'
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v1
|
||||
@@ -34,13 +69,28 @@ jobs:
|
||||
echo `echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin` >> $GITHUB_PATH
|
||||
|
||||
- name: Build
|
||||
run: python3 tools/build_all.py
|
||||
run: |
|
||||
make BOARD=${{ matrix.board }} all
|
||||
make BOARD=${{ matrix.board }} copy-artifact
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{ matrix.board }}
|
||||
path: _bin/${{ matrix.board }}
|
||||
|
||||
- name: Creat Release Asset
|
||||
if: ${{ github.event_name == 'release' }}
|
||||
run: zip -jr ${{ matrix.board }}_bootloader-${{ github.event.release.tag_name }}.zip _bin/${{ matrix.board }}
|
||||
|
||||
- name: Upload Release Asset
|
||||
if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')
|
||||
working-directory: tools
|
||||
id: upload-release-asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
UPLOAD_URL: ${{ github.event.release.upload_url }}
|
||||
ADABOT_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: "[ -z \"$ADABOT_GITHUB_ACCESS_TOKEN\" ] || python3 -u upload_release_files.py"
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
if: ${{ github.event_name == 'release' }}
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: ${{ matrix.board }}_bootloader-${{ github.event.release.tag_name }}.zip
|
||||
asset_name: ${{ matrix.board }}_bootloader-${{ github.event.release.tag_name }}.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
sudo: required
|
||||
dist: xenial
|
||||
language: c
|
||||
compiler:
|
||||
- gcc
|
||||
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key: "$GITHUB_TOKEN"
|
||||
file_glob: true
|
||||
file: "$TRAVIS_BUILD_DIR/bin/*/*"
|
||||
skip_cleanup: true
|
||||
on:
|
||||
tags: true
|
||||
|
||||
before_script:
|
||||
- (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2018q2-1~xenial1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb)
|
||||
- (wget https://www.nordicsemi.com/api/sitecore/Products/DownloadPlatform --post-data=fileid=8F19D314130548209E75EFFADD9348DB -O cli-tools.tar && tar -xv -f cli-tools.tar && mv mergehex mergehex_all && mv mergehex_all/mergehex .)
|
||||
- export PATH=.:$PATH
|
||||
- mergehex --version
|
||||
|
||||
# report some good version numbers to the build
|
||||
- gcc --version
|
||||
- arm-none-eabi-gcc --version
|
||||
- python3 --version
|
||||
- python --version
|
||||
- sudo apt-get install -y python3-pip python3-setuptools
|
||||
- pip3 install --user adafruit-nrfutil
|
||||
|
||||
script:
|
||||
- python3 tools/build_all.py
|
||||
@@ -28,10 +28,10 @@ GIT_VERSION := $(shell git describe --dirty --always --tags)
|
||||
GIT_SUBMODULE_VERSIONS := $(shell git submodule status | cut -d" " -f3,4 | paste -s -d" " -)
|
||||
|
||||
# compiled file name
|
||||
OUT_FILE = $(BOARD)_bootloader-$(GIT_VERSION)
|
||||
OUT_NAME = $(BOARD)_bootloader-$(GIT_VERSION)
|
||||
|
||||
# merged file = compiled + sd
|
||||
MERGED_FILE = $(OUT_FILE)_$(SD_NAME)_$(SD_VERSION)
|
||||
MERGED_FILE = $(OUT_NAME)_$(SD_NAME)_$(SD_VERSION)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Tool configure
|
||||
@@ -46,6 +46,16 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||
SIZE = $(CROSS_COMPILE)size
|
||||
GDB = $(CROSS_COMPILE)gdb
|
||||
|
||||
# Set make directory command, Windows tries to create a directory named "-p" if that flag is there.
|
||||
ifneq ($(OS), Windows_NT)
|
||||
MKDIR = mkdir -p
|
||||
else
|
||||
MKDIR = mkdir
|
||||
endif
|
||||
|
||||
RM = rm -rf
|
||||
CP = cp
|
||||
|
||||
# Flasher utility options
|
||||
NRFUTIL = adafruit-nrfutil
|
||||
NRFJPROG = nrfjprog
|
||||
@@ -66,15 +76,6 @@ else
|
||||
$(error Unsupported flash utility: "$(FLASHER)")
|
||||
endif
|
||||
|
||||
# Set make directory command, Windows tries to create a directory named "-p" if that flag is there.
|
||||
ifneq ($(OS), Windows_NT)
|
||||
MK = mkdir -p
|
||||
else
|
||||
MK = mkdir
|
||||
endif
|
||||
|
||||
RM = rm -rf
|
||||
|
||||
# auto-detect BMP on macOS, otherwise have to specify
|
||||
BMP_PORT ?= $(shell ls -1 /dev/cu.usbmodem????????1 | head -1)
|
||||
GDB_BMP = $(GDB) -ex 'target extended-remote $(BMP_PORT)' -ex 'monitor swdp_scan' -ex 'attach 1'
|
||||
@@ -93,6 +94,7 @@ endif
|
||||
|
||||
# Build directory
|
||||
BUILD = _build/build-$(BOARD)
|
||||
BIN = _bin/$(BOARD)
|
||||
|
||||
# Board specific
|
||||
-include src/boards/$(BOARD)/board.mk
|
||||
@@ -334,7 +336,7 @@ INC_PATHS = $(addprefix -I,$(IPATH))
|
||||
.PHONY: all clean flash dfu-flash sd gdbflash gdb
|
||||
|
||||
# default target to build
|
||||
all: $(BUILD)/$(OUT_FILE).out $(BUILD)/$(OUT_FILE)-nosd.hex $(BUILD)/$(OUT_FILE)-nosd.uf2 $(BUILD)/$(MERGED_FILE).hex $(BUILD)/$(MERGED_FILE).zip
|
||||
all: $(BUILD)/$(OUT_NAME).out $(BUILD)/$(OUT_NAME)_nosd.hex $(BUILD)/update-$(OUT_NAME)_nosd.uf2 $(BUILD)/$(MERGED_FILE).hex $(BUILD)/$(MERGED_FILE).zip
|
||||
|
||||
# Print out the value of a make variable.
|
||||
# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile
|
||||
@@ -345,10 +347,11 @@ print-%:
|
||||
|
||||
# Create build directories
|
||||
$(BUILD):
|
||||
@$(MK) "$@"
|
||||
@$(MKDIR) "$@"
|
||||
|
||||
clean:
|
||||
@$(RM) $(BUILD)
|
||||
@$(RM) $(BIN)
|
||||
|
||||
# Create objects from C SRC files
|
||||
$(BUILD)/%.o: %.c
|
||||
@@ -361,7 +364,7 @@ $(BUILD)/%.o: %.S
|
||||
@$(CC) -x assembler-with-cpp $(ASFLAGS) $(INC_PATHS) -c -o $@ $<
|
||||
|
||||
# Link
|
||||
$(BUILD)/$(OUT_FILE).out: $(BUILD) $(OBJECTS)
|
||||
$(BUILD)/$(OUT_NAME).out: $(BUILD) $(OBJECTS)
|
||||
@echo LD $(notdir $@)
|
||||
@$(CC) -o $@ $(LDFLAGS) $(OBJECTS) -Wl,--start-group $(LIBS) -Wl,--end-group
|
||||
@$(SIZE) $@
|
||||
@@ -369,29 +372,38 @@ $(BUILD)/$(OUT_FILE).out: $(BUILD) $(OBJECTS)
|
||||
#------------------- Binary generator -------------------
|
||||
|
||||
# Create hex file (no sd, no mbr)
|
||||
$(BUILD)/$(OUT_FILE).hex: $(BUILD)/$(OUT_FILE).out
|
||||
$(BUILD)/$(OUT_NAME).hex: $(BUILD)/$(OUT_NAME).out
|
||||
@echo Create $(notdir $@)
|
||||
@$(OBJCOPY) -O ihex $< $@
|
||||
|
||||
# Hex file with mbr (still no SD)
|
||||
$(BUILD)/$(OUT_FILE)-nosd.hex: $(BUILD)/$(OUT_FILE).hex
|
||||
$(BUILD)/$(OUT_NAME)_nosd.hex: $(BUILD)/$(OUT_NAME).hex
|
||||
@echo Create $(notdir $@)
|
||||
@python3 tools/hexmerge.py --overlap=replace -o $@ $< $(MBR_HEX)
|
||||
|
||||
# Bootolader only uf2
|
||||
$(BUILD)/$(OUT_FILE)-nosd.uf2: $(BUILD)/$(OUT_FILE)-nosd.hex
|
||||
# Bootolader self-update uf2
|
||||
$(BUILD)/update-$(OUT_NAME)_nosd.uf2: $(BUILD)/$(OUT_NAME)_nosd.hex
|
||||
@echo Create $(notdir $@)
|
||||
@python3 lib/uf2/utils/uf2conv.py -f 0xd663823c -c -o $@ $^
|
||||
|
||||
# merge bootloader and sd hex together
|
||||
$(BUILD)/$(MERGED_FILE).hex: $(BUILD)/$(OUT_FILE).hex
|
||||
$(BUILD)/$(MERGED_FILE).hex: $(BUILD)/$(OUT_NAME).hex
|
||||
@echo Create $(notdir $@)
|
||||
@python3 tools/hexmerge.py -o $@ $< $(SD_HEX)
|
||||
|
||||
# Create pkg zip file for bootloader+SD combo to use with DFU CDC
|
||||
$(BUILD)/$(MERGED_FILE).zip: $(BUILD)/$(OUT_FILE).hex
|
||||
$(BUILD)/$(MERGED_FILE).zip: $(BUILD)/$(OUT_NAME).hex
|
||||
@$(NRFUTIL) dfu genpkg --dev-type 0x0052 --dev-revision $(DFU_DEV_REV) --bootloader $< --softdevice $(SD_HEX) $@
|
||||
|
||||
#-------------- Artifacts --------------
|
||||
$(BIN):
|
||||
@$(MKDIR) -p $@
|
||||
|
||||
copy-artifact: $(BIN)
|
||||
@$(CP) $(BUILD)/update-$(OUT_NAME)_nosd.uf2 $(BIN)
|
||||
@$(CP) $(BUILD)/$(MERGED_FILE).hex $(BIN)
|
||||
@$(CP) $(BUILD)/$(MERGED_FILE).zip $(BIN)
|
||||
|
||||
#------------------- Flash target -------------------
|
||||
|
||||
check_defined = \
|
||||
@@ -402,7 +414,7 @@ __check_defined = \
|
||||
$(error Undefined make flag: $1$(if $2, ($2))))
|
||||
|
||||
# Flash the compiled
|
||||
flash: $(BUILD)/$(OUT_FILE)-nosd.hex
|
||||
flash: $(BUILD)/$(OUT_NAME)_nosd.hex
|
||||
@echo Flashing: $(notdir $<)
|
||||
$(call FLASH_CMD,$<)
|
||||
|
||||
@@ -433,5 +445,5 @@ gdbflash: $(BUILD)/$(MERGED_FILE).hex
|
||||
@echo Flashing: $<
|
||||
@$(GDB_BMP) -nx --batch -ex 'load $<' -ex 'compare-sections' -ex 'kill'
|
||||
|
||||
gdb: $(BUILD)/$(OUT_FILE).out
|
||||
gdb: $(BUILD)/$(OUT_NAME).out
|
||||
$(GDB_BMP) $<
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
# Adafruit nRF52 Bootloader Changelog
|
||||
|
||||
## 0.4.0 - 2021.01.19
|
||||
|
||||
- Decouple bootloader and softdevice i.e bootloader will always work with and/or without softdevice present. This allows application to pack firmware + softdevice into an uf2/serial for DFU.
|
||||
- Add self-update feature with update-{board}.uf2. This allow bootloader to update itself easily (requires running bootloader with at least 0.4.0)
|
||||
- Enlarge the fake FAT disk to ~ 32MB to allow piggy-pack multiple application (different family ID) within the same uf2.
|
||||
- Support uf2 with family ID = vendor ID + product ID
|
||||
- Reset into application if there is no USB connection in ~3 seconds.
|
||||
- Remove DFU idle 300 seconds timeout
|
||||
- Support power supply configuration with `ENABLE_DCDC_0` and `ENABLE_DCDC_1`
|
||||
- Add new boards support: nice nano, bast ble, ikigaisense vita, nrf52840 M2, Pitaya Go, AE-BL652-BO, BlueMicro, ADM_B_NRF52840_1
|
||||
|
||||
## 0.3.2 - 2020.03.12
|
||||
|
||||
- Make sure all pins are in reset state when jumping to app mode.
|
||||
|
||||
@@ -391,8 +391,8 @@ int write_block (uint32_t block_no, uint8_t *data, WriteState *state)
|
||||
switch ( bl->familyID )
|
||||
{
|
||||
|
||||
case CFG_UF2_BOARD_APP_ID: // board-specific app ... may not be usable on other nrf52 boards
|
||||
case CFG_UF2_FAMILY_APP_ID: // legacy, or where app uses bootloader configuration to discover pins
|
||||
case CFG_UF2_BOARD_APP_ID: // board-specific app
|
||||
case CFG_UF2_FAMILY_APP_ID: // family app
|
||||
/* Upgrading Application
|
||||
*
|
||||
* SoftDevice is considered as part of application and can be (or not) included in uf2.
|
||||
@@ -430,9 +430,7 @@ int write_block (uint32_t block_no, uint8_t *data, WriteState *state)
|
||||
/* Upgrading Bootloader
|
||||
*
|
||||
* - For simplicity, the Bootloader Start Address is fixed for now.
|
||||
*
|
||||
* - Since SoftDevice is not part of Bootloader, it MUST NOT be included as part of uf2 file.
|
||||
*
|
||||
* - To prevent corruption/disconnection while transferring we don't directly write over Bootloader.
|
||||
* Instead it is written to highest possible address in Application region. Once everything is received
|
||||
* and verified, it is safely activated using MBR COPY BL command.
|
||||
@@ -516,7 +514,7 @@ int write_block (uint32_t block_no, uint8_t *data, WriteState *state)
|
||||
}
|
||||
else
|
||||
{
|
||||
PRINTF("DOES NOT mismatches our VID/PID\r\n");
|
||||
PRINTF("DOES NOT match our VID/PID\r\n");
|
||||
state->aborted = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user