mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
boards/frdm-common: Introduce frdm-common for shared files for all FRDM boards
This commit is contained in:
parent
b098ef7baa
commit
156c7ec58c
46
boards/frdm-common/Makefile.include
Normal file
46
boards/frdm-common/Makefile.include
Normal file
@ -0,0 +1,46 @@
|
||||
# set default port depending on operating system
|
||||
PORT_LINUX ?= /dev/ttyACM0
|
||||
|
||||
export FFLAGS = flash-elf
|
||||
|
||||
# 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
|
||||
|
||||
# OpenOCD v0.10.0 and newer have built-in support for disabling the Kinetis
|
||||
# watchdog automatically. However, current stable releases of Ubuntu and Debian
|
||||
# have only version 0.9.0 and older OpenOCD packages (Ubuntu 17.04, Debian Jessie)
|
||||
# Set this to 0 to avoid the extra manual step of disabling the watchdog.
|
||||
export USE_OLD_OPENOCD ?= 1
|
||||
|
||||
ifeq (1,$(USE_OLD_OPENOCD))
|
||||
# We need special handling of the watchdog if we want to speed up the flash
|
||||
# verification by using the MCU to compute the image checksum after flashing.
|
||||
# wdog-disable.bin is a precompiled binary which will disable the watchdog and
|
||||
# return control to the debugger (OpenOCD)
|
||||
export OPENOCD_PRE_VERIFY_CMDS += \
|
||||
-c 'load_image $(RIOTCPU)/kinetis_common/dist/wdog-disable.bin 0x20000000 bin' \
|
||||
-c 'resume 0x20000000'
|
||||
export OPENOCD_EXTRA_INIT
|
||||
|
||||
.PHONY: flash
|
||||
flash: $(RIOTCPU)/kinetis_common/dist/wdog-disable.bin
|
||||
|
||||
# Reset the default goal.
|
||||
.DEFAULT_GOAL :=
|
||||
|
||||
export OPENOCD_CONFIG ?= $(RIOTBOARD)/frdm-common/dist/old-openocd-$(FRDM_IFACE)-$(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
|
||||
|
||||
# Check the flash configuration field before flashing
|
||||
export PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/kinetis_common/dist/check-fcfield-elf.sh
|
||||
|
||||
# setup serial terminal
|
||||
include $(RIOTMAKE)/tools/serial.inc.mk
|
||||
|
||||
# this board uses openocd
|
||||
include $(RIOTMAKE)/tools/openocd.inc.mk
|
48
boards/frdm-common/dist/old-openocd-dap-kx.cfg
vendored
Normal file
48
boards/frdm-common/dist/old-openocd-dap-kx.cfg
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
#
|
||||
# Freescale Kinetis Kxx devices on a CMSIS-DAP adapter
|
||||
#
|
||||
source [find interface/cmsis-dap.cfg]
|
||||
|
||||
source [find target/swj-dp.tcl]
|
||||
|
||||
if { [info exists CHIPNAME] } {
|
||||
set _CHIPNAME $CHIPNAME
|
||||
} else {
|
||||
set _CHIPNAME kx
|
||||
}
|
||||
|
||||
if { [info exists CPUTAPID] } {
|
||||
set _CPUTAPID $CPUTAPID
|
||||
} else {
|
||||
set _CPUTAPID 0x2ba01477
|
||||
}
|
||||
|
||||
set _TARGETNAME $_CHIPNAME.cpu
|
||||
|
||||
swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID
|
||||
|
||||
target create $_TARGETNAME cortex_m -chain-position $_CHIPNAME.cpu
|
||||
|
||||
$_CHIPNAME.cpu configure -event examine-start { puts "START..." ; }
|
||||
|
||||
# It is important that "kinetis mdm check_security" is called for
|
||||
# 'examine-end' event and not 'eximine-start'. Calling it in 'examine-start'
|
||||
# causes "kinetis mdm check_security" to fail the first time openocd
|
||||
# calls it when it tries to connect after the CPU has been power-cycled.
|
||||
$_CHIPNAME.cpu configure -event examine-end {
|
||||
kinetis mdm check_security
|
||||
}
|
||||
|
||||
$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 0x1000 -work-area-backup 0
|
||||
|
||||
flash bank $_CHIPNAME.flash kinetis 0 0 0 0 $_TARGETNAME
|
||||
|
||||
cortex_m reset_config sysresetreq
|
||||
#reset_config srst_only srst_nogate connect_assert_srst
|
||||
|
||||
adapter_khz 1000
|
||||
|
||||
$_TARGETNAME configure -event gdb-attach {
|
||||
halt
|
||||
}
|
||||
$_TARGETNAME configure -rtos auto
|
48
boards/frdm-common/dist/old-openocd-jlink-kx.cfg
vendored
Normal file
48
boards/frdm-common/dist/old-openocd-jlink-kx.cfg
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
#
|
||||
# Freescale Kinetis Kxx devices on a Segger J-Link adapter
|
||||
#
|
||||
source [find interface/jlink.cfg]
|
||||
|
||||
source [find target/swj-dp.tcl]
|
||||
|
||||
if { [info exists CHIPNAME] } {
|
||||
set _CHIPNAME $CHIPNAME
|
||||
} else {
|
||||
set _CHIPNAME kx
|
||||
}
|
||||
|
||||
if { [info exists CPUTAPID] } {
|
||||
set _CPUTAPID $CPUTAPID
|
||||
} else {
|
||||
set _CPUTAPID 0x2ba01477
|
||||
}
|
||||
|
||||
set _TARGETNAME $_CHIPNAME.cpu
|
||||
|
||||
swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID
|
||||
|
||||
target create $_TARGETNAME cortex_m -chain-position $_CHIPNAME.cpu
|
||||
|
||||
$_CHIPNAME.cpu configure -event examine-start { puts "START..." ; }
|
||||
|
||||
# It is important that "kinetis mdm check_security" is called for
|
||||
# 'examine-end' event and not 'eximine-start'. Calling it in 'examine-start'
|
||||
# causes "kinetis mdm check_security" to fail the first time openocd
|
||||
# calls it when it tries to connect after the CPU has been power-cycled.
|
||||
$_CHIPNAME.cpu configure -event examine-end {
|
||||
kinetis mdm check_security
|
||||
}
|
||||
|
||||
$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 0x1000 -work-area-backup 0
|
||||
|
||||
flash bank $_CHIPNAME.flash kinetis 0 0 0 0 $_TARGETNAME
|
||||
|
||||
cortex_m reset_config sysresetreq
|
||||
#reset_config srst_only srst_nogate connect_assert_srst
|
||||
|
||||
adapter_khz 1000
|
||||
|
||||
$_TARGETNAME configure -event gdb-attach {
|
||||
halt
|
||||
}
|
||||
$_TARGETNAME configure -rtos auto
|
22
boards/frdm-common/dist/openocd-dap-kx.cfg
vendored
Normal file
22
boards/frdm-common/dist/openocd-dap-kx.cfg
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
#
|
||||
# NXP Kinetis Freedom developer board
|
||||
#
|
||||
# OpenSDA is the on-board debugger, some boards have a CMSIS-DAP compatible
|
||||
# interface, other boards comes pre-flashed with a Segger J-Link compatible
|
||||
# firmware. The OpenSDA controller can be re-flashed to provide either of the two.
|
||||
# Both interfaces work with OpenOCD, but we need to tell which one we have on
|
||||
# our debugger.
|
||||
|
||||
# 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]
|
||||
|
||||
reset_config srst_only
|
||||
|
||||
$_TARGETNAME configure -event gdb-attach {
|
||||
halt
|
||||
}
|
||||
$_TARGETNAME configure -rtos auto
|
22
boards/frdm-common/dist/openocd-jlink-kx.cfg
vendored
Normal file
22
boards/frdm-common/dist/openocd-jlink-kx.cfg
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
#
|
||||
# NXP Kinetis Freedom developer board
|
||||
#
|
||||
# OpenSDA is the on-board debugger, some boards have a CMSIS-DAP compatible
|
||||
# interface, other boards comes pre-flashed with a Segger J-Link compatible
|
||||
# firmware. The OpenSDA controller can be re-flashed to provide either of the two.
|
||||
# Both interfaces work with OpenOCD, but we need to tell which one we have on
|
||||
# our debugger.
|
||||
|
||||
# J-Link compatible firmware binaries for OpenSDA can be found at:
|
||||
# https://www.segger.com/downloads/jlink#JLinkOpenSDABoardSpecificFirmwares
|
||||
source [find interface/jlink.cfg]
|
||||
|
||||
# Kinetis K series CPUs
|
||||
source [find target/kx.cfg]
|
||||
|
||||
reset_config srst_only
|
||||
|
||||
$_TARGETNAME configure -event gdb-attach {
|
||||
halt
|
||||
}
|
||||
$_TARGETNAME configure -rtos auto
|
@ -2,30 +2,5 @@
|
||||
export CPU = k64f
|
||||
export CPU_MODEL = mk64fn1m0vll12
|
||||
|
||||
# set default port depending on operating system
|
||||
PORT_LINUX ?= /dev/ttyACM0
|
||||
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
||||
|
||||
.PHONY: flash
|
||||
flash: $(RIOTCPU)/kinetis_common/dist/wdog-disable.bin
|
||||
|
||||
# Reset the default goal.
|
||||
.DEFAULT_GOAL :=
|
||||
|
||||
export FFLAGS = flash-elf
|
||||
export TUI = 1
|
||||
# We need special handling of the watchdog if we want to speed up the flash
|
||||
# verification by using the MCU to compute the image checksum after flashing.
|
||||
# wdog-disable.bin is a precompiled binary which will disable the watchdog and
|
||||
# return control to the debugger (OpenOCD)
|
||||
export OPENOCD_PRE_VERIFY_CMDS += \
|
||||
-c 'load_image $(RIOTCPU)/kinetis_common/dist/wdog-disable.bin 0x20000000 bin' \
|
||||
-c 'resume 0x20000000'
|
||||
export OPENOCD_EXTRA_INIT
|
||||
export PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/kinetis_common/dist/check-fcfield-elf.sh
|
||||
|
||||
# setup serial terminal
|
||||
include $(RIOTMAKE)/tools/serial.inc.mk
|
||||
|
||||
# this board uses openocd
|
||||
include $(RIOTMAKE)/tools/openocd.inc.mk
|
||||
# Include default FRDM board config
|
||||
include $(RIOTBOARD)/frdm-common/Makefile.include
|
||||
|
@ -1,5 +1,6 @@
|
||||
# define the CPU architecture for the k64f
|
||||
export CPU_ARCH = cortex-m4
|
||||
export CPU_FAMILY = kx
|
||||
|
||||
# map CPU models to generic Kinetis linkerscript
|
||||
LD_MK64FN1M0VLL12 = kinetis_f1024l64u192.ld
|
||||
|
Loading…
Reference in New Issue
Block a user