* tools/build/.cvsignore, tools/build/ChangeLog,

tools/build/Makefile.am, tools/build/README, tools/build/binpatch.c,
	tools/build/cklength.c, tools/build/config.h.in,
	tools/build/configure.ac, tools/build/cvsignore-add.sh,
	tools/build/doxy-filter, tools/build/eolstrip.c,
	tools/build/install-if-change.in, tools/build/multigen,
	tools/build/packhex.c, tools/build/rtems-bin2c.c,
	tools/build/search-id.sh, tools/build/unhex.c, tools/cpu/.cvsignore,
	tools/cpu/ChangeLog, tools/cpu/Makefile.am, tools/cpu/configure.ac,
	tools/cpu/generic/.cvsignore, tools/cpu/generic/ChangeLog,
	tools/cpu/generic/Makefile.am, tools/cpu/generic/configure.ac,
	tools/cpu/generic/size_rtems.in, tools/cpu/nios2/.cvsignore,
	tools/cpu/nios2/ChangeLog, tools/cpu/nios2/Makefile.am,
	tools/cpu/nios2/README, tools/cpu/nios2/bridges.c,
	tools/cpu/nios2/bridges.h, tools/cpu/nios2/clocks.c,
	tools/cpu/nios2/clocks.h, tools/cpu/nios2/configure.ac,
	tools/cpu/nios2/devices.c, tools/cpu/nios2/devices.h,
	tools/cpu/nios2/linkcmds.c, tools/cpu/nios2/linkcmds.h,
	tools/cpu/nios2/memory.c, tools/cpu/nios2/memory.h,
	tools/cpu/nios2/nios2gen.c, tools/cpu/nios2/output.c,
	tools/cpu/nios2/output.h, tools/cpu/nios2/ptf.c,
	tools/cpu/nios2/ptf.h, tools/cpu/nios2/sample.ptf,
	tools/cpu/sh/.cvsignore, tools/cpu/sh/AUTHORS, tools/cpu/sh/COPYING,
	tools/cpu/sh/ChangeLog, tools/cpu/sh/Makefile.am, tools/cpu/sh/TODO,
	tools/cpu/sh/configure.ac, tools/cpu/sh/sci.c, tools/cpu/sh/sci.h,
	tools/cpu/sh/shgen.c: New files.
