Skip to content

Commit 875d7f4

Browse files
committed
Split nrf into separate set of jobs and install nrfutil 7
1 parent cd94275 commit 875d7f4

File tree

5 files changed

+51
-22
lines changed

5 files changed

+51
-22
lines changed

.github/actions/deps/external/action.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ runs:
3737

3838
# arm
3939
- name: Get arm toolchain
40-
if: inputs.platform == 'aarch' || inputs.platform == 'arm'
40+
if: inputs.platform == 'aarch' || inputs.platform == 'arm' || inputs.platform == 'nrf'
4141
uses: carlosperate/arm-none-eabi-gcc-action@v1
4242
with:
4343
release: '10-2020-q4'
@@ -65,6 +65,22 @@ runs:
6565
echo >> $GITHUB_PATH "$PATH"
6666
shell: bash
6767

68+
# nrf
69+
- name: Get nrfutil 7+
70+
if: inputs.platform == 'nrf'
71+
run: |
72+
wget https://developer.nordicsemi.com/.pc-tools/nrfutil/x64-linux/nrfutil
73+
chmod +x nrfutil
74+
./nrfutil install nrf5sdk-tools
75+
mkdir -p $HOME/.local/bin
76+
mv nrfutil $HOME/.local/bin
77+
echo "$HOME/.local/bin" >> $GITHUB_PATH
78+
shell: bash
79+
- name: Print nrfutil version
80+
if: inputs.platform == 'nrf'
81+
run: nrfutil version
82+
shell: bash
83+
6884
# riscv
6985
- name: Get riscv toolchain
7086
if: inputs.platform == 'riscv'

.github/workflows/build.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
boards-aarch: ${{ steps.set-matrix.outputs.boards-aarch }}
2626
boards-arm: ${{ steps.set-matrix.outputs.boards-arm }}
2727
boards-esp: ${{ steps.set-matrix.outputs.boards-esp }}
28+
boards-nrf: ${{ steps.set-matrix.outputs.boards-nrf }}
2829
boards-riscv: ${{ steps.set-matrix.outputs.boards-riscv }}
2930
boards-rpi: ${{ steps.set-matrix.outputs.boards-rpi }}
3031
cp-version: ${{ steps.set-up-submodules.outputs.version }}
@@ -248,6 +249,14 @@ jobs:
248249
boards: ${{ needs.scheduler.outputs.boards-esp }}
249250
cp-version: ${{ needs.scheduler.outputs.cp-version }}
250251

252+
nrf:
253+
needs: [scheduler, mpy-cross, tests]
254+
if: ${{ needs.scheduler.outputs.boards-nrf != '[]' }}
255+
uses: ./.github/workflows/build-boards.yml
256+
with:
257+
platform: nrf
258+
boards: ${{ needs.scheduler.outputs.boards-nrf }}
259+
cp-version: ${{ needs.scheduler.outputs.cp-version }}
251260

252261
riscv:
253262
needs: [scheduler, mpy-cross, tests]

ports/nrf/Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ UF2_FAMILY_ID_nrf52840 = 0xADA52840
206206
UF2_FAMILY_ID_nrf52833 = 0x621E937A
207207

208208

209-
all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2 $(BUILD)/firmware.combined.hex $(BUILD)/firmware.espruino.zip
209+
all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2 $(BUILD)/firmware.combined.hex
210210

211211
$(BUILD)/firmware.elf: $(OBJ) $(GENERATED_LD_FILE)
212212
$(STEPECHO) "LINK $@"
@@ -275,7 +275,8 @@ endif
275275
#####################
276276
.phony: dfu-gen dfu-flash
277277

278-
NRFUTIL = adafruit-nrfutil
278+
NRFUTIL = nrfutil
279+
ADAFRUIT_NRFUTIL = adafruit-nrfutil
279280

280281
ifeq ($(MCU_SUB_VARIANT),nrf52840)
281282
DFU_TOUCH = --touch 1200
@@ -293,17 +294,17 @@ __check_defined = \
293294
## Flash with DFU serial
294295
dfu-flash: $(BUILD)/dfu-package.zip
295296
@:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyUSB0)
296-
$(NRFUTIL) --verbose dfu serial --package $^ -p $(SERIAL) -b 115200 --singlebank $(DFU_TOUCH)
297+
$(ADAFRUIT_NRFUTIL) --verbose dfu serial --package $^ -p $(SERIAL) -b 115200 --singlebank $(DFU_TOUCH)
297298

298299
## Create DFU package file
299300
dfu-gen: $(BUILD)/dfu-package.zip
300301

