contrib/loaders: Enforce Little Endian ARM machine code
[openocd.git] / contrib / loaders / flash / kinetis_ke / kinetis_ke_watchdog.s
blob289662d07561c691bd831c7cea239a975526e4a0
1 /***************************************************************************
2 * Copyright (C) 2015 by Ivan Meleca *
3 * ivan@artekit.eu *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 ***************************************************************************/
16 .text
17 .cpu cortex-m0plus
18 .code 16
19 .thumb_func
21 .align 2
23 ldr r3, wdog_cs1
24 mov r2, #127
25 ldrb r5, [r3]
26 ldrb r4, [r3, #1]
27 and r2, r5
28 ldr r5, unlock1
29 ldrh r0, [r3, #4]
30 ldrh r1, [r3, #6]
31 strh r5, [r3, #2]
32 ldr r5, unlock2
33 strh r5, [r3, #2]
34 strb r4, [r3, #1]
35 strh r0, [r3, #4]
36 strh r1, [r3, #6]
37 strb r2, [r3]
38 bkpt #0
40 .align 2
42 wdog_cs1:
43 .word 0x40052000 // Watchdog Control and Status Register 1
44 unlock1:
45 .word 0x20C5 // 1st unlock word
46 unlock2:
47 .word 0x28D9 // 2nd unlock word