Skip to content

Commit 15e2661

Browse files
authored
Merge pull request adafruit#185 from adafruit/upload-artifacts
Prepare for release
2 parents eab7e68 + a141254 commit 15e2661

File tree

5 files changed

+109
-69
lines changed

5 files changed

+109
-69
lines changed

.github/workflows/githubci.yml

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,55 @@
11
name: Build
22

33
on:
4-
push:
54
pull_request:
5+
push:
6+
repository_dispatch:
67
release:
7-
types: [published]
8+
types:
9+
- created
810

911
jobs:
1012
build:
1113
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
board:
18+
# Adafruit Boards
19+
- 'circuitplayground_nrf52840'
20+
- 'clue_nrf52840'
21+
- 'feather_nrf52832'
22+
- 'feather_nrf52840_express'
23+
- 'feather_nrf52840_sense'
24+
- 'itsybitsy_nrf52840_express'
25+
- 'metro_nrf52840_express'
26+
# Alphabetical order
27+
- 'ADM_B_NRF52840_1'
28+
- 'ae_bl652_bo'
29+
- 'aramcon_badge_2019'
30+
- 'arcade_feather_nrf52840_express'
31+
- 'arduino_nano_33_ble'
32+
- 'bast_ble'
33+
- 'bluemicro_nrf52840'
34+
- 'electronut_labs_papyr'
35+
- 'ikigaisense_vita'
36+
- 'mdk_nrf52840_dongle'
37+
- 'nice_nano'
38+
- 'nrf52840_m2'
39+
- 'ohs2020_badge'
40+
- 'particle_argon'
41+
- 'particle_boron'
42+
- 'particle_xenon'
43+
- 'pca10056'
44+
- 'pca10059'
45+
- 'pca10100'
46+
- 'pitaya_go'
47+
- 'raytac_mdbt50q_rx'
48+
- 'waveshare_nrf52840_eval'
49+
1250
steps:
1351
- name: Setup Python
1452
uses: actions/setup-python@v2
15-
with:
16-
# 3.9 has issue with intelhex https://github.com/python-intelhex/intelhex/issues/45
17-
python-version: '3.8'
1853

1954
- name: Setup Node.js
2055
uses: actions/setup-node@v1
@@ -34,13 +69,28 @@ jobs:
3469
echo `echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin` >> $GITHUB_PATH
3570
3671
- name: Build
37-
run: python3 tools/build_all.py
72+
run: |
73+
make BOARD=${{ matrix.board }} all
74+
make BOARD=${{ matrix.board }} copy-artifact
3875
76+
- uses: actions/upload-artifact@v2
77+
with:
78+
name: ${{ matrix.board }}
79+
path: _bin/${{ matrix.board }}
80+
81+
- name: Creat Release Asset
82+
if: ${{ github.event_name == 'release' }}
83+
run: zip -jr ${{ matrix.board }}_bootloader-${{ github.event.release.tag_name }}.zip _bin/${{ matrix.board }}
84+
3985
- name: Upload Release Asset
40-
if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')
41-
working-directory: tools
86+
id: upload-release-asset
87+
uses: actions/upload-release-asset@v1
4288
env:
43-
UPLOAD_URL: ${{ github.event.release.upload_url }}
44-
ADABOT_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45-
run: "[ -z \"$ADABOT_GITHUB_ACCESS_TOKEN\" ] || python3 -u upload_release_files.py"
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
if: ${{ github.event_name == 'release' }}
91+
with:
92+
upload_url: ${{ github.event.release.upload_url }}
93+
asset_path: ${{ matrix.board }}_bootloader-${{ github.event.release.tag_name }}.zip
94+
asset_name: ${{ matrix.board }}_bootloader-${{ github.event.release.tag_name }}.zip
95+
asset_content_type: application/zip
4696

.travis.yml.bck

Lines changed: 0 additions & 31 deletions
This file was deleted.

Makefile

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ GIT_VERSION := $(shell git describe --dirty --always --tags)
2828
GIT_SUBMODULE_VERSIONS := $(shell git submodule status | cut -d" " -f3,4 | paste -s -d" " -)
2929

3030
# compiled file name
31-
OUT_FILE = $(BOARD)_bootloader-$(GIT_VERSION)
31+
OUT_NAME = $(BOARD)_bootloader-$(GIT_VERSION)
3232

3333
# merged file = compiled + sd
34-
MERGED_FILE = $(OUT_FILE)_$(SD_NAME)_$(SD_VERSION)
34+
MERGED_FILE = $(OUT_NAME)_$(SD_NAME)_$(SD_VERSION)
3535

3636
#------------------------------------------------------------------------------
3737
# Tool configure
@@ -46,6 +46,16 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
4646
SIZE = $(CROSS_COMPILE)size
4747
GDB = $(CROSS_COMPILE)gdb
4848

