Skip to content

Commit

Permalink
Merge pull request #13567 from aabadie/pr/boards/jlink_export_cleanup
Browse files Browse the repository at this point in the history
boards: remove exports of jlink related variables
  • Loading branch information
fjmolinas authored Mar 10, 2020
2 parents 7943187 + ad5b9d7 commit db04522
Show file tree
Hide file tree
Showing 19 changed files with 52 additions and 28 deletions.
2 changes: 1 addition & 1 deletion boards/common/arduino-mkr/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include $(RIOTMAKE)/tools/serial.inc.mk
# setup the flash tool used
ifeq ($(PROGRAMMER),jlink)
# in case J-Link is attached to SWD pins, use a plain CPU memory model
export JLINK_DEVICE := $(MKR_JLINK_DEVICE)
JLINK_DEVICE = $(MKR_JLINK_DEVICE)
include $(RIOTMAKE)/tools/jlink.inc.mk
else
# by default, we use BOSSA to flash this board and take into account the
Expand Down
2 changes: 1 addition & 1 deletion boards/common/nrf51/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ ifeq ($(PROGRAMMER),openocd)
include $(RIOTMAKE)/tools/openocd.inc.mk
else ifeq ($(PROGRAMMER),jlink)
# setup JLink for flashing
export JLINK_DEVICE := nrf51822
JLINK_DEVICE = nrf51822
include $(RIOTMAKE)/tools/jlink.inc.mk
endif
6 changes: 3 additions & 3 deletions boards/common/nrf52/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ include $(RIOTBOARD)/$(BOARD)/Makefile.dep
PROGRAMMER ?= jlink
ifeq (jlink,$(PROGRAMMER))
# setup JLink for flashing
export JLINK_DEVICE := nrf52
JLINK_DEVICE = nrf52

# special options when using SoftDevice
ifneq (,$(filter nordic_softdevice_ble,$(USEPKG)))
export JLINK_PRE_FLASH := loadfile $(BINDIR)/softdevice.hex
export FLASH_ADDR := 0x1f000
JLINK_PRE_FLASH = loadfile $(BINDIR)/softdevice.hex
FLASH_ADDR = 0x1f000
LINKER_SCRIPT ?= $(RIOTCPU)/$(CPU)/ldscripts/$(CPU_MODEL)_sd.ld
# murdock: softdevice.hex file is used for flashing
# It must be taken into account for the test input hash and
Expand Down
2 changes: 1 addition & 1 deletion boards/common/silabs/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ INCLUDES += -I$(RIOTBOARD)/common/silabs/drivers/include

PROGRAMMER ?= jlink

export JLINK_DEVICE ?= ${CPU_MODEL}
JLINK_DEVICE ?= ${CPU_MODEL}
OPENOCD_CONFIG ?= board/efm32.cfg

ifeq ($(PROGRAMMER),jlink)
Expand Down
2 changes: 1 addition & 1 deletion boards/common/slwstk6000b/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include $(RIOTMAKE)/tools/serial.inc.mk

# setup JLink for flashing
include $(RIOTBOARD)/common/slwstk6000b/slwstk6000b.info.mk
export JLINK_DEVICE = $(word 2, $(SLWSTK6000B_MAINBOARD_VARS_$(BOARD_MODULE)))
JLINK_DEVICE = $(word 2, $(SLWSTK6000B_MAINBOARD_VARS_$(BOARD_MODULE)))

# include board common
include $(RIOTBOARD)/common/silabs/Makefile.include
2 changes: 1 addition & 1 deletion boards/feather-m0/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include $(RIOTMAKE)/tools/serial.inc.mk
# setup the flash tool used
ifeq ($(PROGRAMMER),jlink)
# in case J-Link is attached to SWD pins, use a plain CPU memory model
export JLINK_DEVICE := atsamd21
JLINK_DEVICE = atsamd21
include $(RIOTMAKE)/tools/jlink.inc.mk
else
# by default, we use BOSSA to flash this board to take into account the
Expand Down
2 changes: 1 addition & 1 deletion boards/hamilton/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# debugger config
export JLINK_DEVICE := atsamr21e18a
JLINK_DEVICE = atsamr21e18a
OBJDUMPFLAGS += --disassemble --source --disassembler-options=force-thumb
OFLAGS := --gap-fill 0xff

Expand Down
6 changes: 3 additions & 3 deletions boards/hifive1b/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ include $(RIOTMAKE)/tools/serial.inc.mk

# setup JLink for flashing
# export JLINK := JLink
export JLINK_DEVICE := FE310
export JLINK_IF := JTAG
export FLASH_ADDR := 0x20010000
JLINK_DEVICE = FE310
JLINK_IF = JTAG
FLASH_ADDR = 0x20010000
include $(RIOTMAKE)/tools/jlink.inc.mk

TESTRUNNER_RESET_DELAY = 1
Expand Down
2 changes: 1 addition & 1 deletion boards/ikea-tradfri/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PORT_LINUX ?= /dev/ttyACM0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))

# setup JLink for flashing
export JLINK_DEVICE := EFR32MG1PxxxF256
JLINK_DEVICE = EFR32MG1PxxxF256
include $(RIOTMAKE)/tools/jlink.inc.mk

# setup serial terminal
Expand Down
8 changes: 4 additions & 4 deletions boards/openmote-b/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ ifeq ($(PROGRAMMER),cc2538-bsl)
include $(RIOTMAKE)/tools/cc2538-bsl.inc.mk
else ifeq ($(PROGRAMMER),jlink)
# Special flashing and reset scripts are required due to board hardware
export FLASH_ADDR = 0x200000
export JLINK_DEVICE = CC2538SF53
export JLINK_IF = JTAG
export JLINK_RESET_FILE = $(RIOTBOARD)/openmote-b/dist/hw_reset.seg
FLASH_ADDR = 0x200000
JLINK_DEVICE = CC2538SF53
JLINK_IF = JTAG
JLINK_RESET_FILE = $(RIOTBOARD)/openmote-b/dist/hw_reset.seg
include $(RIOTMAKE)/tools/jlink.inc.mk
endif

