Merge pull request #11545 from cladmi/pr/kinetis/flash_no_arm_toolchain
cpu/kinetis: allow flashing without toolchain
This commit is contained in:
commit
245f04a33d
@ -22,9 +22,6 @@ export OPENOCD_PRE_VERIFY_CMDS += \
|
|||||||
-c 'load_image $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin 0x20000000 bin' \
|
-c 'load_image $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin 0x20000000 bin' \
|
||||||
-c 'resume 0x20000000'
|
-c 'resume 0x20000000'
|
||||||
export OPENOCD_EXTRA_INIT
|
export OPENOCD_EXTRA_INIT
|
||||||
|
|
||||||
FLASHDEPS += $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin
|
|
||||||
|
|
||||||
export OPENOCD_CONFIG ?= $(RIOTBOARD)/common/frdm/dist/old-openocd-$(CPU_FAMILY).cfg
|
export OPENOCD_CONFIG ?= $(RIOTBOARD)/common/frdm/dist/old-openocd-$(CPU_FAMILY).cfg
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@ -58,8 +58,6 @@ export OPENOCD_PRE_VERIFY_CMDS += \
|
|||||||
-c 'resume 0x20000000'
|
-c 'resume 0x20000000'
|
||||||
export PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/$(CPU)/dist/check-fcfield.sh
|
export PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/$(CPU)/dist/check-fcfield.sh
|
||||||
|
|
||||||
FLASHDEPS += $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin
|
|
||||||
|
|
||||||
# this board uses openocd
|
# this board uses openocd
|
||||||
include $(RIOTMAKE)/tools/openocd.inc.mk
|
include $(RIOTMAKE)/tools/openocd.inc.mk
|
||||||
|
|
||||||
|
|||||||
@ -10,8 +10,6 @@ export CPU_MODEL ?= mkw21d256vha5
|
|||||||
PORT_LINUX ?= /dev/ttyACM0
|
PORT_LINUX ?= /dev/ttyACM0
|
||||||
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
||||||
|
|
||||||
FLASHDEPS += $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin
|
|
||||||
|
|
||||||
# We need special handling of the watchdog if we want to speed up the flash
|
# 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.
|
# 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
|
# wdog-disable.bin is a precompiled binary which will disable the watchdog and
|
||||||
|
|||||||
@ -47,8 +47,4 @@ USEMODULE += periph_mcg
|
|||||||
endif
|
endif
|
||||||
USEMODULE += periph_wdog
|
USEMODULE += periph_wdog
|
||||||
|
|
||||||
# Define a recipe to build the watchdog disable binary, used when flashing
|
|
||||||
$(RIOTCPU)/$(CPU)/dist/wdog-disable.bin: $(RIOTCPU)/$(CPU)/dist/wdog-disable.s
|
|
||||||
$(Q)$(MAKE) -C $(RIOTCPU)/$(CPU)/dist/ $(notdir $@)
|
|
||||||
|
|
||||||
include $(RIOTMAKE)/arch/cortexm.inc.mk
|
include $(RIOTMAKE)/arch/cortexm.inc.mk
|
||||||
|
|||||||
7
cpu/kinetis/dist/README.md
vendored
7
cpu/kinetis/dist/README.md
vendored
@ -6,10 +6,15 @@ This directory contains tools for working with K60 CPUs.
|
|||||||
Watchdog disable
|
Watchdog disable
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
wdog-disable.bin is a location-independent watchdog disable function with a breakpoint instruction at the end. Useful for disabling the watchdog directly from OpenOCD.
|
wdog-disable.bin is a location-independent watchdog disable function with a
|
||||||
|
breakpoint instruction at the end. Useful for disabling the watchdog directly
|
||||||
|
from OpenOCD.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
openocd -c 'reset halt' \
|
openocd -c 'reset halt' \
|
||||||
-c 'load_image wdog-disable.bin 0x20000000 bin' \
|
-c 'load_image wdog-disable.bin 0x20000000 bin' \
|
||||||
-c 'resume 0x20000000' # watchdog is disabled and core halted
|
-c 'resume 0x20000000' # watchdog is disabled and core halted
|
||||||
|
|
||||||
|
The file is saved generated in the repository to remove the need to have a
|
||||||
|
compiler when flashing. It is only 34 bytes binary.
|
||||||
|
|||||||
8
cpu/kinetis/dist/check-fcfield.sh
vendored
8
cpu/kinetis/dist/check-fcfield.sh
vendored
@ -12,6 +12,8 @@
|
|||||||
# @author Joakim Nohlgård <joakim.nohlgard@eistec.se>
|
# @author Joakim Nohlgård <joakim.nohlgard@eistec.se>
|
||||||
# @author Francisco Molina <francisco.molina@inria.fr>
|
# @author Francisco Molina <francisco.molina@inria.fr>
|
||||||
|
|
||||||
|
: ${OBJDUMP:=arm-none-eabi-objdump}
|
||||||
|
|
||||||
# elf, hex or bin file to flash
|
# elf, hex or bin file to flash
|
||||||
FLASHFILE="$1"
|
FLASHFILE="$1"
|
||||||
|
|
||||||
@ -27,11 +29,11 @@ EXPECTED_FCFIELD="^fffffffffffffffffffffffffe..ffff$"
|
|||||||
get_fc_field()
|
get_fc_field()
|
||||||
{
|
{
|
||||||
if [ ${1##*.} = elf ]; then
|
if [ ${1##*.} = elf ]; then
|
||||||
arm-none-eabi-objdump -j.fcfield -s "${1}"
|
"${OBJDUMP}" -j.fcfield -s "${1}"
|
||||||
elif [ ${1##*.} = bin ]; then
|
elif [ ${1##*.} = bin ]; then
|
||||||
arm-none-eabi-objdump --start-address=${FCFIELD_START} --stop-address=${FCFIELD_END} -bbinary -marm ${1} -s
|
"${OBJDUMP}" --start-address=${FCFIELD_START} --stop-address=${FCFIELD_END} -bbinary -marm ${1} -s
|
||||||
elif [ ${1##*.} = hex ]; then
|
elif [ ${1##*.} = hex ]; then
|
||||||
arm-none-eabi-objdump --start-address=${FCFIELD_START} --stop-address=${FCFIELD_END} ${1} -s
|
"${OBJDUMP}" --start-address=${FCFIELD_START} --stop-address=${FCFIELD_END} ${1} -s
|
||||||
else
|
else
|
||||||
echo "Unkown file extension: ${1##*.}"
|
echo "Unkown file extension: ${1##*.}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
BIN
cpu/kinetis/dist/wdog-disable.bin
vendored
Normal file
BIN
cpu/kinetis/dist/wdog-disable.bin
vendored
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user