flash/nor: Add Infineon XMC1000 flash driver
[openocd.git] / contrib / loaders / flash / xmc1xxx / write.S
1 /*
2 * Infineon XMC1000 flash write
3 *
4 * Copyright (c) 2016 Andreas Färber
5 *
6 * Based on XMC1100 AA-Step Reference Manual
7 *
8 * License: GPL-2.0+
9 */
10
11 #include "xmc1xxx.S"
12
13 .macro write_block, nvmbase, dest, src, tmp, tmp2
14
15 ldr \tmp, [\src, #0x0]
16 str \tmp, [\dest, #0x0]
17 ldr \tmp, [\src, #0x4]
18 str \tmp, [\dest, #0x4]
19 ldr \tmp, [\src, #0x8]
20 str \tmp, [\dest, #0x8]
21 ldr \tmp, [\src, #0xc]
22 str \tmp, [\dest, #0xc]
23
24 busy_wait \nvmbase, \tmp, \tmp2
25
26 .endm
27
28
29 .macro write, nvmbase, dest, src, count, tmp, tmp2
30
31 movs \tmp, #NVMPROG_ACTION_WRITE_CONTINUOUS
32 strh \tmp, [\nvmbase, #NVMPROG]
33 1001:
34 write_block \nvmbase, \dest, \src, \tmp, \tmp2
35
36 adds \dest, \dest, #NVM_BLOCK_SIZE
37 adds \src, \src, #NVM_BLOCK_SIZE
38 subs \count, \count, #1
39 cmp \count, #0
40 bgt 1001b
41
42 movs \tmp, #NVMPROG_ACTION_IDLE
43 strh \tmp, [\nvmbase, #NVMPROG]
44
45 .endm
46
47
48 /*
49 * r0 = 0x40050000
50 * r1 = e.g. 0x10001000
51 * r2 = e.g. 0x20000000
52 * r3 = e.g. 1
53 * NVMPROG.ACTION = 0x00
54 */
55 write:
56 write r0, r1, r2, r3, r4, r5
57
58 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)