]> git.sur5r.net Git - openocd/commitdiff
Alan Carvalho de Assis <acassis@gmail.com> test app for imx27
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Thu, 15 Jan 2009 13:22:04 +0000 (13:22 +0000)
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Thu, 15 Jan 2009 13:22:04 +0000 (13:22 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1323 b42882b7-edfa-0310-969c-e2dbd0fdcd60

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

diff --git a/testing/examples/ledtest-imx27ads/Makefile b/testing/examples/ledtest-imx27ads/Makefile
new file mode 100644 (file)
index 0000000..4251649
--- /dev/null
@@ -0,0 +1,42 @@
+# This will make the test program for a Freescale iMX27 ADS Board with a \r
+# FreeScale iMX27 CPU \r
+\r
+PROC=arm\r
+TYPE=926ejs-linux\r
+LDSCRIPT=ldscript\r
+\r
+PATH:=/opt/freescale/usr/local/gcc-4.1.1-glibc-2.4-nptl-sf-1/arm-926ejs-linux/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=arm920t\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-imx27ads/crt0.S b/testing/examples/ledtest-imx27ads/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-imx27ads/gdbinit-imx27ads b/testing/examples/ledtest-imx27ads/gdbinit-imx27ads
new file mode 100644 (file)
index 0000000..44758cf
--- /dev/null
@@ -0,0 +1,36 @@
+echo Script to load ledtest on iMX27ADS.\n\r
+\r
+# Note: you need to startup openocd with "-f board/imx27ads.cfg"\r
+# in order to it initialize RAM memory.\r
+\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
+# CONNECT TO TARGET :\r
+target remote 127.0.0.1:3333\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
+\r
diff --git a/testing/examples/ledtest-imx27ads/ldscript b/testing/examples/ledtest-imx27ads/ldscript
new file mode 100644 (file)
index 0000000..39cf768
--- /dev/null
@@ -0,0 +1,18 @@
+SECTIONS\r
+{\r
+    . = 0xA0000000;\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-imx27ads/test.c b/testing/examples/ledtest-imx27ads/test.c
new file mode 100644 (file)
index 0000000..945778d
--- /dev/null
@@ -0,0 +1,60 @@
+/***************************************************************************\r
+ *   Copyright (C) 2009 by Alan Carvalho de Assis                         *\r
+ *   acassis@gmail.com                                                     *\r
+ *                                                                         *\r
+ *   This program is free software; you can redistribute it and/or modify  *\r
+ *   it under the terms of the GNU General Public License as published by  *\r
+ *   the Free Software Foundation; either version 2 of the License, or     *\r
+ *   (at your option) any later version.                                   *\r
+ *                                                                         *\r
+ *   This program is distributed in the hope that it will be useful,       *\r
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *\r
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *\r
+ *   GNU General Public License for more details.                          *\r
+ *                                                                         *\r
+ *   You should have received a copy of the GNU General Public License     *\r
+ *   along with this program; if not, write to the                         *\r
+ *   Free Software Foundation, Inc.,                                       *\r
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *\r
+ ***************************************************************************/\r
+\r
+void delay()\r
+{\r
+       int i;\r
+       for (i = 0; i < 500000; i++);\r
+}\r
+\r
+/* MAIN ARM FUNTION */\r
+int main (void)  \r
+{\r
+       int i;  \r
+        volatile unsigned char *ledoff = ((volatile unsigned char *)0xD4000008);\r
+        volatile unsigned char *ledon = ((volatile unsigned char *)0xD400000C);\r
+       \r
+       for (i = 0; i < 10000; i++)\r
+       {\r
+               *ledon = 0x30;\r
+               delay();\r
+               *ledoff = 0x30;\r
+               delay();\r
+       } /* FOR */\r
+\r
+} /* MAIN */\r
+\r
+__gccmain()\r
+{\r
+} /* GCCMAIN */\r
+\r
+\r
+void exit(int exit_code)\r
+{\r
+  while(1);\r
+} /* EXIT */\r
+\r
+\r
+atexit()\r
+{\r
+  while(1);\r
+} /* ATEXIT */\r
+\r
+\r
diff --git a/testing/examples/ledtest-imx27ads/test.elf b/testing/examples/ledtest-imx27ads/test.elf
new file mode 100644 (file)
index 0000000..f65dcd6
Binary files /dev/null and b/testing/examples/ledtest-imx27ads/test.elf differ