2
0
mirror of git://git.code.sf.net/p/openocd/code synced 2025-07-21 00:42:15 +10:00
openocd/contrib/loaders/watchdog/armv7m_kinetis_wdog.s
Antonio Borneo a126229dff contrib: replace the GPLv2-or-later license tag
Replace the GPLv2-or-later boilerplate with the SPDX tag.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: I380d552940f1c405309a3346454251c0e80b5a45
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7159
Tested-by: jenkins
2022-09-13 22:06:14 +00:00

52 lines
1.2 KiB
ArmAsm

/* SPDX-License-Identifier: GPL-2.0-or-later */
/***************************************************************************
* Copyright (C) 2015 Tomas Vanek *
* vanekt@fbl.cz *
***************************************************************************/
/*
Disable watchdog for Kinetis Kx and KVx
Parameters:
r0 ... WDOG base (in)
Used instruction set should work on both Cortex-M4 and M0+
*/
.text
.syntax unified
.cpu cortex-m0
.thumb
/* WDOG registers offsets */
WDOG_STCTRLH = 0
WDOG_UNLOCK = 0x0e
WDOG_KEY1 = 0xc520
WDOG_KEY2 = 0xd928
.thumb_func
start:
/* WDOG_UNLOCK = 0xC520 */
ldr r2, =WDOG_KEY1
strh r2, [r0, WDOG_UNLOCK]
/* WDOG_UNLOCK = 0xD928 */
ldr r2, =WDOG_KEY2
strh r2, [r0, WDOG_UNLOCK]
/* WDOG_STCTRLH clear bit 0 */
movs r4, #1
ldrh r2, [r0, WDOG_STCTRLH]
bics r2, r4
strh r2, [r0, WDOG_STCTRLH]
/* OpenOCD checks exit point address. Jump to the very end. */
b done
.pool
/* Avoid padding at .text segment end. Otherwise exit point check fails. */
.skip ( . - start + 2) & 2, 0
done:
bkpt #0
.end