flash/rsl10: fix typo
[openocd.git] / contrib / loaders / flash / kinetis / kinetis_flash.s
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 /***************************************************************************
4 * Copyright (C) 2015 by Ivan Meleca *
5 * ivan@artekit.eu *
6 * *
7 * Copyright (C) 2016 by Tomas Vanek *
8 * vanekt@fbl.cz *
9 ***************************************************************************/
10
11 /* Params:
12 * r0 = flash destination address in/out
13 * r1 = longword count
14 * r2 = workarea start address
15 * r3 = workarea end address
16 * r4 = FTFx base
17 */
18
19 .text
20 .cpu cortex-m0plus
21 .code 16
22 .thumb_func
23
24 .align 2
25
26 /* r5 = rp
27 * r6 = wp, tmp
28 * r7 = tmp
29 */
30
31 /* old longword algo: 6.680 KiB/s @ adapter_khz 2000
32 * this async algo: 19.808 KiB/s @ adapter_khz 2000
33 */
34
35 FTFx_FSTAT = 0
36 FTFx_FCCOB3 = 4
37 FTFx_FCCOB0 = 7
38 FTFx_FCCOB7 = 8
39
40 wait_fifo:
41 ldr r6, [r2, #0] /* read wp */
42 cmp r6, #0 /* abort if wp == 0 */
43 beq exit
44
45 ldr r5, [r2, #4] /* read rp */
46 cmp r5, r6 /* wait until rp != wp */
47 beq wait_fifo
48
49 str r0, [r4, #FTFx_FCCOB3] /* set flash address */
50 mov r7, #6
51 strb r7, [r4, #FTFx_FCCOB0] /* flash command */
52
53 ldr r7, [r5] /* set longword data = *rp */
54 str r7, [r4, #FTFx_FCCOB7]
55
56 mov r7, #128
57 strb r7, [r4, #FTFx_FSTAT]
58
59 add r5, #4 /* rp += 4 */
60 cmp r5, r3 /* Wrap? */
61 bcc no_wrap
62 mov r5, r2
63 add r5, #8
64
65 no_wrap:
66 str r5, [r2, #4] /* Store rp */
67
68 wait_ccif:
69 ldr r6, [r2, #0] /* read wp */
70 cmp r6, #0 /* abort if wp == 0 */
71 beq exit
72
73 ldrb r6, [r4, #FTFx_FSTAT]
74 tst r6, r7
75 beq wait_ccif
76
77 mov r7, #0x70
78 tst r6, r7
79 bne error
80
81 add r0, #4 /* flash address += 4, do not increment before err check */
82
83 sub r1, #1 /* word_count-- */
84 cmp r1, #0
85 bne wait_fifo
86 b exit
87
88 error:
89 mov r5, #0
90 str r5, [r2, #4] /* set rp = 0 on error */
91
92 exit:
93 bkpt #0

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)