6c993443a9d3f30e9d9009ff0f21c9bd42747f0c
[openocd.git] / contrib / loaders / flash / xmc1xxx / erase_check.S
1 /*
2 * Infineon XMC1000 flash sector erase check
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 verify_block, nvmbase, addr, tmp, tmp2
14
15 movs \tmp, #0x00
16 mvns \tmp, \tmp
17 str \tmp, [\addr, #0x0]
18 str \tmp, [\addr, #0x4]
19 str \tmp, [\addr, #0x8]
20 str \tmp, [\addr, #0xC]
21
22 busy_wait \nvmbase, \tmp, \tmp2
23
24 .endm
25
26
27 .macro erase_check, nvmbase, addr, end, tmp, tmp2
28
29 ldrh \tmp, [\nvmbase, #NVMCONF]
30 movs \tmp2, #NVMCONF_HRLEV_MASK
31 mvns \tmp2, \tmp2
32 ands \tmp, \tmp, \tmp2
33 movs \tmp2, #NVMCONF_HRLEV_HRE
34 orrs \tmp, \tmp, \tmp2
35 strh \tmp, [\nvmbase, #NVMCONF]
36
37 movs \tmp, #NVMPROG_ACTION_VERIFY_CONTINUOUS
38 strh \tmp, [\nvmbase, #NVMPROG]
39 2001:
40 verify_block \nvmbase, \addr, \tmp, \tmp2
41
42 ldrh \tmp, [\nvmbase, #NVMSTATUS]
43 movs \tmp2, #NVMSTATUS_VERR_MASK
44 ands \tmp, \tmp, \tmp2
45 cmp \tmp, #NVMSTATUS_VERR_NOFAIL
46 bne 2010f
47
48 adds \addr, \addr, #NVM_BLOCK_SIZE
49 cmp \addr, \end
50 blt 2001b
51 2010:
52 movs \tmp, #NVMPROG_ACTION_IDLE
53 strh \tmp, [\nvmbase, #NVMPROG]
54
55 .endm
56
57
58 /*
59 * r0 = 0x40050000
60 * r1 = e.g. 0x10001000
61 * r2 = e.g. 0x10002000
62 * NVMPROG.ACTION = 0x00
63 */
64 erase_check:
65 erase_check r0, r1, r2, r3, r4
66
67 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)