diff --git a/contrib/loaders/erase_check/Makefile b/contrib/loaders/erase_check/Makefile new file mode 100644 index 000000000..32b751754 --- /dev/null +++ b/contrib/loaders/erase_check/Makefile @@ -0,0 +1,19 @@ +BIN2C = ../../../src/helper/bin2char.sh + +ARM_CROSS_COMPILE ?= arm-none-eabi- +ARM_AS ?= $(ARM_CROSS_COMPILE)as +ARM_OBJCOPY ?= $(ARM_CROSS_COMPILE)objcopy + +arm: armv7m_erase_check.inc armv7m_0_erase_check.inc + +armv7m_%.elf: armv7m_%.s + $(ARM_AS) $< -o $@ + +armv7m_%.bin: armv7m_%.elf + $(ARM_OBJCOPY) -Obinary $< $@ + +armv7m_%.inc: armv7m_%.bin + $(BIN2C) < $< > $@ + +clean: + -rm -f *.elf *.bin *.inc diff --git a/contrib/loaders/erase_check/armv7m_0_erase_check.inc b/contrib/loaders/erase_check/armv7m_0_erase_check.inc new file mode 100644 index 000000000..76115ec17 --- /dev/null +++ b/contrib/loaders/erase_check/armv7m_0_erase_check.inc @@ -0,0 +1,2 @@ +/* Autogenerated with ../../../src/helper/bin2char.sh */ +0x03,0x78,0x01,0x30,0x1a,0x43,0x01,0x39,0xfa,0xd1,0x00,0xbe, diff --git a/src/flash/nor/xmc4xxx.c b/src/flash/nor/xmc4xxx.c index 10497834a..f676e8cde 100644 --- a/src/flash/nor/xmc4xxx.c +++ b/src/flash/nor/xmc4xxx.c @@ -628,16 +628,8 @@ int xmc4xxx_blank_check_memory(struct target *target, struct armv7m_algorithm armv7m_info; int retval; - /* see contrib/loaders/erase_check/armv7m_0_erase_check.s for src */ - static const uint8_t erase_check_code[] = { - /* loop: */ - 0x03, 0x78, /* ldrb r3, [r0] */ - 0x01, 0x30, /* adds r0, #1 */ - 0x1A, 0x43, /* orrs r2, r2, r3 */ - 0x01, 0x39, /* subs r1, r1, #1 */ - 0xFA, 0xD1, /* bne loop */ - 0x00, 0xBE /* bkpt #0 */ +#include "../../../contrib/loaders/erase_check/armv7m_0_erase_check.inc" }; /* make sure we have a working area */