-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci-boards.mk.pre
60 lines (49 loc) · 2.1 KB
/
ci-boards.mk.pre
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Use the 'ryot-ci' boards for flashing and testing
#
# e.g.: RYOT_CI=1 BOARD=nucleo-l152re make -C tests/xtimer_drift/ flash term
# ===============================================
ifneq (,$(RYOT_CI))
RYOT_CI_ENV_VARS += \
BOARD_INDEX \
RIOT_TERMINAL \
PROGRAMMER \
PROGRAMMER_QUIET \
#
RYOT_CI_CMDLINE_ENV_VARS := $(strip $(foreach varname,$(RYOT_CI_ENV_VARS), \
$(if $(filter file environment command,$(origin $(varname))), \
$(varname)=$($(varname)),)))
RYOT_CI_SERVER ?= [email protected]
RYOT_CI_DIR ?= /builds/boards
RYOT_CI_MAKE ?= $(RYOT_CI_CMDLINE_ENV_VARS) BOARD=$(BOARD) QUIET=1 make --no-print-directory -C $(RYOT_CI_DIR)
# Remote flashfile respects the extension (required for openocd)
RYOT_CI_FLASHFILE ?= $(RYOT_CI_DIR)/bin/$(BOARD)_flashfile$(suffix $(FLASHFILE))
.PHONY: list-ci-boards list-ci-boards-json
list-ci-boards:
@ssh $(RYOT_CI_SERVER) '$(RYOT_CI_MAKE) list-boards'
list-ci-boards-json:
@ssh $(RYOT_CI_SERVER) '$(RYOT_CI_MAKE) list-boards-json'
# Flash must do the copy and flash
# * 'IMAGE_OFFSET' must be sent to to handle 'riotboot/flash-slotX'
# * 'FLASHFILE' is set from the command line to force the value
# Set FLASHER to 'ssh' to not trigger compiling 'edbg'
override FLASHER = ssh
override FFLAGS = $(RYOT_CI_SERVER) 'IMAGE_OFFSET=$(IMAGE_OFFSET) $(RYOT_CI_MAKE) flash-only FLASHFILE=$(RYOT_CI_FLASHFILE)'
# Use rsync to honor remote permissions
SSH_UPLOAD = rsync --chmod=ugo=rwX
define ci-flash-recipe
$(SSH_UPLOAD) $(FLASHFILE) $(RYOT_CI_SERVER):$(RYOT_CI_FLASHFILE)
$(FLASHER) $(FFLAGS)
endef
# edbg redefines flash-recipe, override to handle that case
override flash-recipe = $(ci-flash-recipe)
PREFLASHER = ssh
PREFFLAGS = $(RYOT_CI_SERVER) '$(RYOT_CI_MAKE) preflash'
RESET = ssh
RESET_FLAGS = $(RYOT_CI_SERVER) '$(RYOT_CI_MAKE) reset'
override TERMPROG = ssh
ifneq (,$(filter term, $(MAKECMDGOALS)))
override TERMFLAGS = -t $(RYOT_CI_SERVER) '$(RYOT_CI_MAKE) term'
else
override TERMFLAGS = -t $(RYOT_CI_SERVER) '$(RYOT_CI_MAKE) cleanterm'
endif
endif