Re: [Openocd-development] [PATCH] contrib: add ram loader src code

2010-10-28 Thread Spencer Oliver

On 27/10/2010 18:50, Øyvind Harboe wrote:

On Wed, Oct 27, 2010 at 6:21 PM, Peter Stugepe...@stuge.se  wrote:

Spencer Oliver wrote:

Having a bit of a tidy up and found the src to the various ram loaders
i have written over the years - no objections i will commit.


Acked-by: Peter Stugepe...@stuge.se

Could they also be magically hooked up to OpenOCD?


I think a good start would be to add comments in the
code where these stubs are used(now as binary sequences)
that the next time these sequences need to change, then
they should be built using a script.

I don't think we want to  require target cross compilers to be
available to build OpenOCD.




updated patchset attached - is this better?

Cheers
Spen

From 1fafb669c99744b986d85b5c4a4e276767898654 Mon Sep 17 00:00:00 2001
From: Spencer Oliver ntfr...@users.sourceforge.net
Date: Thu, 28 Oct 2010 09:19:37 +0100
Subject: [PATCH 1/2] contrib: add ram loader src code

Add src code for ram loaders to contrib directory.

Signed-off-by: Spencer Oliver ntfr...@users.sourceforge.net
---
 contrib/loaders/README |   33 
 contrib/loaders/checksum/armv4_5_crc.s |   58 ++
 contrib/loaders/checksum/armv7m_crc.s  |   66 
 contrib/loaders/checksum/mips32.s  |   72 +
 contrib/loaders/flash/pic32mx.s|  131 
 contrib/loaders/flash/stellaris.s  |   66 
 contrib/loaders/flash/stm32x.s |   52 +
 contrib/loaders/flash/str7x.s  |   57 ++
 contrib/loaders/flash/str9x.s  |   54 +
 9 files changed, 589 insertions(+), 0 deletions(-)
 create mode 100644 contrib/loaders/README
 create mode 100644 contrib/loaders/checksum/armv4_5_crc.s
 create mode 100644 contrib/loaders/checksum/armv7m_crc.s
 create mode 100644 contrib/loaders/checksum/mips32.s
 create mode 100644 contrib/loaders/flash/pic32mx.s
 create mode 100644 contrib/loaders/flash/stellaris.s
 create mode 100644 contrib/loaders/flash/stm32x.s
 create mode 100644 contrib/loaders/flash/str7x.s
 create mode 100644 contrib/loaders/flash/str9x.s

