Skip to content

Commit

Permalink
Merge pull request #7686 from gebart/pr/board-debugger-separation
Browse files Browse the repository at this point in the history
boards: board<->debugger separation
  • Loading branch information
kYc0o committed Nov 17, 2017
2 parents 416ef12 + f4e9cad commit 3ec7ca4
Show file tree
Hide file tree
Showing 91 changed files with 307 additions and 424 deletions.
3 changes: 3 additions & 0 deletions boards/airfy-beacon/Makefile.include
Expand Up @@ -9,5 +9,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
# setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk

export DEBUG_ADAPTER ?= stlink
export STLINK_VERSION ?= 2

# this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk
3 changes: 0 additions & 3 deletions boards/airfy-beacon/dist/openocd.cfg
@@ -1,6 +1,3 @@
source [find interface/stlink-v2.cfg]
transport select hla_swd

set WORKAREASIZE 0x4000
source [find target/nrf51.cfg]
$_TARGETNAME configure -rtos auto
6 changes: 0 additions & 6 deletions boards/arduino-zero/dist/openocd.cfg
@@ -1,7 +1 @@
source [find interface/cmsis-dap.cfg]

set CHIPNAME at91samd21g18
set ENDIAN little
set telnet_port 0

source [find target/at91samdXX.cfg]
3 changes: 3 additions & 0 deletions boards/b-l072z-lrwan1/Makefile.include
Expand Up @@ -9,5 +9,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
# setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk

export DEBUG_ADAPTER ?= stlink
export STLINK_VERSION ?= 2-1

# this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk
4 changes: 0 additions & 4 deletions boards/b-l072z-lrwan1/dist/openocd.cfg
@@ -1,7 +1,3 @@
source [find interface/stlink-v2-1.cfg]

transport select hla_swd

source [find target/stm32l0.cfg]

reset_config srst_only
3 changes: 3 additions & 0 deletions boards/bluepill/Makefile.include
Expand Up @@ -26,5 +26,8 @@ ifeq ($(PROGRAMMER),dfu-util)
export FFLAGS = -d 1d50:6017 -s 0x08002000:leave -D "$(HEXFILE)"
else
# this board uses openocd by default
export DEBUG_ADAPTER ?= stlink
export STLINK_VERSION ?= 2

include $(RIOTMAKE)/tools/openocd.inc.mk
endif
3 changes: 0 additions & 3 deletions boards/bluepill/dist/openocd.cfg
@@ -1,6 +1,3 @@
source [find interface/stlink-v2.cfg]
transport select hla_swd

source [find target/stm32f1x.cfg]
reset_config none separate

Expand Down
8 changes: 4 additions & 4 deletions boards/frdm-common/Makefile.include
Expand Up @@ -4,8 +4,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))

# Use the shared OpenOCD configuration
# Using dap or jlink depends on which firmware the OpenSDA debugger is running
export FRDM_IFACE ?= dap
#export FRDM_IFACE ?= jlink
export DEBUG_ADAPTER ?= dap
#export DEBUG_ADAPTER ?= jlink

# OpenOCD v0.10.0 and newer have built-in support for disabling the Kinetis
# watchdog automatically. However, current stable releases of Ubuntu and Debian
Expand All @@ -29,11 +29,11 @@ flash: $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin
# Reset the default goal.
.DEFAULT_GOAL :=

export OPENOCD_CONFIG ?= $(RIOTBOARD)/frdm-common/dist/old-openocd-$(FRDM_IFACE)-$(CPU_FAMILY).cfg
export OPENOCD_CONFIG ?= $(RIOTBOARD)/frdm-common/dist/old-openocd-$(CPU_FAMILY).cfg
endif

# Configuration for OpenOCD v0.10.0 and newer
export OPENOCD_CONFIG ?= $(RIOTBOARD)/frdm-common/dist/openocd-$(FRDM_IFACE)-$(CPU_FAMILY).cfg
export OPENOCD_CONFIG ?= $(RIOTBOARD)/frdm-common/dist/openocd-$(CPU_FAMILY).cfg

