From 63336f4aaf672899db78de4ce6781c9451851472 Mon Sep 17 00:00:00 2001 From: Jian-Hong Pan Date: Thu, 10 Nov 2022 00:14:10 +0800 Subject: flash/nor, contrib/loaders: move numicro M4 write assembly to contrib/loaders Simply move numicro M4 flash write assembly to contrib/loaders. Also, add corresponding Makefile and generated numicro_m4.inc. Signed-off-by: Jian-Hong Pan Change-Id: I22b8be0a245857335b11bd0b538db415fc34748d Reviewed-on: https://review.openocd.org/c/openocd/+/7343 Tested-by: jenkins Reviewed-by: Antonio Borneo --- contrib/loaders/flash/numicro_m4/Makefile | 31 +++++++++++ contrib/loaders/flash/numicro_m4/numicro_m4.S | 70 +++++++++++++++++++++++++ contrib/loaders/flash/numicro_m4/numicro_m4.inc | 5 ++ src/flash/nor/numicro.c | 57 +------------------- 4 files changed, 107 insertions(+), 56 deletions(-) create mode 100644 contrib/loaders/flash/numicro_m4/Makefile create mode 100644 contrib/loaders/flash/numicro_m4/numicro_m4.S create mode 100644 contrib/loaders/flash/numicro_m4/numicro_m4.inc diff --git a/contrib/loaders/flash/numicro_m4/Makefile b/contrib/loaders/flash/numicro_m4/Makefile new file mode 100644 index 0000000..0f9c507 --- /dev/null +++ b/contrib/loaders/flash/numicro_m4/Makefile @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +BIN2C = ../../../../src/helper/bin2char.sh + +CROSS_COMPILE ?= arm-none-eabi- + +CC=$(CROSS_COMPILE)gcc +OBJCOPY=$(CROSS_COMPILE)objcopy +OBJDUMP=$(CROSS_COMPILE)objdump + + +AFLAGS = -static -nostartfiles -mlittle-endian -mcpu=cortex-m4 -Wa,-EL + +all: numicro_m4.inc + +.PHONY: clean + +%.elf: %.S + $(CC) $(AFLAGS) $< -o $@ + +%.lst: %.elf + $(OBJDUMP) -S $< > $@ + +%.bin: %.elf + $(OBJCOPY) -Obinary $< $@ + +%.inc: %.bin + $(BIN2C) < $< > $@ + +clean: + -rm -f *.elf *.lst *.bin *.inc diff --git a/contrib/loaders/flash/numicro_m4/numicro_m4.S b/contrib/loaders/flash/numicro_m4/numicro_m4.S new file mode 100644 index 0000000..6c59cca --- /dev/null +++ b/contrib/loaders/flash/numicro_m4/numicro_m4.S @@ -0,0 +1,70 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/*************************************************************************** + * Copyright (C) 2017 Zale Yu * + * CYYU@nuvoton.com * + * * + * Copyright (C) 2022 Jian-Hong Pan * + * chienhung.pan@gmail.com * + ***************************************************************************/ + + .text + .cpu cortex-m4 + .thumb + + /* Params: + * r0 - workarea buffer / result + * r1 - target address + * r2 - wordcount + * Clobbered: + * r4 - tmp + * r5 - tmp + * r6 - tmp + * r7 - tmp + */ + +.L1: + /* for(register uint32_t i=0;i