This commit is contained in:
Joel Sherrill
2011-05-17 20:39:40 +00:00
parent d305d75c7e
commit d751cecbb1
58 changed files with 7659 additions and 0 deletions
+27
View File
@@ -1,3 +1,30 @@
* tools/build/.cvsignore, tools/build/ChangeLog,
tools/build/Makefile.am, tools/build/README, tools/build/binpatch.c,
tools/build/cklength.c, tools/build/config.h.in,
tools/build/configure.ac, tools/build/cvsignore-add.sh,
tools/build/doxy-filter, tools/build/eolstrip.c,
tools/build/install-if-change.in, tools/build/multigen,
tools/build/packhex.c, tools/build/rtems-bin2c.c,
tools/build/search-id.sh, tools/build/unhex.c, tools/cpu/.cvsignore,
tools/cpu/ChangeLog, tools/cpu/Makefile.am, tools/cpu/configure.ac,
tools/cpu/generic/.cvsignore, tools/cpu/generic/ChangeLog,
tools/cpu/generic/Makefile.am, tools/cpu/generic/configure.ac,
tools/cpu/generic/size_rtems.in, tools/cpu/nios2/.cvsignore,
tools/cpu/nios2/ChangeLog, tools/cpu/nios2/Makefile.am,
tools/cpu/nios2/README, tools/cpu/nios2/bridges.c,
tools/cpu/nios2/bridges.h, tools/cpu/nios2/clocks.c,
tools/cpu/nios2/clocks.h, tools/cpu/nios2/configure.ac,
tools/cpu/nios2/devices.c, tools/cpu/nios2/devices.h,
tools/cpu/nios2/linkcmds.c, tools/cpu/nios2/linkcmds.h,
tools/cpu/nios2/memory.c, tools/cpu/nios2/memory.h,
tools/cpu/nios2/nios2gen.c, tools/cpu/nios2/output.c,
tools/cpu/nios2/output.h, tools/cpu/nios2/ptf.c,
tools/cpu/nios2/ptf.h, tools/cpu/nios2/sample.ptf,
tools/cpu/sh/.cvsignore, tools/cpu/sh/AUTHORS, tools/cpu/sh/COPYING,
tools/cpu/sh/ChangeLog, tools/cpu/sh/Makefile.am, tools/cpu/sh/TODO,
tools/cpu/sh/configure.ac, tools/cpu/sh/sci.c, tools/cpu/sh/sci.h,
tools/cpu/sh/shgen.c: New files.
2011-05-17 Joel Sherrill <joel.sherrill@oarcorp.com>
* tools/build/.cvsignore, tools/build/ChangeLog,
+18
View File
@@ -0,0 +1,18 @@
aclocal.m4
autom4te*.cache
config.cache
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
depcomp
install-if-change
install-sh
Makefile
Makefile.in
missing
mkinstalldirs
stamp-h.in
+209
View File
@@ -0,0 +1,209 @@
2011-02-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: Require autoconf-2.68, automake-1.11.1.
2010-07-30 Ralf Corsépius <ralf.corsepius@rtems.org>
* rtems-bin2c.c: Fix memory leak in '.c' suffix strip.
Also strip '.h' suffix.
2010-07-30 Ralf Corsépius <ralf.corsepius@rtems.org>
* rtems-bin2c.c: Make -v (verbose) working.
2010-07-30 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: Check for libgen.h, basename.
* rtems-bin2c.c: Use basename(3) instead of strrchr cascade.
Introduce ifbasename. Use ifbasename in generated files.
2010-07-29 Ralf Corsépius <ralf.corsepius@rtems.org>
* rtems-bin2c.c: Add -C and -H options.
2010-03-12 Joel Sherrill <joel.sherrill@oarcorp.com>
* eolstrip.c: Readdress use of ctype methods per recommendation from
D.J. Delorie on the newlib mailing list. We should pass an unsigned
char into these methods.
2007-09-18 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am: Rename bin2c to rtems-bin2c.
2007-09-10 Joel Sherrill <joel.sherrill@OARcorp.com>
* bin2c.c: Updated license after author changed it.
2007-09-07 Joel Sherrill <joel.sherrill@OARcorp.com>
* bin2c.c: Update comments.
2007-09-04 Joel Sherrill <joel.sherrill@oarcorp.com>
* bin2c.c: Significant improvements -- add multiple options, generate
both C and H files, do not always generate static. fix indentation,
add comments.
2007-09-04 Joel Sherrill <joel.sherrill@oarcorp.com>
* bin2c.c: New file.
http://www.wxwidgets.org/wiki/index.php/Embedding_PNG_Images-Bin2c_In_C
2007-09-04 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am: Add bin2c so we can have a more reliable way to convert
binary files to objects. If they are in C, we can use the correct CPU
CFLAGS and they will link easier.
2006-12-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: New BUG-REPORT address.
2006-10-17 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: Require autoconf-2.60. Require automake-1.10.
2006-07-13 Ralf Corsepius <ralf.corsepius@rtems.org>
* doxy-filter: New.
* Makefile.am: Add doxy-filter.
2006-07-11 Ralf Corsepius <ralf.corsepius@rtems.org>
* ampolish3.in: Remove.
* Makefile.am: Remove ampolish3.
* configure.ac: Remove ampolish3, perl.
2006-01-14 Ralf Corsepius <ralf.corsepius@rtems.org>
* ampolish3.in: Check Makefile.am for SUBDIRS.
Add all-am: for PREINSTALL_FILES.
2006-01-12 Ralf Corsepius <ralf.corsepius@rtems.org>
* ampolish3.in: Add all: for PREINSTALL_FILES.
Add all-local for TMPINSTALL_FILES.
Misc bug fixes.
2006-01-12 Ralf Corsepius <ralf.corsepius@rtems.org>
* ampolish3.in: Check if Makefile.am already contains CLEANFILES or
DISTCLEANFILES.
2006-01-10 Ralf Corsepius <ralf.corsepius@rtems.org>
* ampolish3.in: Update.
2005-10-25 Ralf Corsepius <ralf.corsepius@rtems.org>
* ampolish3.in: Sync with private bleeding-edge .
2005-10-24 Ralf Corsepius <ralf.corsepius@rtems.org>
* ampolish3.in: Use @PERL@, partial update from local sources.
2005-10-24 Ralf Corsepius <ralf.corsepius@rtems.org>
* configure.ac: Add ampolish3.
* Makefile.am: Add ampolish3.
* ampolish3.in: New.
2004-09-24 Ralf Corsepius <ralf.corsepius@rtems.org>
* configure.ac: Require automake > 1.9.
2004-02-20 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* Makefile.am: Add EXTRA_DIST = search-id.sh multigen
cvsignore-add.sh.
2003-12-12 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Require automake >= 1.8, autoconf >= 2.59.
2003-08-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Use rtems-bugs@rtems.com as bug report email address.
2003-03-07 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Add AC_CHECK_HEADERS(getopt.h) to work around a bug
in autoconf-2.57.
2003-03-06 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Remove AC_CONFIG_AUX_DIR.
2003-03-02 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Add AC_CHECK_HEADERS.
2003-02-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: AM_INIT_AUTOMAKE([1.7.2]).
2003-02-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: AC_PREREQ(2.57).
2002-10-21 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* .cvsignore: Reformat.
Add autom4te*cache.
Remove autom4te.cache.
2002-10-02 Chris Johns <cjohns@cybertec.com.au>
* cvsignore-add.sh: Script to append a specific file to all
.cvsignore files if the files exists is a specific directory.
2002-05-01 Joel Sherrill <joel@OARcorp.com>
* lock-directory.in, unlock-directory.in: Removed.
* Makefile.am, README, .cvsignore: Updated to reflect above.
2002-04-01 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Remove AC_EXEEXT (obsolete).
2002-03-27 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac:
AC_INIT(package,_RTEMS_VERSION,_RTEMS_BUGS).
AM_INIT_AUTOMAKE([no-define foreign 1.6]).
* Makefile.am: Remove AUTOMAKE_OPTIONS.
2001-10-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* .cvsignore: Add autom4te.cache for autoconf > 2.52.
* configure.in: Remove.
* configure.ac: New file, generated from configure.in by autoupdate.
2001-01-24 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* config.h.in: Automatically generated. Remove from CVS.
2000-11-09 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* Makefile.am: Use ... instead of RTEMS_TOPdir in ACLOCAL_AMFLAGS.
2000-11-02 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* Makefile.am: Switch to ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal.
2000-10-30 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* Makefile.am: Switch to GNU-canonicalized autoconf macros.
2000-08-10 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* multigen: Fix BARE_CPU_CFLAGS.
2000-08-06 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* multigen: Fix usage.
2000-08-10 Joel Sherrill <joel@OARcorp.com>
* ChangeLog: New file.
+26
View File
@@ -0,0 +1,26 @@
##
## $Id$
##
ACLOCAL_AMFLAGS = -I ../../aclocal
bin_PROGRAMS = cklength eolstrip packhex unhex rtems-bin2c
noinst_PROGRAMS = binpatch
cklength_SOURCES = cklength.c
eolstrip_SOURCES = eolstrip.c
packhex_SOURCES = packhex.c
unhex_SOURCES = unhex.c
binpatch_SOURCES = binpatch.c
rtems_bin2c_SOURCES = rtems-bin2c.c
bin_SCRIPTS = install-if-change
noinst_SCRIPTS = search-id.sh multigen cvsignore-add.sh
EXTRA_DIST = search-id.sh multigen cvsignore-add.sh
noinst_SCRIPTS += doxy-filter
EXTRA_DIST += doxy-filter
include $(top_srcdir)/../../automake/host.am
+10
View File
@@ -0,0 +1,10 @@
#
# $Id$
#
Misc. support tools for RTEMS workspaces.
install-if-change
Smart install script that also can append suffixes as it
installs (suffixes used for debug and profile variants).
Requires bash or ksh.
+156
View File
@@ -0,0 +1,156 @@
/*
* $Id$
*/
#include <stdio.h>
#include <stdlib.h>
/*
* This function will patch binary file
*/
static char buf[512];
static void
usage(void)
{
printf("usage: binpatch [-h] <ofile> <ifile> <reloc> <off> <byte0> "
"[<byte1> [<byte2> [<byte3>]]]\n");
printf("this function patches binary file at specified offset with\n");
printf("up to 4 bytes provided on command line \n");
printf("-h - prints this message\n\n");
printf("<ofile> - output file\n");
printf("<ifile> - input ifile\n");
printf("<reloc> - relocation address of image\n");
printf("<off> - offset of patch, offset in file is at off - reloc\n");
printf("<byte0> - byte 0 of patch\n");
printf("<byte1> - byte 1 of patch\n");
printf("<byte2> - byte 1 of patch\n");
printf("<byte3> - byte 1 of patch\n");
return;
}
int
main(int argc, char **argv)
{
int c;
FILE *ofp, *ifp;
char patch[4], *end;
int patchLen, tmp, i, off, cnt, patched, len, reloc;
/* parse command line options */
while ((c = getopt(argc, argv, "h")) >= 0)
{
switch (c)
{
case 'h':
usage();
return 0;
default:
usage();
return 1;
}
}
if(argc < 6)
{
usage();
return 1;
}
/* Let us get offset in file */
reloc = strtol(argv[3], &end, 0);
if(end == argv[3] || off < 0)
{
fprintf(stderr, "bad reloc value %s\n", argv[3]);
return 1;
}
off = strtol(argv[4], &end, 0);
if(end == argv[4] || off < 0 || off < reloc)
{
fprintf(stderr, "bad offset value %s\n", argv[4]);
return 1;
}
off -= reloc;
/* Let us get patch */
patchLen = argc - 5;
for(i=0; i<patchLen; i++)
{
tmp = strtol(argv[5+i], &end, 0);
if(end == argv[4+i] || tmp < 0 || tmp > 0xff)
{
fprintf(stderr, "bad byte value %s\n", argv[5+i]);
return 1;
}
patch[i] = tmp;
}
ifp = fopen(argv[2], "r");
if(ifp == NULL)
{
fprintf(stderr, "unable to open file %s\n", argv[2]);
return 1;
}
ofp = fopen(argv[1], "w");
if(ofp == NULL)
{
fprintf(stderr, "unable to open file %s\n", argv[1]);
return 1;
}
cnt = 0;
patched = 0;
for(;;)
{
len = fread(buf, 1, sizeof(buf), ifp);
if(len == 0)
{
break;
}
if(cnt <= off && (cnt + len) > off)
{
/* Perform patch */
for(i=0; i<patchLen && (off+i)<(cnt+len); i++)
{
buf[off-cnt+i] = patch[i];
}
patched = 1;
}
else if(cnt > off && cnt < (off + patchLen))
{
/* Perform patch */
for(i=cnt-off; i<patchLen; i++)
{
buf[off-cnt+i] = patch[i];
}
patched = 1;
}
fwrite(buf, 1, len, ofp);
cnt += len;
}
fclose(ifp);
fclose(ofp);
if(!patched)
{
fprintf(stderr, "warning: offset is beyond input file length\n");
fprintf(stderr, " no patch is performed\n");
}
return 0;
}
+377
View File
@@ -0,0 +1,377 @@
/*
* cklength - check the length of lines in a file
*
* This program check to see if the files passed to it on the command line
* contain a line which exceeds the maximum allowable length. The default
* maximum line length is 80.
*
* usage: cklength [ -v ] [ arg ... ] files...
* -l length -- maximum line length
* -v -- verbose
*
* $Id$
*/
#define GETOPTARGS "l:nNv"
char *USAGE = "\
usage: cklength [ -v ] [ arg ... ] files... \n\
-l length -- maximum line length\n\
-n -- report line numbers for offending lines\n\
-N -- report line numbers and length for offending lines\n\
-v -- verbose\n\
\n\
Print the name of files which have at least 1 line which exceeds the\n\
maximum line length. The default maximum line length is 80.\n\
";
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <memory.h>
#include <stdarg.h>
#include <errno.h>
#include "config.h"
#ifndef VMS
#ifndef HAVE_STRERROR
extern int sys_nerr;
extern char *sys_errlist[];
#define strerror( _err ) \
((_err) < sys_nerr) ? sys_errlist [(_err)] : "unknown error"
#else /* HAVE_STRERROR */
char *strerror ();
#endif
#else /* VMS */
char *strerror (int,...);
#endif
#define BUFFER_SIZE 512
#define SUCCESS 0
#define FAILURE -1
#define Failed(x) (((int) (x)) == FAILURE)
#define TRUE 1
#define FALSE 0
#define STREQ(a,b) (strcmp(a,b) == 0)
#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
/*
* Definitions for unsigned "ints"; especially for use in data structures
* that will be shared among (potentially) different cpu's (we punt on
* byte ordering problems tho)
*/
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned long u32;
/*
* vars controlled by command line options
*/
int verbose = FALSE; /* be verbose */
int report_line_numbers = FALSE; /* report line numbers of offenders */
int report_line_length = FALSE; /* report line length of offenders */
int line_length = 80; /* maximum allowable line length */
extern char *optarg; /* getopt(3) control vars */
extern int optind, opterr;
char *progname; /* for error() */
int process(char *arg);
void error(int errn, ...);
long getparm(char *s, long min, long max, char *msg);
#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
#define ERR_FATAL (ERR_ERRNO / 2) /* fatal error ; no return */
#define ERR_ABORT (ERR_ERRNO / 4) /* fatal error ; abort */
#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
#define stol(p) strtol(p, (char **) NULL, 0)
int Open(), Read(), Write();
int main(
int argc,
char **argv
)
{
register int c;
int showusage = FALSE; /* usage error? */
int rc = 0;
/*
* figure out invocation leaf-name
*/
if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
progname = argv[0];
else
progname++;
argv[0] = progname; /* for getopt err reporting */
/*
* Check options and arguments.
*/
opterr = 0; /* we'll report all errors */
while ((c = getopt(argc, argv, GETOPTARGS)) != EOF)
switch (c)
{
case 'l': /* line length */
line_length = atoi( optarg );
if ( line_length < 0 || line_length > BUFFER_SIZE )
error(ERR_FATAL, "(%d) is illegal line length\n",line_length);
break;
case 'n': /* toggle report_line_numbers */
report_line_numbers = ! report_line_numbers;
break;
case 'N': /* toggle both reports */
report_line_numbers = ! report_line_numbers;
report_line_length = ! report_line_length;
break;
case 'v': /* toggle verbose */
verbose = ! verbose;
break;
case '?':
showusage = TRUE;
}
if (showusage)
{
(void) fprintf(stderr, "%s", USAGE);
exit(1);
}
/*
* traverse and process the arguments
*/
for ( ; argv[optind]; optind++)
if (Failed(process(argv[optind])))
rc = FAILURE;
return rc;
}
/*
* process(arg)
*/
int
process(char *arg)
{
FILE *in;
char *bptr;
char buffer[ BUFFER_SIZE ];
int line_number;
int length;
int count;
int rc = SUCCESS; /* succeed by default */
in = fopen( arg, "r" );
if (!in)
error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
count = 0;
for ( line_number=1 ; ; line_number++ ) {
bptr = fgets( buffer, BUFFER_SIZE, in );
if (!bptr)
break;
/*
* Don't count the carriage return.
*/
length = strlen( buffer ) - 1;
if ( length <= line_length )
continue;
if ( count == 0 ) {
fprintf( stderr, "%s\n", arg );
if ( !report_line_numbers )
break;
}
if ( verbose )
fprintf( stderr, "TOO LONG:%d: %s\n", line_number, buffer );
if ( report_line_numbers ) {
if ( report_line_length )
fprintf( stderr, "%d: %d\n" , line_number, length );
else
fprintf( stderr, "%d\n" , line_number );
}
count++;
}
fclose( in );
return rc;
}
/*
* error(errn, arglist)
* report an error to stderr using printf(3) conventions.
* Any output is preceded by '<progname>: '
*
* Uses ERR_FATAL bit to request exit(errn)
* ERR_ABORT to request abort()
* ERR_ERRNO to indicate use of errno instead of argument.
*
* If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
* associated error message is appended to the output.
*/
/*VARARGS*/
void
error(int error_flag, ...)
{
va_list arglist;
register char *format;
int local_errno;
extern int errno;
(void) fflush(stdout); /* in case stdout/stderr same */
local_errno = error_flag & ~ERR_MASK;
if (error_flag & ERR_ERRNO) /* use errno? */
local_errno = errno;
va_start(arglist, error_flag);
format = va_arg(arglist, char *);
(void) fprintf(stderr, "%s: ", progname);
(void) vfprintf(stderr, format, arglist);
va_end(arglist);
if (local_errno)
(void) fprintf(stderr, " (%s)\n", strerror(local_errno));
(void) fflush(stderr);
if (error_flag & (ERR_FATAL | ERR_ABORT))
{
if (error_flag & ERR_FATAL)
{
error(0, "fatal error, exiting");
exit(local_errno ? local_errno : 1);
}
else
{
error(0, "fatal error, aborting");
abort();
}
}
}
long
getparm(char *s,
long min,
long max,
char *msg)
{
long val;
if ( ! strchr("0123456789-", *s))
{
error(ERR_FATAL, "'%s' is not a number", s);
return min;
}
val = strtol(s, (char **) NULL, 0);
if ((val < min) || (val > max))
{
if (min == max)
error(ERR_FATAL, "%s can only be %ld", s, min);
else
error(ERR_FATAL, "%s must be between %ld and %ld", msg, min, max);
}
return val;
}
/*
* Open()
* Perform open(2), returning the file descriptor. Prints
* error message if open fails.
*/
int
Open(char *file,
int oflag,
int mode)
{
int O_fd;
if (Failed(O_fd = open(file, oflag, mode)))
error(
ERR_ERRNO | ERR_FATAL,
"open('%s', 0x%x, 0%o) failed", file, oflag, mode
);
return O_fd;
}
/*
* Read()
* Perform read(2); prints error message if fails.
*/
int
Read(int file,
char *buffer,
unsigned int count)
{
int nbytes;
if (Failed(nbytes = read(file, buffer, count)))
error(
ERR_ERRNO | ERR_FATAL,
"read(%d, 0x%x, %d) failed", file, buffer, count
);
return nbytes;
}
/*
* Write()
* Perform write(2); prints error message if fails.
*/
int
Write(int file,
char *buffer,
unsigned int count)
{
int nbytes;
if (Failed(nbytes = write(file, buffer, count)))
error(
ERR_ERRNO | ERR_FATAL,
"write(%d, 0x%x, %d) failed", file, buffer, count
);
return nbytes;
}
+55
View File
@@ -0,0 +1,55 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strerror' function. */
#undef HAVE_STRERROR
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strtol' function. */
#undef HAVE_STRTOL
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
+26
View File
@@ -0,0 +1,26 @@
#
# $Id$
#
AC_PREREQ([2.68])
AC_INIT([rtems-tools-build],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
AC_CONFIG_SRCDIR([install-if-change.in])
RTEMS_TOP(../..)
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([no-define foreign 1.11.1])
AM_MAINTAINER_MODE
AC_PROG_CC
AC_CHECK_HEADERS([getopt.h libgen.h])
AC_CHECK_FUNCS(strerror strtol basename)
RTEMS_PATH_KSH
AC_CONFIG_HEADERS([config.h])
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([install-if-change],[chmod +x install-if-change])
AC_OUTPUT
+25
View File
@@ -0,0 +1,25 @@
#!/bin/sh
#
# Find a file in the directory tree and create or add to a .cvsignore
# file that file name so it is ignored.
#
# Copyright 2001 Cybertec Pty Limited
# All rights reserved.
#
# $Id$
#
#
# We need one parameter, the file to add.
#
if [ $# -eq 0 ]; then
echo "Usage: $0 file, where file is the one to be added."
exit 1
fi
for f in `find . -name $1`;
do
echo "`dirname $f`/.cvsignore"
echo "$1" >> `dirname $f`/.cvsignore
done
+21
View File
@@ -0,0 +1,21 @@
#!/bin/sh
# doxygen input filter
# $Id$
# usage: doxy-filter <input-file-name>
# Reads <input-file> and writes to stdout.
file=$1
# Does file contain a doxygen @file directive?
if ! grep -q '@file' $file >/dev/null ; then
# No, add one
echo "/** @file $file */"
cat $file
else
# Yes, adjust path to work around doxygen not being able to
# distinguish file names properly
exec sed -e "s,@file.*$,@file $file," $file
fi
+366
View File
@@ -0,0 +1,366 @@
/*
* eolstrip - strip white space from end of lines
*
* This program strips the white space from the end of every line in the
* specified program.
*
* usage: eolstrip [ -v ] [ arg ... ] files...
* -v -- verbose
*
* $Id$
*/
#define GETOPTARGS "vt"
char *USAGE = "\
usage: cklength [ -v ] [ arg ... ] files... \n\
-v -- verbose\n\
-t -- test only .. DO NOT OVERWRITE FILE!!!\n\
\n\
Strip the white space from the end of every line on the list of files.\n\
";
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <memory.h>
#include <stdarg.h>
#include <errno.h>
#include "config.h"
#ifndef VMS
#ifndef HAVE_STRERROR
extern int sys_nerr;
extern char *sys_errlist[];
#define strerror( _err ) \
((_err) < sys_nerr) ? sys_errlist [(_err)] : "unknown error"
#else /* HAVE_STRERROR */
char *strerror ();
#endif
#else /* VMS */
char *strerror (int,...);
#endif
#define BUFFER_SIZE 2048
#define MAX_PATH 2048
#define SUCCESS 0
#define FAILURE -1
#define Failed(x) (((int) (x)) == FAILURE)
#define TRUE 1
#define FALSE 0
#define STREQ(a,b) (strcmp(a,b) == 0)
#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
/*
* Definitions for unsigned "ints"; especially for use in data structures
* that will be shared among (potentially) different cpu's (we punt on
* byte ordering problems tho)
*/
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned long u32;
/*
* vars controlled by command line options
*/
int verbose = FALSE; /* be verbose */
int test_only = FALSE; /* test only */
extern char *optarg; /* getopt(3) control vars */
extern int optind, opterr;
char *progname; /* for error() */
int process(char *arg);
void error(int errn, ...);
long getparm(char *s, long min, long max, char *msg);
#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
#define ERR_FATAL (ERR_ERRNO / 2) /* fatal error ; no return */
#define ERR_ABORT (ERR_ERRNO / 4) /* fatal error ; abort */
#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
#define stol(p) strtol(p, (char **) NULL, 0)
int Open(), Read(), Write();
int main(
int argc,
char **argv
)
{
register int c;
int showusage = FALSE; /* usage error? */
int rc = 0;
/*
* figure out invocation leaf-name
*/
if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
progname = argv[0];
else
progname++;
argv[0] = progname; /* for getopt err reporting */
/*
* Check options and arguments.
*/
opterr = 0; /* we'll report all errors */
while ((c = getopt(argc, argv, GETOPTARGS)) != EOF)
switch (c)
{
case 't': /* toggle test only mode */
test_only = ! test_only;
break;
case 'v': /* toggle verbose */
verbose = ! verbose;
break;
case '?':
showusage = TRUE;
}
if (showusage)
{
(void) fprintf(stderr, "%s", USAGE);
exit(1);
}
/*
* traverse and process the arguments
*/
for ( ; argv[optind]; optind++)
if (Failed(process(argv[optind])))
rc = FAILURE;
return rc;
}
/*
* process(arg)
*/
int
process(char *arg)
{
FILE *in;
FILE *out = (FILE *) 0;
char outname[ MAX_PATH ];
char *bptr;
char buffer[ BUFFER_SIZE ];
int length;
int line_number;
int rc = SUCCESS; /* succeed by default */
in = fopen( arg, "r" );
if (!in)
error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
if ( !test_only ) {
sprintf( outname, "%s.eoltmp", arg );
out = fopen( outname, "w" );
if (!out)
error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
}
if ( verbose )
fprintf( stderr, "Processing %s\n", arg );
for ( line_number=1 ; ; line_number++ ) {
bptr = fgets( buffer, BUFFER_SIZE, in );
if (!bptr)
break;
/*
* Don't count the carriage return.
*/
length = strlen( buffer ) - 1;
if ( buffer[ length ] != '\n' )
error(ERR_ERRNO|ERR_FATAL, "Line %d too long in %s\n", line_number, arg);
while ( isspace( (unsigned char) buffer[ length ] ) )
buffer[ length-- ] = '\0';
if ( test_only ) {
fprintf( stderr, "%s\n", arg );
break;
}
fprintf( out, "%s\n", buffer );
}
fclose( in );
if ( !test_only ) {
fclose( out );
rename( outname, arg );
}
return rc;
}
/*
* error(errn, arglist)
* report an error to stderr using printf(3) conventions.
* Any output is preceded by '<progname>: '
*
* Uses ERR_FATAL bit to request exit(errn)
* ERR_ABORT to request abort()
* ERR_ERRNO to indicate use of errno instead of argument.
*
* If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
* associated error message is appended to the output.
*/
/*VARARGS*/
void
error(int error_flag, ...)
{
va_list arglist;
register char *format;
int local_errno;
extern int errno;
(void) fflush(stdout); /* in case stdout/stderr same */
local_errno = error_flag & ~ERR_MASK;
if (error_flag & ERR_ERRNO) /* use errno? */
local_errno = errno;
va_start(arglist, error_flag);
format = va_arg(arglist, char *);
(void) fprintf(stderr, "%s: ", progname);
(void) vfprintf(stderr, format, arglist);
va_end(arglist);
if (local_errno)
(void) fprintf(stderr, " (%s)\n", strerror(local_errno));
else
(void) fprintf(stderr, "\n");
(void) fflush(stderr);
if (error_flag & (ERR_FATAL | ERR_ABORT))
{
if (error_flag & ERR_FATAL)
{
error(0, "fatal error, exiting");
exit(local_errno ? local_errno : 1);
}
else
{
error(0, "fatal error, aborting");
abort();
}
}
}
long
getparm(char *s,
long min,
long max,
char *msg)
{
long val;
if ( ! strchr("0123456789-", *s))
{
error(ERR_FATAL, "'%s' is not a number", s);
return min;
}
val = strtol(s, (char **) NULL, 0);
if ((val < min) || (val > max))
{
if (min == max)
error(ERR_FATAL, "%s can only be %ld", s, min);
else
error(ERR_FATAL, "%s must be between %ld and %ld", msg, min, max);
}
return val;
}
/*
* Open()
* Perform open(2), returning the file descriptor. Prints
* error message if open fails.
*/
int
Open(char *file,
int oflag,
int mode)
{
int O_fd;
if (Failed(O_fd = open(file, oflag, mode)))
error(
ERR_ERRNO | ERR_FATAL,
"open('%s', 0x%x, 0%o) failed", file, oflag, mode
);
return O_fd;
}
/*
* Read()
* Perform read(2); prints error message if fails.
*/
int
Read(int file,
char *buffer,
unsigned int count)
{
int nbytes;
if (Failed(nbytes = read(file, buffer, count)))
error(
ERR_ERRNO | ERR_FATAL,
"read(%d, 0x%x, %d) failed", file, buffer, count
);
return nbytes;
}
/*
* Write()
* Perform write(2); prints error message if fails.
*/
int
Write(int file,
char *buffer,
unsigned int count)
{
int nbytes;
if (Failed(nbytes = write(file, buffer, count)))
error(
ERR_ERRNO | ERR_FATAL,
"write(%d, 0x%x, %d) failed", file, buffer, count
);
return nbytes;
}
+142
View File
@@ -0,0 +1,142 @@
#!@KSH@ -p
#
# Either bash or ksh will be ok for this; requires (( )) arithmetic
# (-p above just says to not parse $ENV file; makes it faster for
# those of us who set $ENV)
#
# install files if they have changed by running 'cmp', then 'install'
# as necessary.
#
# Optionally, can append a suffix before last existing suffix (if any)
#
# NOTE
# We avoid using typical install(1M) programs since they have
# large variability across systems and we also need to support ou
# -V option.
# So we just copy and chmod by hand.
#
# $Id$
#
progname=`basename $0`
#progname=${0##*/} # fast basename hack for ksh, bash
USAGE=\
"usage: $progname [ -vmV ] file [ file ... ] dest-directory-or-file
-v -- verbose
-V suffix -- suffix to append to targets (before any . suffix)
eg: -V _g would change 'foo' to 'foo_g' and
'libfoo.a' to 'libfoo_g.a'
-m mode -- mode for new file(s)"
fatal() {
if [ "$1" ]
then
echo $* >&2
fi
echo "$USAGE" 1>&2
exit 1
}
#
# process the options
#
verbose=""
suffix=""
mode=""
while getopts vm:V: OPT
do
case "$OPT" in
v)
verbose="yes";;
V)
eval suffix=$OPTARG;;
m)
mode="$OPTARG";;
*)
fatal
esac
done
shiftcount=`expr $OPTIND - 1`
shift $shiftcount
args=$*
#
# Separate source file(s) from dest directory or file
#
files=""
dest=""
for d in $args
do
files="$files $dest"
dest=$d
done
if [ ! "$files" ] || [ ! "$dest" ]
then
fatal "missing files or invalid destination"
fi
#
# Process the arguments
#
targets=""
for f in $files
do
# leaf=`basename $f`
leaf=${f##*/} # fast basename hack for ksh, bash
target=$dest
if [ -d $dest ]
then
# if we were given a suffix, then add it as appropriate
if [ "$suffix" ]
then
case $f in
*.*)
# leaf=`echo $leaf |
# /bin/sed "s/\([~\.]*\)\.\(.*\)$/\1$suffix.\2/"`
# ksh,bash hack for above sed script
leaf=${leaf%%.*}$suffix.${leaf#*.}
[ "$verbose" = "yes" ] &&
echo "$progname: $f will be installed as $leaf"
;;
*)
leaf=$leaf$suffix;;
esac
fi
target=$target/$leaf
fi
[ ! -r $f ] && fatal "can not read $f"
if cmp -s $f $target
then
[ "$verbose" = "yes" ] && echo "'$f' not newer than '$target'"
else
[ "$verbose" = "yes" ] && echo "rm -f $target"
rm -f $target
echo "cp -p $f $target"
cp -p $f $target || exit 1
targets="$targets $target" # keep list for chmod below
fi
done
if [ "$mode" -a "$targets" ]
then
[ "$verbose" = "yes" ] && echo "chmod $mode $targets"
chmod $mode $targets
fi
exit 0
# Local Variables: ***
# mode:ksh ***
# End: ***
+173
View File
@@ -0,0 +1,173 @@
#!/bin/sh
# $Id$
version=0.1
verbose=0
target=
custom=0
config=0
usage()
{
program=`basename $0`
cat << EOF
$program generates RTEMS custom/*.cfgs and config-files for gcc multilib
variants a target's gcc supports
Usage: $program [options]
Options:
--target=STRING target
--custom generate make/custom/*.cfg files
--config generate config scripts
--rtems=DIR use DIR as location of RTEMS source tree
-v, --verbose verbose
-h, --help Print this usage
--version Print version and exit
Examples:
$program --config --target=sh-rtems --rtems=/usr/src/rtems-4.5.0
Generates config scripts for all possible bare BSPs from all
valid multilib variants sh-rtems-gcc supports
$program --custom --target=sh-rtems --rtems=/usr/src/rtems-4.5.0
Generates /usr/src/rtems-4.5.0/make/custom/*.cfg files
for all possible bare BSPs from the multilib variants
sh-rtems-gcc supports
Written by Ralf Corsepius <corsepiu@faw.uni-ulm.de>
EOF
}
while test $# -gt 0; do
case "$1" in
--rtems=*)
rtems_srcdir=`echo "$1" | sed -e 's%--rtems=\(.*\)%\1%g'`
;;
--target=*)
target=`echo "$1" | sed -e 's%--target=\(.*\)%\1%g'`
;;
-v|--verbose)
verbose=1
;;
--custom)
custom=1
;;
--config)
config=1
;;
--version)
echo `basename $0` version $version
exit 0
;;
-h|--help)
usage
exit 1
;;
*)
echo "unknown option $1"
usage
exit 1
;;
esac
shift
done
if test $# -gt 0; then
echo "Invalid number of arguments"
exit 1
fi
if test x$target = x; then
echo "Missing required option:"
echo " --target"
exit 1
fi
if test x$rtems_srcdir = x; then
echo "Missing required option:"
echo " --rtems"
exit 1
fi
if test $config -eq 0 && test $custom -eq 0; then
echo "Missing required option:"
echo " --config"
echo " --custom"
echo " (At least one of these is required)"
exit 1
fi
if test ! -r $rtems_srcdir/VERSION; then
echo "Can't find rtems"
echo "Check value passed to --rtems=<DIR>"
exit 1
fi
if test x$target != x ;then
target_prefix=$target-
fi
# Check for CC
saved_IFS=$IFS; IFS=":"
for i in $PATH; do
if test -f $i/${target_prefix}gcc; then
CC=$i/${target_prefix}gcc
break
fi
done
IFS=$saved_IFS
if test x$CC = x; then
echo "No valid gcc found"
exit 1
fi
test $verbose -gt 0 && echo "Using $CC"
for i in `${CC} --print-multi-lib 2>/dev/null`; do
dir=`echo $i | sed -e 's/;.*$//'`
case $dir in
.) f=$target
flags=""
;;
*) f=`echo $target-$dir | sed -e 's%\/%-%g'`
flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`
;;
esac
if test $config -gt 0; then
cfg="rtems-config.$f"
test $verbose -gt 0 && echo "Generating: $cfg"
cat << EOF > $cfg
#!/bin/sh
${rtems_srcdir}/configure --target=$target \\
'--enable-bare-cpu-cflags=$flags' \\
--enable-rtemsbsp="bare" \\
--enable-bare-cpu-model=NONE \\
--disable-networking \\
--disable-tests \\
--enable-maintainer-mode
EOF
chmod +x $cfg
fi
if test $custom -gt 0; then
cfg=${rtems_srcdir}/make/custom/bare-$f.cfg
test $verbose -gt 0 && echo "Generating: $cfg"
cat << EOF > $cfg
# Config file for the bare-$f BSP
BARE_CPU_CFLAGS=$flags
BARE_CPU_MODEL=NONE
include \$(RTEMS_ROOT)/make/custom/bare.cfg
EOF
fi
done
exit 0
File diff suppressed because it is too large Load Diff
+291
View File
@@ -0,0 +1,291 @@
/*
* bin2c.c
*
* convert a binary file into a C source array.
*
* THE "BEER-WARE LICENSE" (Revision 3.1415):
* sandro AT sigala DOT it wrote this file. As long as you retain this
* notice you can do whatever you want with this stuff. If we meet some
* day, and you think this stuff is worth it, you can buy me a beer in
* return. Sandro Sigala
*
* Subsequently modified by Joel Sherrill <joel.sherrill@oarcorp.com>
* to add a number of capabilities not in the original.
*
* syntax: bin2c [-c] [-z] <input_file> <output_file>
*
* -c do NOT add the "const" keyword to definition
* -s add the "static" keywork to definition
* -v verbose
* -z terminate the array with a zero (useful for embedded C strings)
*
* examples:
* bin2c -c myimage.png myimage_png.cpp
* bin2c -z sometext.txt sometext_txt.cpp
*
*/
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libgen.h>
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
int useconst = 1;
int usestatic = 0;
int verbose = 0;
int zeroterminated = 0;
int createC = 1;
int createH = 1;
int myfgetc(FILE *f)
{
int c = fgetc(f);
if (c == EOF && zeroterminated) {
zeroterminated = 0;
return 0;
}
return c;
}
void process(const char *ifname, const char *ofname)
{
FILE *ifile, *ocfile, *ohfile;
char buf[PATH_MAX], *p;
char obasename[PATH_MAX];
char ocname[PATH_MAX];
char ohname[PATH_MAX];
const char *cp;
size_t len;
/* Error check */
if ( !ifname || !ofname ) {
fprintf(stderr, "process has NULL filename\n");
exit(1);
}
strncpy( obasename, ofname, PATH_MAX );
len = strlen( obasename );
if ( len >= 2 ) {
if ( obasename[len-2] == '.' ) {
if ( (obasename[len-1] == 'c') || (obasename[len-1] == 'h') )
obasename[len-2] = '\0';
}
}
sprintf( ocname, "%s.c", obasename );
sprintf( ohname, "%s.h", obasename );
if ( verbose ) {
fprintf(
stderr,
"in file: %s\n"
"c file: %s\n"
"h file: %s\n",
ifname,
ocname,
ohname
);
}
/* Open input and output files */
ifile = fopen(ifname, "rb");
if (ifile == NULL) {
fprintf(stderr, "cannot open %s for reading\n", ifname);
exit(1);
}
if ( createC ) {
ocfile = fopen(ocname, "wb");
if (ocfile == NULL) {
fprintf(stderr, "cannot open %s for writing\n", ocname);
exit(1);
}
}
if ( createH ) {
ohfile = fopen(ohname, "wb");
if (ohfile == NULL) {
fprintf(stderr, "cannot open %s for writing\n", ohname);
exit(1);
}
}
/* find basename */
char *ifbasename = strdup(ifname);
ifbasename = basename(ifbasename);
strcpy(buf, ifbasename);
for (p = buf; *p != '\0'; ++p)
if (!isalnum(*p))
*p = '_';
if ( createC ) {
/* print C file header */
fprintf(
ocfile,
"/*\n"
" * Declarations for C structure representing binary file %s\n"
" *\n"
" * WARNING: Automatically generated -- do not edit!\n"
" */\n"
"\n"
"#include <sys/types.h>\n"
"\n",
ifbasename
);
/* print structure */
fprintf(
ocfile,
"%s%sunsigned char %s[] = {\n ",
((usestatic) ? "static " : ""),
((useconst) ? "const " : ""),
buf
);
int c, col = 1;
while ((c = myfgetc(ifile)) != EOF) {
if (col >= 78 - 6) {
fprintf(ocfile, "\n ");
col = 1;
}
fprintf(ocfile, "0x%.2x, ", c);
col += 6;
}
fprintf(ocfile, "\n};\n");
/* print sizeof */
fprintf(
ocfile,
"\n"
"%s%ssize_t %s_size = sizeof(%s);\n",
((usestatic) ? "static " : ""),
((useconst) ? "const " : ""),
buf,
buf
);
} /* createC */
/*****************************************************************/
/****** END OF C FILE *****/
/*****************************************************************/
if ( createH ) {
/* print H file header */
fprintf(
ohfile,
"/*\n"
" * Extern declarations for C structure representing binary file %s\n"
" *\n"
" * WARNING: Automatically generated -- do not edit!\n"
" */\n"
"\n"
"#ifndef __%s_h\n"
"#define __%s_h\n"
"\n"
"#include <sys/types.h>\n"
"\n",
ifbasename, /* header */
obasename, /* ifndef */
obasename /* define */
);
/* print structure */
fprintf(
ohfile,
"extern %s%sunsigned char %s[];",
((usestatic) ? "static " : ""),
((useconst) ? "const " : ""),
buf
);
/* print sizeof */
fprintf(
ohfile,
"\n"
"extern %s%ssize_t %s_size;\n",
((usestatic) ? "static " : ""),
((useconst) ? "const " : ""),
buf
);
fprintf(
ohfile,
"\n"
"#endif\n"
);
} /* createH */
/*****************************************************************/
/****** END OF H FILE *****/
/*****************************************************************/
fclose(ifile);
if ( createC ) { fclose(ocfile); }
if ( createH ) { fclose(ohfile); }
}
void usage(void)
{
fprintf(
stderr,
"usage: bin2c [-csvzCH] <input_file> <output_file>\n"
" <input_file> is the binary file to convert\n"
" <output_file> should not have a .c or .h extension\n"
"\n"
" -c - do NOT use const in declaration\n"
" -s - do use static in declaration\n"
" -v - verbose\n"
" -z - add zero terminator\n"
" -H - create c-header only\n"
" -C - create c-source file only\n"
);
exit(1);
}
int main(int argc, char **argv)
{
while (argc > 3) {
if (!strcmp(argv[1], "-c")) {
useconst = 0;
--argc;
++argv;
} else if (!strcmp(argv[1], "-s")) {
usestatic = 1;
--argc;
++argv;
} else if (!strcmp(argv[1], "-v")) {
verbose = 1;
--argc;
++argv;
} else if (!strcmp(argv[1], "-z")) {
zeroterminated = 1;
--argc;
++argv;
} else if (!strcmp(argv[1], "-C")) {
createH = 0;
createC = 1;
--argc;
++argv;
} else if (!strcmp(argv[1], "-H")) {
createC = 0;
createH = 1;
--argc;
++argv;
} else {
usage();
}
}
if (argc != 3) {
usage();
}
/* process( input_file, output_basename ) */
process(argv[1], argv[2]);
return 0;
}
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
#
# $Id$
#
find $1 -type f -a ! -name "*.scn" -a ! -name "bsp_specs" -a \
-print > /tmp/$$.0
find $1 -type f -a ! -name "*.scn" -a ! -name "bsp_specs" -a \
-exec grep -l '$Id' {} \; > /tmp/$$.1
diff /tmp/$$.0 /tmp/$$.1 > /tmp/$$.2
grep "<" /tmp/$$.2 | sed 's/< //' >&1
rm -f /tmp/$$*
+737
View File
File diff suppressed because it is too large Load Diff
+14
View File
@@ -0,0 +1,14 @@
aclocal.m4
autom4te*.cache
config.cache
config.guess
config.log
config.status
config.sub
configure
depcomp
install-sh
Makefile
Makefile.in
missing
mkinstalldirs
+123
View File
@@ -0,0 +1,123 @@
2011-02-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: Require autoconf-2.68, automake-1.11.1.
2006-12-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: New BUG-REPORT address.
2006-10-17 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: Require autoconf-2.60. Require automake-1.10.
2006-08-09 Kolja Waschk <waschk@telos.de>
* configure.ac: New port to Altera NIOS II.
* nios2/.cvsignore, nios2/Makefile.am, nios2/README, nios2/bridges.c,
nios2/bridges.h, nios2/clocks.c, nios2/clocks.h, nios2/configure.ac,
nios2/devices.c, nios2/devices.h, nios2/nios2gen.c, nios2/output.c,
nios2/output.h, nios2/ptf.c, nios2/ptf.h: New files.
2004-09-24 Ralf Corsepius <ralf_corsepius@rtems.org>
* configure.ac: Require automake > 1.9.
2004-09-24 Ralf Corsepius <ralf_corsepiu@rtems.org>
* configure.ac: Remove RTEMS_CPU_SUBDIRS.
2004-02-04 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* Makefile.am: DIST_SUBDIRS = @subdirs@.
2003-12-12 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Require automake >= 1.8, autoconf >= 2.59.
2003-09-26 Joel Sherrill <joel@OARcorp.com>
* Makefile.am: Obsoleting HP PA-RISC port.
2003-09-26 Joel Sherrill <joel@OARcorp.com>
* hppa1.1/.cvsignore, hppa1.1/ChangeLog, hppa1.1/Makefile.am,
hppa1.1/configure.ac, hppa1.1/genoffsets.c: Removed.
2003-08-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Use rtems-bugs@rtems.com as bug report email address.
2003-03-06 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Remove AC_CONFIG_AUX_DIR.
2003-02-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: AM_INIT_AUTOMAKE([1.7.2]).
2003-02-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: AC_PREREQ(2.57).
2002-10-21 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* .cvsignore: Reformat.
Add autom4te*cache.
Remove autom4te.cache.
2001-04-03 Joel Sherrill <joel@OARcorp.com>
* sh/COPYING: Readded. Deleting this violated GPL on shgen.
2001-04-02 Joel Sherrill <joel@OARcorp.com>
* sh/COPYING: Deleted.
2001-04-02 Joel Sherrill <joel@OARcorp.com>
* sh/Makefile.am: Use "./shgen" not "shgen" so current directory
does not have to be in the PATH.
2001-04-02 Joel Sherrill <joel@OARcorp.com>
* Makefile.am: Remove unix from DIST_SUBDIRS.
2001-03-29 Joel Sherrill <joel@OARcorp.com>
* Per PR150, unix directory and contents removed.
* unix/, unix/ChangeLog, unix/Makefile.am, unix/configure.ac,
unix/gensize.c: Deleted.
2002-03-27 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac:
AC_INIT(package,_RTEMS_VERSION,_RTEMS_BUGS).
AM_INIT_AUTOMAKE([no-define foreign 1.6]).
* Makefile.am: Remove AUTOMAKE_OPTIONS.
2001-10-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* .cvsignore: Add autom4te.cache for autoconf > 2.52.
* configure.in: Remove.
* configure.ac: New file, generated from configure.in by autoupdate.
2001-10-09 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.in: AC_PREREQ(2.52), apply RTEMS_CPU_SUBDIRS.
2000-11-09 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* Makefile.am: Use ... instead of RTEMS_TOPdir in ACLOCAL_AMFLAGS.
2000-11-02 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* Makefile.am: Switch to ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal.
2000-10-30 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* Makefile.am: Switch to GNU-canonicalized autoconf macros.
2000-08-10 Joel Sherrill <joel@OARcorp.com>
* ChangeLog: New file.
+12
View File
@@ -0,0 +1,12 @@
##
## $Id$
##
ACLOCAL_AMFLAGS = -I ../../aclocal
SUBDIRS = @subdirs@
DIST_SUBDIRS = @subdirs@
include $(top_srcdir)/../../automake/subdirs.am
include $(top_srcdir)/../../automake/host.am
+28
View File
@@ -0,0 +1,28 @@
## Process this file with autoconf to produce a configure script.
##
## $Id$
AC_PREREQ([2.68])
AC_INIT([rtems-tools-cpu],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
AC_CONFIG_SRCDIR([generic])
RTEMS_TOP(../..)
RTEMS_CANONICAL_TARGET_CPU
AM_INIT_AUTOMAKE([no-define foreign 1.11.1])
AM_MAINTAINER_MODE
RTEMS_PATH_KSH
RTEMS_TOOLPATHS
AC_SUBST(program_prefix)
AC_CONFIG_SUBDIRS(generic)
case "$RTEMS_CPU" in
sh ) AC_CONFIG_SUBDIRS(sh);;
nios2 ) AC_CONFIG_SUBDIRS(nios2);;
esac
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
+15
View File
@@ -0,0 +1,15 @@
aclocal.m4
autom4te*.cache
config.cache
config.guess
config.log
config.status
config.sub
configure
depcomp
install-sh
Makefile
Makefile.in
missing
mkinstalldirs
size_rtems
+78
View File
@@ -0,0 +1,78 @@
2011-02-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: Require autoconf-2.68, automake-1.11.1.
2006-12-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: New BUG-REPORT address.
2006-10-17 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: Require autoconf-2.60. Require automake-1.10.
2004-09-24 Ralf Corsepius <ralf_corsepius@rtems.org>
* configure.ac: Require automake > 1.9.
2003-12-12 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Require automake >= 1.8, autoconf >= 2.59.
2003-12-12 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* Makefile.am: Cosmetics.
2003-09-04 Joel Sherrill <joel@OARcorp.com>
* size_rtems.in: URL for license changed.
2003-08-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Use rtems-bugs@rtems.com as bug report email address.
2003-03-06 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Remove AC_CONFIG_AUX_DIR.
2003-02-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: AM_INIT_AUTOMAKE([1.7.2]).
2003-02-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: AC_PREREQ(2.57).
2002-10-21 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* .cvsignore: Reformat.
Add autom4te*cache.
Remove autom4te.cache.
2002-03-27 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac:
AC_INIT(package,_RTEMS_VERSION,_RTEMS_BUGS).
AM_INIT_AUTOMAKE([no-define foreign 1.6]).
* Makefile.am: Remove AUTOMAKE_OPTIONS.
2001-10-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* .cvsignore: Add autom4te.cache for autoconf > 2.52.
* configure.in: Remove.
* configure.ac: New file, generated from configure.in by autoupdate.
2000-11-09 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* Makefile.am: Use ... instead of RTEMS_TOPdir in ACLOCAL_AMFLAGS.
2000-11-02 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* Makefile.am: Switch to ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal.
2000-10-30 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* Makefile.am: Switch to GNU-canonicalized autoconf macros.
2000-08-10 Joel Sherrill <joel@OARcorp.com>
* ChangeLog: New file.
+9
View File
@@ -0,0 +1,9 @@
##
## $Id$
##
ACLOCAL_AMFLAGS = -I ../../../aclocal
noinst_SCRIPTS = size_rtems
include $(top_srcdir)/../../../automake/host.am
+23
View File
@@ -0,0 +1,23 @@
## Process this file with autoconf to produce a configure script.
##
## $Id$
AC_PREREQ([2.68])
AC_INIT([rtems-tools-cpu-generic],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
AC_CONFIG_SRCDIR([size_rtems.in])
RTEMS_TOP(../../..)
RTEMS_CANONICAL_TARGET_CPU
AM_INIT_AUTOMAKE([no-define foreign 1.11.1])
AM_MAINTAINER_MODE
RTEMS_PATH_KSH
RTEMS_TOOLPATHS
AC_SUBST(program_prefix)
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile
size_rtems])
AC_OUTPUT
+284
View File
@@ -0,0 +1,284 @@
#!@KSH@ -p
#
# size_rtems
#
# This script gathers information related to the size of RTEMS
# using the GNU "size" command.
#
# This script operates by summing up the sizes of the various
# object files which constitute a particular configuration of
# RTEMS. This size information is gathered for placement in the
# brochure flyers and supplement manuals.
#
# NOTE: The concept of the minimum executive size is buried in this script.
#
# COPYRIGHT (c) 1989-1999.
# On-Line Applications Research Corporation (OAR).
#
# The license and distribution terms for this file may be
# found in the file LICENSE in this distribution or at
# http://www.rtems.com/license/LICENSE.
#
# $Id$
#
target=@target@
program_prefix=@program_prefix@
gnusize=${program_prefix}size
# check usage
if [ $# -ne 2 ] ; then
echo usage ${0}: bsp object_directory
exit 1
fi
bsp=$1
board=$1
ARCH=$2
cpu=`echo $target | sed -e 's/-.*//'`
case $target in
sparc-sun-solaris*)
rtems_cpu=unix
bsp=solaris2
echo Not supported on unix port.
exit 0
;;
i[34567]86-pc-linux-gnu)
echo linux
rtems_cpu=unix
bsp=linux1
echo Not supported on unix port.
exit 0
;;
i[34567]86-unknown-freebsd2.[12]*)
echo freebsd
rtems_cpu=unix
bsp=freebsd2
echo Not supported on unix port.
exit 0
;;
*-rtems*)
cpu=`echo $target | sed -e 's/-.*//'`
rtems_cpu=$cpu
;;
*)
echo unknown target $target
exit 1
;;
esac
case $ARCH in
*debug*) VARIANT=debug ;;
*profile*) VARIANT=profile ;;
*) VARIANT=optimized;;
esac
echo
echo Size Information for the Following Configuration:
echo CPU: ${cpu}
echo BSP: ${board}
echo VARIANT: ${VARIANT}
echo
#
# KLUDGE to figure out at runtime how to echo a line without a
# newline.
#
count=`echo "\\c" | wc -c`
if [ ${count} -ne 0 ] ; then
EARG="-n"
EOL=""
else
EARG=""
EOL="\\c"
fi
if [ ! -d ../${board} ] ; then
echo "${board} does not exist ... is the current directory the build directory?"
exit 1
fi
#DIRLIST -- so greps for DIRLIST will find this file
CPUOBJ=exec/score/cpu/${rtems_cpu}/wrap/${ARCH}
COREOBJ=exec/score/src/${ARCH}
RTEMSOBJ=exec/rtems/src/${ARCH}
SAPIOBJ=exec/sapi/src/${ARCH}
OPTOBJ=exec/rtems/optman/${ARCH}
# XXX These have been split up
MANLIST=" \
${RTEMSOBJ}/clockget.o \
${RTEMSOBJ}/clockset.o \
${RTEMSOBJ}/clocktick.o \
${RTEMSOBJ}/dpmem.o \
${RTEMSOBJ}/event.o \
${RTEMSOBJ}/intr.o \
${RTEMSOBJ}/msg.o \
${RTEMSOBJ}/part.o \
${RTEMSOBJ}/ratemon.o \
${RTEMSOBJ}/region.o \
${RTEMSOBJ}/sem.o \
${RTEMSOBJ}/signal.o \
${RTEMSOBJ}/tasks.o \
${RTEMSOBJ}/timer.o \
${SAPIOBJ}/debug.o \
${SAPIOBJ}/extension.o \
${SAPIOBJ}/fatal.o \
${SAPIOBJ}/exinit.o \
${SAPIOBJ}/io.o \
${SAPIOBJ}/rtemsapi.o \
"
if [ -r ${RTEMSOBJ}/mp.o ] ; then
MPLIST="\
${RTEMSOBJ}/mp.o ${RTEMSOBJ}/eventmp.o \
${COREOBJ}/mpci.o ${RTEMSOBJ}/msgmp.o ${COREOBJ}/objectmp.o \
${RTEMSOBJ}/partmp.o ${RTEMSOBJ}/regionmp.o ${RTEMSOBJ}/semmp.o \
${RTEMSOBJ}/signalmp.o ${RTEMSOBJ}/taskmp.o ${COREOBJ}/threadmp.o \
"
MPOBJLIST=${OPTOBJ}/no-mp.rel
fi
OPTMANLIST="\
${OPTOBJ}/no-dpmem.rel \
${OPTOBJ}/no-event.rel \
${MPOBJLIST} \
${OPTOBJ}/no-msg.rel \
${OPTOBJ}/no-part.rel \
${OPTOBJ}/no-region.rel \
${OPTOBJ}/no-rtmon.rel \
${OPTOBJ}/no-sem.rel \
${OPTOBJ}/no-signal.rel \
${OPTOBJ}/no-timer.rel \
"
REQMANLIST="\
${SAPIOBJ}/exinit.o \
${RTEMSOBJ}/tasks.o \
${RTEMSOBJ}/intr.o \
${SAPIOBJ}/fatal.o \
"
# XXX parts of these have been split up
CORELIST=" \
${COREOBJ}/apiext.o ${COREOBJ}/chain.o \
${COREOBJ}/coremsg.o ${COREOBJ}/coremutex.o ${COREOBJ}/coresem.o \
${COREOBJ}/heap.o ${COREOBJ}/interr.o \
${COREOBJ}/isr.o \
${COREOBJ}/object.o \
${SAPIOBJ}/rtemsapi.o \
${COREOBJ}/thread.o ${COREOBJ}/threadq.o ${COREOBJ}/tod.o \
${COREOBJ}/userext.o \
${COREOBJ}/watchdog.o ${COREOBJ}/wkspace.o \
"
CPULIST="\
${CPUOBJ}/rtems-cpu.rel \
"
# check directories
for i in ${EXECOBJ} ${CPUOBJ} ${OPTOBJ}
do
if [ ! -d ${i} ] ; then
echo "${i} does not exist ... is RTEMS compiled and installed?"
exit 1
fi
done
for i in ${MANLIST} ${MPLIST} ${OPTMANLIST} ${REQMANLIST} ${CORELIST} ${CPULIST}
do
if [ ! -r ${i} ] ; then
echo ${i} does not exist ... is RTEMS compiled and installed?
exit 1
fi
done
# "rips" a line of gsize's output and prints size, data, bss
parse_size()
{
echo $1 $2 $3
}
# prepares a list of code, data, bss sizes for a directory
sizedir()
{
${gnusize} $* | sed -e '1,1d' |
while read line
do
parse_size ${line}
done
}
# adds the numbers passed on the command line
addit()
{
sumx=0
for x in $*
do
sumx=`expr $sumx + $x`
done
echo $sumx
}
# adds a column from the output of sizedir
addsizes()
{
# dc version is not portable enough -- It can be left out during
# installing linux and may not be available on non-UNIX hosts.
#cut -d' ' -f${2} ${1} | sed -e '2,$s/$/ + /' -e '$,$s/$/ p/' | dc
# This may not be as fast but it is probably more portable.
addit `cut -d' ' -f${2} ${1}`
}
# calculates total size of a directory and prints report line
size_files()
{
trap "rm -f /tmp/size.$$ ; exit 1" 2 3
for file in $*
do
parse_size `${gnusize} $file | sed -e '/text/d'`
done >/tmp/size.$$
code=`cat /tmp/size.$$ | addsizes 1`
data=`cat /tmp/size.$$ | addsizes 2`
bss=` cat /tmp/size.$$ | addsizes 3`
echo "${code} ${data} ${bss}"
rm /tmp/size.$$
}
echo
echo " RTEMS SIZE REPORT"
echo
echo " CODE DATA BSS"
echo " =================="
echo ${EARG} "MANAGERS: " ${EOL} ; size_files $MANLIST $MPLIST
echo ${EARG} "CORE : " ${EOL} ; size_files $CORELIST $CPULIST
echo ${EARG} "CPU : " ${EOL} ; size_files $CPULIST
echo ${EARG} "OVERALL : " ${EOL} ; size_files $CPULIST $CORELIST $MANLIST \
$MPLIST
echo ${EARG} "MINIMUM : " ${EOL} ; size_files $CPULIST $CORELIST \
$OPTMANLIST $REQMANLIST
echo
for file in $MANLIST
do
base=`basename ${file}`
echo ${EARG} ""${base} : " ${EOL} " ; size_files ${file}
done
echo ${EARG} "MP : " ${EOL} ; size_files $MPLIST
echo
for file in $OPTMANLIST
do
base=`basename ${file}`
echo ${EARG} "${base} : " ${EOL} ; size_files ${file}
done
echo
exit 0
+14
View File
@@ -0,0 +1,14 @@
aclocal.m4
autom4te*.cache
config.cache
config.guess
config.log
config.status
config.sub
configure
depcomp
install-sh
Makefile
Makefile.in
missing
mkinstalldirs
+34
View File
@@ -0,0 +1,34 @@
2011-02-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: Require autoconf-2.68, automake-1.11.1.
2006-12-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: New BUG-REPORT address.
2006-10-17 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: Require autoconf-2.60. Require automake-1.10.
2006-08-15 Kolja Waschk <kawk@telos.de>
* linkcmds.c, linkcmds.h, memory.c, memory.h, sample.ptf: New files.
* bridges.c: corrected detection of bridged connections
* clocks.c: removed a printf
* linkcmds.[ch] new files, added output of linker script
* Makefile.am: added new files
* memory.[ch]: new files, detection of memory in SOPC configuration
* nios2gen.c: updated command line parsing and output control
* output.[ch]: improved output of BSP header file
* ptf.[ch]: added ptf_dump_ptf_item and small fixes
* sample.ptf: new file, sample configuration for nios2gen
* README: updated
2006-08-10 Joel Sherrill <joel@oarcorp.com>
* nios2gen.c: Added some very basic support for --help and --version
options along with output that is roughly in GNU format. This is
required by help2man. help2man expects this all to be written to
stdout instead of stderr so this was changed as well.
* ChangeLog: New file.
+25
View File
@@ -0,0 +1,25 @@
##
## $Id$
##
ACLOCAL_AMFLAGS = -I ../../../aclocal
noinst_PROGRAMS = nios2gen
nios2gen_SOURCES = nios2gen.c \
bridges.c bridges.h \
devices.c devices.h \
clocks.c clocks.h \
output.c output.h \
linkcmds.c linkcmds.h \
memory.c memory.h \
ptf.h ptf.c
if HELP2MAN
man_MANS = nios2gen.1
nios2gen.1: nios2gen$(EXEEXT)
$(HELP2MAN) -N ./nios2gen >$@
endif
include $(top_srcdir)/../../../automake/host.am
+148
View File
@@ -0,0 +1,148 @@
$Id$
nios2gen:
Tool to generate BSP data for boards utilizing NIOS2 soft core processor.
=================================
What it does
It creates a sopc.h and linkcmds file for RTEMS nios2 BSPs from one or more inputs:
1. SOPC System Description PTF
As an output from SOPC Builder you get a file with extension ".ptf" that fully
describes the SOPC, including all CPUs, memory and integrated peripherals.
(PTF simply means "plain-text file").
2. BSP Configuration PTF
This file, using the same format as the SOPC System Description PTF, describes
which components of the SOPC shall be used by the BSP. For example, there may
be several timers, but a BSP wants at least one named "CLOCK" and optionally
another named "TIMER". This mapping can be specified in the BSP.
=================================
Contents of the configuration PTF
There can be definitions of ...
HEADER: This is written to sopc.h before anything else. Example:
HEADER = "
#ifndef __SOPC_H
#define __SOPC_H 1
";
EPILOG: This is written to sopc.h after anything else. Example:
EPILOG = "
#endif
";
CLOCKS section: Used to specify names for clocks to be used in definitions in
the sopc.h. The default name (if none is specified here) is the uppercased name
as in the system description PTF. Specify the name you want on the left, the
name in the sopc PTF on the right! Example:
CLOCKS
{
GLOBAL_CLOCK = "sys_clk";
}
MODULES section: Same as clocks but for modules / peripherals. As a special definition,
if the PTF contains more than one nios2 CPU, it /must/ define a CPU to use. Example to
select cpu_0 and rename timer_0 to CLOCK and timer_1 to TIMER:
MODULES
{
CPU = "cpu_0";
CLOCK = "timer_0";
TIMER = "timer_1";
}
CLASS xyz sections: These specify what you want in the sopc.h, and how the definitions
shall be named. Actually, the CLASS xyz should look exactly like the corresponding MODULE
specification in the system description PTF of modules belonging to that class; e.g. a
a JTAG UART is originally described like this:
MODULE jtag_uart_0
{
class = "altera_avalon_jtag_uart";
class_version = "1.0";
iss_model_name = "altera_avalon_jtag_uart";
SLAVE avalon_jtag_slave
{
SYSTEM_BUILDER_INFO
{
Bus_Type = "avalon";
Is_Printable_Device = "1";
Address_Alignment = "native";
Address_Width = "1";
Data_Width = "32";
Has_IRQ = "1";
Read_Wait_States = "peripheral_controlled";
Write_Wait_States = "peripheral_controlled";
JTAG_Hub_Base_Id = "0x04006E";
JTAG_Hub_Instance_Id = "0";
MASTERED_BY cpu_0/data_master
{
priority = "1";
}
IRQ_MASTER cpu_0/data_master
{
IRQ_Number = "2";
}
Base_Address = "0x08000000";
}
}
...
}
If you want to have definitions about its base address and irq number in your sopc.h,
define a CLASS for altera_avalon_jtag_uart that matches the MODULE description above,
but instead of values for the items you specify names to be used in your sopc.h (You
can omit items from the MODULE as you like, but the section nesting must match; and
section names (such as avalon_jtag_slave for the SLAVE section) also have to match)
CLASS altera_avalon_jtag_uart
{
SLAVE avalon_jtag_slave
{
SYSTEM_BUILDER_INFO
{
Base_Address = "BASE_ADDR";
IRQ_MASTER { IRQ_Number = "IRQ"; }
}
}
}
The output for jtag_uart_0 will be:
#define JTAG_UART_BASE_ADDR 0x021208D0
#define JTAG_UART_IRQ 1
There are some values with special meaning to nios2gen,
N2G_CLOCKREF_CLOCK: This should be used whereever the value in the SOPC PTF
specifies the name of a clock. nios2gen will use whatever you configured for
the selected clock in your CLOCKS section.
N2G_CLOCKREF_DEVICE: This should be used whereever the value in the SOPC PTF
specifies the name of a module. nios2gen will use whatever you configured for
the selected module in your MODULES section.
Additionally, you can specify items in your CLASSes so that nios2gen will include
constant definitions in the sopc.h whenever such CLASS is present. The format is
N2G_DEFINE_xyz = "123"
and will result in
#define MODULENAME_xyz 123
+114
View File
@@ -0,0 +1,114 @@
/*
* Copyright (c) 2006 Kolja Waschk rtemsdev/ixo.de
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
/********************************************************/
/* Find bus bridges */
/* This part of the program builds a list with pairs of bus
master port names (each is "device name/master port name").
It is then possible to find if a given master is actually
available under a different master port name through bridges.
*/
/* Typical example with external SRAM that is slave of
tristate_bridge_0/tristate_master, and
tristate_bridge_0 itself is slave of cpu0/data_master, the
bridge information would be stored as this bus_bridge_pair:
mastered_by = "cpu0/data_master" and
bridges_to = "tristate_bridge_0/tristate_master".
That allows to deduce that SRAM is actually mastered by
cpu0/data_master. If there were any address or bus width
translations, it should be noted in the bridges list... For
now we simply assume that bridges never translate anything.
*/
#include <string.h>
#include <stdlib.h>
#include "ptf.h"
#include "bridges.h"
int is_bridged(
char *cpu_master,
char *dev_master,
bus_bridge_pair *bridges)
{
char *curr_master;
bus_bridge_pair *bbp;
if(strcmp(cpu_master, dev_master) == 0) return 1; /* cpu directly masters dev */
for(bbp = bridges; bbp != NULL; bbp=bbp->next)
{
if(strcmp(cpu_master, bbp->mastered_by) == 0 &&
is_bridged(bbp->bridges_to, dev_master, bridges))
{
return 1; /* cpu masters dev via bridge */
}
};
return 0;
}
void add_bridge_master(struct ptf_item *pi, void *arg)
{
struct { char *bt; bus_bridge_pair **bridges; } *binfo = arg;
bus_bridge_pair *new_pair;
if(binfo->bridges == 0) return;
new_pair = (bus_bridge_pair *)malloc(sizeof(bus_bridge_pair));
if(new_pair == NULL) return;
new_pair->bridges_to = binfo->bt;
new_pair->mastered_by = pi->item[pi->level]->value;
new_pair->next = *(binfo->bridges);
*(binfo->bridges) = new_pair;
}
void add_bridge_dest(struct ptf_item *pi, void *arg)
{
struct ptf maby_section = { section, "MASTERED_BY", 0, 0, 0 };
struct ptf_item maby = { 1, &maby_section };
char *bridge_name = pi->item[1]->value;
char *bridge_dest = pi->item[pi->level]->value;
struct { char *bt; bus_bridge_pair **bridges; } binfo;
binfo.bridges = arg;
binfo.bt = (char*)malloc(strlen(bridge_name)+strlen(bridge_dest) + 2);
strcpy(binfo.bt, bridge_name);
strcat(binfo.bt, "/");
strcat(binfo.bt, bridge_dest);
ptf_match(pi->item[pi->level-1]->sub, &maby, add_bridge_master, &binfo);
/* binfo.bt is NOT freed here */
}
bus_bridge_pair *find_bridges(struct ptf *p)
{
bus_bridge_pair *bridges = 0;
struct ptf system = { section, "SYSTEM", 0, 0, 0 };
struct ptf module = { section, "MODULE", 0, 0, 0 };
struct ptf slave = { section, "SLAVE", 0, 0, 0 };
struct ptf syb = { section, "SYSTEM_BUILDER_INFO", 0, 0, 0 };
struct ptf to = { item, "Bridges_To", 0, 0, 0 };
struct ptf_item brdg = { 5, &system, &module, &slave, &syb, &to };
ptf_match(p, &brdg, add_bridge_dest, &bridges);
return bridges;
}
+31
View File
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2006 Kolja Waschk rtemsdev/ixo.de
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#ifndef __NIOS2GEN_BRIDGES_H
#define __NIOS2GEN_BRIDGES_H 1
typedef struct bus_bridge_pair
{
char *mastered_by;
char *bridges_to;
struct bus_bridge_pair *next;
}
bus_bridge_pair;
bus_bridge_pair *find_bridges(struct ptf *p);
int is_bridged(
char *cpu_master,
char *dev_master,
bus_bridge_pair *bridges);
#endif
+77
View File
@@ -0,0 +1,77 @@
/*
* Copyright (c) 2006 Kolja Waschk rtemsdev/ixo.de
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include "ptf.h"
#include "clocks.h"
#include <stdlib.h>
void add_clock_spec(struct ptf_item *pi, void *arg)
{
clock_desc **clocks = arg;
clock_desc *new_clock;
unsigned long freq;
new_clock = (clock_desc*)malloc(sizeof(clock_desc));
if(new_clock == NULL) return;
new_clock->freq = strtoul(pi->item[pi->level]->value, 0, 0);
new_clock->cfgname = NULL;
new_clock->name = pi->item[pi->level-1]->value;
new_clock->next = *clocks;
*clocks = new_clock;
}
void set_clock_cfgname(struct ptf_item *pi, void *arg)
{
clock_desc *clock = arg;
clock->cfgname = pi->item[pi->level]->name;
}
clock_desc *find_clocks( struct ptf *sopc, struct ptf *cfg )
{
clock_desc *clocks, *reverse;
struct ptf system = { section, "SYSTEM", 0, 0, 0 };
struct ptf wizargs = { section, "WIZARD_SCRIPT_ARGUMENTS", 0, 0, 0 };
struct ptf all = { section, "CLOCKS", 0, 0, 0 };
struct ptf clock = { section, "CLOCK", 0, 0, 0 };
struct ptf freq = { item, "frequency", 0, 0, 0 };
struct ptf_item clk_spec = { 5, &system, &wizargs, &all, &clock, &freq };
struct ptf named = { item, 0, 0, 0, 0 };
struct ptf_item clk_cfg = { 2, &all, &named };
clocks = NULL;
ptf_match(sopc, &clk_spec, add_clock_spec, &clocks);
/* Reverse the linked list and look for configured names */
reverse = NULL;
while(clocks)
{
clock_desc *tmp = clocks;
clocks = clocks->next;
tmp->next = reverse;
reverse = tmp;
named.value = tmp->name;
ptf_match(cfg, &clk_cfg, set_clock_cfgname, tmp);
if(tmp->cfgname == NULL) tmp->cfgname = ptf_defused_name(tmp->name);
};
return reverse;
}
+28
View File
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2006 Kolja Waschk rtemsdev/ixo.de
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#ifndef __NIOS2GEN_CLOCKS_H
#define __NIOS2GEN_CLOCKS_H 1
#include "ptf.h"
typedef struct clockdsc
{
char *name;
char *cfgname;
unsigned long freq;
struct clockdsc *next;
}
clock_desc;
clock_desc *find_clocks( struct ptf *ptf, struct ptf *cfg );
#endif
+23
View File
@@ -0,0 +1,23 @@
## Process this file with autoconf to produce a configure script.
##
## $Id$
AC_PREREQ([2.68])
AC_INIT([rtems-tools-cpu-nios2],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
AC_CONFIG_SRCDIR([nios2gen.c])
RTEMS_TOP(../../..)
RTEMS_CANONICAL_TARGET_CPU
AM_INIT_AUTOMAKE([foreign 1.11.1])
AM_MAINTAINER_MODE
AC_PROG_CC
AC_CHECK_PROGS(HELP2MAN,help2man)
AM_CONDITIONAL(HELP2MAN,test -n "$HELP2MAN" )
RTEMS_TOOLPATHS
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
+132
View File
@@ -0,0 +1,132 @@
/*
* Copyright (c) 2006 Kolja Waschk rtemsdev/ixo.de
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ptf.h"
#include "bridges.h"
#include "devices.h"
void add_device(device_desc **dl, struct ptf *dev)
{
device_desc *eds;
for(eds = *dl; eds; eds = eds->next)
{
if(eds->ptf == dev)
{
eds->slaves++;
return;
};
};
eds = (device_desc *)malloc(sizeof(device_desc));
eds->slaves = 1;
eds->ptf = dev;
eds->next = *dl;
*dl = eds;
}
void check_and_add_device(struct ptf_item *pi, void *arg)
{
struct ptf *module = pi->item[pi->level-3];
struct ptf *sysinfo = pi->item[pi->level-2];
char *master_name = pi->item[pi->level]->value;
struct { char *dm; char *im; device_desc **dl; bus_bridge_pair *bridges; } *dinfo = arg;
if(is_bridged(dinfo->dm, master_name, dinfo->bridges) ||
is_bridged(dinfo->im, master_name, dinfo->bridges))
{
struct ptf *ni = ptf_alloc_item(item, "N2G_Selected", "1");
if(ni != NULL)
{
ni->next = sysinfo->sub;
sysinfo->sub = ni;
};
add_device(dinfo->dl, module);
};
}
void set_dev_cfgname(struct ptf_item *pi, void *arg)
{
device_desc *dev = arg;
dev->cfgname = pi->item[pi->level]->name;
}
device_desc *find_devices(
struct ptf *ptf,
struct ptf *cfg,
struct ptf *cpu,
bus_bridge_pair *bridges)
{
struct ptf system = { section, "SYSTEM", 0, 0, 0 };
struct ptf module = { section, "MODULE", 0, 0, 0 };
struct ptf slave = { section, "SLAVE", 0, 0, 0 };
struct ptf syb = { section, "SYSTEM_BUILDER_INFO", 0, 0, 0 };
struct ptf maby = { section, "MASTERED_BY", 0, 0, 0 };
struct ptf_item brdg = { 5, &system, &module, &slave, &syb, &maby };
struct ptf modules = { section, "MODULES", 0, 0, 0 };
struct ptf named = { item, 0, 0, 0, 0};
struct ptf_item devcf = { 2, &modules, &named };
struct { char *dm; char *im; device_desc **dl; bus_bridge_pair *bridges; } dinfo;
device_desc *found, *reverse;
found = NULL;
add_device(&found, cpu); /* The CPU is "self-connected", add it */
dinfo.dl = &found;
dinfo.bridges = bridges;
dinfo.dm = (char *)malloc(strlen(cpu->value)+13);
dinfo.im = (char *)malloc(strlen(cpu->value)+20);
strcpy(dinfo.im, cpu->value);
strcat(dinfo.im, "/");
strcpy(dinfo.dm, dinfo.im);
strcat(dinfo.dm, "data_master");
strcat(dinfo.im, "instruction_master");
/* "Available" is any MODULE with a SLAVE section that is MASTERED_BY
either instr_master or data_master of selected CPU, either directly
or through a bridge. See code above for more info about bridges.
*/
ptf_match(ptf, &brdg, check_and_add_device, &dinfo);
free(dinfo.dm);
free(dinfo.im);
/* Reverse the linked list */
reverse = NULL;
while(found)
{
device_desc *tmp = found;
found = found->next;
tmp->next = reverse;
reverse = tmp;
named.value = tmp->ptf->value;
tmp->cfgname = NULL;
ptf_match(cfg, &devcf, set_dev_cfgname, tmp);
if(tmp->cfgname == NULL) tmp->cfgname = ptf_defused_name(tmp->ptf->value);
};
return reverse;
}
+32
View File
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2006 Kolja Waschk rtemsdev/ixo.de
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#ifndef __NIOS2GEN_DEVICES_H
#define __NIOS2GEN_DEVICES_H 1
#include "ptf.h"
#include "bridges.h"
typedef struct dev_descr
{
int slaves;
char *cfgname;
struct ptf *ptf;
struct dev_descr *next;
}
device_desc;
device_desc *find_devices(
struct ptf *ptf,
struct ptf *cfg,
struct ptf *cpu,
bus_bridge_pair *bridges);
#endif
+122
View File
@@ -0,0 +1,122 @@
/*
* Copyright (c) 2006 Kolja Waschk rtemsdev/ixo.de
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ptf.h"
#include "devices.h"
#include "output.h" /* is_not_connected, fwrite_value, etc */
#include "memory.h"
#include "linkcmds.h"
typedef struct
{
FILE *file;
struct ptf *cfg, *cpu;
device_desc *devices;
memory_desc *memory;
}
lcmd_desc;
void fwrite_lcmds_section(struct ptf_item *pi, void *arg)
{
lcmd_desc *li = (lcmd_desc *)arg;
struct ptf *p;
struct ptf_item lpi;
char *location = NULL;
char *section_name = pi->item[1]->value;
if(section_name == 0)
{
fprintf(stderr, "Found a LINKER/SECTION without name, ignoring it.\n");
return;
};
p = ptf_find(pi->item[1]->sub, &lpi, item, "LOCATION", 0);
if(p)
{
location = p->value;
}
else
{
if(strcmp(section_name, "entry") == 0)
{
p = ptf_find(li->cpu, &lpi, item, "reset_slave", 0);
}
else if(strcmp(section_name, "exceptions") == 0)
{
p = ptf_find(li->cpu, &lpi, item, "exc_slave", 0);
};
if(p) location = p->value;
/* TODO: This doesn't work yet, parse full slave address, translate into our naming */
}
if(location == 0)
{
fprintf(stderr, "No LOCATION configured for section '%s'!\n", pi->item[1]->value);
return;
};
fprintf(li->file, " .%s :\n {\n", pi->item[1]->value);
fprintf(li->file, pi->item[2]->value);
fprintf(li->file, " } > %s\n\n", location);
}
void fwrite_linkcmds_file(FILE *file, struct ptf *cfg, struct ptf *cpu, device_desc *devices, memory_desc *memory)
{
struct ptf *p;
struct ptf_item pi;
memory_desc *tmd;
lcmd_desc linfo;
struct ptf ptlink = { section, "LINKCMDS", 0, 0, 0 };
struct ptf ptleadtext = { item, "LEADTEXT", 0, 0, 0 };
struct ptf ptepilog = { item, "EPILOG", 0, 0, 0 };
struct ptf_item malihead = { 2, &ptlink, &ptleadtext };
struct ptf_item maliepil = { 2, &ptlink, &ptepilog };
struct ptf ptsect = { section, "SECTION", 0, 0, 0 };
struct ptf ptcmds = { item, "COMMANDS", 0, 0, 0 };
struct ptf ptstabs = { item, "STABS", 0, 0, 0 };
struct ptf_item malisect = { 3, &ptlink, &ptsect, &ptcmds };
struct ptf_item malistabs = { 2, &ptlink, &ptstabs };
linfo.cfg = cfg;
linfo.cpu = cpu;
linfo.file = file;
linfo.devices = devices;
linfo.memory = memory;
ptf_match(cfg, &malihead, fwrite_value, file);
fprintf(file, "MEMORY\n{\n");
for(tmd = linfo.memory; tmd; tmd = tmd->next)
{
fprintf(file, " %s : ORIGIN = 0x%08X, LENGTH = 0x%08X\n", tmd->dev->cfgname, tmd->base, tmd->size);
}
fprintf(file, "}\n\nSECTIONS\n{\n");
ptf_match(cfg, &malisect, fwrite_lcmds_section, &linfo);
ptf_match(cfg, &malistabs, fwrite_value, file);
for(tmd = linfo.memory; tmd; tmd = tmd->next)
{
fprintf(file, " %s : ORIGIN = 0x%08X, LENGTH = 0x%08X\n", tmd->dev->cfgname, tmd->base, tmd->size);
}
fprintf(file, "}\n\n");
ptf_match(cfg, &maliepil, fwrite_value, file);
}
+25
View File
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2006 Kolja Waschk rtemsdev/ixo.de
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#ifndef __LINKCMDS_H
#define __LINKCMDS_H 1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ptf.h"
#include "devices.h"
void fwrite_linkcmds_file(FILE *file, struct ptf *cfg, struct ptf *cpu, device_desc *devices, memory_desc *memory);
#endif
+104
View File
@@ -0,0 +1,104 @@
/*
* Copyright (c) 2006 Kolja Waschk rtemsdev/ixo.de
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ptf.h"
#include "devices.h"
#include "memory.h"
memory_desc *find_memory(device_desc *devices)
{
struct ptf *p;
struct ptf_item pi;
memory_desc *tmd, *memory;
/********************************************************/
/* Check which of the devices are memory, sort by size */
if(devices)
{
struct ptf *p, *s;
struct ptf_item pi;
device_desc *dd;
memory = NULL;
for(dd = devices; dd; dd=dd->next)
{
p = ptf_find(dd->ptf->sub, &pi, item, "Is_Memory_Device", "1");
if(p != NULL && pi.level>0)
{
s = pi.item[pi.level-1];
p = ptf_find(s, &pi, item, "Base_Address", 0);
};
if(p != NULL)
{
tmd = (memory_desc*)malloc(sizeof(memory_desc));
if(tmd != NULL)
{
tmd->base = strtoul(p->value, 0, 0);
p = ptf_find(s, &pi, item, "Address_Span", 0);
if(p != 0)
{
tmd->size = strtoul(p->value, 0, 0);
}
else
{
tmd->size = 0;
p = ptf_find(s, &pi, item, "Address_Width", 0);
if(p) tmd->size = 1 << strtoul(p->value, 0, 0);
p = ptf_find(s, &pi, item, "Data_Width", 0);
if(p) tmd->size *= (strtoul(p->value, 0, 0) >> 3);
};
if(tmd->size == 0)
{
free(tmd);
}
else
{
tmd->dev = dd;
if(memory == NULL)
{
tmd->next = NULL;
memory = tmd;
}
else
{
if(tmd->size > memory->size)
{
tmd->next = memory;
memory = tmd;
}
else
{
memory_desc *uplink = memory;
while(uplink->next != NULL && uplink->next->size > tmd->size) uplink=uplink->next;
tmd->next = uplink->next;
uplink->next = tmd;
};
};
};
};
};
};
};
return memory;
}
+29
View File
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2006 Kolja Waschk rtemsdev/ixo.de
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#ifndef __MEMORY_H
#define __MEMORY_H 1
#include "devices.h"
typedef struct memdsc
{
unsigned long base;
unsigned long size;
device_desc *dev;
struct memdsc *next;
}
memory_desc;
memory_desc *find_memory(device_desc *devices);
#endif
+496
View File
@@ -0,0 +1,496 @@
/*
* Copyright (c) 2006 Kolja Waschk rtemsdev/ixo.de
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ptf.h"
#include "bridges.h"
#include "clocks.h"
#include "devices.h"
#include "memory.h"
#include "output.h"
#include "linkcmds.h"
#define NIOS2GEN_PACKAGE PACKAGE
#define NIOS2GEN_VERSION VERSION
#include "getopt.h"
/********************************************************/
void store_ptf_parent(struct ptf_item *pi, void *arg)
{
struct ptf *p = pi->item[pi->level-1];
*(struct ptf **)arg = p;
}
/********************************************************/
void store_ptf_ptr(struct ptf_item *pi, void *arg)
{
struct ptf *p = pi->item[pi->level];
*(struct ptf **)arg = p;
}
/********************************************************/
void printf_ptf_value(struct ptf_item *pi, void *arg)
{
struct ptf *p = pi->item[pi->level];
printf(*(char **)arg, p->value);
}
/********************************************************/
void read_include_file(struct ptf_item *pi, void *arg)
{
struct ptf *inc, *next;
struct ptf *p = pi->item[pi->level];
inc = ptf_parse_file(p->value);
if(inc == NULL)
{
fprintf(stderr, "Warning: couldn't parse included '%s'.\n", p->value);
return;
};
printf("Successfully read included PTF file %s.\n", p->value);
next = p->next;
for(p->next = inc; p->next != NULL; p = p->next);
p->next = next;
}
/********************************************************/
void version(FILE *f)
{
fprintf(f,
"nios2gen (" __DATE__ ")\n"
" Copyright (c) 2006 Kolja Waschk rtemsdev/ixo.de\n"
"\n"
" The license and distribution terms for this file may be\n"
" found in the file LICENSE in this distribution or at\n"
" http://www.rtems.com/license/LICENSE.\n"
, VERSION
);
}
void usage (FILE *f, char *errmsg)
{
char *info = "Purpose:\n Create RTEMS nios2 BSP configuration from Altera SOPC description\n";
if(errmsg) info=errmsg;
version(f);
fprintf(f,"\n%s\nUsage: nios2gen [OPTIONS] <SOPC PTF> [CONFIG PTF] [CONFIG PTF]...\n", info);
fprintf(f," -h --help Print help and exit\n");
fprintf(f," -V --version Print version and exit\n");
fprintf(f," -bFILENAME --bspheader=FILENAME Output BSP configuration header file (default='sopc.h')\n");
fprintf(f," -B --no-bspheader Do not output BSP configuration header file\n");
fprintf(f," -lFILENAME --linkcmds=FILENAME Output linker script (default='linkcmds')\n");
fprintf(f," -L --no-linkcmds Do not output linker script\n");
fprintf(f," -pFILENAME --parsed=FILENAME Output PTF contents as long list (default: don't)\n");
fprintf(f," -P --no-parsed Do not output PTF contents as long list\n");
fprintf(f," -q --quiet Do not print progress info to stdout\n\n");
fprintf(f,"Using \"-\" as the FILENAME means standard output (stdout).\n");
}
/********************************************************/
int main(int argc, char *argv[])
{
struct ptf *sopc, *cfg, *p, *cpu;
struct ptf_item pi;
device_desc *devices;
bus_bridge_pair *bridges;
clock_desc *clocks;
memory_desc *memory;
int verbose = 1;
int output_order = 127;
char *parsed_filename = NULL;
int output_parsed = 0;
char *bspheader_filename = "sopc.h";
int output_bspheader = 1;
char *linkcmds_filename = "linkcmds";
int output_linkcmds = 2;
optarg = 0;
optind = 1;
opterr = 1;
optopt = '?';
if(argc > 126)
{
usage(stderr,"Too many commandline arguments!\n");
return -1;
};
while(1)
{
int c, long_index = 0;
static char *optstring = "hVBb:Ll:Pp:q";
static struct option long_options[] =
{
{ "help", 0, NULL, 'h' },
{ "version", 0, NULL, 'V' },
{ "no-bspheader", 0, NULL, 'B' },
{ "bspheader", 1, NULL, 'b' },
{ "no-linkcmds", 0, NULL, 'L' },
{ "linkcmds", 1, NULL, 'l' },
{ "no-parsed", 0, NULL, 'P' },
{ "parsed", 1, NULL, 'p' },
{ "quiet", 0, NULL, 'q' },
{ NULL, 0, NULL, 0 }
};
c = getopt_long (argc, argv, optstring, long_options, &long_index);
if(c == -1) break; /* Exit from while(1) loop */
switch(c)
{
case 'q': /* Be quiet */
verbose = 0;
break;
case 'h': /* Print help and exit */
usage(stdout,NULL);
return 0;
case 'V': /* Print version and exit */
version(stdout);
return 0;
case 'B': /* Do not output BSP configuration header file */
output_bspheader = 0;
break;
case 'b': /* Output BSP configuration header file */
bspheader_filename = optarg;
output_bspheader = output_order;
output_order--;
break;
case 'L': /* Do not output linker script */
output_linkcmds = 0;
break;
case 'l': /* Output linker script */
linkcmds_filename = optarg;
output_linkcmds = output_order;
output_order--;
break;
case 'P': /* Do not output PTF contents */
output_parsed = 0;
break;
case 'p': /* Output PTF contents as long list */
parsed_filename = optarg;
output_parsed = output_order;
output_order--;
break;
case 0:
case '?':
return -1;
default:
fprintf(stderr, "%s: unknown option: %c\n", NIOS2GEN_PACKAGE, c);
};
};
if(optind >= argc)
{
usage(stderr,"No PTF specified!\n");
return -1;
};
/********************************************************/
sopc = ptf_parse_file(argv[optind]);
if(sopc == NULL)
{
fprintf(stderr, "Could not parse system description PTF '%s'.\n", argv[optind]);
return -1;
};
if(verbose) printf("Successfully read SOPC PTF file %s.\n", argv[optind]);
/********************************************************/
cfg = NULL;
for(optind++;optind<argc;optind++)
{
struct ptf *morecfg = ptf_parse_file(argv[optind]);
if(morecfg == NULL)
{
fprintf(stderr, "Couldn't parse '%s'.\n", argv[optind]);
return -1;
};
if(verbose) printf("Successfully read config PTF file %s.\n", argv[optind]);
cfg = ptf_concat(cfg, morecfg);
};
/********************************************************/
/* Pull in include files specified in the configs; */
/* Only one level is read; included files are not */
/* checked for further INCLUDEs */
{
struct ptf include_item = { item, "INCLUDE", 0, 0, 0 };
struct ptf_item inc_file_spec = { 1, &include_item };
ptf_match(cfg, &inc_file_spec, read_include_file, NULL);
}
/********************************************************/
/* Find CPU */
if(verbose) printf("Looking for usable CPUs...\n");
/* Check if a CPU has been specified in the config PTF */
{
struct ptf modules = { section, "MODULES", 0, 0, 0 };
struct ptf cpu_def = { item, "CPU", 0, 0, 0 };
struct ptf_item cpu_spec = { 2, &modules, &cpu_def };
ptf_match(cfg, &cpu_spec, store_ptf_ptr, &cpu);
};
/* Look for CPUs in system description PTF */
{
int cpu_count;
struct ptf system = { section, "SYSTEM", 0, 0, 0 };
struct ptf module = { section, "MODULE", 0, 0, 0 };
struct ptf nios2_cpu_class = { item, "class", "altera_nios2", 0, 0 };
struct ptf_item class_spec = { 3, &system, &module, &nios2_cpu_class };
if(cpu) if(cpu->value) class_spec.item[1]->value = cpu->value;
cpu_count = ptf_match(sopc, &class_spec, store_ptf_parent, &cpu);
if(cpu_count > 1)
{
fprintf(stderr, "There is more than one CPU. Please specify the one\n");
fprintf(stderr, "you want to use with this BSP in your config file.\n");
fprintf(stderr, "The available CPUs are named as follows:\n");
ptf_match(sopc, &class_spec, printf_ptf_value, " %s\n");
return -1;
};
if(cpu_count == 0)
{
fprintf(stderr, "There is no NIOS2 cpu in the system.\n");
return -1;
}
};
if(verbose)
{
printf("Using NIOS II CPU '%s'.\n", cpu->value);
printf("Only modules mastered by this CPU are considered now.\n");
};
/********************************************************/
/* Find Bridges */
if(verbose) printf("Looking for bus bridges...\n");
bridges = find_bridges(sopc);
if(verbose)
{
if(bridges)
{
bus_bridge_pair *bbp;
for(bbp = bridges; bbp; bbp=bbp->next)
{
printf("Found bridge: %s\n", bbp->mastered_by);
printf(" \\_%s\n", bbp->bridges_to);
};
}
else
{
printf("No bridges present.\n");
};
};
/********************************************************/
/* Find clocks */
if(verbose) printf("Looking for clock definitions...\n");
clocks = find_clocks(sopc, cfg);
if(verbose)
{
if(clocks)
{
clock_desc *cs;
for(cs = clocks; cs; cs = cs->next)
{
printf("Found clock \"%s\" (%lu Hz), naming it %s\n", cs->name, cs->freq, cs->cfgname);
};
}
else
{
printf("No clocks present.\n");
};
};
/********************************************************/
/* Find other devices available to the selected CPU */
if(verbose) printf("Looking for devices...\n");
devices = find_devices(sopc, cfg, cpu, bridges);
if(verbose)
{
if(devices)
{
device_desc *dd;
for(dd = devices; dd; dd=dd->next)
{
printf("Found device \"%s\", naming it %s\n", dd->ptf->value, dd->cfgname);
};
}
else
{
printf("No devices present.\n");
};
};
/********************************************************/
/* Find out which devices are actually memory */
if(verbose) printf("Looking for memory...\n");
memory = find_memory(devices);
if(verbose)
{
if(memory)
{
memory_desc *md;
for(md = memory; md; md=md->next)
{
printf("Found memory in \"%s\", base=0x%08X, size=%lu bytes\n",
md->dev->cfgname,
md->base, md->size);
};
}
else
{
printf("None of the devices seems to provide memory?!\n");
};
};
/********************************************************/
/* Output files in the order they were specified
on the command line */
{
int i;
for(i=0;i<3;i++)
{
if(output_bspheader>0
&& output_bspheader>=output_linkcmds
&& output_bspheader>=output_parsed)
{
output_bspheader = 0;
if(bspheader_filename == NULL || (bspheader_filename[0]=='-' && bspheader_filename[1]==0))
{
fwrite_header_file(stdout, cfg, devices, clocks);
}
else
{
FILE *f = fopen(bspheader_filename, "w");
if(!f)
{
perror(bspheader_filename);
return -1;
}
else
{
fwrite_header_file(f, cfg, devices, clocks);
fclose(f);
}
}
};
if(output_linkcmds>0
&& output_linkcmds>=output_bspheader
&& output_linkcmds>=output_parsed)
{
output_linkcmds = 0;
if(linkcmds_filename == NULL || (linkcmds_filename[0]=='-' && linkcmds_filename[1]==0))
{
fwrite_linkcmds_file(stdout, cfg, cpu, devices, memory);
}
else
{
FILE *f = fopen(linkcmds_filename, "w");
if(!f)
{
perror(linkcmds_filename);
return -1;
}
else
{
fwrite_linkcmds_file(f, cfg, cpu, devices, memory);
fclose(f);
}
}
};
if(output_parsed>0
&& output_parsed>=output_linkcmds
&& output_parsed>=output_bspheader)
{
output_parsed = 0;
if(parsed_filename == NULL || (parsed_filename[0]=='-' && parsed_filename[1]==0))
{
ptf_printf(stdout, sopc, "");
}
else
{
FILE *f = fopen(parsed_filename, "w");
if(!f)
{
perror(parsed_filename);
return -1;
}
else
{
ptf_printf(f, sopc, "");
fclose(f);
}
}
};
}
};
if(verbose) printf("Done.\n");
return 0;
}
/* vi:ts=4:
*/
+195
View File
@@ -0,0 +1,195 @@
/*
* Copyright (c) 2006 Kolja Waschk rtemsdev/ixo.de
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ptf.h"
#include "devices.h"
#include "output.h"
typedef struct
{
FILE *file;
device_desc *dev;
char *def_name;
char *orig_value;
clock_desc *clocks;
device_desc *devices;
}
out_desc;
int is_not_connected(struct ptf_item *pi)
{
if(pi->item[0] == NULL) return 0;
if(pi->item[0]->name == NULL) return 0;
if(strcmp(pi->item[0]->name, "SLAVE") == 0)
{
struct ptf *t;
struct ptf_item ti;
t = ptf_find(pi->item[0]->sub, &ti, item, "N2G_Selected", "1");
if(t == NULL) return 1;
};
return 0;
}
void fwrite_devhead_def(struct ptf_item *pi, void *arg)
{
out_desc *dinfo = arg;
if(pi != NULL) if(is_not_connected(pi)) return;
fprintf(dinfo->file, "#define %s_%s %s\n",
dinfo->dev->cfgname, dinfo->def_name, dinfo->orig_value);
}
void fwrite_devhead_line(struct ptf_item *pi, void *arg)
{
out_desc *dinfo = arg;
if(is_not_connected(pi)) return;
if(strncmp(dinfo->orig_value, "N2G_", 4)==0)
{
if(strncmp(dinfo->orig_value, "N2G_CLOCKREF_", 13)==0)
{
clock_desc *c;
for(c = dinfo->clocks; c; c=c->next)
{
if(strcmp(c->name, pi->item[pi->level]->value) == 0)
{
fprintf(dinfo->file, "#define %s_%s %s\n",
dinfo->dev->cfgname, dinfo->orig_value + 13, c->cfgname);
break;
};
};
}
else if(strncmp(dinfo->orig_value, "N2G_DEVICEREF_", 14)==0)
{
device_desc *d;
for(d = dinfo->devices; d; d=d->next)
{
if(strcmp(d->ptf->value, pi->item[pi->level]->value) == 0)
{
fprintf(dinfo->file, "#define %s_%s %s\n",
dinfo->dev->cfgname, dinfo->orig_value + 14, d->cfgname);
break;
};
};
}
}
else
{
fprintf(dinfo->file, "#define %s_%s %s\n",
dinfo->dev->cfgname, dinfo->orig_value,
pi->item[pi->level]->value);
};
}
void fwrite_device_header(struct ptf_item *pi, void *arg)
{
struct ptf *f;
struct ptf_item fi;
out_desc *dinfo = arg;
/* This is called for every matching CLASS section in the
configuration. The following loop iterates through all
items in the CLASS section regardless of their nesting level */
f = ptf_find(pi->item[pi->level]->sub, &fi, item, 0, 0);
while(f != NULL)
{
dinfo->orig_value = f->value;
if(f->name && strncmp(f->name, "N2G_DEFINE_", 11)==0)
{
dinfo->def_name = f->name + 11;
if(fi.level >= 2)
{
fi.level--; /* match only the enclosing section */
ptf_match(dinfo->dev->ptf->sub, &fi, fwrite_devhead_def, dinfo);
fi.level++;
}
else
{
fwrite_devhead_def( 0, dinfo );
};
}
else
{
f->value = 0; /* Match ANY value */
ptf_match(dinfo->dev->ptf->sub, &fi, fwrite_devhead_line, dinfo);
f->value = dinfo->orig_value;
};
f = ptf_next(&fi, item, 0, 0);
};
}
void fwrite_value(struct ptf_item *pi, void *arg)
{
FILE *file = arg;
fputs(pi->item[pi->level]->value, file);
}
void fwrite_header_file( FILE *file, struct ptf *cfg, device_desc *devices, clock_desc *clocks)
{
struct ptf *p;
struct ptf_item pi;
struct ptf aclass = { section, "CLASS", 0, 0, 0 };
struct ptf_item matchaclass = { 1, &aclass };
struct ptf bspsect = { section, "BSPHEADER", 0, 0, 0 };
struct ptf leadtext = { item, "LEADTEXT", 0, 0, 0 };
struct ptf_item matchleadtext = { 2, &bspsect, &leadtext };
struct ptf epilog = { item, "EPILOG", 0, 0, 0 };
struct ptf_item matchepilog = { 2, &bspsect, &epilog };
out_desc dinfo;
dinfo.file = file;
dinfo.clocks = clocks;
dinfo.devices = devices;
ptf_match(cfg, &matchleadtext, fwrite_value, file);
if(clocks)
{
clock_desc *cs;
for(cs = clocks; cs; cs = cs->next)
{
fprintf(file, "#define %s_FREQ %luu\n", cs->cfgname, cs->freq);
};
};
if(devices)
{
for(dinfo.dev = devices; dinfo.dev; dinfo.dev=dinfo.dev->next)
{
/* fprintf(file, "\n#define SOPC_HAS_%s 1\n", dinfo.dev->cfgname); */
p = ptf_find(dinfo.dev->ptf, &pi, item, "class", 0);
if(p)
{
aclass.value = p->value;
ptf_match(cfg, &matchaclass, fwrite_device_header, &dinfo);
};
};
};
ptf_match(cfg, &matchepilog, fwrite_value, file);
}
+27
View File
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2006 Kolja Waschk rtemsdev/ixo.de
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#ifndef __OUTPUT_H
#define __OUTPUT_H 1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ptf.h"
#include "clocks.h"
#include "devices.h"
void fwrite_value(struct ptf_item *pi, void *arg);
void fwrite_header_file(FILE *file, struct ptf *cfg, device_desc *devices, clock_desc *clocks);
#endif
File diff suppressed because it is too large Load Diff
+71
View File
@@ -0,0 +1,71 @@
/*
* Copyright (c) 2006 Kolja Waschk rtemsdev/ixo.de
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#if !defined(__PTF_H)
#define __PTF_H 1
#include <stdio.h>
#define MAX_SECTION_NESTING 20
typedef enum
{
item, section
}
ptf_item_type;
struct ptf
{
ptf_item_type type;
char *name;
char *value;
struct ptf *sub;
struct ptf *next;
};
struct ptf_item
{
int level;
struct ptf *item[MAX_SECTION_NESTING];
};
typedef void (*ptf_match_action)(struct ptf_item *x, void *arg);
struct ptf *ptf_parse_file(char *filename);
struct ptf *ptf_concat(struct ptf *a, struct ptf *b);
struct ptf *ptf_alloc_item(ptf_item_type t, char *name, char *value);
void ptf_printf(FILE *s, struct ptf *tree, char *prefix);
void ptf_dump_ptf_item(FILE *s, struct ptf_item *pi);
struct ptf *ptf_find(
struct ptf *tree,
struct ptf_item *item,
ptf_item_type ttype,
char *name,
char *value);
struct ptf *ptf_next(
struct ptf_item *item,
ptf_item_type ttype,
char *name,
char *value);
int ptf_match(
struct ptf *const ptf,
struct ptf_item *const match,
const ptf_match_action action,
void *arg);
char *ptf_defused_name(char *);
#endif /* !defined(__PTF_H) */
+462
View File
@@ -0,0 +1,462 @@
N2GCOMM = "=============== Header output settings ===========================";
BSPHEADER
{
LEADTEXT =
"/* Autogenerated by nios2gen, (C) 2006 K. Waschk rtemsdev/ixo.de */
#ifndef __SOPC_H
#define __SOPC_H 1
#ifdef __cplusplus
extern "C" {
#endif
#define CLOCK_FREQ_REF(clock) clock ## _FREQ
#define CLOCK_FREQ(x) CLOCK_FREQ_REF(x)
";
EPILOG =
"
#ifdef __cplusplus
}
#endif
#endif
";
}
N2GCOMM = "=============== Class templates ==================================";
CLASS altera_nios2
{
N2G_DEFINE_IS_AVAILABLE = "1";
SYSTEM_BUILDER_INFO
{
Clock_Source = "N2G_CLOCKREF_CLOCK";
}
SLAVE jtag_debug_module
{
SYSTEM_BUILDER_INFO { Base_Address = "BASE_ADDR"; }
}
WIZARD_SCRIPT_ARGUMENTS
{
cache_has_dcache = "HAS_DCACHE";
cache_has_icache = "HAS_ICACHE";
cache_dcache_size = "DCACHE_SIZE";
cache_icache_size = "ICACHE_SIZE";
cache_dcache_line_size = "DCACHE_LINE_SIZE";
cache_icache_line_size = "ICACHE_LINE_SIZE";
cache_dcache_bursts = "DCACHE_BURSTS";
cache_icache_burst_type = "ICACHE_BURST_TYPE";
hardware_multiply_present = "HAS_HWMULT";
}
}
CLASS altera_avalon_onchip_memory2
{
N2G_DEFINE_IS_AVAILABLE = "1";
WIZARD_SCRIPT_ARGUMENTS
{
Writeable = "WRITEABLE";
dual_port = "DUAL_PORT";
Size_Value = "SIZE_VALUE";
Size_Multiple = "SIZE_MULTIPLE";
}
SYSTEM_BUILDER_INFO
{
Clock_Source = "N2G_CLOCKREF_CLOCK";
}
SLAVE s1
{
N2G_DEFINE_CONNECTED_PORT = "S1";
SYSTEM_BUILDER_INFO
{
Base_Address = "S1_BASE_ADDR";
Data_Width = "S1_DATA_WIDTH";
Address_Width = "S1_ADDR_WIDTH";
Address_Span = "S1_ADDR_SPAN";
}
}
SLAVE s2
{
N2G_DEFINE_CONNECTED_PORT = "S2";
SYSTEM_BUILDER_INFO
{
Base_Address = "S2_BASE_ADDR";
Data_Width = "S2_DATA_WIDTH";
Address_Width = "S2_ADDR_WIDTH";
Address_Span = "S2_ADDR_SPAN";
}
}
}
CLASS sram_256k_x_16_bit
{
N2G_DEFINE_IS_AVAILABLE = "1";
SLAVE sram
{
SYSTEM_BUILDER_INFO
{
Base_Address = "BASE_ADDR";
Data_Width = "DATA_WIDTH";
Address_Width = "ADDR_WIDTH";
Address_Span = "ADDR_SPAN";
}
}
}
CLASS altera_avalon_sysid
{
N2G_DEFINE_IS_AVAILABLE = "1";
SLAVE control_slave
{
SYSTEM_BUILDER_INFO
{
Base_Address = "BASE_ADDR";
}
}
WIZARD_SCRIPT_ARGUMENTS
{
id = "ID";
timestamp = "TIMESTAMP";
}
}
CLASS altera_avalon_timer
{
N2G_DEFINE_IS_AVAILABLE = "1";
SLAVE s1
{
SYSTEM_BUILDER_INFO
{
Base_Address = "BASE_ADDR";
IRQ_MASTER { IRQ_Number = "IRQ"; }
}
}
WIZARD_SCRIPT_ARGUMENTS
{
snapshot = "SNAPSHOT";
always_run = "ALWAYS_RUN";
mult = "MULT";
period = "PERIOD";
period_units = "PERIOD_UNITS";
fixed_period = "FIXED_PERIOD";
}
SYSTEM_BUILDER_INFO
{
Clock_Source = "N2G_CLOCKREF_CLOCK";
}
}
CLASS altera_avalon_uart
{
N2G_DEFINE_IS_AVAILABLE = "1";
SYSTEM_BUILDER_INFO
{
Clock_Source = "N2G_CLOCKREF_CLOCK";
}
WIZARD_SCRIPT_ARGUMENTS
{
use_cts_rts = "USE_CTS_RTS";
use_eop_register = "USE_EOP_REG";
}
SLAVE s1
{
SYSTEM_BUILDER_INFO
{
Base_Address = "BASE_ADDR";
IRQ_MASTER { IRQ_Number = "IRQ"; }
}
}
}
CLASS altera_avalon_jtag_uart
{
N2G_DEFINE_IS_AVAILABLE = "1";
SLAVE avalon_jtag_slave
{
SYSTEM_BUILDER_INFO
{
Base_Address = "BASE_ADDR";
IRQ_MASTER { IRQ_Number = "IRQ"; }
}
}
}
CLASS altera_avalon_pio
{
N2G_DEFINE_IS_AVAILABLE = "1";
SYSTEM_BUILDER_INFO
{
Clock_Source = "N2G_CLOCKREF_CLOCK";
}
SLAVE
{
SYSTEM_BUILDER_INFO
{
Base_Address = "BASE_ADDR";
IRQ_MASTER { IRQ_Number = "IRQ"; }
}
}
}
N2GCOMM = "=============== Linkcmds output settings =========================";
LINKCMDS
{
LEADTEXT = "
OUTPUT_FORMAT( "elf32-littlenios2",
"elf32-littlenios2",
"elf32-littlenios2" )
OUTPUT_ARCH( nios2 )
ENTRY( _start )
"
SECTION entry
{
COMMANDS =
" KEEP (*(.entry))
";
}
SECTION exceptions
{
COMMANDS =
" PROVIDE (__ram_exceptions_start = ABSOLUTE(.));
. = ALIGN(0x20);
*(.irq)
KEEP (*(.exceptions.entry.label));
KEEP (*(.exceptions.entry.user));
KEEP (*(.exceptions.entry));
KEEP (*(.exceptions.irqtest.user));
KEEP (*(.exceptions.irqtest));
KEEP (*(.exceptions.irqhandler.user));
KEEP (*(.exceptions.irqhandler));
KEEP (*(.exceptions.irqreturn.user));
KEEP (*(.exceptions.irqreturn));
KEEP (*(.exceptions.notirq.label));
KEEP (*(.exceptions.notirq.user));
KEEP (*(.exceptions.notirq));
KEEP (*(.exceptions.soft.user));
KEEP (*(.exceptions.soft));
KEEP (*(.exceptions.unknown.user));
KEEP (*(.exceptions.unknown));
KEEP (*(.exceptions.exit.label));
KEEP (*(.exceptions.exit.user));
KEEP (*(.exceptions.exit));
KEEP (*(.exceptions));
PROVIDE (__ram_exceptions_end = ABSOLUTE(.));
";
}
SECTION text
{
LOCATION = "SDRAM";
COMMANDS =
" PROVIDE (stext = ABSOLUTE(.));
*(.interp)
*(.hash)
*(.dynsym)
*(.dynstr)
*(.gnu.version)
*(.gnu.version_d)
*(.gnu.version_r)
*(.rel.init)
*(.rela.init)
*(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
*(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
*(.rel.fini)
*(.rela.fini)
*(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
*(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
*(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
*(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
*(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
*(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
*(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
*(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
*(.rel.ctors)
*(.rela.ctors)
*(.rel.dtors)
*(.rela.dtors)
*(.rel.got)
*(.rela.got)
*(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
*(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
*(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
*(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
*(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
*(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
*(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
*(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
*(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
*(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
*(.rel.plt)
*(.rela.plt)
KEEP (*(.init))
*(.plt)
*(.text .stub .text.* .gnu.linkonce.t.*)
/* Special FreeBSD sysctl sections. */
. = ALIGN (16);
__start_set_sysctl_set = .;
*(set_sysctl_*);
__stop_set_sysctl_set = ABSOLUTE(.);
*(set_domain_*);
*(set_pseudo_*);
*(.gnu.warning.*)
KEEP (*(.fini))
PROVIDE (__etext = ABSOLUTE(.));
PROVIDE (_etext = ABSOLUTE(.));
PROVIDE (etext = ABSOLUTE(.));
*(.eh_frame_hdr)
/* Ensure the __preinit_array_start label is properly aligned. We
could instead move the label definition inside the section, but
the linker would then create the section even if it turns out to
be empty, which isn't pretty. */
. = ALIGN(32 / 8);
PROVIDE (__preinit_array_start = ABSOLUTE(.));
*(.preinit_array)
PROVIDE (__preinit_array_end = ABSOLUTE(.));
PROVIDE (__init_array_start = ABSOLUTE(.));
*(.init_array)
PROVIDE (__init_array_end = ABSOLUTE(.));
PROVIDE (__fini_array_start = ABSOLUTE(.));
*(.fini_array)
PROVIDE (__fini_array_end = ABSOLUTE(.));
SORT(CONSTRUCTORS)
KEEP (*(.eh_frame))
*(.gcc_except_table)
*(.dynamic)
PROVIDE (__CTOR_LIST__ = ABSOLUTE(.));
KEEP (*(.ctors))
KEEP (*(SORT(.ctors.*)))
PROVIDE (__CTOR_END__ = ABSOLUTE(.));
PROVIDE (__DTOR_LIST__ = ABSOLUTE(.));
KEEP (*(.dtors))
KEEP (*(SORT(.dtors.*)))
PROVIDE (__DTOR_END__ = ABSOLUTE(.));
KEEP (*(.jcr))
. = ALIGN(32 / 8);
";
}
SECTION rodata
{
LOCATION = "SDRAM";
COMMANDS =
" PROVIDE (__ram_rodata_start = ABSOLUTE(.));
. = ALIGN(32 / 8);
*(.rodata .rodata.* .gnu.linkonce.r.*)
*(.rodata1)
. = ALIGN(32 / 8);
PROVIDE (__ram_rodata_end = ABSOLUTE(.));
";
}
SECTION rwdata
{
LOCATION = "SDRAM";
COMMANDS =
" PROVIDE (__ram_rwdata_start = ABSOLUTE(.));
. = ALIGN(32 / 8);
*(.got.plt) *(.got)
*(.data1)
*(.data .data.* .gnu.linkonce.d.*)
_gp = ABSOLUTE(. + 0x8000);
PROVIDE(gp = _gp);
*(.sdata .sdata.* .gnu.linkonce.s.*)
*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
. = ALIGN(32 / 8);
_edata = ABSOLUTE(.);
PROVIDE (edata = ABSOLUTE(.));
PROVIDE (__ram_rwdata_end = ABSOLUTE(.));
";
}
SECTION bss
{
LOCATION = "SDRAM";
COMMANDS =
" __bss_start = ABSOLUTE(.);
PROVIDE (__sbss_start = ABSOLUTE(.));
PROVIDE (___sbss_start = ABSOLUTE(.));
*(.dynsbss)
*(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
*(.scommon)
PROVIDE (__sbss_end = ABSOLUTE(.));
PROVIDE (___sbss_end = ABSOLUTE(.));
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(32 / 8);
__bss_end = ABSOLUTE(.);
";
}
STABS =
" .stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/* Altera debug extensions */
.debug_alt_sim_info 0 : { *(.debug_alt_sim_info) }
";
HEAP = "SDRAM";
STACK = "SDRAM";
}
+14
View File
@@ -0,0 +1,14 @@
aclocal.m4
autom4te*.cache
config.cache
config.guess
config.log
config.status
config.sub
configure
depcomp
install-sh
Makefile
Makefile.in
missing
mkinstalldirs
+3
View File
@@ -0,0 +1,3 @@
Ralf Corsepius (corsepiu@faw.uni-ulm.de)
* Initial implementation
* generator for sci bitrate table

Some files were not shown because too many files have changed in this diff Show More