# Check the flash configuration field before flashing
export PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/$(CPU)/dist/check-fcfield-elf.sh
Expand Down
48 changes: 0 additions & 48 deletions boards/frdm-common/dist/old-openocd-jlink-kx.cfg

This file was deleted.

@@ -1,8 +1,6 @@
#
# Freescale Kinetis Kxx devices on a CMSIS-DAP adapter
# Freescale Kinetis Kxx devices when using old OpenOCD versions (<0.10.0)
#
source [find interface/cmsis-dap.cfg]

source [find target/swj-dp.tcl]

if { [info exists CHIPNAME] } {
Expand Down
22 changes: 0 additions & 22 deletions boards/frdm-common/dist/openocd-jlink-kx.cfg

This file was deleted.

Expand Up @@ -9,7 +9,6 @@

# CMSIS-DAP (DAPLink) compatible OpenSDA firmware binary images can be found at:
# http://www.nxp.com/opensda
source [find interface/cmsis-dap.cfg]

# Kinetis K series CPUs
source [find target/kx.cfg]
Expand Down
3 changes: 3 additions & 0 deletions boards/limifrog-v1/Makefile.include
Expand Up @@ -9,5 +9,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
# setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk

export DEBUG_ADAPTER ?= stlink
export STLINK_VERSION ?= 2

# this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk
3 changes: 0 additions & 3 deletions boards/limifrog-v1/dist/openocd.cfg
@@ -1,6 +1,3 @@
source [find interface/stlink-v2.cfg]
transport select hla_swd

set WORKAREASIZE 0x2800
source [find target/stm32l1.cfg]
$_TARGETNAME configure -rtos auto
3 changes: 3 additions & 0 deletions boards/maple-mini/Makefile.include
Expand Up @@ -9,5 +9,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
# setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk

export DEBUG_ADAPTER ?= stlink
export STLINK_VERSION ?= 2-1

# this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk
4 changes: 0 additions & 4 deletions boards/maple-mini/dist/openocd.cfg
@@ -1,7 +1,3 @@
source [find interface/stlink-v2-1.cfg]

transport select hla_swd

source [find target/stm32f1x.cfg]

reset_config srst_only
3 changes: 3 additions & 0 deletions boards/msbiot/Makefile.include
Expand Up @@ -9,5 +9,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
# setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk

export DEBUG_ADAPTER ?= stlink
export STLINK_VERSION ?= 2

# this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk
7 changes: 6 additions & 1 deletion boards/msbiot/dist/openocd.cfg
@@ -1,2 +1,7 @@
source [find board/stm32f4discovery.cfg]
# increase working area to 64KB
set WORKAREASIZE 0x10000

source [find target/stm32f4x.cfg]

reset_config srst_only
$_TARGETNAME configure -rtos auto
49 changes: 9 additions & 40 deletions boards/mulle/Makefile.include
@@ -1,9 +1,6 @@
# define the cpu used by the Mulle board
export CPU = kinetis

# Default GDB port
export GDBPORT ?= 3333

# MULLE_SERIAL is used to select which specific Mulle board we are compiling for.
ifdef MULLE_SERIAL
CFLAGS += -DMULLE_SERIAL=$(MULLE_SERIAL)
Expand All @@ -22,53 +19,26 @@ endif

export CPU_MODEL

# OpenOCD settings for Mulle board.
# Try to determine which version of the OpenOCD config file we should use.
# Specify PROGRAMMER_VERSION or PROGRAMMER_SERIAL to choose a specific programmer board.
ifeq ($(PROGRAMMER_VERSION),)
ifneq ($(PROGRAMMER_SERIAL),)
# Makefile-way of comparing numbers, using lexicographical sorting since we don't have any arithmetic comparisons.
# Programmers with serial 100 -- 148 are version 0.60
# Programmers with serial 301 -- 330 are version 0.70
ifeq "100" "$(word 1, $(sort 100 $(PROGRAMMER_SERIAL)))"
# >= 100
ifneq "149" "$(word 1, $(sort 149 $(PROGRAMMER_SERIAL)))"
# < 149
PROGRAMMER_VERSION = 0.60
else
# >= 149
PROGRAMMER_VERSION = 0.70
endif
endif
endif
# Default to version 0.70 programmer
PROGRAMMER_VERSION ?= 0.70
endif

export OPENOCD_CONFIG = $(RIOTBOARD)/$(BOARD)/dist/openocd/mulle-programmer-$(PROGRAMMER_VERSION).conf

# Add serial matching command
ifneq ($(PROGRAMMER_SERIAL),)
OPENOCD_EXTRA_INIT += -c 'ftdi_serial $(PROGRAMMER_SERIAL)'
endif

OPENOCD_EXTRA_INIT += $(CPU_OOCD_FLAGS)

# Default debug adapter choice is to use the Mulle programmer board
export DEBUG_ADAPTER ?= mulle
# Host OS name
OS := $(shell uname)

# Fall back to PROGRAMMER_SERIAL for backwards compatibility
export DEBUG_ADAPTER_ID ?= $(PROGRAMMER_SERIAL)

ifeq ($(PORT),)
# try to find tty name by serial number, only works on Linux currently.
ifeq ($(OS),Linux)
ifneq ($(PROGRAMMER_SERIAL),)
PORT := $(firstword $(shell $(RIOTBASE)/dist/tools/usb-serial/find-tty.sh '^$(PROGRAMMER_SERIAL)$$'))
ifneq ($(DEBUG_ADAPTER_ID),)
PORT := $(firstword $(shell $(RIOTBASE)/dist/tools/usb-serial/find-tty.sh '^$(DEBUG_ADAPTER_ID)$$'))
else
# find-tty.sh will return the first USB tty if no serial is given.
PORT := $(firstword $(shell $(RIOTBASE)/dist/tools/usb-serial/find-tty.sh))
endif
else ifeq ($(OS),Darwin)
ifneq ($(PROGRAMMER_SERIAL),)
PORT := /dev/tty.usbserial-$(PROGRAMMER_SERIAL)B
ifneq ($(DEBUG_ADAPTER_ID),)
PORT := /dev/tty.usbserial-$(DEBUG_ADAPTER_ID)B
else
PORT := $(firstword $(sort $(wildcard /dev/tty.usbserial*)))
endif
Expand All @@ -86,7 +56,6 @@ endif
export OPENOCD_PRE_VERIFY_CMDS += \
-c 'load_image $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin 0x20000000 bin' \
-c 'resume 0x20000000'
export OPENOCD_EXTRA_INIT
export PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/$(CPU)/dist/check-fcfield-elf.sh

.PHONY: flash
Expand Down
12 changes: 12 additions & 0 deletions boards/mulle/dist/openocd.cfg
@@ -0,0 +1,12 @@
# Copyright 2017 Eistec AB
#
# OpenOCD configuration for Eistec Mulle board with Kinetis K MCU
#

source [find target/kx.cfg]

# The nTRST functionality can only be used if the MCU has been configured by
# setting the correct pin multiplexing function on the TRST pin (PTA5 on Kinetis K60).
# If you have configured the TRST pin correctly you can change srst_only to
# trst_and_srst
reset_config srst_only
28 changes: 28 additions & 0 deletions boards/mulle/dist/openocd/mulle-programmer-0.60.cfg
@@ -0,0 +1,28 @@
#
# Mulle programmer board v0.60
#
# The Mulle programming board uses a FTDI FT2232H chip for USB UART and JTAG
# combined functionality.
#

# Reduce this if you are having problems with losing connection to the Mulle
adapter_khz 1000

# JTAG interface configuration

interface ftdi
ftdi_device_desc "Mulle Programmer v0.60"
ftdi_vid_pid 0x0403 0x6010

ftdi_channel 1
ftdi_layout_init 0x0008 0x005b

# These are the pins that are used for SRST and TRST. Note that the Mulle
# programming board inverts the reset signal between the FTDI chip and the MCU,
# so we need to use -ndata here to tell OpenOCD that the signals are active HIGH.
ftdi_layout_signal nTRST -ndata 0x0010
ftdi_layout_signal nSRST -ndata 0x0040

# In the eyes of OpenOCD, the reset signal is push-pull, because of the hardware
# design however, it is actually open drain.
reset_config srst_push_pull

0 comments on commit 3ec7ca4

Please sign in to comment.