From: OpenOCD-Gerrit <ope...@us...> - 2020-04-21 15:39:43
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 65d8fdf0d1e7aa931dd70cb2b0784473fe7834e1 (commit) from 5c6e32612df3360abe0ada4e434783b5636643f2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 65d8fdf0d1e7aa931dd70cb2b0784473fe7834e1 Author: Aurélien Martin <mar...@gm...> Date: Tue Jul 23 21:21:39 2019 +0200 nrf5: Include generated loader code Dump legacy hexadecimal machine code Change-Id: I336efa461058bccc3894131cb22473785b68479c Signed-off-by: Aurélien Martin <mar...@gm...> Reviewed-on: http://openocd.zylin.com/5267 Tested-by: jenkins Reviewed-by: Tomas Vanek <va...@fb...> diff --git a/contrib/loaders/flash/nrf5/Makefile b/contrib/loaders/flash/nrf5/Makefile new file mode 100644 index 000000000..67390b9bd --- /dev/null +++ b/contrib/loaders/flash/nrf5/Makefile @@ -0,0 +1,28 @@ +BIN2C = ../../../../src/helper/bin2char.sh + +CROSS_COMPILE ?= arm-none-eabi- + +CC=$(CROSS_COMPILE)gcc +OBJCOPY=$(CROSS_COMPILE)objcopy +OBJDUMP=$(CROSS_COMPILE)objdump + +CFLAGS = -static -nostartfiles -mlittle-endian -Wa,-EL + +all: nrf5.inc + +.PHONY: clean + +%.elf: %.S + $(CC) $(CFLAGS) $< -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/nrf5/nrf5.S b/contrib/loaders/flash/nrf5/nrf5.S new file mode 100644 index 000000000..b148e3caf --- /dev/null +++ b/contrib/loaders/flash/nrf5/nrf5.S @@ -0,0 +1,55 @@ +/*************************************************************************** + * Copyright (C) 2014 Angus Gratton * + * gu...@pr... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc. * + ***************************************************************************/ + + .text + .syntax unified + .thumb + +/* + * Params : + * r0 = byte count + * r1 = buffer start + * r2 = buffer end + * r3 = target address + */ + + .thumb_func + .global _start +_start: +wait_fifo: + ldr r5, [r1, #0] + cmp r5, #0 + beq.n exit + ldr r4, [r1, #4] + cmp r4, r5 + beq.n wait_fifo + ldmia r4!, {r5} + stmia r3!, {r5} + cmp r4, r2 + bcc.n no_wrap + mov r4, r1 + adds r4, #8 +no_wrap: + str r4, [r1, #4] + subs r0, #4 + bne.n wait_fifo +exit: + bkpt #0x00 + + .pool diff --git a/contrib/loaders/flash/nrf5/nrf5.inc b/contrib/loaders/flash/nrf5/nrf5.inc new file mode 100644 index 000000000..a9b185c45 --- /dev/null +++ b/contrib/loaders/flash/nrf5/nrf5.inc @@ -0,0 +1,3 @@ +/* Autogenerated with ../../../../src/helper/bin2char.sh */ +0x0d,0x68,0x00,0x2d,0x0b,0xd0,0x4c,0x68,0xac,0x42,0xf9,0xd0,0x20,0xcc,0x20,0xc3, +0x94,0x42,0x01,0xd3,0x0c,0x46,0x08,0x34,0x4c,0x60,0x04,0x38,0xf0,0xd1,0x00,0xbe, diff --git a/src/flash/nor/nrf5.c b/src/flash/nor/nrf5.c index 5bef8487c..c569c1800 100644 --- a/src/flash/nor/nrf5.c +++ b/src/flash/nor/nrf5.c @@ -900,30 +900,6 @@ static int nrf5_erase_page(struct flash_bank *bank, return res; } -static const uint8_t nrf5_flash_write_code[] = { - /* See contrib/loaders/flash/cortex-m0.S */ -/* <wait_fifo>: */ - 0x0d, 0x68, /* ldr r5, [r1, #0] */ - 0x00, 0x2d, /* cmp r5, #0 */ - 0x0b, 0xd0, /* beq.n 1e <exit> */ - 0x4c, 0x68, /* ldr r4, [r1, #4] */ - 0xac, 0x42, /* cmp r4, r5 */ - 0xf9, 0xd0, /* beq.n 0 <wait_fifo> */ - 0x20, 0xcc, /* ldmia r4!, {r5} */ - 0x20, 0xc3, /* stmia r3!, {r5} */ - 0x94, 0x42, /* cmp r4, r2 */ - 0x01, 0xd3, /* bcc.n 18 <no_wrap> */ - 0x0c, 0x46, /* mov r4, r1 */ - 0x08, 0x34, /* adds r4, #8 */ -/* <no_wrap>: */ - 0x4c, 0x60, /* str r4, [r1, #4] */ - 0x04, 0x38, /* subs r0, #4 */ - 0xf0, 0xd1, /* bne.n 0 <wait_fifo> */ -/* <exit>: */ - 0x00, 0xbe /* bkpt 0x0000 */ -}; - - /* Start a low level flash write for the specified region */ static int nrf5_ll_flash_write(struct nrf5_info *chip, uint32_t address, const uint8_t *buffer, uint32_t bytes) { @@ -935,6 +911,10 @@ static int nrf5_ll_flash_write(struct nrf5_info *chip, uint32_t address, const u struct armv7m_algorithm armv7m_info; int retval = ERROR_OK; + static const uint8_t nrf5_flash_write_code[] = { +#include "../../../contrib/loaders/flash/nrf5/nrf5.inc" + }; + LOG_DEBUG("Writing buffer to flash address=0x%"PRIx32" bytes=0x%"PRIx32, address, bytes); assert(bytes % 4 == 0); ----------------------------------------------------------------------- Summary of changes: contrib/loaders/flash/{stm32 => nrf5}/Makefile | 2 +- .../armv4_5_erase_check.s => flash/nrf5/nrf5.S} | 56 ++++++++++++++-------- contrib/loaders/flash/nrf5/nrf5.inc | 3 ++ src/flash/nor/nrf5.c | 28 ++--------- 4 files changed, 44 insertions(+), 45 deletions(-) copy contrib/loaders/flash/{stm32 => nrf5}/Makefile (86%) copy contrib/loaders/{erase_check/armv4_5_erase_check.s => flash/nrf5/nrf5.S} (65%) create mode 100644 contrib/loaders/flash/nrf5/nrf5.inc hooks/post-receive -- Main OpenOCD repository |