49+
# Set make directory command, Windows tries to create a directory named "-p" if that flag is there.
50+
ifneq ($(OS), Windows_NT)
51+
MKDIR = mkdir -p
52+
else
53+
MKDIR = mkdir
54+
endif
55+
56+
RM = rm -rf
57+
CP = cp
58+
4959
# Flasher utility options
5060
NRFUTIL = adafruit-nrfutil
5161
NRFJPROG = nrfjprog
@@ -66,15 +76,6 @@ else
6676
$(error Unsupported flash utility: "$(FLASHER)")
6777
endif
6878

69-
# Set make directory command, Windows tries to create a directory named "-p" if that flag is there.
70-
ifneq ($(OS), Windows_NT)
71-
MK = mkdir -p
72-
else
73-
MK = mkdir
74-
endif
75-
76-
RM = rm -rf
77-
7879
# auto-detect BMP on macOS, otherwise have to specify
7980
BMP_PORT ?= $(shell ls -1 /dev/cu.usbmodem????????1 | head -1)
8081
GDB_BMP = $(GDB) -ex 'target extended-remote $(BMP_PORT)' -ex 'monitor swdp_scan' -ex 'attach 1'
@@ -93,6 +94,7 @@ endif
9394

9495
# Build directory
9596
BUILD = _build/build-$(BOARD)
97+
BIN = _bin/$(BOARD)
9698

9799
# Board specific
98100
-include src/boards/$(BOARD)/board.mk
@@ -334,7 +336,7 @@ INC_PATHS = $(addprefix -I,$(IPATH))
334336
.PHONY: all clean flash dfu-flash sd gdbflash gdb
335337

336338
# default target to build
337-
all: $(BUILD)/$(OUT_FILE).out $(BUILD)/$(OUT_FILE)-nosd.hex $(BUILD)/$(OUT_FILE)-nosd.uf2 $(BUILD)/$(MERGED_FILE).hex $(BUILD)/$(MERGED_FILE).zip
339+
all: $(BUILD)/$(OUT_NAME).out $(BUILD)/$(OUT_NAME)_nosd.hex $(BUILD)/update-$(OUT_NAME)_nosd.uf2 $(BUILD)/$(MERGED_FILE).hex $(BUILD)/$(MERGED_FILE).zip
338340

339341
# Print out the value of a make variable.
340342
# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile
@@ -345,10 +347,11 @@ print-%:
345347

346348
# Create build directories
347349
$(BUILD):
348-
@$(MK) "$@"
350+
@$(MKDIR) "$@"
349351

350352
clean:
351353
@$(RM) $(BUILD)
354+
@$(RM) $(BIN)
352355

353356
# Create objects from C SRC files
354357
$(BUILD)/%.o: %.c
@@ -361,37 +364,46 @@ $(BUILD)/%.o: %.S
361364
@$(CC) -x assembler-with-cpp $(ASFLAGS) $(INC_PATHS) -c -o $@ $<
362365

363366
# Link
364-
$(BUILD)/$(OUT_FILE).out: $(BUILD) $(OBJECTS)
367+
$(BUILD)/$(OUT_NAME).out: $(BUILD) $(OBJECTS)
365368
@echo LD $(notdir $@)
366369
@$(CC) -o $@ $(LDFLAGS) $(OBJECTS) -Wl,--start-group $(LIBS) -Wl,--end-group
367370
@$(SIZE) $@
368371

369372
#------------------- Binary generator -------------------
370373

371374
# Create hex file (no sd, no mbr)
372-
$(BUILD)/$(OUT_FILE).hex: $(BUILD)/$(OUT_FILE).out
375+
$(BUILD)/$(OUT_NAME).hex: $(BUILD)/$(OUT_NAME).out
373376
@echo Create $(notdir $@)
374377
@$(OBJCOPY) -O ihex $< $@
375378

376379
# Hex file with mbr (still no SD)
377-
$(BUILD)/$(OUT_FILE)-nosd.hex: $(BUILD)/$(OUT_FILE).hex
380+
$(BUILD)/$(OUT_NAME)_nosd.hex: $(BUILD)/$(OUT_NAME).hex
378381
@echo Create $(notdir $@)
379382
@python3 tools/hexmerge.py --overlap=replace -o $@ $< $(MBR_HEX)
380383

381-
# Bootolader only uf2
382-
$(BUILD)/$(OUT_FILE)-nosd.uf2: $(BUILD)/$(OUT_FILE)-nosd.hex
384+
# Bootolader self-update uf2
385+
$(BUILD)/update-$(OUT_NAME)_nosd.uf2: $(BUILD)/$(OUT_NAME)_nosd.hex
383386
@echo Create $(notdir $@)
384387
@python3 lib/uf2/utils/uf2conv.py -f 0xd663823c -c -o $@ $^
385388

