From d8490491e672cef628528904df559cdc618bbfd7 Mon Sep 17 00:00:00 2001 From: oharboe Date: Wed, 14 Jan 2009 19:30:51 +0000 Subject: [PATCH] Alan Carvalho de Assis - testcase git-svn-id: svn://svn.berlios.de/openocd/trunk@1319 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- testing/examples/ledtest-imx31pdk/Makefile | 42 ++++++ testing/examples/ledtest-imx31pdk/crt0.S | 47 ++++++ .../ledtest-imx31pdk/gdbinit-imx31pdk | 136 ++++++++++++++++++ testing/examples/ledtest-imx31pdk/ldscript | 18 +++ testing/examples/ledtest-imx31pdk/test.c | 58 ++++++++ testing/examples/ledtest-imx31pdk/test.elf | Bin 0 -> 3242 bytes 6 files changed, 301 insertions(+) create mode 100644 testing/examples/ledtest-imx31pdk/Makefile create mode 100644 testing/examples/ledtest-imx31pdk/crt0.S create mode 100644 testing/examples/ledtest-imx31pdk/gdbinit-imx31pdk create mode 100644 testing/examples/ledtest-imx31pdk/ldscript create mode 100644 testing/examples/ledtest-imx31pdk/test.c create mode 100644 testing/examples/ledtest-imx31pdk/test.elf diff --git a/testing/examples/ledtest-imx31pdk/Makefile b/testing/examples/ledtest-imx31pdk/Makefile new file mode 100644 index 000000000..fc643adc2 --- /dev/null +++ b/testing/examples/ledtest-imx31pdk/Makefile @@ -0,0 +1,42 @@ +# $Header: $ +# This will make the test program for ARM. + +PROC=arm +TYPE=none-linux-gnueabi +LDSCRIPT=ldscript + +PATH:=/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/:$(PATH) +CC=$(PROC)-$(TYPE)-gcc +AS=$(PROC)-$(TYPE)-as +AR=$(PROC)-$(TYPE)-ar +LD=$(PROC)-$(TYPE)-ld +NM=$(PROC)-$(TYPE)-nm +OBJDUMP=$(PROC)-$(TYPE)-objdump +CFLAGS= -g -c -mcpu=arm1136j-s + +all: test.elf + +# Make a little endian image: +# In Eclipse, add the line : +# source gdbinit +# to : Run -> Debug... (menu) -> Commands (tab): Commands (listbox) +# To start gdb from a window use : arm-elf-gdb --command=gdbinit +test.elf: test.c Makefile ldscript crt0.S + $(CC) $(CFLAGS) -o crt0.o crt0.S + $(CC) $(CFLAGS) -o test.o test.c + $(LD) -g -v -T$(LDSCRIPT) -o test.elf crt0.o test.o + $(NM) test.elf + + +dump: + $(OBJDUMP) --all-headers test.elf + +dump_test: + $(OBJDUMP) --disassemble test.elf + +dump_full: + $(OBJDUMP) --full-contents test.elf + +clean: + -/bin/rm -f *.o *~ test.elf + diff --git a/testing/examples/ledtest-imx31pdk/crt0.S b/testing/examples/ledtest-imx31pdk/crt0.S new file mode 100644 index 000000000..6c15be213 --- /dev/null +++ b/testing/examples/ledtest-imx31pdk/crt0.S @@ -0,0 +1,47 @@ +/* Sample initialization file */ + + .extern main + .extern exit + +/* .text is used instead of .section .text so it works with arm-aout too. */ + .text + .code 32 + .align 0 + + .global _mainCRTStartup + .global _start + .global start +start: +_start: +_mainCRTStartup: + +/* Start by setting up a stack */ + /* Set up the stack pointer to end of bss */ + ldr r3, .LC2 + mov sp, r3 + + sub sl, sp, #512 /* Still assumes 512 bytes below sl */ + + mov a2, #0 /* Second arg: fill value */ + mov fp, a2 /* Null frame pointer */ + mov r7, a2 /* Null frame pointer for Thumb */ + + ldr a1, .LC1 /* First arg: start of memory block */ + ldr a3, .LC2 /* Second arg: end of memory block */ + sub a3, a3, a1 /* Third arg: length of block */ + + mov r0, #0 /* no arguments */ + mov r1, #0 /* no argv either */ + + bl main + bl exit /* Should not return */ + + /* For Thumb, constants must be after the code since only + positive offsets are supported for PC relative addresses. */ + + .align 0 +.LC1: + .word __bss_start__ +.LC2: + .word __bss_end__ + diff --git a/testing/examples/ledtest-imx31pdk/gdbinit-imx31pdk b/testing/examples/ledtest-imx31pdk/gdbinit-imx31pdk new file mode 100644 index 000000000..336ddfba1 --- /dev/null +++ b/testing/examples/ledtest-imx31pdk/gdbinit-imx31pdk @@ -0,0 +1,136 @@ +echo Setting up for the FreeScale iMX31 Board.\n +# SETUP GDB : +# +# Common gdb setup for ARM CPUs +set complaints 1 +set output-radix 10 +set input-radix 10 +set prompt (arm-gdb) +set endian little +dir . + +# Tell GDB to use 1024 bytes packes when downloading, this +# reduces load image download times +set remote memory-write-packet-size 1024 +set remote memory-write-packet-size fixed + + + +# DEFINE MACROS : +# +# Create a "refresh" macro to update gdb's screens after the cpu +# has been stopped by the other CPU or following an "monitor allstop" +define refresh + monitor set hbreak + cont + monitor clear hbreak +end + + +# CONNECT TO TARGET : +target remote 127.0.0.1:3333 +monitor reset run +monitor reset halt + +# iMX31 PDK board initialization commands: + +#// init_ccm + +monitor mww 0x53FC0000 0x040 +monitor mww 0x53F80000 0x074B0B7D + +#//532-133-66.5 +#//monitor mww 0x53F80004 0xFF871D58 +#//monitor mww 0x53F80010 0x0033280C + +#// 399MHz - 26MHz input, PD=1,MFI=7, MFN=27, MFD=40 +monitor mww 0x53F80004 0xFF871D50 +monitor mww 0x53F80010 0x00271C1B + +#// 208-104-52 +#//monitor mww 0x53F80004 0xFF871D48 +#//monitor mww 0x53F80010 0x04002000 + + +#// Configure CPLD on CS5 +monitor mww 0xb8002050 0x0000DCF6 +monitor mww 0xb8002054 0x444A4541 +monitor mww 0xb8002058 0x44443302 + +#// Disable maximum drive strength for SDRAM/DDR lines by clearing DSE1 bits +#// in SW_PAD_CTL registers + +#// SDCLK +monitor mww 0x43FAC26C 0 + +#// CAS +monitor mww 0x43FAC270 0 + +#// RAS +monitor mww 0x43FAC274 0 + +#// CS2 (CSD0) +monitor mww 0x43FAC27C 0x1000 + +#// DQM3 +monitor mww 0x43FAC284 0 + +#// DQM2, DQM1, DQM0, SD31-SD0, A25-A0, MA10 (0x288..0x2DC) +monitor mww 0x43FAC288 0 +monitor mww 0x43FAC28C 0 +monitor mww 0x43FAC290 0 +monitor mww 0x43FAC294 0 +monitor mww 0x43FAC298 0 +monitor mww 0x43FAC29C 0 +monitor mww 0x43FAC2A0 0 +monitor mww 0x43FAC2A4 0 +monitor mww 0x43FAC2A8 0 +monitor mww 0x43FAC2AC 0 +monitor mww 0x43FAC2B0 0 +monitor mww 0x43FAC2B4 0 +monitor mww 0x43FAC2B8 0 +monitor mww 0x43FAC2BC 0 +monitor mww 0x43FAC2C0 0 +monitor mww 0x43FAC2C4 0 +monitor mww 0x43FAC2C8 0 +monitor mww 0x43FAC2CC 0 +monitor mww 0x43FAC2D0 0 +monitor mww 0x43FAC2D4 0 +monitor mww 0x43FAC2D8 0 +monitor mww 0x43FAC2DC 0 + +#// Initialization script for 32 bit DDR on MX31 PDK +monitor mww 0xB8001010 0x00000004 +monitor mww 0xB8001004 0x006ac73a +monitor mww 0xB8001000 0x92100000 +monitor mww 0x80000f00 0x12344321 +monitor mww 0xB8001000 0xa2100000 +monitor mww 0x80000000 0x12344321 +monitor mww 0x80000000 0x12344321 +monitor mww 0xB8001000 0xb2100000 +#monitor char 0x80000033 0xda +monitor mwb 0x80000033 0xda +#monitor char 0x81000000 0xff +monitor mwb 0x81000000 0xff +monitor mww 0xB8001000 0x82226080 +monitor mww 0x80000000 0xDEADBEEF +monitor mww 0xB8001010 0x0000000c + +# LOAD IMAGE : +# + +# Load the program executable called "u-boot" +load test.elf + +# Load the symbols for the program. +symbol-file test.elf + +# RUN TO MAIN : +# +# Set a breakpoint at main(). +#b reset +b main + +# Run to the breakpoint. +c + diff --git a/testing/examples/ledtest-imx31pdk/ldscript b/testing/examples/ledtest-imx31pdk/ldscript new file mode 100644 index 000000000..1baea1eff --- /dev/null +++ b/testing/examples/ledtest-imx31pdk/ldscript @@ -0,0 +1,18 @@ +SECTIONS +{ + . = 0x80000100; + .text : { *(.text) } + .data ALIGN(0x10): { *(.data) } + .bss ALIGN(0x10): { + __bss_start__ = ABSOLUTE(.); + *(.bss) + . += 0x100; + } + __bss_end__ = .; +PROVIDE (__stack = .); + _end = .; + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } +} diff --git a/testing/examples/ledtest-imx31pdk/test.c b/testing/examples/ledtest-imx31pdk/test.c new file mode 100644 index 000000000..992447b86 --- /dev/null +++ b/testing/examples/ledtest-imx31pdk/test.c @@ -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 index 0000000000000000000000000000000000000000..bdd69d6aab205476ca4a2d2fb695943b4c5a71fb GIT binary patch literal 3242 zcmb<-^>JflWMqH=CI$@#FprU;!GwW{7{fq{Xc z;Ri?qGXn!VNDL$bqK61JFqr?8`ND#SOly1}F$gSp%(!8}L&kyy4@DT}KNV4!|CB+& z=>Y@7g2x~^VFrfRY77jo8JHLv7?>Fvcn>Ui$Z$jVCCdh%M;sS?A2Ap#cr0MR{gjD; z;gx`a^ixKI=0_mDfP(Z>9*{i@K@WfY|9^|;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