-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefiles.pre
47 lines (38 loc) · 1.58 KB
/
makefiles.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
# Set correct PORT and DEBUG_ADAPTER_ID for BOARDs present in LOCAL_BOARDS.
#
# Disabled if DISABLE_LOCAL_BOARDS is set or if running on ci (RYOT_CI is set)
ifeq (,$(DISABLE_LOCAL_BOARDS)$(RYOT_CI))
LOCAL_CONF_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
# Include all locally configured boards
include $(LOCAL_CONF_DIR)/local-boards.mk
# Overrite default board configurations
include $(LOCAL_CONF_DIR)/local-boards-configs.mk
# Filter out LOCAL_BOARDS that are not connected
LOCAL_CONNECTED_BOARDS = $(sort $(patsubst /dev/riot/tty-%,%,$(wildcard /dev/riot/tty-*)))
.PHONY: list-boards
list-boards: info-debug-variable-LOCAL_CONNECTED_BOARDS
# Common configuration
CFG_PORT_BASE ?= /dev/riot/tty-$(BOARD)
CFG_PROG_BASE ?= /dev/riot/$(PROGRAMMER)-$(BOARD)
ifneq (,$(wildcard $(CFG_PORT_BASE)_$(BOARD_INDEX)))
CFG_PORT ?= $(CFG_PORT_BASE)_$(BOARD_INDEX)
else
CFG_PORT ?= $(CFG_PORT_BASE)
endif
ifneq (,$(wildcard $(CFG_PROG_BASE)_$(BOARD_INDEX)))
CFG_PROG ?= $(CFG_PROG_BASE)_$(BOARD_INDEX)
else
CFG_PROG ?= $(CFG_PROG_BASE)
endif
# Use progammer serial if it exists
ifneq (,$(wildcard $(CFG_PROG)))
CFG_DEBUG_ADAPTER_ID ?= $(shell udevadm info -q property $(CFG_PROG) | sed -n '/ID_SERIAL_SHORT/ {s/ID_SERIAL_SHORT=//p}')
else
CFG_DEBUG_ADAPTER_ID ?= $(shell udevadm info -q property $(CFG_PORT) | sed -n '/ID_SERIAL_SHORT/ {s/ID_SERIAL_SHORT=//p}')
endif
# Board specific configuration
ifneq (,$(findstring $(BOARD),$(LOCAL_CONNECTED_BOARDS)))
PORT = $(CFG_PORT)
DEBUG_ADAPTER_ID = $(CFG_DEBUG_ADAPTER_ID)
endif
endif