|
From: Erik M. <er...@us...> - 2001-10-07 22:09:56
|
Update of /cvsroot/blob/blob/src/diag
In directory usw-pr-cvs1:/tmp/cvs-serv27014
Modified Files:
Makefile.am
Added Files:
commands.c initcalls.c ld-script main.c start.S
Log Message:
Basic files for diag
--- NEW FILE: commands.c ---
/*
* commands.c: commands for diag
*
* Copyright (C) 2001 Erik Mouw <J.A...@it...>
*
* $Id: commands.c,v 1.1 2001/10/07 22:09:54 erikm Exp $
*
* 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
*
*/
#ident "$Id: commands.c,v 1.1 2001/10/07 22:09:54 erikm Exp $"
#ifdef HAVE_CONFIG_H
# include <blob/config.h>
#endif
#include <blob/command.h>
#include <blob/terminal.h>
static char resethelp[] = "reset\n"
"Reset terminal\n";
__commandlist(reset_terminal, "reset", resethelp);
--- NEW FILE: initcalls.c ---
/*
* initcalls.c: init and exit calls for diag
*
* Copyright (C) 2001 Erik Mouw <J.A...@it...>
*
* $Id: initcalls.c,v 1.1 2001/10/07 22:09:54 erikm Exp $
*
* 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
*
*/
#ident "$Id: initcalls.c,v 1.1 2001/10/07 22:09:54 erikm Exp $"
#ifdef HAVE_CONFIG_H
# include <blob/config.h>
#endif
#include <blob/init.h>
#include <blob/icache.h>
#include <blob/led.h>
#include <blob/serial.h>
#include <blob/time.h>
/* default serial initialisation */
static void serial_default_init(void)
{
SerialInit(baud9k6);
}
/* init calls */
__initlist(serial_default_init, INIT_LEVEL_INITIAL_HARDWARE);
__initlist(enable_icache, INIT_LEVEL_INITIAL_HARDWARE);
__initlist(led_on, INIT_LEVEL_INITIAL_HARDWARE);
__initlist(TimerInit, INIT_LEVEL_OTHER_HARDWARE);
/* exit calls */
__exitlist(disable_icache, INIT_LEVEL_INITIAL_HARDWARE);
__exitlist(led_off, INIT_LEVEL_INITIAL_HARDWARE);
--- NEW FILE: ld-script ---
/*-------------------------------------------------------------------------
* Filename: ld-script
* Version: $Id: ld-script,v 1.1 2001/10/07 22:09:54 erikm Exp $
* Copyright: Copyright (C) 1999, Erik Mouw
* Author: Erik Mouw <J.A...@it...>
* Description: ld (linker) script to make diag.
* Heavily inspired by the Linux kernel linker scripts.
* Created at: Tue Aug 24 17:24:06 1999
* Modified by: Erik Mouw <J.A...@it...>
* Modified at: Sun Aug 29 14:45:54 1999
*-----------------------------------------------------------------------*/
/*OUTPUT_FORMAT("elf32-arm", "elf32-arm", "elf32-arm")*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(_start)
SECTIONS
{
. = 0xc0008000;
. = ALIGN(4);
.text : { *(.text) }
. = ALIGN(4);
.rodata : { *(.rodata) }
. = ALIGN(4);
.data : { *(.data) }
. = ALIGN(4);
.got : { *(.got) }
. = ALIGN(4);
.commandlist : {
__commandlist_start = .;
*(.commandlist)
__commandlist_end = .;
}
. = ALIGN(4);
.initlist : {
__initlist_start = .;
*(.initlist)
__initlist_end = .;
}
. = ALIGN(4);
.exitlist : {
__exitlist_start = .;
*(.exitlist)
__exitlist_end = .;
}
/* the BSS section should be the last section */
. = ALIGN(4);
.bss : { *(.bss) }
}
--- NEW FILE: main.c ---
/*
* main.c: main file for diag
*
* Copyright (C) 2001 Erik Mouw <J.A...@it...>
*
* $Id: main.c,v 1.1 2001/10/07 22:09:54 erikm Exp $
*
* 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
*
*/
#ident "$Id: main.c,v 1.1 2001/10/07 22:09:54 erikm Exp $"
#ifdef HAVE_CONFIG_H
# include <blob/config.h>
#endif
#include <blob/command.h>
#include <blob/error.h>
#include <blob/init.h>
#include <blob/serial.h>
int main(void)
{
int numRead;
char commandline[MAX_COMMANDLINE_LENGTH];
int retval;
/* call subsystems */
init_subsystems();
SerialOutputString("\ndiag version " VERSION "\n"
"Copyright (C) 2001 "
"Stefan Eletzhofer and Erik Mouw\n");
SerialOutputString("diag comes with ABSOLUTELY NO WARRANTY; "
"read the GNU GPL for details.\n");
SerialOutputString("This is free software, and you are welcome "
"to redistribute it\n");
SerialOutputString("under certain conditions; "
"read the GNU GPL for details.\n");
/* the command loop. endless, of course */
for(;;) {
DisplayPrompt("diag> ");
/* wait 10 minutes for a command */
numRead = GetCommand(commandline, MAX_COMMANDLINE_LENGTH, 600);
if(numRead > 0) {
if((retval = parse_command(commandline)) < 0 )
printerror(retval, NULL);
}
}
return 0;
}
--- NEW FILE: start.S ---
/*
* start.S: diag start code
*
* Copyright (C) 1999 2000 2001 Erik Mouw (J.A...@it...) and
* Jan-Derk Bakker (J.D...@it...)
*
* 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
*
*/
.ident "$Id: start.S,v 1.1 2001/10/07 22:09:54 erikm Exp $"
.text
.globl _start
_start:
/* set up the stack pointer */
ldr r0, MEM_START
add r1, r0, #(1024 * 1024)
sub sp, r1, #0x04
loop:
bl main
/* if main ever returns we just call it again */
b loop
/* main memory starts at 0xc0000000 */
MEM_START: .long 0xc0000000
Index: Makefile.am
===================================================================
RCS file: /cvsroot/blob/blob/src/diag/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Makefile.am 2001/10/07 15:07:13 1.1
+++ Makefile.am 2001/10/07 22:09:54 1.2
@@ -0,0 +1,67 @@
+# -*- makefile -*-
+#
+# Makefile.am
+#
+# Copyright (C) 2001 Erik Mouw (J.A...@it...)
+#
+# $Id$
+#
+# 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
+#
+
+
+bin_PROGRAMS = \
+ diag-elf32 \
+ diag
+
+
+INCLUDES += \
+ -I${top_builddir}/include \
+ -I${top_srcdir}/include
+
+
+# WARNING: start.S *must* be the first file, otherwise the target will
+# be linked in the wrong order!
+diag_elf32_SOURCES = \
+ start.S \
+ commands.c \
+ initcalls.c \
+ main.c
+
+
+diag_elf32_LDFLAGS += \
+ -Wl,-T,${srcdir}/ld-script
+
+
+diag_elf32_LDADD += \
+ -L${top_builddir}/src/lib -lblob \
+ -lgcc
+
+
+diag_SOURCES =
+
+
+diag: diag-elf32
+ $(OBJCOPY) $(OCFLAGS) $< $@
+
+
+EXTRA_DIST = \
+ ld-script
+
+
+CLEANFILES = ${srcdir}/*~
+
+
+DISTCLEANFILES = ${builddir}/.deps/*.P
|