stm8 : new target
[openocd.git] / contrib / loaders / erase_check / stm8_erase_check.s
1 /*
2 Copyright (C) 2017 Ake Rehnman
3 ake.rehnman(at)gmail.com
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 3 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
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 ;;
19 ;; erase check memory code
20 ;;
21 .org 0x0
22 ;; start address
23 start_addr: .byte 0x00
24 .word 0x8000
25 ;; byte count
26 byte_cnt: .byte 0x00
27 .word 0x8000
28 ;
29 ; SP must point to start_addr on entry
30 ; first relocate start_addr to the location
31 ; we are running at
32 start:
33 ldw X,SP
34 ldw .cont+2,X
35 ldw X,(start_addr+1,SP) ;start addr
36 ldw Y,(byte_cnt+1,SP) ;count
37 ld A,#0xff
38 ;
39 ; if count == 0 return
40 .L1:
41 tnzw Y
42 jrne .decrcnt ;continue if low word != 0
43 tnz (byte_cnt,SP) ;high byte
44 jreq .exit ;goto exit
45 ;
46 ; decrement count (byte_cnt)
47 .decrcnt:
48 tnzw Y ;low word count
49 jrne .decr1
50 dec (byte_cnt,SP) ;high byte
51 .decr1:
52 decw Y; decr low word
53 ;
54 ; first check if [start_addr] is 0xff
55 .cont:
56 ldf A, [start_addr.e]
57 cp A,#0xff
58 jrne .exit ;exit if not 0xff
59 ;
60 ; increment start_addr (addr)
61 incw X
62 jrne .L1
63 inc (start_addr,SP) ;increment high byte
64 jra .L1
65 ;
66 .exit:
67 ldw (start_addr+1,SP),X ;start addr
68 ldw (byte_cnt+1,SP),Y ;count
69 break

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)