2
0
mirror of git://git.code.sf.net/p/openocd/code synced 2025-08-16 10:57:00 +10:00
openocd/contrib/loaders/erase_check/armv7m_erase_check.s
Antonio Borneo a126229dff contrib: replace the GPLv2-or-later license tag
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
2022-09-13 22:06:14 +00:00

61 lines
1.1 KiB
ArmAsm

/* SPDX-License-Identifier: GPL-2.0-or-later */
/***************************************************************************
* Copyright (C) 2010 by Spencer Oliver *
* spen@spen-soft.co.uk *
***************************************************************************/
/*
parameters:
r0 - pointer to struct { uint32_t size_in_result_out, uint32_t addr }
r1 - value to check
*/
.text
.syntax unified
.cpu cortex-m0
.thumb
.thumb_func
.align 2
BLOCK_SIZE_RESULT = 0
BLOCK_ADDRESS = 4
SIZEOF_STRUCT_BLOCK = 8
start:
block_loop:
ldr r2, [r0, #BLOCK_SIZE_RESULT] /* get size */
tst r2, r2
beq done
ldr r3, [r0, #BLOCK_ADDRESS] /* get address */
word_loop:
ldr r4, [r3] /* read word */
adds r3, #4
cmp r4, r1
bne not_erased
subs r2, #1
bne word_loop
movs r4, #1 /* block is erased */
save_result:
str r4, [r0, #BLOCK_SIZE_RESULT]
adds r0, #SIZEOF_STRUCT_BLOCK
b block_loop
not_erased:
movs r4, #0
b save_result
/* Avoid padding at .text segment end. Otherwise exit point check fails. */
.skip ( . - start + 2) & 2, 0
done:
bkpt #0
.end