Expand Down
6 changes: 3 additions & 3 deletions boards/openmote-cc2538/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ PROGRAMMER ?= cc2538-bsl

ifeq ($(PROGRAMMER),jlink)
# setup JLink for flashing
export JLINK_DEVICE := cc2538sf53
export FLASH_ADDR := 0x200000
export JLINK_IF := JTAG
JLINK_DEVICE = cc2538sf53
FLASH_ADDR = 0x200000
JLINK_IF = JTAG
export TUI := 1
include $(RIOTMAKE)/tools/jlink.inc.mk
else ifeq ($(PROGRAMMER),cc2538-bsl)
Expand Down
4 changes: 2 additions & 2 deletions boards/pic32-wifire/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ifeq ($(PROGRAMMER),pic32prog)
include $(RIOTMAKE)/tools/pic32prog.inc.mk
else ifeq ($(PROGRAMMER),jlink)
FLASHFILE ?= $(HEXFILE)
export JLINK_DEVICE := PIC32MZ2048EFG100
export JLINK_IF := JTAG
JLINK_DEVICE = PIC32MZ2048EFG100
JLINK_IF = JTAG
include $(RIOTMAKE)/tools/jlink.inc.mk
endif
2 changes: 1 addition & 1 deletion boards/sensebox_samd21/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include $(RIOTMAKE)/tools/serial.inc.mk
# setup the flash tool used
ifeq ($(PROGRAMMER),jlink)
# in case J-Link is attached to SWD pins, use a plain CPU memory model
export JLINK_DEVICE := atsamd21
JLINK_DEVICE = atsamd21
include $(RIOTMAKE)/tools/jlink.inc.mk
else
# by default, we use BOSSA to flash this board to take into account the
Expand Down
2 changes: 1 addition & 1 deletion boards/slstk3401a/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
include $(RIOTMAKE)/tools/serial.inc.mk

# setup JLink for flashing
export JLINK_PRE_FLASH = r
JLINK_PRE_FLASH = r

# include board common
include $(RIOTBOARD)/common/silabs/Makefile.include
2 changes: 1 addition & 1 deletion boards/slstk3402a/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
include $(RIOTMAKE)/tools/serial.inc.mk

# setup JLink for flashing
export JLINK_PRE_FLASH = r
JLINK_PRE_FLASH = r

# include board common
include $(RIOTBOARD)/common/silabs/Makefile.include
4 changes: 2 additions & 2 deletions boards/sltb001a/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
include $(RIOTMAKE)/tools/serial.inc.mk

# setup JLink for flashing
export JLINK_DEVICE := EFR32MG1PxxxF256
export JLINK_PRE_FLASH = r
JLINK_DEVICE = EFR32MG1PxxxF256
JLINK_PRE_FLASH = r

# include board common
include $(RIOTBOARD)/common/silabs/Makefile.include
2 changes: 1 addition & 1 deletion boards/slwstk6220a/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PORT_LINUX ?= /dev/ttyACM0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))

# setup JLink for flashing
export JLINK_DEVICE := ezr32wg330f256
JLINK_DEVICE = ezr32wg330f256
include $(RIOTMAKE)/tools/jlink.inc.mk

# setup serial terminal
Expand Down
2 changes: 2 additions & 0 deletions dist/tools/buildsystem_sanity_check/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ UNEXPORTED_VARIABLES+=('OPENOCD_CONFIG')
UNEXPORTED_VARIABLES+=('OPENOCD_RESET_USE_CONNECT_ASSERT_SRST')
UNEXPORTED_VARIABLES+=('FLASH_TARGET_TYPE')
UNEXPORTED_VARIABLES+=('PYOCD_ADAPTER_INIT')
UNEXPORTED_VARIABLES+=('JLINK_DEVICE' 'JLINK_IF')
UNEXPORTED_VARIABLES+=('JLINK_PRE_FLASH' 'JLINK_RESET_FILE')

EXPORTED_VARIABLES_ONLY_IN_VARS=()
EXPORTED_VARIABLES_ONLY_IN_VARS+=('APPDEPS')
Expand Down
22 changes: 22 additions & 0 deletions makefiles/tools/jlink.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,28 @@ RESET_FLAGS ?= reset

JLINK_SERIAL ?= $(DEBUG_ADAPTER_ID)

JLINK_IF ?=
JLINK_RESET_FILE ?=
JLINK_PRE_FLASH ?=

# Export JLINK_SERIAL to required targets
JLINK_TARGETS = debug% flash% reset term-rtt
$(call target-export-variables,$(JLINK_TARGETS),JLINK_SERIAL)

# Export JLINK_DEVICE to required targets
$(call target-export-variables,$(JLINK_TARGETS),JLINK_DEVICE)

ifneq (,$(JLINK_IF))
# Export JLINK_IF to required targets if not empty
$(call target-export-variables,$(JLINK_TARGETS),JLINK_IF)
endif

ifneq (,$(JLINK_RESET_FILE))
# Export JLINK_RESET_FILE to required targets if not empty
$(call target-export-variables,$(JLINK_TARGETS),JLINK_RESET_FILE)
endif

# Export JLINK_PRE_FLASH to flash targets only if not empty
ifneq (,$(JLINK_PRE_FLASH))
$(call target-export-variables,flash%,JLINK_PRE_FLASH)
endif

0 comments on commit db04522

Please sign in to comment.