Skip to content

Commit

Permalink
kinetis: save 'wdog-disable.bin' binary in the repository
Browse files Browse the repository at this point in the history
Keep the compiled '.bin' file to remove the need to compile it when
flashing. This remove the need to have the toolchain when flashing so
allow compiling and flashing with `BUILD_IN_DOCKER=1` without a local
toolchain.

Even if it ends up storing a binary, the file is only 34 bytes.
  • Loading branch information
cladmi committed May 20, 2019
1 parent 2199b06 commit 6068502
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 12 deletions.
3 changes: 0 additions & 3 deletions boards/common/frdm/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ export OPENOCD_PRE_VERIFY_CMDS += \
-c 'load_image $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin 0x20000000 bin' \
-c 'resume 0x20000000'
export OPENOCD_EXTRA_INIT

FLASHDEPS += $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin

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

Expand Down
2 changes: 0 additions & 2 deletions boards/mulle/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ export OPENOCD_PRE_VERIFY_CMDS += \
-c 'resume 0x20000000'
export PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/$(CPU)/dist/check-fcfield-elf.sh

FLASHDEPS += $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin

# this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk

Expand Down
2 changes: 0 additions & 2 deletions boards/pba-d-01-kw2x/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ export CPU_MODEL ?= mkw21d256vha5
PORT_LINUX ?= /dev/ttyACM0
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
# 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
Expand Down
4 changes: 0 additions & 4 deletions cpu/kinetis/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,4 @@ USEMODULE += periph_mcg
endif
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
7 changes: 6 additions & 1 deletion cpu/kinetis/dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ This directory contains tools for working with K60 CPUs.
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:

openocd -c 'reset halt' \
-c 'load_image wdog-disable.bin 0x20000000 bin' \
-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.
Binary file added cpu/kinetis/dist/wdog-disable.bin
Binary file not shown.

0 comments on commit 6068502

Please sign in to comment.