Commit 37e9965b authored by Bernhard Nortmann's avatar Bernhard Nortmann
Browse files

fel: Add "memmove" command



This also obsoletes fel-copy.c - for details see issue #78.
Signed-off-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
parent 81f54c0c
/*
* (C) Copyright 2011 Henrik Nordstrom <henrik@henriknordstrom.net>
*
* 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., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
/*
Build instructions:
arm-none-linux-gnueabi-gcc -g -Os -fno-common -ffixed-r8 -msoft-float -fno-builtin -ffreestanding -nostdinc -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fno-toplevel-reorder fel-copy.c -c
arm-none-linux-gnueabi-objcopy -O binary fel-copy.o fel-copy.bin
Parameters:
0x2100 Destination address
0x2104 Source address
0x2108 Length
Source address is updated, allowing repeated copy to same destination
*/
#define CONFIG_BASE 0x2100
void copy(void)
{
unsigned long *b = (void *)CONFIG_BASE;
unsigned long **ptr = (void *)b++;
unsigned long *a = *ptr;
unsigned long i = *b++;
while (i--) {
*b++ = *a++;
}
*ptr = a;
}
......@@ -996,6 +996,7 @@ int main(int argc, char **argv)
" dump address length Binary memory dump\n"
" exe[cute] address Call function address\n"
" reset64 address RMR request for AArch64 warm boot\n"
" memmove dest source size Copy <size> bytes within device memory\n"
" readl address Read 32-bit value from device memory\n"
" writel address value Write 32-bit value to device memory\n"
" read address length file Write memory contents into file\n"
......@@ -1090,6 +1091,11 @@ int main(int argc, char **argv)
} else if (strncmp(argv[1], "dump", 4) == 0 && argc > 3) {
aw_fel_dump(handle, strtoul(argv[2], NULL, 0), strtoul(argv[3], NULL, 0));
skip = 3;
} else if (strcmp(argv[1], "memmove") == 0 && argc > 4) {
/* three parameters: destination addr, source addr, byte count */
fel_memmove(handle, strtoul(argv[2], NULL, 0),
strtoul(argv[3], NULL, 0), strtoul(argv[4], NULL, 0));
skip = 4;
} else if (strcmp(argv[1], "readl") == 0 && argc > 2) {
printf("0x%08x\n", fel_readl(handle, strtoul(argv[2], NULL, 0)));
skip = 2;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment