From c3c15d2e076639fad185a0c45b866e9c5e754af5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andreas=20F=C3=A4rber?= Date: Sun, 29 Nov 2015 03:35:51 +0100 Subject: [PATCH] armv7m: Integrate build of erase check code MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Instead of documenting the file path as a comment and inline-commenting the THUMB bytecode, include the hex array via preprocessor. This assures the path is actually up-to-date and facilitates updating the code. Change-Id: Ieb0a7cd0bc14882ac96750f524616d9768a0c6f5 Signed-off-by: Andreas Färber Reviewed-on: http://openocd.zylin.com/3134 Tested-by: jenkins Reviewed-by: Andreas Fritiofson --- contrib/loaders/erase_check/armv7m_erase_check.inc | 2 ++ src/target/armv7m.c | 10 +--------- 2 files changed, 3 insertions(+), 9 deletions(-) create mode 100644 contrib/loaders/erase_check/armv7m_erase_check.inc diff --git a/contrib/loaders/erase_check/armv7m_erase_check.inc b/contrib/loaders/erase_check/armv7m_erase_check.inc new file mode 100644 index 00000000..1fe25cd5 --- /dev/null +++ b/contrib/loaders/erase_check/armv7m_erase_check.inc @@ -0,0 +1,2 @@ +/* Autogenerated with ../../../src/helper/bin2char.sh */ +0x03,0x78,0x01,0x30,0x1a,0x40,0x01,0x39,0xfa,0xd1,0x00,0xbe, diff --git a/src/target/armv7m.c b/src/target/armv7m.c index 15de8cd9..52b394cf 100644 --- a/src/target/armv7m.c +++ b/src/target/armv7m.c @@ -769,16 +769,8 @@ int armv7m_blank_check_memory(struct target *target, struct armv7m_algorithm armv7m_info; int retval; - /* see contrib/loaders/erase_check/armv7m_erase_check.s for src */ - static const uint8_t erase_check_code[] = { - /* loop: */ - 0x03, 0x78, /* ldrb r3, [r0] */ - 0x01, 0x30, /* adds r0, #1 */ - 0x1A, 0x40, /* ands r2, r2, r3 */ - 0x01, 0x39, /* subs r1, r1, #1 */ - 0xFA, 0xD1, /* bne loop */ - 0x00, 0xBE /* bkpt #0 */ +#include "../../contrib/loaders/erase_check/armv7m_erase_check.inc" }; /* make sure we have a working area */ -- 2.39.5