mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
kinetis: Add watchdog disable code snippet
This commit is contained in:
parent
41aad42d8f
commit
a745de3ef5
@ -9,3 +9,10 @@ export UNDEF += $(BINDIR)kinetis_common/startup.o
|
||||
|
||||
# add the CPU specific fault handlers for the linker
|
||||
export UNDEF += $(BINDIR)kinetis_common/fault_handlers.o
|
||||
|
||||
# Define a recipe to build the watchdog disable binary, used when flashing
|
||||
$(RIOTCPU)/kinetis_common/dist/wdog-disable.bin: $(RIOTCPU)/kinetis_common/dist/wdog-disable.s
|
||||
$(AD)$(MAKE) -C $(RIOTCPU)/kinetis_common/dist/ $(notdir $@)
|
||||
|
||||
# Reset the default goal to not make wdog-disable.bin the default target.
|
||||
.DEFAULT_GOAL :=
|
||||
|
9
cpu/kinetis_common/dist/Makefile
vendored
Normal file
9
cpu/kinetis_common/dist/Makefile
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
wdog-disable.bin: wdog-disable.o
|
||||
arm-none-eabi-objcopy -O binary -j .text.wdog_disable -S -g $^ $@
|
||||
|
||||
wdog-disable.o: wdog-disable.s
|
||||
arm-none-eabi-as -mthumb -o $@ $^
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@rm wdog-disable.o
|
15
cpu/kinetis_common/dist/README.md
vendored
Normal file
15
cpu/kinetis_common/dist/README.md
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
K60 tools
|
||||
=========
|
||||
|
||||
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.
|
||||
|
||||
Usage:
|
||||
|
||||
openocd -c 'reset halt' \
|
||||
-c 'load_image wdog-disable.bin 0x20000000 bin' \
|
||||
-c 'resume 0x20000000' # watchdog is disabled and core halted
|
33
cpu/kinetis_common/dist/wdog-disable.s
vendored
Normal file
33
cpu/kinetis_common/dist/wdog-disable.s
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Eistec AB
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/* GCC ARM assembler */
|
||||
|
||||
.text
|
||||
.thumb
|
||||
.align 2
|
||||
|
||||
/* Public functions declared in this file */
|
||||
.global wdog_disable
|
||||
|
||||
.section .text.wdog_disable
|
||||
.thumb_func
|
||||
.func
|
||||
wdog_disable:
|
||||
movw r0, #0x200e
|
||||
movw r1, #0xc520
|
||||
movt r0, #0x4005
|
||||
strh r1, [r0, #0]
|
||||
movw r1, #0xd928
|
||||
strh r1, [r0, #0]
|
||||
movw r0, #0x2000
|
||||
movs r1, #0xd2
|
||||
movt r0, #0x4005
|
||||
strh r1, [r0, #0]
|
||||
bkpt #0
|
||||
.endfunc
|
Loading…
Reference in New Issue
Block a user