Alan Carvalho de Assis <acassis@gmail.com> - testcase
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Wed, 14 Jan 2009 19:30:51 +0000 (19:30 +0000)
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Wed, 14 Jan 2009 19:30:51 +0000 (19:30 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1319 b42882b7-edfa-0310-969c-e2dbd0fdcd60

testing/examples/ledtest-imx31pdk/Makefile [new file with mode: 0644]
testing/examples/ledtest-imx31pdk/crt0.S [new file with mode: 0644]
testing/examples/ledtest-imx31pdk/gdbinit-imx31pdk [new file with mode: 0644]
testing/examples/ledtest-imx31pdk/ldscript [new file with mode: 0644]
testing/examples/ledtest-imx31pdk/test.c [new file with mode: 0644]
testing/examples/ledtest-imx31pdk/test.elf [new file with mode: 0644]

diff --git a/testing/examples/ledtest-imx31pdk/Makefile b/testing/examples/ledtest-imx31pdk/Makefile
new file mode 100644 (file)
index 0000000..fc643ad
--- /dev/null
@@ -0,0 +1,42 @@
+# $Header: $\r
+# This will make the test program for ARM.\r
+\r
+PROC=arm\r
+TYPE=none-linux-gnueabi\r
+LDSCRIPT=ldscript\r
+\r
+PATH:=/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/:$(PATH)\r
+CC=$(PROC)-$(TYPE)-gcc\r
+AS=$(PROC)-$(TYPE)-as\r
+AR=$(PROC)-$(TYPE)-ar\r
+LD=$(PROC)-$(TYPE)-ld\r
+NM=$(PROC)-$(TYPE)-nm\r
+OBJDUMP=$(PROC)-$(TYPE)-objdump\r
+CFLAGS= -g -c -mcpu=arm1136j-s\r
+\r
+all: test.elf\r
+\r
+# Make a little endian image:\r
+# In Eclipse, add the line :\r
+#    source gdbinit \r
+# to : Run -> Debug... (menu) -> Commands (tab): Commands (listbox)\r
+# To start gdb from a window use : arm-elf-gdb --command=gdbinit\r
+test.elf: test.c Makefile ldscript crt0.S\r
+       $(CC) $(CFLAGS) -o crt0.o crt0.S\r
+       $(CC) $(CFLAGS) -o test.o test.c\r
+       $(LD) -g -v -T$(LDSCRIPT) -o test.elf crt0.o test.o \r
+       $(NM) test.elf\r
+\r
+       \r
+dump:\r
+       $(OBJDUMP) --all-headers test.elf\r
+\r
+dump_test:\r
+       $(OBJDUMP) --disassemble test.elf\r
+\r
+dump_full:\r
+       $(OBJDUMP) --full-contents test.elf\r
+\r
+clean:\r
+       -/bin/rm -f *.o *~ test.elf\r
+\r
diff --git a/testing/examples/ledtest-imx31pdk/crt0.S b/testing/examples/ledtest-imx31pdk/crt0.S
new file mode 100644 (file)
index 0000000..6c15be2
--- /dev/null
@@ -0,0 +1,47 @@
+/* Sample initialization file */\r
+       \r
+       .extern main\r
+       .extern exit\r
+       \r
+/* .text is used instead of .section .text so it works with arm-aout too.  */\r
+       .text\r
+       .code 32\r
+       .align  0\r
+\r
+       .global _mainCRTStartup\r
+       .global _start\r
+       .global start\r
+start:\r
+_start:\r
+_mainCRTStartup:\r
+\r
+/* Start by setting up a stack */\r
+       /*  Set up the stack pointer to end of bss */\r
+       ldr     r3, .LC2\r
+       mov     sp, r3\r
+\r
+       sub     sl, sp, #512    /* Still assumes 512 bytes below sl */\r
+\r
+       mov     a2, #0          /* Second arg: fill value */\r
+       mov     fp, a2          /* Null frame pointer */\r
+       mov     r7, a2          /* Null frame pointer for Thumb */\r
+       \r
+       ldr     a1, .LC1        /* First arg: start of memory block */\r
+       ldr     a3, .LC2        /* Second arg: end of memory block */\r
+       sub     a3, a3, a1      /* Third arg: length of block */\r
+       \r
+       mov     r0, #0          /*  no arguments  */\r
+       mov     r1, #0          /*  no argv either */\r
+\r
+       bl      main\r
+       bl      exit            /* Should not return */\r
+\r
+       /* For Thumb, constants must be after the code since only \r
+       positive offsets are supported for PC relative addresses. */\r
+       \r
+       .align 0\r
+.LC1:\r
+       .word   __bss_start__\r
+.LC2:\r
+       .word   __bss_end__\r
+\r
diff --git a/testing/examples/ledtest-imx31pdk/gdbinit-imx31pdk b/testing/examples/ledtest-imx31pdk/gdbinit-imx31pdk
new file mode 100644 (file)
index 0000000..336ddfb
--- /dev/null
@@ -0,0 +1,136 @@
+echo Setting up for the FreeScale iMX31 Board.\n\r
+# SETUP GDB :\r
+#\r
+# Common gdb setup for ARM CPUs\r
+set complaints 1\r
+set output-radix 10\r
+set input-radix 10\r
+set prompt (arm-gdb) \r
+set endian little\r
+dir .\r
+\r
+# Tell GDB to use 1024 bytes packes when downloading, this\r
+# reduces load image download times\r
+set remote memory-write-packet-size 1024\r
+set remote memory-write-packet-size fixed\r
+\r
+\r
+\r
+# DEFINE MACROS        :\r
+#\r
+# Create a "refresh" macro to update gdb's screens after the cpu\r
+# has been stopped by the other CPU or following an "monitor allstop" \r
+define refresh\r
+       monitor set hbreak\r
+       cont\r
+       monitor clear hbreak\r
+end\r
+\r
+\r
+# CONNECT TO TARGET :\r
+target remote 127.0.0.1:3333\r
+monitor reset run\r
+monitor reset halt\r
+\r
+# iMX31 PDK board initialization commands:\r
+\r
+#// init_ccm\r
+\r
+monitor mww 0x53FC0000 0x040\r
+monitor mww 0x53F80000 0x074B0B7D\r
+\r
+#//532-133-66.5\r
+#//monitor mww 0x53F80004 0xFF871D58\r
+#//monitor mww 0x53F80010 0x0033280C\r
+\r
+#// 399MHz - 26MHz input, PD=1,MFI=7, MFN=27, MFD=40\r
+monitor mww 0x53F80004 0xFF871D50\r
+monitor mww 0x53F80010 0x00271C1B\r
+\r
+#// 208-104-52\r
+#//monitor mww 0x53F80004 0xFF871D48\r
+#//monitor mww 0x53F80010 0x04002000\r
+\r
+\r
+#// Configure CPLD on CS5 \r
+monitor mww 0xb8002050 0x0000DCF6\r
+monitor mww 0xb8002054 0x444A4541\r
+monitor mww 0xb8002058 0x44443302\r
+\r
+#// Disable maximum drive strength for SDRAM/DDR lines by clearing DSE1 bits\r
+#// in SW_PAD_CTL registers\r
+\r
+#// SDCLK\r
+monitor mww 0x43FAC26C 0\r
\r
+#// CAS\r
+monitor mww 0x43FAC270 0\r
\r
+#// RAS\r
+monitor mww 0x43FAC274 0\r
\r
+#// CS2 (CSD0)\r
+monitor mww 0x43FAC27C 0x1000\r
+    \r
+#// DQM3\r
+monitor mww 0x43FAC284 0\r
\r
+#// DQM2, DQM1, DQM0, SD31-SD0, A25-A0, MA10 (0x288..0x2DC)\r
+monitor mww 0x43FAC288 0\r
+monitor mww 0x43FAC28C 0\r
+monitor mww 0x43FAC290 0\r
+monitor mww 0x43FAC294 0\r
+monitor mww 0x43FAC298 0\r
+monitor mww 0x43FAC29C 0\r
+monitor mww 0x43FAC2A0 0\r
+monitor mww 0x43FAC2A4 0\r
+monitor mww 0x43FAC2A8 0\r
+monitor mww 0x43FAC2AC 0\r
+monitor mww 0x43FAC2B0 0\r
+monitor mww 0x43FAC2B4 0\r
+monitor mww 0x43FAC2B8 0\r
+monitor mww 0x43FAC2BC 0\r
+monitor mww 0x43FAC2C0 0\r
+monitor mww 0x43FAC2C4 0\r
+monitor mww 0x43FAC2C8 0\r
+monitor mww 0x43FAC2CC 0\r
+monitor mww 0x43FAC2D0 0\r
+monitor mww 0x43FAC2D4 0\r
+monitor mww 0x43FAC2D8 0\r
+monitor mww 0x43FAC2DC 0\r
+\r
+#// Initialization script for 32 bit DDR on MX31 PDK \r
+monitor mww 0xB8001010 0x00000004\r
+monitor mww 0xB8001004 0x006ac73a\r
+monitor mww 0xB8001000 0x92100000\r
+monitor mww 0x80000f00 0x12344321\r
+monitor mww 0xB8001000 0xa2100000\r
+monitor mww 0x80000000 0x12344321\r
+monitor mww 0x80000000 0x12344321\r
+monitor mww 0xB8001000 0xb2100000\r
+#monitor char 0x80000033 0xda\r
+monitor mwb 0x80000033 0xda\r
+#monitor char 0x81000000 0xff\r
+monitor mwb 0x81000000 0xff\r
+monitor mww 0xB8001000 0x82226080\r
+monitor mww 0x80000000 0xDEADBEEF\r
+monitor mww 0xB8001010 0x0000000c\r
+\r
+#  LOAD IMAGE :\r
+#\r
+\r
+# Load the program executable called "u-boot"\r
+load test.elf\r
+\r
+# Load the symbols for the program.\r
+symbol-file test.elf\r
+\r
+# RUN TO MAIN :\r
+#\r
+# Set a breakpoint at main().\r
+#b reset\r
+b main\r
+\r
+# Run to the breakpoint.\r
+c\r
+
diff --git a/testing/examples/ledtest-imx31pdk/ldscript b/testing/examples/ledtest-imx31pdk/ldscript
new file mode 100644 (file)
index 0000000..1baea1e
--- /dev/null
@@ -0,0 +1,18 @@
+SECTIONS\r
+{\r
+       . = 0x80000100;\r
+       .text : { *(.text) }\r
+       .data ALIGN(0x10): { *(.data) }\r
+       .bss ALIGN(0x10): {\r
+           __bss_start__ = ABSOLUTE(.);\r
+           *(.bss)\r
+           . += 0x100;\r
+        }\r
+       __bss_end__ = .;\r
+PROVIDE (__stack = .);\r
+       _end = .;\r
+       .debug_info     0 : { *(.debug_info) }\r
+       .debug_abbrev   0 : { *(.debug_abbrev) }\r
+       .debug_line     0 : { *(.debug_line) }\r
+       .debug_frame    0 : { *(.debug_frame) }\r
+}\r
diff --git a/testing/examples/ledtest-imx31pdk/test.c b/testing/examples/ledtest-imx31pdk/test.c
new file mode 100644 (file)
index 0000000..992447b
--- /dev/null
@@ -0,0 +1,58 @@
+/***************************************************************************
+ *   Copyright (C) 2009 by Alan Carvalho de Assis                         *
+ *   acassis@gmail.com                                                     *
+ *                                                                         *
+ *   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.             *
+ ***************************************************************************/
+
+void delay()
+{
+       int i;
+       for (i = 0; i < 500000; i++);
+}
+
+/* MAIN ARM FUNTION */
+int main (void)  
+{
+        volatile unsigned char *led = ((volatile unsigned char *)0xB6020000);
+       
+       while(1)
+       {
+               *led = 0xFF;
+               delay();
+               *led = 0x00;
+               delay();
+       } /* FOR */
+
+} /* MAIN */
+
+__gccmain()
+{
+} /* GCCMAIN */
+
+
+void exit(int exit_code)
+{
+  while(1);
+} /* EXIT */
+
+
+atexit()
+{
+  while(1);
+} /* ATEXIT */
+
+
diff --git a/testing/examples/ledtest-imx31pdk/test.elf b/testing/examples/ledtest-imx31pdk/test.elf
new file mode 100644 (file)
index 0000000..bdd69d6
Binary files /dev/null and b/testing/examples/ledtest-imx31pdk/test.elf differ