diff --git a/contrib/loaders/README b/contrib/loaders/README
new file mode 100644
index 000..2b123cf
--- /dev/null
+++ b/contrib/loaders/README
@@ -0,0 +1,33 @@
+Included in these directories are the src to the various ram loaders used
+within openocd.
+
+** target checksum loaders **
+
+checksum/armv4_5_crc.s :
+ - ARMv4 and ARMv5 checksum loader : see target/arm_crc_code.c:arm_crc_code
+
+checksum/armv7m_crc.s :
+ - ARMv7m checksum loader : see target/armv7m.c:cortex_m3_crc_code
+
+checksum/mips32.s :
+ - MIPS32 checksum loader : see target/mips32.c:mips_crc_code
+
+** target flash loaders **
+
+flash/pic32mx.s :
+ - Microchip PIC32 flash loader : see 
flash/nor/pic32mx.c:pic32mx_flash_write_code
+
+flash/stellaris.s :
+ - TI Stellaris flash loader : see flash/nor/stellaris.c:stellaris_write_code
+
+flash/stm32x.s :
+ - ST STM32 flash loader : see flash/nor/stm32x.c:stm32x_flash_write_code
+
+flash/str7x.s :
+ - ST STR7 flash loader : see flash/nor/str7x.c:str7x_flash_write_code
+
+flash/str9x.s :
+ - ST STR9 flash loader : see flash/nor/str9x.c:str9x_flash_write_code
+
+Spencer Oliver
+s...@spen-soft.co.uk
diff --git a/contrib/loaders/checksum/armv4_5_crc.s 
b/contrib/loaders/checksum/armv4_5_crc.s
new file mode 100644
index 000..950a8d0
--- /dev/null
+++ b/contrib/loaders/checksum/armv4_5_crc.s
@@ -0,0 +1,58 @@
+/***
+ *   Copyright (C) 2010 by Spencer Oliver  *
+ *   s...@spen-soft.co.uk  *
+ * *
+ *   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. *
+ ***/
+
+/*
+   r0 - 

Re: [Openocd-development] [PATCH] contrib: add ram loader src code

2010-10-28 Thread Øyvind Harboe
On Thu, Oct 28, 2010 at 11:12 AM, Spencer Oliver s...@spen-soft.co.uk wrote:
 On 27/10/2010 18:50, Øyvind Harboe wrote:

 On Wed, Oct 27, 2010 at 6:21 PM, Peter Stugepe...@stuge.se  wrote:

 Spencer Oliver wrote:

 Having a bit of a tidy up and found the src to the various ram loaders
 i have written over the years - no objections i will commit.

 Acked-by: Peter Stugepe...@stuge.se

 Could they also be magically hooked up to OpenOCD?

 I think a good start would be to add comments in the
 code where these stubs are used(now as binary sequences)
 that the next time these sequences need to change, then
 they should be built using a script.

 I don't think we want to  require target cross compilers to be
 available to build OpenOCD.



 updated patchset attached - is this better?

Much better. Anyone who wants to work on these magic
sequences will then know where the source is and then
take it from there.


-- 
Øyvind Harboe
US toll free 1-866-980-3434 / International +47 51 63 25 00
http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


[Openocd-development] [PATCH] contrib: add ram loader src code

2010-10-27 Thread Spencer Oliver

Hi,

Having a bit of a tidy up and found the src to the various ram loaders i 
have written over the years - no objections i will commit.


Cheers
Spen
From 5c25c2cbec8d4a7966ccb18b8dadbde5da59b4b9 Mon Sep 17 00:00:00 2001
From: Spencer Oliver ntfr...@users.sourceforge.net
Date: Wed, 27 Oct 2010 11:03:16 +0100
Subject: [PATCH] contrib: add ram loader src code

Add src code for ram loaders to contrib directory.

Signed-off-by: Spencer Oliver ntfr...@users.sourceforge.net
---
 contrib/loaders/checksum/armv4_5_crc.s |   58 
 contrib/loaders/checksum/armv7m_crc.s  |   66 
 contrib/loaders/flash/stellaris.s  |   66 
 contrib/loaders/flash/stm32x.s |   52 +
 contrib/loaders/flash/str7x.s  |   57 +++
 contrib/loaders/flash/str9x.s  |   54 ++
 6 files changed, 353 insertions(+), 0 deletions(-)
 create mode 100644 contrib/loaders/checksum/armv4_5_crc.s
 create mode 100644 contrib/loaders/checksum/armv7m_crc.s
 create mode 100644 contrib/loaders/flash/stellaris.s
 create mode 100644 contrib/loaders/flash/stm32x.s
 create mode 100644 contrib/loaders/flash/str7x.s
 create mode 100644 contrib/loaders/flash/str9x.s

diff --git a/contrib/loaders/checksum/armv4_5_crc.s 
b/contrib/loaders/checksum/armv4_5_crc.s
new file mode 100644
index 000..950a8d0
--- /dev/null
+++ b/contrib/loaders/checksum/armv4_5_crc.s
@@ -0,0 +1,58 @@
+/***
+ *   Copyright (C) 2010 by Spencer Oliver  *
+ *   s...@spen-soft.co.uk  *
+ * *
+ *   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. *
+ ***/
+
+/*
+   r0 - address in - crc out
+   r1 - char count
+*/
+
+   .text
+   .arm
+
+_start:
+main:
+   mov r2, r0
+   mov r0, #0x /* crc */
+   mov r3, r1
+   mov r4, #0
+   b   ncomp
+nbyte:
+   ldrbr1, [r2, r4]
+   ldr r7, CRC32XOR
+   eor r0, r0, r1, asl #24
+   mov r5, #0
+loop:
+   cmp r0, #0
+   mov r6, r0, asl #1
+   add r5, r5, #1
+   mov r0, r6
+   eorlt   r0, r6, r7
+   cmp r5, #8
+   bne loop
+   add r4, r4, #1
+ncomp:
+   cmp r4, r3
+   bne nbyte
+end:
+   bkpt#0
+
+CRC32XOR:  .word   0x04c11db7
+
+   .end
diff --git a/contrib/loaders/checksum/armv7m_crc.s 
b/contrib/loaders/checksum/armv7m_crc.s
new file mode 100644
index 000..e50db0a
--- /dev/null
+++ b/contrib/loaders/checksum/armv7m_crc.s
@@ -0,0 +1,66 @@
+/***
+ *   Copyright (C) 2010 by Spencer Oliver  *
+ *   s...@spen-soft.co.uk  *
+ * *
+ *   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 

Re: [Openocd-development] [PATCH] contrib: add ram loader src code

2010-10-27 Thread Øyvind Harboe
On Wed, Oct 27, 2010 at 6:21 PM, Peter Stuge pe...@stuge.se wrote:
 Spencer Oliver wrote:
 Having a bit of a tidy up and found the src to the various ram loaders
 i have written over the years - no objections i will commit.

 Acked-by: Peter Stuge pe...@stuge.se

 Could they also be magically hooked up to OpenOCD?

I think a good start would be to add comments in the
code where these stubs are used(now as binary sequences)
that the next time these sequences need to change, then
they should be built using a script.

I don't think we want to  require target cross compilers to be
available to build OpenOCD.



-- 
Øyvind Harboe
US toll free 1-866-980-3434 / International +47 51 63 25 00
http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] [PATCH] contrib: add ram loader src code

2010-10-27 Thread Peter Stuge
Øyvind Harboe wrote:
  Having a bit of a tidy up and found the src to the various ram loaders
  i have written over the years - no objections i will commit.
 
  Could they also be magically hooked up to OpenOCD?
 
 I think a good start would be to add comments in the
 code where these stubs are used(now as binary sequences)

Oh! So they are already magically hooked up! Great.


 that the next time these sequences need to change, then
 they should be built using a script.
 
 I don't think we want to  require target cross compilers to be
 available to build OpenOCD.

I actually don't think it is an unreasonable expectation. I know I
have not had OpenOCD without the cross toolchain.

However, compiling them could be done in make dist, rather than make.
(Ie. when preparing a tarball, rather than when compiling OpenOCD.)


//Peter
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] [PATCH] contrib: add ram loader src code

2010-10-27 Thread Øyvind Harboe
On Wed, Oct 27, 2010 at 10:10 PM, Peter Stuge pe...@stuge.se wrote:
 Øyvind Harboe wrote:
  Having a bit of a tidy up and found the src to the various ram loaders
  i have written over the years - no objections i will commit.
 
  Could they also be magically hooked up to OpenOCD?

 I think a good start would be to add comments in the
 code where these stubs are used(now as binary sequences)

 Oh! So they are already magically hooked up! Great.

Actually, I think they are the source code for the unsigned code[]
={0x12345678,...}  codelets you find here and there.

 that the next time these sequences need to change, then
 they should be built using a script.

 I don't think we want to  require target cross compilers to be
 available to build OpenOCD.

 I actually don't think it is an unreasonable expectation. I know I
 have not had OpenOCD without the cross toolchain.

 However, compiling them could be done in make dist, rather than make.
 (Ie. when preparing a tarball, rather than when compiling OpenOCD.)

I'm loathe to make building OpenOCD from the master branch
any more difficult than it is already: learning git, installing
the right tools, etc.


-- 
Øyvind Harboe
US toll free 1-866-980-3434 / International +47 51 63 25 00
http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] [PATCH] contrib: add ram loader src code

2010-10-27 Thread Michael Schwingen
On 10/27/2010 10:29 PM, Øyvind Harboe wrote:
 I actually don't think it is an unreasonable expectation. I know I
 have not had OpenOCD without the cross toolchain.

 However, compiling them could be done in make dist, rather than make.
 (Ie. when preparing a tarball, rather than when compiling OpenOCD.)
 I'm loathe to make building OpenOCD from the master branch
 any more difficult than it is already: learning git, installing
 the right tools, etc.
Yes. However, having scripts that compile these assembler parts and
create the corresponding C source files with the arrays would be nice.
The generated files can be checked in (just like they are now), so only
someone who wants to modify that code needs the cross compiler installed.

cu
Michael


___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development