mirror of
https://git.code.sf.net/p/openocd/code
synced 2024-11-25 07:36:24 +00:00
a126229dff
Replace the GPLv2-or-later boilerplate with the SPDX tag. The SPDX tag on files *.c is incorrect, as it should use the C99 single line comment using '//'. But current checkpatch doesn't allow C99 comments, so keep using standard C comments, by now. Change-Id: I380d552940f1c405309a3346454251c0e80b5a45 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7159 Tested-by: jenkins
59 lines
1.0 KiB
ArmAsm
59 lines
1.0 KiB
ArmAsm
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/*
|
|
* Copyright (C) 2017 Ake Rehnman
|
|
* ake.rehnman(at)gmail.com
|
|
*/
|
|
;;
|
|
;; erase check memory code
|
|
;;
|
|
.org 0x0
|
|
;; start address
|
|
start_addr: .byte 0x00
|
|
.word 0x8000
|
|
;; byte count
|
|
byte_cnt: .byte 0x00
|
|
.word 0x8000
|
|
;
|
|
; SP must point to start_addr on entry
|
|
; first relocate start_addr to the location
|
|
; we are running at
|
|
start:
|
|
ldw X,SP
|
|
ldw .cont+2,X
|
|
ldw X,(start_addr+1,SP) ;start addr
|
|
ldw Y,(byte_cnt+1,SP) ;count
|
|
ld A,#0xff
|
|
;
|
|
; if count == 0 return
|
|
.L1:
|
|
tnzw Y
|
|
jrne .decrcnt ;continue if low word != 0
|
|
tnz (byte_cnt,SP) ;high byte
|
|
jreq .exit ;goto exit
|
|
;
|
|
; decrement count (byte_cnt)
|
|
.decrcnt:
|
|
tnzw Y ;low word count
|
|
jrne .decr1
|
|
dec (byte_cnt,SP) ;high byte
|
|
.decr1:
|
|
decw Y; decr low word
|
|
;
|
|
; first check if [start_addr] is 0xff
|
|
.cont:
|
|
ldf A, [start_addr.e]
|
|
cp A,#0xff
|
|
jrne .exit ;exit if not 0xff
|
|
;
|
|
; increment start_addr (addr)
|
|
incw X
|
|
jrne .L1
|
|
inc (start_addr,SP) ;increment high byte
|
|
jra .L1
|
|
;
|
|
.exit:
|
|
ldw (start_addr+1,SP),X ;start addr
|
|
ldw (byte_cnt+1,SP),Y ;count
|
|
break
|