386389
# merge bootloader and sd hex together
387-
$(BUILD)/$(MERGED_FILE).hex: $(BUILD)/$(OUT_FILE).hex
390+
$(BUILD)/$(MERGED_FILE).hex: $(BUILD)/$(OUT_NAME).hex
388391
@echo Create $(notdir $@)
389392
@python3 tools/hexmerge.py -o $@ $< $(SD_HEX)
390393

391394
# Create pkg zip file for bootloader+SD combo to use with DFU CDC
392-
$(BUILD)/$(MERGED_FILE).zip: $(BUILD)/$(OUT_FILE).hex
395+
$(BUILD)/$(MERGED_FILE).zip: $(BUILD)/$(OUT_NAME).hex
393396
@$(NRFUTIL) dfu genpkg --dev-type 0x0052 --dev-revision $(DFU_DEV_REV) --bootloader $< --softdevice $(SD_HEX) $@
394397

398+
#-------------- Artifacts --------------
399+
$(BIN):
400+
@$(MKDIR) -p $@
401+
402+
copy-artifact: $(BIN)
403+
@$(CP) $(BUILD)/update-$(OUT_NAME)_nosd.uf2 $(BIN)
404+
@$(CP) $(BUILD)/$(MERGED_FILE).hex $(BIN)
405+
@$(CP) $(BUILD)/$(MERGED_FILE).zip $(BIN)
406+
395407
#------------------- Flash target -------------------
396408

397409
check_defined = \
@@ -402,7 +414,7 @@ __check_defined = \
402414
$(error Undefined make flag: $1$(if $2, ($2))))
403415

404416
# Flash the compiled
405-
flash: $(BUILD)/$(OUT_FILE)-nosd.hex
417+
flash: $(BUILD)/$(OUT_NAME)_nosd.hex
406418
@echo Flashing: $(notdir $<)
407419
$(call FLASH_CMD,$<)
408420

@@ -433,5 +445,5 @@ gdbflash: $(BUILD)/$(MERGED_FILE).hex
433445
@echo Flashing: $<
434446
@$(GDB_BMP) -nx --batch -ex 'load $<' -ex 'compare-sections' -ex 'kill'
435447

436-
gdb: $(BUILD)/$(OUT_FILE).out
448+
gdb: $(BUILD)/$(OUT_NAME).out
437449
$(GDB_BMP) $<

changelog.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Adafruit nRF52 Bootloader Changelog
22

3+
## 0.4.0 - 2021.01.19
4+
5+
- 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.
6+
- Add self-update feature with update-{board}.uf2. This allow bootloader to update itself easily (requires running bootloader with at least 0.4.0)
7+
- Enlarge the fake FAT disk to ~ 32MB to allow piggy-pack multiple application (different family ID) within the same uf2.
8+
- Support uf2 with family ID = vendor ID + product ID
9+
- Reset into application if there is no USB connection in ~3 seconds.
10+
- Remove DFU idle 300 seconds timeout
11+
- Support power supply configuration with `ENABLE_DCDC_0` and `ENABLE_DCDC_1`
12+
- Add new boards support: nice nano, bast ble, ikigaisense vita, nrf52840 M2, Pitaya Go, AE-BL652-BO, BlueMicro, ADM_B_NRF52840_1
13+
314
## 0.3.2 - 2020.03.12
415

516
- Make sure all pins are in reset state when jumping to app mode.

src/usb/uf2/ghostfat.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,8 @@ int write_block (uint32_t block_no, uint8_t *data, WriteState *state)
391391
switch ( bl->familyID )
392392
{
393393

394-
case CFG_UF2_BOARD_APP_ID: // board-specific app ... may not be usable on other nrf52 boards
395-
case CFG_UF2_FAMILY_APP_ID: // legacy, or where app uses bootloader configuration to discover pins
394+
case CFG_UF2_BOARD_APP_ID: // board-specific app
395+
case CFG_UF2_FAMILY_APP_ID: // family app
396396
/* Upgrading Application
397397
*
398398
* 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)
430430
/* Upgrading Bootloader
431431
*
432432
* - For simplicity, the Bootloader Start Address is fixed for now.
433-
*
434433
* - Since SoftDevice is not part of Bootloader, it MUST NOT be included as part of uf2 file.
435-
*
436434
* - To prevent corruption/disconnection while transferring we don't directly write over Bootloader.
437435
* Instead it is written to highest possible address in Application region. Once everything is received
438436
* 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)
516514
}
517515
else
518516
{
519-
PRINTF("DOES NOT mismatches our VID/PID\r\n");
517+
PRINTF("DOES NOT match our VID/PID\r\n");
520518
state->aborted = true;
521519
return -1;
522520
}

0 commit comments

Comments
 (0)