301302
$(BUILD)/dfu-package.zip: $(BUILD)/firmware.hex
302-
$(NRFUTIL) dfu genpkg --sd-req 0xFFFE --dev-type 0x0052 --application $^ $(BUILD)/dfu-package.zip
303+
$(ADAFRUIT_NRFUTIL) dfu genpkg --sd-req 0xFFFE --dev-type 0x0052 --application $^ $(BUILD)/dfu-package.zip
303304

304305
# Espruino DFU
305306
$(BUILD)/firmware.espruino.zip: $(BUILD)/firmware.hex
306-
$(NRFUTIL) pkg generate $(BUILD)/firmware.espruino.zip --application $^ --application-version 0xff --hw-version 52 --sd-req 0xa9,0xae,0xb6 --key-file espruino_dfu_private_key.pem
307+
$(Q)$(NRFUTIL) pkg generate $(BUILD)/firmware.espruino.zip --application $^ --application-version 0xff --hw-version 52 --sd-req 0xa9,0xae,0xb6 --key-file espruino_dfu_private_key.pem
307308

308309
espruino-dfu-gen: $(BUILD)/firmware.espruino.zip
309310

tools/build_release_files.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,20 @@
6666
if clean_build:
6767
build_dir += "-{language}".format(language=language)
6868

69+
extensions = [
70+
extension.strip()
71+
for extension in board_settings["CIRCUITPY_BUILD_EXTENSIONS"].split(",")
72+
]
73+
74+
artifacts = [os.path.join(build_dir, "firmware." + extension) for extension in extensions]
6975
make_result = subprocess.run(
70-
"make -C ../ports/{port} TRANSLATION={language} BOARD={board} BUILD={build} -j {cores}".format(
76+
"make -C ../ports/{port} TRANSLATION={language} BOARD={board} BUILD={build} -j {cores} {artifacts}".format(
7177
port=board_info["port"],
7278
language=language,
7379
board=board,
7480
build=build_dir,
7581
cores=cores,
82+
artifacts=" ".join(artifacts),
7683
),
7784
shell=True,
7885
stdout=subprocess.PIPE,
@@ -86,10 +93,6 @@
8693
success = "\033[31mfailed\033[0m"
8794

8895
other_output = ""
89-
extensions = [
90-
extension.strip()
91-
for extension in board_settings["CIRCUITPY_BUILD_EXTENSIONS"].split(",")
92-
]
9396

9497
for extension in extensions:
9598
temp_filename = "../ports/{port}/{build}/firmware.{extension}".format(

tools/ci_set_matrix.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@
4242
all_ports_all_boards,
4343
)
4444

45-
PORT_TO_ARCH = {
45+
PORT_TO_BUILD_JOB = {
4646
"atmel-samd": "arm",
4747
"broadcom": "aarch",
4848
"cxd56": "arm",
4949
"espressif": "esp",
5050
"litex": "riscv",
5151
"mimxrt10xx": "arm",
52-
"nrf": "arm",
52+
"nrf": "nrf",
5353
"raspberrypi": "rpi",
5454
"stm": "arm",
5555
}
@@ -203,14 +203,14 @@ def get_settings(board):
203203
boards_to_build = all_board_ids
204204
break
205205

206-
# Split boards by architecture.
207-
arch_to_boards = {"aarch": [], "arm": [], "esp": [], "riscv": [], "rpi": []}
206+
# Split boards by build job.
207+
build_job_to_boards = {"aarch": [], "arm": [], "esp": [], "nrf": [], "riscv": [], "rpi": []}
208208

209209
# Append previously failed boards
210-
for arch in arch_to_boards:
211-
arch_to_job = f"build-{arch}"
212-
if arch_to_job in last_failed_jobs:
213-
for board in last_failed_jobs[arch_to_job]:
210+
for build_job in build_job_to_boards:
211+
job_name = f"build-{build_job}"
212+
if job_name in last_failed_jobs:
213+
for board in last_failed_jobs[job_name]:
214214
if not board in boards_to_build:
215215
boards_to_build.append(board)
216216

@@ -225,12 +225,12 @@ def get_settings(board):
225225
# if this happens it's not in `board_to_port`.
226226
if not port:
227227
continue
228-
arch_to_boards[PORT_TO_ARCH[port]].append(board)
228+
build_job_to_boards[PORT_TO_BUILD_JOB[port]].append(board)
229229
print(" ", board)
230230

231231
# Set the step outputs for each architecture
232-
for arch in arch_to_boards:
233-
set_output(f"boards-{arch}", json.dumps(arch_to_boards[arch]))
232+
for build_job in build_job_to_boards:
233+
set_output(f"boards-{build_job}", json.dumps(build_job_to_boards[arch]))
234234

235235

236236
def set_docs_to_build(build_doc: bool):

0 commit comments

Comments
 (0)