initial push

This commit is contained in:
Bernd Mueller
2026-06-17 13:44:30 +02:00
commit adfd70813f
372 changed files with 146450 additions and 0 deletions

8
m68k/.cvsignore Normal file
View File

@@ -0,0 +1,8 @@
autom4te.cache
configure
config.h.in
config.log
config.status
aclocal.m4
Makefile.in
Makefile

62
m68k/BUGS Normal file
View File

@@ -0,0 +1,62 @@
BUGS
====
- Missing 5282 support (patch needed).
- Duplicated debug output on windows.
- PCI parallel ports with non-standard port-addresses not supported.
- Probing of different access methods (driver, ioperm, bdmd) with
irritating error messages.
This one and the PCI parallel ports above would probably best be resolved
by a new naming sheme for the target devices.
- In insight-5.3, when "Run" button is hit, no bdm_reset is executed. This
leads to the effect that _first_ "Run" works (since you can/should put
bdm_reset into the setup-and-load macro). But the _second_ "Run" will
fail since IRQs are left enabled and some registers are writeable only
once after reset.
- Insight-6.0 don't work at all.
- The target is hardwired to /dev/bdmcf0 in insight.
- Parallel port on Elitegroup ECS K7S5A (sis735 chipset) motherboard seems not
to work. The port pins are active only for a couple milliseconds after an
edge of the strobe signal and set tri-state thereafter. The bdm adaptor
requires that the pins have valid signals all the time. Tri-stating the pins
result in loss of control over the adaptor/target.
- Dell Pentium III machines seem to not work. Not really sure why but clearing
the parallel port register for the CF processors causes the parallel port to
either initialise or reset and not work.
- Coldfire - support to detect version of the debug module for auto detection
of the PST lines has problems if a BDM pod is not connected to the target or
the target is not powered.
- The 5407 BDM hardware does not implement the SSI bit and the driver tries to
use it. No idea why this bit was removed as it was just stupid. The work
arounds for the driver are complex and not yet implemented.
- For m68k ELF systems you need to be careful about the binutils mix you use.
Binutils of versions 2.9.5.* will not work with gdb-4.18 or earilier. You
will get core dumps. Earilier version of gcc and binutils as used by the
ucLinux project have some problems.
---------------------------
Reporting Them:
If you've got any questions/remarks about any of this, please contact the BDM
project mailing list on the SourceForge web site:
http://sourceforge.net/projects/bdm/
It is a good idea to turn on the debug and look at the output. Keep
the log as it might be useful for us to track the problem down.
A patch is also welcome.
---------------------------

339
m68k/COPYING Normal file
View File

@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

1174
m68k/ChangeLog Normal file

File diff suppressed because it is too large Load Diff

234
m68k/INSTALL Normal file
View File

@@ -0,0 +1,234 @@
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006 Free Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You need `configure.ac' if
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
Running `configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that the
`configure' script does not know about. Run `./configure --help' for
details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
installed the package for one architecture, use `make distclean' before
reconfiguring for another architecture.
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out automatically,
but needs to determine by the type of machine the package will run on.
Usually, assuming the package is built to be run on the _same_
architectures, `configure' can figure that out, but if it prints a
message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share, you
can create a site shell script called `config.site' that gives default
values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf bug. Until the bug is fixed you can use this workaround:
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
`configure' recognizes the following options to control how it operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

57
m68k/Makefile.am Normal file
View File

@@ -0,0 +1,57 @@
##
## $Id: Makefile.am,v 1.8 2004/06/01 02:02:25 codewiz Exp $
##
## This file is part of a free BDM package
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
CFLAGS = @CFLAGS@
SUBDIRS = @BDM_SUBDIRS@
EXTRA_DIST = \
README.insight \
BUGS \
config/bootstrap \
driver/freebsd/bdm \
driver/freebsd/bdm.8 \
driver/freebsd/freebsd-bdm.c \
driver/freebsd/Makefile \
driver/freebsd/README \
driver/freebsd/setdef0.c \
driver/freebsd/setdef1.c \
driver/freebsd/unbdm \
driver/freebsd/bus_if.h \
driver/freebsd/device_if.h \
driver/freebsd/isa_if.h \
driver/freebsd/setdefs.h \
driver/openbsd/Makefile \
driver/openbsd/README \
driver/openbsd/bdm-install.sh \
driver/openbsd/openbsd-bdm.c \
driver/linux/linux-bdm.c \
driver/linux/Makefile \
driver/linux-2.6/bdm.c \
driver/linux-2.6/Makefile \
driver/sco/Makefile \
driver/sco/Master \
driver/sco/Node \
driver/sco/README \
driver/sco/sco.c \
driver/sco/Space.c \
driver/sco/System \
driver/win/win-bdm.c \
driver/win/win-io.h
dist-hook:
cp -R -p $(srcdir)/local_scripts $(distdir)
rm -r -f `find $(distdir)/local_scripts -name CVS`
cp -R -p $(srcdir)/../gdb $(distdir)
rm -r -f `find $(distdir)/gdb -name CVS`
cp -R -p $(srcdir)/../schematics $(distdir)
rm -r -f `find $(distdir)/schematics -name CVS`

666
m68k/Makefile.in Normal file
View File

@@ -0,0 +1,666 @@
# Makefile.in generated by automake 1.10 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/configure COPYING ChangeLog INSTALL \
config/compile config/config.guess config/config.sub \
config/depcomp config/install-sh config/missing \
config/mkinstalldirs config/ylwrap
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 $(distdir).zip
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BDM_SUBDIRS = @BDM_SUBDIRS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FLASH_PLUGIN_GCC = @FLASH_PLUGIN_GCC@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBUSB_INCLUDE_DIR = @LIBUSB_INCLUDE_DIR@
LIBUSB_LIB_DIR = @LIBUSB_LIB_DIR@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
flash_plugin_cc = @flash_plugin_cc@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = @BDM_SUBDIRS@
EXTRA_DIST = \
README.insight \
BUGS \
config/bootstrap \
driver/freebsd/bdm \
driver/freebsd/bdm.8 \
driver/freebsd/freebsd-bdm.c \
driver/freebsd/Makefile \
driver/freebsd/README \
driver/freebsd/setdef0.c \
driver/freebsd/setdef1.c \
driver/freebsd/unbdm \
driver/freebsd/bus_if.h \
driver/freebsd/device_if.h \
driver/freebsd/isa_if.h \
driver/freebsd/setdefs.h \
driver/openbsd/Makefile \
driver/openbsd/README \
driver/openbsd/bdm-install.sh \
driver/openbsd/openbsd-bdm.c \
driver/linux/linux-bdm.c \
driver/linux/Makefile \
driver/linux-2.6/bdm.c \
driver/linux-2.6/Makefile \
driver/sco/Makefile \
driver/sco/Master \
driver/sco/Node \
driver/sco/README \
driver/sco/sco.c \
driver/sco/Space.c \
driver/sco/System \
driver/win/win-bdm.c \
driver/win/win-io.h
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
cd $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps)
cd $(top_srcdir) && $(AUTOHEADER)
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
test -d $(distdir) || mkdir $(distdir)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
am__remove_distdir=: \
am__skip_length_check=: \
distdir) \
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile config.h
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info: info-recursive
info-am:
install-data-am:
install-dvi: install-dvi-recursive
install-exec-am:
install-html: install-html-recursive
install-info: install-info-recursive
install-man:
install-pdf: install-pdf-recursive
install-ps: install-ps-recursive
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
install-strip
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
dist-hook dist-shar dist-tarZ dist-zip distcheck distclean \
distclean-generic distclean-hdr distclean-tags distcleancheck \
distdir distuninstallcheck dvi dvi-am html html-am info \
info-am install install-am install-data install-data-am \
install-dvi install-dvi-am install-exec install-exec-am \
install-html install-html-am install-info install-info-am \
install-man install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
pdf-am ps ps-am tags tags-recursive uninstall uninstall-am
dist-hook:
cp -R -p $(srcdir)/local_scripts $(distdir)
rm -r -f `find $(distdir)/local_scripts -name CVS`
cp -R -p $(srcdir)/../gdb $(distdir)
rm -r -f `find $(distdir)/gdb -name CVS`
cp -R -p $(srcdir)/../schematics $(distdir)
rm -r -f `find $(distdir)/schematics -name CVS`
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

909
m68k/README Normal file
View File

@@ -0,0 +1,909 @@
BDM GDB DRIVER AND LIBRARY PACKAGE
==================================
INTRODUCTION
============
This package contains everything you need to know to be able to run GDB on
Linux, FreeBSD, SCO Unix, and Windows and control a Motorola CPU32+ (68360) or
Coldfire (V2/V3/V4) target through a standard PC parallel port or via a USB
pod.
o The CPU32 interfaces supported are PD and the IDC interface. GDB
should now operate with the CPU32 processor without error.
o The Coldfire interface is the TBLCF USB pod or P&E parallel port type
interface.
o You can build Insight if you apply the Insight patch. See the
Insight README in this directory.
o For WindowsNT or Window2000 you will need the GiveIO package. You
are best to search the net for the GiveIO (giveio.sys) package. You
will also need the INSTDRV.EXE file that is also available on the net.
GiveIO has been test on Windows 2000 and Windows XP.
o For Unix users the library is built with I/O perm support by
default. The same library allows an application to directly
access the hardware or use an installed BDM kernel driver. On FreeBSD
this the "/dev/io" support.
I/O Permission is a means of getting at the parallel port hardware
without the need for a kernel driver. This BDM package still provides
support to build a kernel driver, but you do not need to if you want to
avoid kernel drivers. Some people wish to use kernel drivers and some do
not.
If you wish to learn more about I/O Perm support please refer to the
section at the end of the file.
You can disable I/O perm support by editing the Makefile. It is hoped
autoconf support in the future will provide a better way to handle this.
o To support the TBLCF UDB pod you will need the libusb package. For Windows
this means the LibUSB-Win32 package.
o Support for an initialisation script called '.m68kbdminit'. See the
section on Initialisation Scripts.
The subdirectories contain:
config
Autotools support files.
driver
Source for a Linux, SCO, FreeBSD, I/O Perm, and Windows BDM device
driver module.
gdbPatches
Move to outside this tree. Please refer to the Sourceforge
project for the patches.
gdbScripts
Example GDB command scripts that show how to initialize and run
a Motorola 68360 system using standard GDB commands.
gdbserver
A GDB Remote protocol server. Needs GDB 6.7 or later.
lib
User-level library routines for accessing the BDM device driver.
flashlib
Library for flash support. This library currently supports host-only
and host-assisted operation modes of 29Fxxx and 49Fxxx chips in
any combination of bus_width=[1|2|4] and chip_width=[1|2|4]. It is
already prepared for target-only operation mode and addition of different
flash algorithms.
local_scripts
Scripts to run on the host machine the driver is being installed
on.
server
The BDM server. This is a daemon which interfaces to the local BDM
driver remotely. The BDM library can be built to support local and remote,
just local or just remote access.
tblcf
The TBLCF code from Daniel Malik. It include the various tools for managing
the pod.
test
Programs to test the BDM library and driver routines.
utils
contains some utilities which might be useful.
README Files
============
There are 4 README files which document the BDM package. They are:
o README
This is the top level README file and the one you are currently readling.
o README.cvs
If you use the code from CVS you should read this file. It explains how
to bootstrap the package to create the configure script and Makefiles.
o README.bdmgdbserver
This file documents the BDM GDB Server. It explains why you should use
the BDM GDB Server to interface to GDB and how to build GDB.
o README.insight
This is an old README and may be useful to anyone still wanting to
use Insight as a GUI interface to GDB. A current Insight with a current
GDB should work with the BDM GDB Server.
WINDOWS
=======
Windows is supported on Windows 98, Windows 2000 and Windows XP. It may run on
other version of Windows, but the ones listed have been tested. Windows 2000,
Windows XP and beyond need to the GiveIO driver to gain direct access to the
parallel port hardware if you are using a parallel port pod. A USB pod need the
libusb software for Windows.
You can download the GiveIO package from the net plus you will need the
INSTDRV.EXE program. To install GiveIO place the 'giveio.sys' and INSTDRV.EXE
in a directory and log in as an Administrator or equivalent then:
c:\tmp> insdrv givio c:\tmp\giveio.sys
The package builds under Cygwin and MinGW.
The MinGW support provides you with a version that directly accesses the
Windows APIs and does not need a Cygwin DLL. To build with MinGW you need to
get the MinGW and MSYS packages from the MinGW web site:
http://www.mingw.org/
The MinGW package provides the compiler and MSYS provides a shell capable of
running the configure script.
To build the TBLCF USB pod support you need to obtain the LibUsb-Win32 package
from:
http://libusb-win32.sourceforge.net/
Click the Downloads link and move the Sourceforge download page then select the
libusb-win32-device-bin package. I have tested with the 0.1.12 version. Unpack
the tar file to a directory on your machine ready to use. Make sure you do not
have any spaces in the path. Spaces cause problems with the autoconf test for
the libusb library.
QUICK START
===========
You have unpacked the package. Next to the top of the package create an empty
directory and enter it, configure the package, make, then install.
$ tar xzf bdm-xx.tar.gz
$ mkdir build
$ cd build
$ ../gdb-bdm-xxx/m68k/configure
$ make
$ make install
Note: this process by default creates an IOPERM type parallel BDM driver and a
TBLCF USB driver. If you wish to build a Linux kernel driver please follow the
INSTALLATION directions.
INSTALLATION
============
The Makefiles in all the subdirectories are set up to install their
results in /usr/{bin,lib,.....}.
On FreeBSD remember to use `gmake' rather than `make'.
Notes:
1. For Windows move to Step 2 as the driver is built into the library. You
may also need to add `CC=gcc' to make's command line.
2. For I/O Permission or USB users move to step 2 as the driver is built
into the library.
3. Driver users will still have a library with I/O perm support unless the
default of the library Makefile is manually changed.
4. You can specify a different `prefix' for the installation directory by
running all the `make install' commands described below as:
$ make prefix=/some/directory install
Step 1 -- Compile and install the BDM device driver
If you do not wish to use a driver and just want the I/O perm support move to
Step 2.
Make sure the kernel source code is installed under the /usr/src path.
Support for more than Linux has been added. You must enter the OS specific
directory then enter the make command. We assume Linux for the remainder of
this file.
If your Linux kernel has been configured for module versions you must
uncomment the #MODVERSIONS=-DMODVERSIONS line in driver/linux Makefile. If
the kernel is configured for module versions and you fail to uncomment this
line the driver will install and work properly, but depmod will complain
about unresolved symbols.
For Coldfire users the driver now looks for the debug module version and will
use the PST signals if it detects a version 1 debug module. The debug version
1 is found on the 5307.
Disable the TBLCF code with the configure option '--disable-tblcf'.
# cd driver/linux
# make all install
You may get a bunch of error messages like:
In file included from /usr/include/linux/fs.h:277,
from linux-bdm.c:63:
/usr/include/linux/hpfs_fs_i.h:5: parse error before `ino_t'
/usr/include/linux/hpfs_fs_i.h:5: warning: no semicolon at \
end of struct or union
/usr/include/linux/hpfs_fs_i.h:12: parse error before `:'
If this happens, try adding `-I /usr/include' to the beginning of the CFLAGS
definition in the Makefile in driver/linux.
A script is provided in `local_scripts' called MAKEDEV which create the
special files needed for the CPU32 and Coldfire.
To make the special files by hand you can enter:
# mknod /dev/bdmcpu320 c 34 0
^^ ^
| |
| +--Minor device number (see below).
|
+--This value must match the
BDM_MAJOR_NUMBER in driver/bdm.h
To have the module module loaded by kerneld when needed
adding to /etc/conf.modules the line:
alias char-major-34 bdm
To automaticially load the driver into the kernel every time
you reboot you can add the line:
# /sbin/insmod bdm
to your startup script, such as /etc/rc.d/rc.local.
You will need to create the device names. The local script MAKEDEV can do
this for you:
# ./local_scripts/MAKEDEV
Step 2 -- Compile and install the library and user programs
The package provides a configure script that you use to build the
package. All testing I have performed is not to build in the source tree. For
the default configuration just run the configure script:
$ mkdir build
$ cd build
$ ../gdb-bdm-xx/m68k/configure
You will need to change the 'gdb-bdm-xx' to the name of the directory in the
version of the package you have downloaded.
On Windows if building the TBLCF driver you need to provide the location of
the libusb package. The details to download and obtain the libusb package for
Windows is detail above. Provide the path to the top of the libusb package:
$ ../gdb-bdm-xx/m68k/configure \
--with-usblib-dir="c:/work/libusb-win32-device-bin-0.1.12.1"
The above command is run inside the MSYS shell.
Once the package has configured itself you can make it:
$ make
To install you may need to obtain the appropriate permissions. Once you have:
$ make install
The library can be built to access a BDM driver locally via the kernel's
driver interface, remotely via a TCP/IP socket interfacei, or with direct
hardware access via the ioperm system call. You can have a library which
supports all or a mix of interfaces. This allows you to build the
library and therefore gdb on a host which does not support the driver
interface.
On Windows 2000 install the GiveIO driver. This is detailed in the WINDOWS
section earlier. To install the USB pod on Windows refer the TBLCF Pod
section later.
The package supports a number of configuration options over and above the
standard configure options such as '--prefix'. These are:
--enable-debug: Turn on compiler debug information
On by default.
--enable-remote: Turn on the remote protocol and build it into
the library. On by default.
--enable-ioperm: Turn on direct IOPERM hardware access. Enabled
if the OS provides the ioperm() system call.
--enable-driver: Turn on driver access from the library. Enabled
by default on systems that support it.
--enable-server: Turn on building the BDM server. On by default.
--enable-flashlib: Turn on building of the flashlib.
--enable-bdmctrl: Turn on building of the bdmctrl utility. Since there
might be problems to locate bfd.h/libbfd.a which
know how to handle target object files, building
the bdmctrl utility is disabled unless you have
specified the configure options --with-libbfd,
--with-libiberty and --with-bfd-include-dir.
--enable-tblcf: Turn on building the TBLCF support. On by default.
On Windows the --with-usblib-dir can be used to
provide the location of the unpacked Win32 libusb
package.
--with-libusb-dir Path, with no spaces to the libusb library if the
library is not installed in the default location.
To turn off an option use '--disable-*' where '*' is one of the above.
Some host settings automatically disable some options:
Linux : All default settings.
Cygwin: All default settings.
MinGW : Server is not built.
The prefix defaults to the platform specific default. Please refer to your
documentation for this default setting or just try and see what happens.
Note, the BDM library is now installed under the package directory of 'bdm'
under the prefix. For example a prefix of '/usr/local' as found on Linux
results in the library being under '/usr/local/lib/bdm/libBDM.a'.
The BDM package also supports cross-compiling. For example you can build
for a mingw32 host on a Linux machine if you have a MinGW cross-compiler
and runtime installed:
$ ../gdb-bdm-xx/m68k/configure --host=ming32 \
--build=`./gdb-bdm-xx/m68k/config/config.guess`
Step 3 -- Installing the Server
You only need the BDM server if you intend to use the ioperm method of
accessing the parallel port, or you wish to support remote access. If you
wish to use a driver and your access is local to your development machine
then this step may be skipped.
Before using the server, please make sure you understand the implications
of such a setup. You probably want to restrict access to the bdmd port
to trusted machines.
The BDM server allows a lab to contain your target hardware and you can
access it from your development machine. The BDM server can support clients
on different platforms. This means a Linux server can be accessed from MacOS
or Windows clients.
The server runs from the xinetd or inetd daemon, and installs into
the 'sbin' directory under the configure prefix when building the user
programs in Step 2 above.
You need to edit the /etc/services file to add the port number bdmd
uses. Add this line at the bottom of the /etc/services file:
bdm 6543/tcp # BDM server
The BDM remote library will check /etc/services to see if a port is
provided. If not found the remote library will default to 6543.
It is recommended you add the entry to /etc/services and you check
the client and server match.
For inetd users such as FreeBSD:
You need to edit the /etc/inetd.conf file. Add this line at the end of
/etc/inetd.conf:
bdm stream tcp nowait root /usr/local/sbin/bdmd bdmd
You can specify any user including root. If you are wishing to use the
ioperm support then the user must be root.
For xinetd users as root install the follow in a file called:
/etc/xinetd.d/bdm
service bdm
{
socket_type = stream
port = 6543
wait = no
user = root
server = /usr/sbin/bdmd
server_args = -n
log_on_failure += USERID
disable = no
}
then get xinetd to reload its configuration.
To test the bdmd server open a shell on the machine bdmd has been installed
and condigured. At the shell prompt run telnet as follows:
$ telnet localhost bdm
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
>> helo
HELO 2 ted BDM server 1.0.0 ready.
>> quit
Connection closed by foreign host.
$
The lines marked '>>' you type and press enter. Once the connected to
localhost appears enter 'helo' and enter. The server should respond with
version etc. To exit enter 'quit' then enter.
If is not working you are best to check your system log (/var/log/messages)
to locate the reason xinetd is not starting the bdmd server. To debug an
xinetd setup, as root do:
# kill -SIGUSR1 $(pidof xinetd)
# less /var/run/xinetd.dump
The look for the BDM entry and check entry is correct. Here is an
example:
Service = bdm
State = Active
Service configuration: bdm
id = bdm
flags = IPv4
socket_type = stream
Protocol (name,number) = (tcp,6)
port = 6543
Groups = no
Bind = All addresses.
Server = /usr/sbin/bdmd
Server argv = bdmd -n
Only from: All sites
No access: No blocked sites
Logging to syslog. Facility = authpriv, level = info
Log_on_success flags = HOST PID
Log_on_failure flags = HOST USERID
running servers = 1
retry servers = 0
attempts = 0
service fd = 5
Step 4 -- (Optional) Testing the driver.
It a good idea to build and run the test program called `bdm-chk' for
Coldfire processors and 'bdm-cpu32-chk' for CPU32 processors. This will show
the library built correctly, the driver loads and functions, and your
hardware is connected correctly and functioning.
You will need to select the correct device for the Coldfire. The example
below is for the CPU32 interface on LPT1. To test a CPU32 processor do:
$ cd test
$ ./bdm-chk /dev/bdmcpu320
To test a Coldfire processor do:
$ ./bdm-chk /dev/bdmcf0
Note, the number at the end of the device path is the parallel
port number your pod hardware is connected too. The device nodes
start from 0, while the standard PC LPT ports number from 1. This
means '/dev/bdmcf0' will look for a Coldfire processor on LPT1.
For a TBLCF USB pod on Linux you need to set up udev to create a symlink.
The section 'TBLCF USB Support' details how to set up udev. The TBLCF tools
tblcf-show returns the following for a single pod connected to a Linux box:
$ ./tblcf-show
TBLCF Turbo BDM Light ColdFire Show
Found 1 device(s)
1: 001-012
There is one pod and the name is '01-012' and udev links this to
/dev/tblcf3. To run check using this pod:
$ ./bdm-chk /dev/tblcf3
Note, the name will change on Linux if you disconnect the pod and reconnect
it. If want to lock a name down you can use udev.
To test using a BDM server on a remote host call 'foo':
$ /bdm-chk foo:/dev/bdmcpu320
Note, do not use the MSYS rxtv shell to test from. It currently transforms
program arguments and the device path used in these example becomes
something very different.
Step 5 -- Patch your GDB distribution
Step 6 -- Compile and install the cross-GDB with BDM support
These step have been removed. We do not need to patch GDB any more. Use the
m68k-bdm-gdbserver executable with GDB built from the FSF sources.
Please refer to README.bdmgdbserver for instructions on using the BDM GDB
Server.
Step 7 -- (Optional) Install the GDB scripts
$ cd gdbScripts
$ make install
You will have to change the scripts to match your CPU32(+) hardware.
Step 8 -- Build a BDM interface
See the Schematics directory for an example circuit.
Step 7 -- Try it out
This is left as an exercise for the reader.....
INITIALISATION SCRIPTS
======================
The M68K BDM package supports initialisation scripts. The scripts are all
called '.m68kbdminit' and read from 3 locations during the bdmOpen call. The
locations are:
1. The current directory ($PWD)
2. The user's home directory as specified by the "HOME" environment
variable.
3. A user define location as specified by the "M68K_BDM_INIT" environment
variable.
The files are plain text files and are read into a character array on after
another. The '#' is a comment character and line continuation using the '\' at
the end of a line is supported.
The configurations supported are:
dev:
"dev user-name device-name"
A line starting with 'dev' followed by white space defines a device mapping
or renaming. The user-name is the name a user may use to reference a
device. The device-name is the name required by the hardware to access the
device. This can be used to map a difficult USB device name that libusb uses
to a simpler user friendly name. This helps users because the naming of USB
devices vary between host platforms. The device mapping also helps
configuration control of debugging scripts. A common script can reference a
name and each user in a team can place the actual device they use in the a
user specific file in their home directory.
TBLCF USB SUPPORT
=================
The TBLCF is the Turbo BDM Light Coldfire UDB Pod created by Daniel Malik back
in 2006. This is a GPL design for both hardware and software. It uses a small
microcontrolller and firmware in the pod and the open source libusb code to
provide the low level USB support on various hosts.
The supported hosts are Linux, FreeBSD, and Windows. The specifics of the hosts
make the set up different for each. The scripts support helps user isolate
their host specifics. USB device names are helped by the 'dev' entry in the
M68K BDM script files. These entries allow you to make a simpler entry for a
more complex name. Use the' tblcf-show tool' to dump the names of the USB
devices you need to pass to the BDM software. On Linux you may wish to use read
the Linux section and use the udev interface.
The USB support in the BDM package checks the device name against the devices
detected by libusb. Linux is an exception where special code is present to
handle udev created sym-links. The code will partial match the device node
against the libusb detected devices. For example if the libusb device node
found on Windows is 'bus-0-\\.\libusb0-0002-0x0425-0x1001' then you could use
'0002-0x0425-0x1001' to use the device.
If you are a CPU32 user and would like to look at supporting the CPU32
processor with this pod please contact the BDM mailing list.
Linux
-----
The USB pod is simple to support on Linux. Just plug it and check the kernel
messages:
$ dmesg | tail
usb 1-1.2: new low speed USB device using ehci_hcd and address 12
usb 1-1.2: config 1 interface 0 altsetting 0 endpoint 0x82 is Bulk; ...
usb 1-1.2: config 1 interface 0 altsetting 0 endpoint 0x2 is Bulk; ...
usb 1-1.2: configuration #1 chosen from 1 choice
usb 1-1.2: New USB device found, idVendor=0425, idProduct=1001
usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=2
usb 1-1.2: Product: Turbo BDM Light ColdFire v0.4
usb 1-1.2: Manufacturer: Freescale
usb 1-1.2: SerialNumber: Turbo BDM Light ColdFire v0.4
You can see the pod has connected with address 12. Run the 'tblcf-show' command
to list the names of the pods as seen by libusb. If you disconnect the pod or
power cycle the pod or system the address of the pod can change. For example a
disconnect then reconnect moves the address onto the next number on my
system. This make it difficult to create scripts that take care of this.
The solution is to use udev. This is a user land system present on current
Linux systems that responds to and manages hot plug kernel events. The
Wikipedia page on udev (http://en.wikipedia.org/wiki/Udev) provide a nice
overview of udev.
Create a udev rule for the TBLCF pod to create a node in the 'dev'
directory. You can customise the node name used to suite your specific
needs. For me I have a single pod on my local Fedora Core 8 workstation and so
a basic setup is all that is needed:
# cat /etc/udev/rules.d/91-tlbcf.rules
SUBSYSTEM=="usb" ATTR{manufacturer}=="Freescale" \
ATTR{idVendor}=="0425" ATTR{idProduct}=="1001" SYMLINK+="tblcf%n"
Note: there is a single line in the actual file.
When I plug in my pod udev creates '/dev/tblcf3'. This is:
# ls -las /dev/tblcf3
0 lrwxrwxrwx 1 root root 15 2008-03-06 14:59 /dev/tblcf3 -> bus/usb/001/012
The USB support for Linux in the BDM package checks if the device node is a
sym-link. If it is the link path is read and checked to see if the prefix is
'bus/usb'. If it is the device is assumed to be a USB device and the trailing
part of the path is the device name returned by libusb. The USB driver will
attempt to open the device. This may fail if the user does not have
permission. In this case the bdmd server on the local host is used. This is
similar to the I/O Permission support.
With udev you can create device nodes with any name that suites. You can also
add more attribute checks to create a specific node. This allows for the
creation of nodes that match the function the pod is performing. In my example
above the number in the dev file is based on the USB port on the work station.
The udev configuration required varys for different types of Linux. Please let
me know of a configuration for your version of Linux and I will add it to the
list.
Windows
-------
Plugging the pod into a Windows machine brings up the standard Hardware found
installer dialog box. I have only done this when an Administrator and I suspect
you will need to be an Administrator because driver files are installed into
the Windows directory.
You need to have the LibUsb-Win32 package unpacked some where on your
machine. Typically you will have done this to build the BDM software and the
package links the libusb library. The BDM package has a axbdm.inf file and you
navigate the Hardware installer to say you have a disk then browse to select
the axbdm.inf file. The installer will then start to install the drivers and if
it cannot find the files it needs it will ask for them. This time navigate to
the location of the LibUsb-Win32 files and select the ones asked for by the
dialog box.
I created the axbdm.inf file for the AxBDM pod from Axiom I have. The
LibUsb-Win32 package contains a program called inf-installer.exe. To use this
program with the pod connected to the computer, run the program then select the
pod and fill in the fields.
Once finished you can run the testlibusb-win.exe and it will show the TBLCF pod
in the list of devices.
Run the tblcf-show program to get a list of detected pods. The returned name is
not pretty but it seems to be unique to pod in a specific USB port. You need to
use this name when using the BDM software:
> chk-bdm bus-0-\\.\libusb0-0002-0x0425-0x1001
It is not a nice name but this is what libusb returns. You can take this name
and place in a .m68kbdminit file to make more user friendly:
dev bus-0-\\.\libusb0-0002-0x0425-0x1001 usb1
On Windows you may need to add a HOME environment variable. You can do this
using the Control Panel's System entry. Open the System entry, select the
Advanced tab, then the Environment Variables button and add to "User Variables"
a "HOME" entry thats points to your home directory. On Windows this is
typically your "My Documents" directory. Once set you can create a .m68kbdminit
file in that directory and the M68K BDM tools will read that file when opening
a BDM device.
When using GDB you need to escape the '\' character. The above device name in
gdb and gdb scripts becomes:
bus-0-\\\\.\\libusb0-0002-0x0425-0x1001
I/O PERM SUPPORT
================
The I/O Permission support is based around the 'ioperm' system call on Linux
and the "/dev/io" I/O port access on FreeBSD. The calls allows a root executed
program direct access to the I/O ports of a PC. Unix programs such as X windows
use this call to gain control of the video card I/O ports without the need for
a driver. The term "ioperm" refers to the ioperm call on Linux and the
"/dev/io" interface on FreeBSD.
The support for the ioperm call has been added to the BDM package because it:
1. Allows a user to build a BDM application without installing kernel
sources.
2. The BDM driver is included in the user land application rather than
the kernel. A kernel upgrade or change does not require the building
of the BDM driver.
3. Binary programs can be created and distributed removing the need for
users to build a driver to use them.
4. Stops the kernel jitter seen when downloading.
The library that BDM applications link to by default now contains the ioperm
call as well as the BDM driver code. If you link the default library to GDB it
will contain the ioperm call. Having an application such as GDB make an ioperm
call will fail unless GDB is executing as root. The ioperm call requires the
program making the call be executing as root and executing GDB as root is not
recommended and is actively discouraged.
The remote protocol that is also built by default into the BDM library provides
an easy means to have GDB executing as a user and the BDM server executing as
root. The BDM server being root can make the ioperm call and gain direct
control of the parallel ports.
To use the ioperm call make sure you install the BDM server. See Step 3 of the
INSTALLATION procedure above.
The ioperm support performs the following when opening the BDM port:
1. Issue the ioperm call. If it passes the direct I/O accessing of the
parallel port is performed.
2. If the ioperm call fails, the kernel driver open is attempted. If
is succeeds the kernel driver is used.
3. If the driver call fails an attempt to connect to a local BDM
server is performed. Therefore if ioperm and driver opens fail the
following check command:
$ ./chk /dev/bdmcf0
is transformed into the equivalent command line command of:
$ ./chk localhost:/dev/bdmcf0
where we are attempting to open LPT1 for a Coldfire target. The
device entry at the end should be changed to suite your specific
parallel port and processor.
A side effect of the current I/O perm implementation is the simulation of
device nodes under the '/dev' tree. This design is copied from the Windows
version of the BDM package. The Windows build is a kind of I/O perm driver
where the GiveIO driver provides the Windows application direct access to the
parallel port rather than the ioperm system call. The simulation of BDM device
nodes under the '/dev' directory is used to keep the documentation consisent,
and to allow GDB scripts or BDM programs a common way to operate on different
platforms. The simulation means you will not find device nodes under a '/dev'
tree. This can be confusing for experienced Unix users accustomed to finding
device nodes in the '/dev' directory.
The I/O perm interface has about the same performance as the kernel
module. This is based on limited testing. The kernel module should be a little
faster for most block read/write operations. This is mostly due to the kernel
being blocked while the bit bashing occurs. If you perform a large number of
small BDM requests the performance will about the same for the ioperm direct
accesses and the kernel driver.
The Library
===========
The library provides a higher level interface to the driver without requiring
you to make low level Linux driver calls.
The library interface consists of two parts:
1) The driver interface, and
2) The remote protocol.
The driver interface make Unix driver calls via the open, close, read, write
and ioctl system calls.
The library also contains the remote protocol that talks to the BDM
server. This protocol is not the GDB remote protocol. It operates at a much
lower level than the GDB remote protocol and is designed to support a server
operating from xinetd or inetd. It also allows flash programming tools built
with the BDM library to work remotely.
The library does not contain the download support anymore. The need to contain
a specific BFD header file is broken. The GDB patch contains the code to
perform a download to target.
Windows 9x,NT,2000
==================
The library will build the driver in one pass. There is no driver needed for
Windows 9x. This should allow GDB to be built. The Cygwin or MinGW packages are
needed to build the library.
I have tested the package on Windows 98, Windows 2000 and Windows XP using
MinGW. This is cross-compiled from Linux and also compiled under MinGW on
Windows XP.
Cygwin should build and work, how-ever at the time of updating this file I
could get Cygwin installed and working to test.
Setting the minor device number
===============================
The minor device number (the second number in the mknod command) specifies
the parallel port to which the BDM interface is connected and the type of
the target CPU. The least signficant two bits of the minor device
number specify the parallel port and the remaining bits specify the target
CPU type:
7 6 5 4 3 2 1 0
+----+----+----+----+----+----+----+----+
| | | | | | | | |
+----+----+----+----+----+----+----+----+
\ / \ /
\ / \ /
\ / \ /
------------+----------- -+-
| |
| |
| +-- These two bits select the parallel
| port to which the BDM interface is
| connected: 00 - LPT1
| 01 - LPT2
| 10 - LPT3
|
+-- These six bits select the target CPU type:
000000 - CPU32+ (PD adaptor)
000001 - Coldfire
000010 - CPU32+ (ICD adaptor)
Examples
========
1. Target processor is a Motorola MC68360 (CPU32+) connected to LPT1.
Minor device number is 0.
2. Target processor is a Motorola MC68360 (CPU32+) connected to LPT2.
Minor device number is 1.
3. Target processor is a Motorola MC5206(e) or MCF5307 (Coldfire) connected
to LPT1. Minor device number is 4.
ACKNOWLEDGEMENTS
================
Thanks very much to Motorola for making the parallel port BDM
interface circuit freely available and to M. Schraut and G. Magin
for providing the Linux driver and gdb modifications that got this
all started.
For the Coldfire additions I would like thank Eric for the clean
driver frame work, and David L Jenkins
(David.l.jenkins@btinternet.com) for the orginal post to the Coldfire
mailing list (ColdFire@WildRice.com) with the pin out and functions
for the P&E interface. It is what started me doing this and a really
great help. David Fiddes must be thanked for the testing and 5307
reset bug. I would also like to thank Dave Morgan of Plessey Asia
Pacific for the use of some test equipment which helped.
Thanks to David McCullough (davidm@stallion.oz.au) for the SCO
support.
ICD fixes from Alexander Aganichev <AAganichev@hypercom.com>.
ICD performace fixed from Keith Outwater <vac4050@cae597.rsc.raytheon.com>.
NT and GiveIO support to Rick Haubenstricker <rickh@perceptron.com>.
Thanks to Sue Cozart and Joe Circello for answering question about
the Coldfire's BDM hardware.
Additional thanks to Freescale for their continued support.
Thanks to Axiom Manufacturing for their support in adding the TBLCF support.
WHERE TO GET HELP
=================
If you've got any questions about any of this, please contact the BDM project
mailing list on the SourceForge web site:
http://sourceforge.net/projects/bdm/
We like to hear any success stories, as well as suggestions for improvements.

282
m68k/README.bdmgdbserver Normal file
View File

@@ -0,0 +1,282 @@
M68K BDM GDB Server
Chris Johns
3 Nov 2007
The 'gdbserver' directory contains a GDB Remote protocol server which provides
BDM support for GDB for a range of Coldfire and CPU32 processors. The server
called 'm68k-bdm-gdbserver' will have been installed when you installed the
M68K BDM package. Make sure the installed server executable's path is in your
environment's path variable.
The BDM GDB server support Linux and Windows using GDB's socket or pipe
interfaces. The socket interface is the standard way GDB talks to a GDB remote
server. The pipe mode is also supported. With the pipe mode GDB spawns the BDM
GDB server and pipe the remote protocol to the new process.
The BDM GDB Server support the BDM library's direct or remote protocol mode of
operation. If you use the BDM library remote protocol the actual hardware will
be 2 processes away from GDB.
The GDB with the BDM GDB Server will break existing GDB scripts. All the
features that the patched version had have been carried over to the BDM GDB
Server with the added advantage of no patch to maintain plus a means to add
support for new Coldfire processors simply with out the need to upgrade GDB.
GDB Patched verses GDB Remote
The old patched GDB and the newer GDB using the remote protocol will break
existing BDM GDB scripts. All the features present in the patched GDB are
present how-ever the commands to access the features have changed. There was
no way to avoid this.
The BDM GDB Server using a remote GDB has many advantages. The advantages are:
- No need to patch GDB.
- BDM fixes and updates with out the need to update GDB.
- Simpler means of adding support for new Coldfire processors.
The hardware break and watch points are supported.
The registers shown by the standard 'info reg' command is now restricted to
registers that are in normal use with-in a program. For example the 5235
processor shows:
(gdb) info reg
d0 0xcf206080 -819961728
d1 0x15001080 352325760
d2 0x19 25
d3 0x3f6afffc 1063976956
d4 0xffffedce -4658
d5 0xff77af57 -8933545
d6 0x5e0658c7 1577474247
d7 0xf9f3dcff -101458689
a0 0x0 0x0
a1 0xffe254d4 0xffe254d4
a2 0x79a7dae5 0x79a7dae5
a3 0xf75e4dbf 0xf75e4dbf
a4 0x637a 0x637a
a5 0xf3df7b7f 0xf3df7b7f
fp 0x627a 0x627a
sp 0x627a 0x627a
ps 0x2704 9988
pc 0xffe254de 0xffe254de
macsr 0x0 0
mask 0xffffff9b -101
acc0 0xef3b7df8 -281313800
acc1 0xe50bdd7a -452207238
acc2 0x3b7df47b 998110331
acc3 0xdbb7cff8 -608710664
accext01 0x3b7df87c 998111356
accext32 0xc1e2f47b -1042090885
The full list of available registers are:
(gdb) info all-registers
d0 0xcf206080 -819961728
d1 0x15001080 352325760
d2 0x19 25
d3 0x3f6afffc 1063976956
d4 0xffffedce -4658
d5 0xff77af57 -8933545
d6 0x5e0658c7 1577474247
d7 0xf9f3dcff -101458689
a0 0x0 0x0
a1 0xffe254d4 0xffe254d4
a2 0x79a7dae5 0x79a7dae5
a3 0xf75e4dbf 0xf75e4dbf
a4 0x637a 0x637a
a5 0xf3df7b7f 0xf3df7b7f
fp 0x627a 0x627a
sp 0x627a 0x627a
ps 0x2704 9988
pc 0xffe254de 0xffe254de
vbr 0x3f8 1016
cacr 0x0 0
acr0 0x16ed4064 384647268
acr1 0xf1bd2080 -239263616
rambar 0x20000020 536870944
othera7 0xedfafefb -302317829
csr 0x1000000 16777216
xcsr 0x8400000 138412032
aatr 0x5 5
tdr 0x40000000 1073741824
pbr 0x0 0
pbmr 0x0 0
abhr 0x0 0
ablr 0x0 0
dbr 0x0 0
dbmr 0x0 0
macsr 0x0 0
mask 0xffffff9b -101
acc0 0xef3b7df8 -281313800
acc1 0xe50bdd7a -452207238
acc2 0x3b7df47b 998110331
acc3 0xdbb7cff8 -608710664
accext01 0x3b7df87c 998111356
accext32 0xc1e2f47b -1042090885
The special BDM command are available. These are accessed using the GDB
'monitor' command. To get a list of available commands connect to the target
then issue 'monitor bdm-help'.
Note: At this point in time some commands are missing. They will be added.
Building GDB
The BDM GDB Server requires GDB 6.7 or later built for a m68k-elf or similar
target. The standard FSF sources are the only sources the BDM GDB Server is
tested with. You do not need to patch GDB but you will need to insure the
'expat' XML library is installed and GDB's configure script detecteds it
correctly. Build and install GDB the normal way. For example:
$ tar jxf gdb-6.7.1.tar.bz2
$ mkdir localhost
$ cd localhost
$ ../gdb-6.7.1/configure
$ make all install
Connecting with GDB
Connect your pod to the PC and to your target hardware then power on the
hardware. This example session is with the Axman 5235 board and using the
remote target's pipe interface.
Test you BDM hardware and software configuration by running one of the test
programs in the M68K BDM package.
Start GDB and obtain the standard GDB prompt.
$ m68k-elf-gdb
GNU gdb 6.7
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=m68k-elf".
(gdb)
Connect to the target:
(gdb) target remote | m68k-bdm-gdbserver pipe /dev/bdmcf0
Remote debugging using | m68k-bdm-gdbserver pipe /dev/bdmcf0
trying kernel driver: /dev/bdmcf0
trying bdm server: localhost:/dev/bdmcf0
m68k-bdm: detected MCF5235
m68k-bdm: architecture CF5235 connected to /dev/bdmcf0
m68k-bdm: Coldfire debug module version is 0 (5206(e)/5235/5272/5282)
Process /dev/bdmcf0 created; pid = 0
Remote debugging using pipe
0xffe254e2 in ?? ()
(gdb)
The 'target remote |' command tells GDB to use the remote protocol via the
pipe interface. GDB will then use the remainder of the command line to invoke
the BDM GDB Server. The command line used is the simplest one that can be
used. It is:
m68k-bdm-gdbserver pipe /dev/bdmcf0
The 'm68k-bdm-gdbserver' is required to be in your environment's path. You can also
use a full path. The first parameter is the type of communications the GDB
server is to use. In this case if the 'pipe' interface. It could be a
socket and we will cover this later.
The BDM GDB Server can accept other command line options. They are:
m68k-bdm-gdbserver -vVhDd -t <time> <device>
-v Verbose. More than one the more verbose.
-V Version.
-h This help.
-D Driver debug level. More than one for more debug.
-d BDM Library debug level. More than one for more debug.
-t time Delay timing for the parallel ports.
device The device to connect to such as /dev/bdmcf0.
These options are mostly development and testing options. The following steps
instructions, shows assembler, set a hardware breakpoint then runs until the
break point:
(gdb) display /i $pc
1: x/i $pc
0xffe254de: moveb %a0@(516),%d1
(gdb) si
0x00000404 in ?? ()
1: x/i $pc
0x404: jmp 0xffe25c04
(gdb)
0xffe25c04 in ?? ()
1: x/i $pc
0xffe25c04: movew #9984,%sr
(gdb) x /20i $pc
0xffe25c04: movew #9984,%sr
0xffe25c08: movel #1073741825,%d0
0xffe25c0e: movel %d0,0x40000000
0xffe25c14: movel #536870945,%d0
0xffe25c1a: movec %d0,%rambar1
0xffe25c1e: movel #536870912,%d0
0xffe25c24: addil #65536,%d0
0xffe25c2a: moveal %d0,%sp
0xffe25c2c: jsr 0xffe3ca08
0xffe25c32: moveal #25530,%sp
0xffe25c38: jmp 0xffe3d5f0
0xffe25c3e: bras 0xffe25c3e
0xffe25c40: nop
0xffe25c42: nop
0xffe25c44: halt
0xffe25c46: nop
0xffe25c48: movel #16777216,%d0
0xffe25c4e: movec %d0,%cacr
0xffe25c52: rts
0xffe25c54: linkw %fp,#0
(gdb) hb *0xffe3d5f0
Hardware assisted breakpoint 1 at 0xffe3d5f0
(gdb) c
Continuing.
Breakpoint 1, 0xffe3d5f0 in ?? ()
1: x/i $pc
0xffe3d5f0: linkw %fp,#0
(gdb) q
The program is running. Exit anyway? (y or n) y
gdb: Killing inferior
$
BDM GDB Server Commands
The BDM GDB Server contains a number of commands. The current help is:
(gdb) monitor bdm-help
m68k-bdm: monitor commands:
bdm-help
This help message.
bdm-debug <level>
Set the M68K BDM debug level.
bdm-lib-debug <level>
Set the BDM library debug level.
bdm-driver-debug <level>
Set the BDM driver debug level. This may result in a
remote BDm server logging to syslog if this is enabled.
bdm-ctl-get <reg>
Get the control register where <reg> is a register value
supported by the target. For example: bdm-ctl-get 0x801
will return the VBR register for most Coldfire processors.
bdm-ctl-set <reg <value>>
Set the control reigster where <reg> is a register value
supported by the target. For example: bdm-ctl-set 0x801 0
bdm-dbg-get <reg>
Get the debug register where <reg> is a register value
supported by the target. For example: bdm-dbg-get 0x1
will return the XCSR register on Coldfire with Debug B+.
bdm-dbg-set <reg> <value>
Set the debug reigster where <reg> is a register value
supported by the target. For example: bdm-dbg-set 0x1 0
To get the VBR register you enter:
(gdb) monitor bdm-ctl-get 0x801
m68k-bdm: control reg: 0x801 = 1016 (0x3f8)
To set the VBR register you enter:
(gdb) monitor bdm-ctl-set 0x801 0x12345678

8
m68k/README.cvs Normal file
View File

@@ -0,0 +1,8 @@
If you've checked out the sources from CVS, you need
recent versions of autoconf, automake and libtool.
To create configure, run the following command from
the source directory:
config/bootstrap

73
m68k/README.insight Normal file
View File

@@ -0,0 +1,73 @@
Insight Support
Chris Johns <ccj@acm.org>, 3rd Feb 2001.
Support has been added to allow Insight to run. The GDB backend and
driver are working, how-ever the dialog box for target connection
could do with more work. You can make connections, set break points,
but I have not done any real debugging. The reason is I have been
testing on Win9x and do not have any compilers setup. I also only ran
Insight from a Cygwin bash prompt.
To build Insight, first apply the gdb patch to the Insight
sources. This should apply cleanly. Then apply the Insight patch. The
Insight patch add BDM support to the target dialog box. Insight is
built the same way as GDB so the notes in the main README can be
followed. Just apply two patches instead of the one.
You need to have a GDB init file which is loaded when you start
Insight. This is the standard GDB script for booting your
processor. It must contain a GDB command `setup-and-load'. The target
dialog box should default to this, but more on the dialog box setup
later. You can find an example for the Coldfire processor in :
gdbScripts/sfp.insight
The command `setup-and-load' command must configure enough of the
processor so RAM is working and the code can be downloaded. You should
also download the code using the load command and set the program
counter.
I found on the Win9x that I could not get Insight to automatically
load a command file. On Unix having a file called `.gdbinit' in the
directory you start GDB works. The documentation for GDB states a file
`gdb.ini' should work on Windows. It did not seem to work for me so I
specified the command file to load on the command line. I suppose this
can be hidden in a Windows shortcut. The command on Win9x is :
/insight-5.0-m68-bdm-elf/bin/m68k-bdm-elf --command=sfp.insight sfp.elf
The Target Selection dialog box has two entries for BDM, BDM/Direct
and BDM/TCP.
Using BDM/Direct.
This target is used when the pod is directly connected to the machine
you are running Insight on. Enter into the Device field the BDM device
your pod is connected to, eg. /dev/bdmcf0. The Port field is present,
and I do not know how to remove it so just ignore it.
Using BDM/TCP.
This target is used when the pod is remote from the computer running
Insight. Entry into the Hostname the remote machine's name or IP
address. In the Port field enter the BDM device, eg. /dev/bdmcf0.
The remainder of the dialog box fields should be set in the following
manner :
Set breakpoint at `main' : Do not care, your choice.
Set breakpoint at `exit' : Do not care, your choice.
Set breakpoint at [ ] : Do not care, your choice.
Display Download Dialog : Off, not checked.
More Options :
Attach to Target : On, checked.
Download Program : Off, not checked.
Run Program : Off, not checked.
Continue from Last Stop : Off, not checked. Not sure what this
one is.
Command to issue after attaching : setup-and-load
Please send me feed back on using Insight as I have no real data of
how well it is being used.

896
m68k/aclocal.m4 vendored Normal file
View File

@@ -0,0 +1,896 @@
# generated automatically by aclocal 1.10 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
m4_if(m4_PACKAGE_VERSION, [2.61],,
[m4_fatal([this file was generated for autoconf 2.61.
You have another version of autoconf. If you want to use that,
you should regenerate the build system entirely.], [63])])
# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.10'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.10], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
# _AM_AUTOCONF_VERSION(VERSION)
# -----------------------------
# aclocal traces this macro to find the Autoconf version.
# This is a private macro too. Using m4_define simplifies
# the logic in aclocal, which can simply ignore this definition.
m4_define([_AM_AUTOCONF_VERSION], [])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.10])dnl
_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
# therefore $ac_aux_dir as well) can be either absolute or relative,
# depending on how configure is run. This is pretty annoying, since
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
# source directory, any form will work fine, but in subdirectories a
# relative path needs to be adjusted first.
#
# $ac_aux_dir/missing
# fails when called from a subdirectory if $ac_aux_dir is relative
# $top_srcdir/$ac_aux_dir/missing
# fails if $ac_aux_dir is absolute,
# fails when called from a subdirectory in a VPATH build with
# a relative $ac_aux_dir
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
# harmless because $srcdir is `.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
# and then we would define $MISSING as
# MISSING="\${SHELL} $am_aux_dir/missing"
# This will work as long as MISSING is not called from configure, because
# unfortunately $(top_srcdir) has no meaning in configure.
# However there are other variables, like CC, which are often used in
# configure, and could therefore not use this "fixed" $ac_aux_dir.
#
# Another solution, used here, is to always expand $ac_aux_dir to an
# absolute PATH. The drawback is that using absolute paths prevent a
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
[dnl Rely on autoconf to set up CDPATH properly.
AC_PREREQ([2.50])dnl
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
])
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 8
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ(2.52)dnl
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])dnl
AC_SUBST([$1_FALSE])dnl
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
AC_MSG_ERROR([[conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 9
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
# NAME is "CC", "CXX", "GCJ", or "OBJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
# dependency, and given that the user is not expected to run this macro,
# just rely on AC_PROG_CC.
AC_DEFUN([_AM_DEPENDENCIES],
[AC_REQUIRE([AM_SET_DEPDIR])dnl
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
[$1], CXX, [depcc="$CXX" am_compiler_list=],
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], UPC, [depcc="$UPC" am_compiler_list=],
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output
# in D'.
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
# We will build objects and dependencies in a subdirectory because
# it helps to detect inapplicable dependency modes. For instance
# both Tru64's cc and ICC support -MD to output dependencies as a
# side effect of compilation, but ICC will put the dependencies in
# the current directory while Tru64 will put them in the object
# directory.
mkdir sub
am_cv_$1_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
fi
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
# we should not choose a depcomp mode which is confused by this.
#
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
# Solaris 8's {/usr,}/bin/sh.
touch sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
case $depmode in
nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested
if test "x$enable_dependency_tracking" = xyes; then
continue
else
break
fi
;;
none) break ;;
esac
# We check with `-c' and `-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this.
if depmode=$depmode \
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
if (grep 'ignoring option' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
am_cv_$1_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_$1_dependencies_compiler_type=none
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
AM_CONDITIONAL([am__fastdep$1], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])
# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
])
# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE(dependency-tracking,
[ --disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])dnl
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#serial 3
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[for mf in $CONFIG_FILES; do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named `Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running `make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# When using ansi2knr, U may be empty or an underscore; expand it
U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
AS_MKDIR_P([$dirpart/$fdir])
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
# AM_OUTPUT_DEPENDENCY_COMMANDS
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
# is enabled. FIXME. This creates each `.P' file that we will
# need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 12
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
# The call with PACKAGE and VERSION arguments is the old style
# call (pre autoconf-2.50), which is being phased out. PACKAGE
# and VERSION should now be passed to AC_INIT and removed from
# the call to AM_INIT_AUTOMAKE.
# We support both call styles for the transition. After
# the next Automake release, Autoconf can make the AC_INIT
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.60])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
if test "`cd $srcdir && pwd`" != "`pwd`"; then
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
# is not polluted with repeated "-I."
AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
# test to see if srcdir already configured
if test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
AM_MISSING_PROG(AUTOCONF, autoconf)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
AM_MISSING_PROG(AUTOHEADER, autoheader)
AM_MISSING_PROG(MAKEINFO, makeinfo)
AM_PROG_INSTALL_SH
AM_PROG_INSTALL_STRIP
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES(CC)],
[define([AC_PROG_CC],
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES(CXX)],
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
[_AM_DEPENDENCIES(OBJC)],
[define([AC_PROG_OBJC],
defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
])
])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
# loop where config.status creates the headers, so we can generate
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
[# Compute $1's index in $config_headers.
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
$1 | $1:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
[rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
am__leading_dot=.
else
am__leading_dot=_
fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
am__doit:
@echo done
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# We grep out `Entering directory' and `Leaving directory'
# messages which can occur if `w' ends up in MAKEFLAGS.
# In particular we don't look at `^make:' because GNU make might
# be invoked under some other name (usually "gmake"), in which
# case it prints its new name instead of `make'.
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
am__include=include
am__quote=
_am_result=GNU
fi
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
am__include=.include
am__quote="\""
_am_result=BSD
fi
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 5
# AM_PROG_CC_C_O
# --------------
# Like AC_PROG_CC_C_O, but changed for automake.
AC_DEFUN([AM_PROG_CC_C_O],
[AC_REQUIRE([AC_PROG_CC_C_O])dnl
AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([compile])dnl
# FIXME: we rely on the cache variable name because
# there is no other way.
set dummy $CC
ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
# Losing compiler, so override with the script.
# FIXME: It is wrong to rewrite CC.
# But if we don't then we get into trouble of one sort or another.
# A longer-term fix would be to have automake use am__CC in this case,
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
CC="$am_aux_dir/compile $CC"
fi
dnl Make sure AC_PROG_CC is never called again, or it will override our
dnl setting of CC.
m4_define([AC_PROG_CC],
[m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 5
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
[AC_REQUIRE([AM_MISSING_HAS_RUN])
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
# AM_MISSING_HAS_RUN
# ------------------
# Define MISSING if not defined so far and test if it supports --run.
# If it does, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
else
am_missing_run=
AC_MSG_WARN([`missing' script is too old or missing])
fi
])
# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_MKDIR_P
# ---------------
# Check for `mkdir -p'.
AC_DEFUN([AM_PROG_MKDIR_P],
[AC_PREREQ([2.60])dnl
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
dnl while keeping a definition of mkdir_p for backward compatibility.
dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
dnl Makefile.ins that do not define MKDIR_P, so we do our own
dnl adjustment using top_builddir (which is defined more often than
dnl MKDIR_P).
AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
case $mkdir_p in
[[\\/$]]* | ?:[[\\/]]*) ;;
*/*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
esac
])
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# _AM_MANGLE_OPTION(NAME)
# -----------------------
AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME)
# ------------------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
# _AM_SET_OPTIONS(OPTIONS)
# ----------------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftest.file
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftest.file`
fi
rm -f conftest.file
if test "$[*]" != "X $srcdir/configure conftest.file" \
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "$[2]" = conftest.file
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
AC_MSG_RESULT(yes)])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_STRIP
# ---------------------
# One issue with vendor `install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
# always use install-sh in `make install-strip', and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# Installed binaries are usually stripped using `strip' when the user
# run `make install-strip'. However `strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the `STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in.
# This macro is traced by Automake.
AC_DEFUN([_AM_SUBST_NOTMAKE])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# _AM_PROG_TAR(FORMAT)
# --------------------
# Check how to create a tarball in format FORMAT.
# FORMAT should be one of `v7', `ustar', or `pax'.
#
# Substitute a variable $(am__tar) that is a command
# writing to stdout a FORMAT-tarball containing the directory
# $tardir.
# tardir=directory && $(am__tar) > result.tar
#
# Substitute a variable $(am__untar) that extract such
# a tarball read from stdin.
# $(am__untar) < result.tar
AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility.
AM_MISSING_PROG([AMTAR], [tar])
m4_if([$1], [v7],
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
[m4_case([$1], [ustar],, [pax],,
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
# Loop over all known methods to create a tar archive until one works.
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
# Do not fold the above two line into one, because Tru64 sh and
# Solaris sh will not grok spaces in the rhs of `-'.
for _am_tool in $_am_tools
do
case $_am_tool in
gnutar)
for _am_tar in tar gnutar gtar;
do
AM_RUN_LOG([$_am_tar --version]) && break
done
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
am__untar="$_am_tar -xf -"
;;
plaintar)
# Must skip GNU tar: if it does not support --format= it doesn't create
# ustar tarball either.
(tar --version) >/dev/null 2>&1 && continue
am__tar='tar chf - "$$tardir"'
am__tar_='tar chf - "$tardir"'
am__untar='tar xf -'
;;
pax)
am__tar='pax -L -x $1 -w "$$tardir"'
am__tar_='pax -L -x $1 -w "$tardir"'
am__untar='pax -r'
;;
cpio)
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
am__untar='cpio -i -H $1 -d'
;;
none)
am__tar=false
am__tar_=false
am__untar=false
;;
esac
# If the value was cached, stop now. We just wanted to have am__tar
# and am__untar set.
test -n "${am_cv_prog_tar_$1}" && break
# tar/untar a dummy directory, and stop if the command works
rm -rf conftest.dir
mkdir conftest.dir
echo GrepMe > conftest.dir/file
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
rm -rf conftest.dir
if test -s conftest.tar; then
AM_RUN_LOG([$am__untar <conftest.tar])
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
fi
done
rm -rf conftest.dir
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR

9817
m68k/autom4te.cache/output.0 Normal file

File diff suppressed because it is too large Load Diff

9817
m68k/autom4te.cache/output.1 Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,131 @@
# This file was generated.
# It contains the lists of macros which have been traced.
# It can be safely removed.
@request = (
bless( [
'0',
1,
[
'/usr/share/autoconf'
],
[
'/usr/share/autoconf/autoconf/autoconf.m4f',
'/usr/share/aclocal-1.10/amversion.m4',
'/usr/share/aclocal-1.10/auxdir.m4',
'/usr/share/aclocal-1.10/cond.m4',
'/usr/share/aclocal-1.10/depend.m4',
'/usr/share/aclocal-1.10/depout.m4',
'/usr/share/aclocal-1.10/init.m4',
'/usr/share/aclocal-1.10/install-sh.m4',
'/usr/share/aclocal-1.10/lead-dot.m4',
'/usr/share/aclocal-1.10/make.m4',
'/usr/share/aclocal-1.10/minuso.m4',
'/usr/share/aclocal-1.10/missing.m4',
'/usr/share/aclocal-1.10/mkdirp.m4',
'/usr/share/aclocal-1.10/options.m4',
'/usr/share/aclocal-1.10/runlog.m4',
'/usr/share/aclocal-1.10/sanity.m4',
'/usr/share/aclocal-1.10/strip.m4',
'/usr/share/aclocal-1.10/substnot.m4',
'/usr/share/aclocal-1.10/tar.m4',
'configure.ac'
],
{
'm4_pattern_forbid' => 1,
'AM_SET_CURRENT_AUTOMAKE_VERSION' => 1,
'_AM_SET_OPTION' => 1,
'AC_DEFUN' => 1,
'AM_PROG_MKDIR_P' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'AM_MISSING_HAS_RUN' => 1,
'AM_MISSING_PROG' => 1,
'AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
'AC_DEFUN_ONCE' => 1,
'AM_PROG_INSTALL_STRIP' => 1,
'_m4_warn' => 1,
'AM_SANITY_CHECK' => 1,
'include' => 1,
'_AM_PROG_TAR' => 1,
'AM_AUX_DIR_EXPAND' => 1,
'AM_DEP_TRACK' => 1,
'_AM_SET_OPTIONS' => 1,
'AM_RUN_LOG' => 1,
'_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
'_AM_IF_OPTION' => 1,
'_AM_SUBST_NOTMAKE' => 1,
'_AM_AUTOCONF_VERSION' => 1,
'AM_PROG_CC_C_O' => 1,
'm4_pattern_allow' => 1,
'_AM_MANGLE_OPTION' => 1,
'AM_SET_LEADING_DOT' => 1,
'AM_CONDITIONAL' => 1,
'AM_SET_DEPDIR' => 1,
'_AM_DEPENDENCIES' => 1,
'm4_include' => 1,
'AM_PROG_INSTALL_SH' => 1,
'_AC_AM_CONFIG_HEADER_HOOK' => 1,
'AU_DEFUN' => 1,
'AM_MAKE_INCLUDE' => 1
}
], 'Autom4te::Request' ),
bless( [
'1',
1,
[
'/usr/share/autoconf'
],
[
'/usr/share/autoconf/autoconf/autoconf.m4f',
'aclocal.m4',
'configure.ac'
],
{
'AM_PROG_F77_C_O' => 1,
'_LT_AC_TAGCONFIG' => 1,
'm4_pattern_forbid' => 1,
'AC_INIT' => 1,
'AC_CANONICAL_TARGET' => 1,
'AC_CONFIG_LIBOBJ_DIR' => 1,
'AC_SUBST' => 1,
'AC_CANONICAL_HOST' => 1,
'AC_FC_SRCEXT' => 1,
'AC_PROG_LIBTOOL' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'LT_CONFIG_LTDL_DIR' => 1,
'AC_REQUIRE_AUX_FILE' => 1,
'AC_CONFIG_LINKS' => 1,
'LT_SUPPORTED_TAG' => 1,
'm4_sinclude' => 1,
'AM_MAINTAINER_MODE' => 1,
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
'_m4_warn' => 1,
'AM_PROG_CXX_C_O' => 1,
'AM_ENABLE_MULTILIB' => 1,
'AC_CONFIG_FILES' => 1,
'include' => 1,
'LT_INIT' => 1,
'AM_GNU_GETTEXT' => 1,
'AC_LIBSOURCE' => 1,
'AM_PROG_FC_C_O' => 1,
'AC_CANONICAL_BUILD' => 1,
'AC_FC_FREEFORM' => 1,
'AH_OUTPUT' => 1,
'_AM_SUBST_NOTMAKE' => 1,
'AC_CONFIG_AUX_DIR' => 1,
'm4_pattern_allow' => 1,
'AM_PROG_CC_C_O' => 1,
'sinclude' => 1,
'AM_CONDITIONAL' => 1,
'AC_CANONICAL_SYSTEM' => 1,
'AC_CONFIG_HEADERS' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'm4_include' => 1,
'AC_SUBST_TRACE' => 1
}
], 'Autom4te::Request' )
);

View File

@@ -0,0 +1,792 @@
m4trace:/usr/share/aclocal-1.10/amversion.m4:14: -1- AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.10'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.10], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
m4trace:/usr/share/aclocal-1.10/amversion.m4:33: -1- AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.10])dnl
_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
m4trace:/usr/share/aclocal-1.10/auxdir.m4:47: -1- AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly.
AC_PREREQ([2.50])dnl
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
])
m4trace:/usr/share/aclocal-1.10/cond.m4:15: -1- AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])dnl
AC_SUBST([$1_FALSE])dnl
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
AC_MSG_ERROR([[conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.]])
fi])])
m4trace:/usr/share/aclocal-1.10/depend.m4:28: -1- AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
[$1], CXX, [depcc="$CXX" am_compiler_list=],
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], UPC, [depcc="$UPC" am_compiler_list=],
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output
# in D'.
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
# We will build objects and dependencies in a subdirectory because
# it helps to detect inapplicable dependency modes. For instance
# both Tru64's cc and ICC support -MD to output dependencies as a
# side effect of compilation, but ICC will put the dependencies in
# the current directory while Tru64 will put them in the object
# directory.
mkdir sub
am_cv_$1_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
fi
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
# we should not choose a depcomp mode which is confused by this.
#
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
# Solaris 8's {/usr,}/bin/sh.
touch sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
case $depmode in
nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested
if test "x$enable_dependency_tracking" = xyes; then
continue
else
break
fi
;;
none) break ;;
esac
# We check with `-c' and `-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this.
if depmode=$depmode \
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
if (grep 'ignoring option' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
am_cv_$1_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_$1_dependencies_compiler_type=none
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
AM_CONDITIONAL([am__fastdep$1], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])
m4trace:/usr/share/aclocal-1.10/depend.m4:139: -1- AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
])
m4trace:/usr/share/aclocal-1.10/depend.m4:147: -1- AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking,
[ --disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])dnl
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
])
m4trace:/usr/share/aclocal-1.10/depout.m4:14: -1- AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named `Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running `make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# When using ansi2knr, U may be empty or an underscore; expand it
U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
AS_MKDIR_P([$dirpart/$fdir])
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done
])
m4trace:/usr/share/aclocal-1.10/depout.m4:64: -1- AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
m4trace:/usr/share/aclocal-1.10/init.m4:26: -1- AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.60])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
if test "`cd $srcdir && pwd`" != "`pwd`"; then
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
# is not polluted with repeated "-I."
AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
# test to see if srcdir already configured
if test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
AM_MISSING_PROG(AUTOCONF, autoconf)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
AM_MISSING_PROG(AUTOHEADER, autoheader)
AM_MISSING_PROG(MAKEINFO, makeinfo)
AM_PROG_INSTALL_SH
AM_PROG_INSTALL_STRIP
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES(CC)],
[define([AC_PROG_CC],
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES(CXX)],
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
[_AM_DEPENDENCIES(OBJC)],
[define([AC_PROG_OBJC],
defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
])
])
m4trace:/usr/share/aclocal-1.10/init.m4:113: -1- AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers.
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
$1 | $1:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
m4trace:/usr/share/aclocal-1.10/install-sh.m4:11: -1- AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
m4trace:/usr/share/aclocal-1.10/lead-dot.m4:12: -1- AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
am__leading_dot=.
else
am__leading_dot=_
fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
m4trace:/usr/share/aclocal-1.10/make.m4:14: -1- AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make}
cat > confinc << 'END'
am__doit:
@echo done
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# We grep out `Entering directory' and `Leaving directory'
# messages which can occur if `w' ends up in MAKEFLAGS.
# In particular we don't look at `^make:' because GNU make might
# be invoked under some other name (usually "gmake"), in which
# case it prints its new name instead of `make'.
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
am__include=include
am__quote=
_am_result=GNU
fi
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
am__include=.include
am__quote="\""
_am_result=BSD
fi
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
m4trace:/usr/share/aclocal-1.10/minuso.m4:14: -1- AC_DEFUN([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC_C_O])dnl
AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([compile])dnl
# FIXME: we rely on the cache variable name because
# there is no other way.
set dummy $CC
ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
# Losing compiler, so override with the script.
# FIXME: It is wrong to rewrite CC.
# But if we don't then we get into trouble of one sort or another.
# A longer-term fix would be to have automake use am__CC in this case,
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
CC="$am_aux_dir/compile $CC"
fi
dnl Make sure AC_PROG_CC is never called again, or it will override our
dnl setting of CC.
m4_define([AC_PROG_CC],
[m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
])
m4trace:/usr/share/aclocal-1.10/missing.m4:14: -1- AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN])
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
m4trace:/usr/share/aclocal-1.10/missing.m4:24: -1- AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
else
am_missing_run=
AC_MSG_WARN([`missing' script is too old or missing])
fi
])
m4trace:/usr/share/aclocal-1.10/mkdirp.m4:11: -1- AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
dnl while keeping a definition of mkdir_p for backward compatibility.
dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
dnl Makefile.ins that do not define MKDIR_P, so we do our own
dnl adjustment using top_builddir (which is defined more often than
dnl MKDIR_P).
AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
case $mkdir_p in
[[\\/$]]* | ?:[[\\/]]*) ;;
*/*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
esac
])
m4trace:/usr/share/aclocal-1.10/options.m4:13: -1- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
m4trace:/usr/share/aclocal-1.10/options.m4:19: -1- AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)])
m4trace:/usr/share/aclocal-1.10/options.m4:25: -1- AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
m4trace:/usr/share/aclocal-1.10/options.m4:31: -1- AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
m4trace:/usr/share/aclocal-1.10/runlog.m4:12: -1- AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
(exit $ac_status); }])
m4trace:/usr/share/aclocal-1.10/sanity.m4:14: -1- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftest.file
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftest.file`
fi
rm -f conftest.file
if test "$[*]" != "X $srcdir/configure conftest.file" \
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "$[2]" = conftest.file
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
AC_MSG_RESULT(yes)])
m4trace:/usr/share/aclocal-1.10/strip.m4:17: -1- AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# Installed binaries are usually stripped using `strip' when the user
# run `make install-strip'. However `strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the `STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
m4trace:/usr/share/aclocal-1.10/substnot.m4:12: -1- AC_DEFUN([_AM_SUBST_NOTMAKE])
m4trace:/usr/share/aclocal-1.10/tar.m4:24: -1- AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility.
AM_MISSING_PROG([AMTAR], [tar])
m4_if([$1], [v7],
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
[m4_case([$1], [ustar],, [pax],,
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
# Loop over all known methods to create a tar archive until one works.
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
# Do not fold the above two line into one, because Tru64 sh and
# Solaris sh will not grok spaces in the rhs of `-'.
for _am_tool in $_am_tools
do
case $_am_tool in
gnutar)
for _am_tar in tar gnutar gtar;
do
AM_RUN_LOG([$_am_tar --version]) && break
done
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
am__untar="$_am_tar -xf -"
;;
plaintar)
# Must skip GNU tar: if it does not support --format= it doesn't create
# ustar tarball either.
(tar --version) >/dev/null 2>&1 && continue
am__tar='tar chf - "$$tardir"'
am__tar_='tar chf - "$tardir"'
am__untar='tar xf -'
;;
pax)
am__tar='pax -L -x $1 -w "$$tardir"'
am__tar_='pax -L -x $1 -w "$tardir"'
am__untar='pax -r'
;;
cpio)
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
am__untar='cpio -i -H $1 -d'
;;
none)
am__tar=false
am__tar_=false
am__untar=false
;;
esac
# If the value was cached, stop now. We just wanted to have am__tar
# and am__untar set.
test -n "${am_cv_prog_tar_$1}" && break
# tar/untar a dummy directory, and stop if the command works
rm -rf conftest.dir
mkdir conftest.dir
echo GrepMe > conftest.dir/file
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
rm -rf conftest.dir
if test -s conftest.tar; then
AM_RUN_LOG([$am__untar <conftest.tar])
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
fi
done
rm -rf conftest.dir
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
AC_SUBST([am__tar])
AC_SUBST([am__untar])
])
m4trace:configure.ac:13: -1- m4_pattern_forbid([^_?A[CHUM]_])
m4trace:configure.ac:13: -1- m4_pattern_forbid([_AC_])
m4trace:configure.ac:13: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS'])
m4trace:configure.ac:13: -1- m4_pattern_allow([^AS_FLAGS$])
m4trace:configure.ac:13: -1- m4_pattern_forbid([^_?m4_])
m4trace:configure.ac:13: -1- m4_pattern_forbid([^dnl$])
m4trace:configure.ac:13: -1- m4_pattern_forbid([^_?AS_])
m4trace:configure.ac:13: -1- m4_pattern_allow([^SHELL$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PATH_SEPARATOR$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_NAME$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_TARNAME$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_VERSION$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_STRING$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^exec_prefix$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^prefix$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^program_transform_name$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^bindir$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^sbindir$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^libexecdir$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^datarootdir$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^datadir$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^sysconfdir$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^sharedstatedir$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^localstatedir$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^includedir$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^oldincludedir$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^docdir$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^infodir$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^htmldir$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^dvidir$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^pdfdir$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^psdir$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^libdir$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^localedir$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^mandir$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_NAME$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_TARNAME$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_VERSION$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_STRING$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^DEFS$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^ECHO_C$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^ECHO_N$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^ECHO_T$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^LIBS$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^build_alias$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^host_alias$])
m4trace:configure.ac:13: -1- m4_pattern_allow([^target_alias$])
m4trace:configure.ac:15: -1- m4_pattern_allow([^build$])
m4trace:configure.ac:15: -1- m4_pattern_allow([^build_cpu$])
m4trace:configure.ac:15: -1- m4_pattern_allow([^build_vendor$])
m4trace:configure.ac:15: -1- m4_pattern_allow([^build_os$])
m4trace:configure.ac:15: -1- m4_pattern_allow([^host$])
m4trace:configure.ac:15: -1- m4_pattern_allow([^host_cpu$])
m4trace:configure.ac:15: -1- m4_pattern_allow([^host_vendor$])
m4trace:configure.ac:15: -1- m4_pattern_allow([^host_os$])
m4trace:configure.ac:15: -1- m4_pattern_allow([^target$])
m4trace:configure.ac:15: -1- m4_pattern_allow([^target_cpu$])
m4trace:configure.ac:15: -1- m4_pattern_allow([^target_vendor$])
m4trace:configure.ac:15: -1- m4_pattern_allow([^target_os$])
m4trace:configure.ac:16: -1- AM_INIT_AUTOMAKE([-Wall -Wno-portability -Wno-unsupported dist-bzip2 dist-zip])
m4trace:configure.ac:16: -1- m4_pattern_allow([^AM_[A-Z]+FLAGS$])
m4trace:configure.ac:16: -1- AM_SET_CURRENT_AUTOMAKE_VERSION
m4trace:configure.ac:16: -1- AM_AUTOMAKE_VERSION([1.10])
m4trace:configure.ac:16: -1- _AM_AUTOCONF_VERSION([2.61])
m4trace:configure.ac:16: -1- m4_pattern_allow([^INSTALL_PROGRAM$])
m4trace:configure.ac:16: -1- m4_pattern_allow([^INSTALL_SCRIPT$])
m4trace:configure.ac:16: -1- m4_pattern_allow([^INSTALL_DATA$])
m4trace:configure.ac:16: -1- m4_pattern_allow([^am__isrc$])
m4trace:configure.ac:16: -1- _AM_SUBST_NOTMAKE([am__isrc])
m4trace:configure.ac:16: -1- m4_pattern_allow([^CYGPATH_W$])
m4trace:configure.ac:16: -1- _AM_SET_OPTIONS([-Wall -Wno-portability -Wno-unsupported dist-bzip2 dist-zip])
m4trace:configure.ac:16: -1- _AM_SET_OPTION([-Wall])
m4trace:configure.ac:16: -2- _AM_MANGLE_OPTION([-Wall])
m4trace:configure.ac:16: -1- _AM_SET_OPTION([-Wno-portability])
m4trace:configure.ac:16: -2- _AM_MANGLE_OPTION([-Wno-portability])
m4trace:configure.ac:16: -1- _AM_SET_OPTION([-Wno-unsupported])
m4trace:configure.ac:16: -2- _AM_MANGLE_OPTION([-Wno-unsupported])
m4trace:configure.ac:16: -1- _AM_SET_OPTION([dist-bzip2])
m4trace:configure.ac:16: -2- _AM_MANGLE_OPTION([dist-bzip2])
m4trace:configure.ac:16: -1- _AM_SET_OPTION([dist-zip])
m4trace:configure.ac:16: -2- _AM_MANGLE_OPTION([dist-zip])
m4trace:configure.ac:16: -1- _m4_warn([obsolete], [The macro `AC_FOREACH' is obsolete.
You should run autoupdate.], [../../lib/autoconf/general.m4:196: AC_FOREACH is expanded from...
/usr/share/aclocal-1.10/options.m4:25: _AM_SET_OPTIONS is expanded from...
/usr/share/aclocal-1.10/init.m4:26: AM_INIT_AUTOMAKE is expanded from...
configure.ac:16: the top level])
m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE$])
m4trace:configure.ac:16: -1- m4_pattern_allow([^VERSION$])
m4trace:configure.ac:16: -1- _AM_IF_OPTION([no-define], [], [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])
m4trace:configure.ac:16: -2- _AM_MANGLE_OPTION([no-define])
m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE$])
m4trace:configure.ac:16: -1- m4_pattern_allow([^VERSION$])
m4trace:configure.ac:16: -1- AM_SANITY_CHECK
m4trace:configure.ac:16: -1- AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
m4trace:configure.ac:16: -1- AM_MISSING_HAS_RUN
m4trace:configure.ac:16: -1- AM_AUX_DIR_EXPAND
m4trace:configure.ac:16: -1- m4_pattern_allow([^ACLOCAL$])
m4trace:configure.ac:16: -1- AM_MISSING_PROG([AUTOCONF], [autoconf])
m4trace:configure.ac:16: -1- m4_pattern_allow([^AUTOCONF$])
m4trace:configure.ac:16: -1- AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
m4trace:configure.ac:16: -1- m4_pattern_allow([^AUTOMAKE$])
m4trace:configure.ac:16: -1- AM_MISSING_PROG([AUTOHEADER], [autoheader])
m4trace:configure.ac:16: -1- m4_pattern_allow([^AUTOHEADER$])
m4trace:configure.ac:16: -1- AM_MISSING_PROG([MAKEINFO], [makeinfo])
m4trace:configure.ac:16: -1- m4_pattern_allow([^MAKEINFO$])
m4trace:configure.ac:16: -1- AM_PROG_INSTALL_SH
m4trace:configure.ac:16: -1- m4_pattern_allow([^install_sh$])
m4trace:configure.ac:16: -1- AM_PROG_INSTALL_STRIP
m4trace:configure.ac:16: -1- m4_pattern_allow([^STRIP$])
m4trace:configure.ac:16: -1- m4_pattern_allow([^INSTALL_STRIP_PROGRAM$])
m4trace:configure.ac:16: -1- AM_PROG_MKDIR_P
m4trace:configure.ac:16: -1- m4_pattern_allow([^mkdir_p$])
m4trace:configure.ac:16: -1- m4_pattern_allow([^AWK$])
m4trace:configure.ac:16: -1- m4_pattern_allow([^SET_MAKE$])
m4trace:configure.ac:16: -1- AM_SET_LEADING_DOT
m4trace:configure.ac:16: -1- m4_pattern_allow([^am__leading_dot$])
m4trace:configure.ac:16: -1- _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
m4trace:configure.ac:16: -2- _AM_MANGLE_OPTION([tar-ustar])
m4trace:configure.ac:16: -1- _AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])
m4trace:configure.ac:16: -2- _AM_MANGLE_OPTION([tar-pax])
m4trace:configure.ac:16: -1- _AM_PROG_TAR([v7])
m4trace:configure.ac:16: -1- AM_MISSING_PROG([AMTAR], [tar])
m4trace:configure.ac:16: -1- m4_pattern_allow([^AMTAR$])
m4trace:configure.ac:16: -1- m4_pattern_allow([^am__tar$])
m4trace:configure.ac:16: -1- m4_pattern_allow([^am__untar$])
m4trace:configure.ac:16: -1- _AM_IF_OPTION([no-dependencies], [], [AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES(CC)],
[define([AC_PROG_CC],
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES(CXX)],
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
[_AM_DEPENDENCIES(OBJC)],
[define([AC_PROG_OBJC],
defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
])
m4trace:configure.ac:16: -2- _AM_MANGLE_OPTION([no-dependencies])
m4trace:configure.ac:20: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:20: -1- m4_pattern_allow([^CFLAGS$])
m4trace:configure.ac:20: -1- m4_pattern_allow([^LDFLAGS$])
m4trace:configure.ac:20: -1- m4_pattern_allow([^LIBS$])
m4trace:configure.ac:20: -1- m4_pattern_allow([^CPPFLAGS$])
m4trace:configure.ac:20: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:20: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:20: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:20: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:20: -1- m4_pattern_allow([^ac_ct_CC$])
m4trace:configure.ac:20: -1- m4_pattern_allow([^EXEEXT$])
m4trace:configure.ac:20: -1- m4_pattern_allow([^OBJEXT$])
m4trace:configure.ac:20: -1- _AM_DEPENDENCIES([CC])
m4trace:configure.ac:20: -1- AM_SET_DEPDIR
m4trace:configure.ac:20: -1- m4_pattern_allow([^DEPDIR$])
m4trace:configure.ac:20: -1- AM_OUTPUT_DEPENDENCY_COMMANDS
m4trace:configure.ac:20: -1- AM_MAKE_INCLUDE
m4trace:configure.ac:20: -1- m4_pattern_allow([^am__include$])
m4trace:configure.ac:20: -1- m4_pattern_allow([^am__quote$])
m4trace:configure.ac:20: -1- AM_DEP_TRACK
m4trace:configure.ac:20: -1- AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
m4trace:configure.ac:20: -1- m4_pattern_allow([^AMDEP_TRUE$])
m4trace:configure.ac:20: -1- m4_pattern_allow([^AMDEP_FALSE$])
m4trace:configure.ac:20: -1- _AM_SUBST_NOTMAKE([AMDEP_TRUE])
m4trace:configure.ac:20: -1- _AM_SUBST_NOTMAKE([AMDEP_FALSE])
m4trace:configure.ac:20: -1- m4_pattern_allow([^AMDEPBACKSLASH$])
m4trace:configure.ac:20: -1- _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])
m4trace:configure.ac:20: -1- m4_pattern_allow([^CCDEPMODE$])
m4trace:configure.ac:20: -1- AM_CONDITIONAL([am__fastdepCC], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_CC_dependencies_compiler_type" = gcc3])
m4trace:configure.ac:20: -1- m4_pattern_allow([^am__fastdepCC_TRUE$])
m4trace:configure.ac:20: -1- m4_pattern_allow([^am__fastdepCC_FALSE$])
m4trace:configure.ac:20: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_TRUE])
m4trace:configure.ac:20: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_FALSE])
m4trace:configure.ac:21: -1- m4_pattern_allow([^RANLIB$])
m4trace:configure.ac:22: -1- m4_pattern_allow([^INSTALL_PROGRAM$])
m4trace:configure.ac:22: -1- m4_pattern_allow([^INSTALL_SCRIPT$])
m4trace:configure.ac:22: -1- m4_pattern_allow([^INSTALL_DATA$])
m4trace:configure.ac:23: -1- m4_pattern_allow([^LEX$])
m4trace:configure.ac:23: -1- m4_pattern_allow([^LEX_OUTPUT_ROOT$])
m4trace:configure.ac:23: -1- m4_pattern_allow([^LEXLIB$])
m4trace:configure.ac:23: -1- m4_pattern_allow([^YYTEXT_POINTER$])
m4trace:configure.ac:29: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:30: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:31: -1- m4_pattern_allow([^CFLAGS$])
m4trace:configure.ac:33: -1- m4_pattern_allow([^AR$])
m4trace:configure.ac:34: -1- m4_pattern_allow([^AR$])
m4trace:configure.ac:35: -1- m4_pattern_allow([^AS$])
m4trace:configure.ac:36: -1- m4_pattern_allow([^AS$])
m4trace:configure.ac:37: -1- m4_pattern_allow([^RANLIB$])
m4trace:configure.ac:38: -1- m4_pattern_allow([^RANLIB$])
m4trace:configure.ac:39: -1- m4_pattern_allow([^LD$])
m4trace:configure.ac:40: -1- m4_pattern_allow([^LD$])
m4trace:configure.ac:42: -1- AM_PROG_CC_C_O
m4trace:configure.ac:42: -1- m4_pattern_allow([^NO_MINUS_C_MINUS_O$])
m4trace:configure.ac:47: -1- m4_pattern_allow([^CPP$])
m4trace:configure.ac:47: -1- m4_pattern_allow([^CPPFLAGS$])
m4trace:configure.ac:47: -1- m4_pattern_allow([^CPP$])
m4trace:configure.ac:47: -1- m4_pattern_allow([^GREP$])
m4trace:configure.ac:47: -1- m4_pattern_allow([^GREP$])
m4trace:configure.ac:47: -1- m4_pattern_allow([^EGREP$])
m4trace:configure.ac:47: -1- m4_pattern_allow([^EGREP$])
m4trace:configure.ac:47: -1- m4_pattern_allow([^STDC_HEADERS$])
m4trace:configure.ac:63: -1- m4_pattern_allow([^HAVE_DECL_STRERROR$])
m4trace:configure.ac:63: -1- m4_pattern_allow([^HAVE_DECL_STRERROR$])
m4trace:configure.ac:63: -1- m4_pattern_allow([^HAVE_DECL_PERROR$])
m4trace:configure.ac:63: -1- m4_pattern_allow([^HAVE_DECL_PERROR$])
m4trace:configure.ac:64: -1- m4_pattern_allow([^HAVE_SOCKLEN_T$])
m4trace:configure.ac:91: -1- AM_CONDITIONAL([BDM_REMOTE], [test x$bdm_remote = xtrue])
m4trace:configure.ac:91: -1- m4_pattern_allow([^BDM_REMOTE_TRUE$])
m4trace:configure.ac:91: -1- m4_pattern_allow([^BDM_REMOTE_FALSE$])
m4trace:configure.ac:91: -1- _AM_SUBST_NOTMAKE([BDM_REMOTE_TRUE])
m4trace:configure.ac:91: -1- _AM_SUBST_NOTMAKE([BDM_REMOTE_FALSE])
m4trace:configure.ac:132: -1- AM_CONDITIONAL([BDM_IOPERM], [test x$bdm_ioperm = xtrue])
m4trace:configure.ac:132: -1- m4_pattern_allow([^BDM_IOPERM_TRUE$])
m4trace:configure.ac:132: -1- m4_pattern_allow([^BDM_IOPERM_FALSE$])
m4trace:configure.ac:132: -1- _AM_SUBST_NOTMAKE([BDM_IOPERM_TRUE])
m4trace:configure.ac:132: -1- _AM_SUBST_NOTMAKE([BDM_IOPERM_FALSE])
m4trace:configure.ac:161: -1- AM_CONDITIONAL([BDM_DRIVER], [test x$bdm_driver = xtrue])
m4trace:configure.ac:161: -1- m4_pattern_allow([^BDM_DRIVER_TRUE$])
m4trace:configure.ac:161: -1- m4_pattern_allow([^BDM_DRIVER_FALSE$])
m4trace:configure.ac:161: -1- _AM_SUBST_NOTMAKE([BDM_DRIVER_TRUE])
m4trace:configure.ac:161: -1- _AM_SUBST_NOTMAKE([BDM_DRIVER_FALSE])
m4trace:configure.ac:181: -1- AM_CONDITIONAL([BDMCTRL], [test x$bdm_bdmctrl = xtrue])
m4trace:configure.ac:181: -1- m4_pattern_allow([^BDMCTRL_TRUE$])
m4trace:configure.ac:181: -1- m4_pattern_allow([^BDMCTRL_FALSE$])
m4trace:configure.ac:181: -1- _AM_SUBST_NOTMAKE([BDMCTRL_TRUE])
m4trace:configure.ac:181: -1- _AM_SUBST_NOTMAKE([BDMCTRL_FALSE])
m4trace:configure.ac:192: -1- AM_CONDITIONAL([BDMFLASHLIB], [test x$bdm_flashlib = xtrue])
m4trace:configure.ac:192: -1- m4_pattern_allow([^BDMFLASHLIB_TRUE$])
m4trace:configure.ac:192: -1- m4_pattern_allow([^BDMFLASHLIB_FALSE$])
m4trace:configure.ac:192: -1- _AM_SUBST_NOTMAKE([BDMFLASHLIB_TRUE])
m4trace:configure.ac:192: -1- _AM_SUBST_NOTMAKE([BDMFLASHLIB_FALSE])
m4trace:configure.ac:212: -1- AM_CONDITIONAL([BDMFLASH], [test x$bdm_bdmflash = xtrue])
m4trace:configure.ac:212: -1- m4_pattern_allow([^BDMFLASH_TRUE$])
m4trace:configure.ac:212: -1- m4_pattern_allow([^BDMFLASH_FALSE$])
m4trace:configure.ac:212: -1- _AM_SUBST_NOTMAKE([BDMFLASH_TRUE])
m4trace:configure.ac:212: -1- _AM_SUBST_NOTMAKE([BDMFLASH_FALSE])
m4trace:configure.ac:215: -1- AM_CONDITIONAL([BDMMON], [test x$bdm_bdmmon = xtrue])
m4trace:configure.ac:215: -1- m4_pattern_allow([^BDMMON_TRUE$])
m4trace:configure.ac:215: -1- m4_pattern_allow([^BDMMON_FALSE$])
m4trace:configure.ac:215: -1- _AM_SUBST_NOTMAKE([BDMMON_TRUE])
m4trace:configure.ac:215: -1- _AM_SUBST_NOTMAKE([BDMMON_FALSE])
m4trace:configure.ac:226: -1- AM_CONDITIONAL([GDBSERVER], [test x$bdm_gdbserver = xtrue])
m4trace:configure.ac:226: -1- m4_pattern_allow([^GDBSERVER_TRUE$])
m4trace:configure.ac:226: -1- m4_pattern_allow([^GDBSERVER_FALSE$])
m4trace:configure.ac:226: -1- _AM_SUBST_NOTMAKE([GDBSERVER_TRUE])
m4trace:configure.ac:226: -1- _AM_SUBST_NOTMAKE([GDBSERVER_FALSE])
m4trace:configure.ac:256: -1- m4_pattern_allow([^HAVE_LIBUSB$])
m4trace:configure.ac:265: -1- AM_CONDITIONAL([TBLCF_USB], [test x$bdm_tblcf = xtrue])
m4trace:configure.ac:265: -1- m4_pattern_allow([^TBLCF_USB_TRUE$])
m4trace:configure.ac:265: -1- m4_pattern_allow([^TBLCF_USB_FALSE$])
m4trace:configure.ac:265: -1- _AM_SUBST_NOTMAKE([TBLCF_USB_TRUE])
m4trace:configure.ac:265: -1- _AM_SUBST_NOTMAKE([TBLCF_USB_FALSE])
m4trace:configure.ac:267: -1- AM_CONDITIONAL([LIBUSB_PATH], [test $ac_libusb_include_dir != NONE])
m4trace:configure.ac:267: -1- m4_pattern_allow([^LIBUSB_PATH_TRUE$])
m4trace:configure.ac:267: -1- m4_pattern_allow([^LIBUSB_PATH_FALSE$])
m4trace:configure.ac:267: -1- _AM_SUBST_NOTMAKE([LIBUSB_PATH_TRUE])
m4trace:configure.ac:267: -1- _AM_SUBST_NOTMAKE([LIBUSB_PATH_FALSE])
m4trace:configure.ac:268: -1- m4_pattern_allow([^LIBUSB_INCLUDE_DIR$])
m4trace:configure.ac:269: -1- m4_pattern_allow([^LIBUSB_LIB_DIR$])
m4trace:configure.ac:286: -1- AM_CONDITIONAL([WIN32], [test x$bdm_win32 = xtrue])
m4trace:configure.ac:286: -1- m4_pattern_allow([^WIN32_TRUE$])
m4trace:configure.ac:286: -1- m4_pattern_allow([^WIN32_FALSE$])
m4trace:configure.ac:286: -1- _AM_SUBST_NOTMAKE([WIN32_TRUE])
m4trace:configure.ac:286: -1- _AM_SUBST_NOTMAKE([WIN32_FALSE])
m4trace:configure.ac:299: -1- m4_pattern_allow([^BDM_SUBDIRS$])
m4trace:configure.ac:304: -1- m4_pattern_allow([^subdirs$])
m4trace:configure.ac:310: -1- m4_pattern_allow([^flash_plugin_cc$])
m4trace:configure.ac:314: -1- AM_CONDITIONAL([BUILD_FLASH_PLUGINS], [test x${flash_plugin_cc} != xnone])
m4trace:configure.ac:314: -1- m4_pattern_allow([^BUILD_FLASH_PLUGINS_TRUE$])
m4trace:configure.ac:314: -1- m4_pattern_allow([^BUILD_FLASH_PLUGINS_FALSE$])
m4trace:configure.ac:314: -1- _AM_SUBST_NOTMAKE([BUILD_FLASH_PLUGINS_TRUE])
m4trace:configure.ac:314: -1- _AM_SUBST_NOTMAKE([BUILD_FLASH_PLUGINS_FALSE])
m4trace:configure.ac:315: -1- m4_pattern_allow([^FLASH_PLUGIN_GCC$])
m4trace:configure.ac:331: -1- m4_pattern_allow([^LIB@&t@OBJS$])
m4trace:configure.ac:331: -1- m4_pattern_allow([^LTLIBOBJS$])
m4trace:configure.ac:331: -1- _AC_AM_CONFIG_HEADER_HOOK([$ac_file])
m4trace:configure.ac:331: -1- _AM_OUTPUT_DEPENDENCY_COMMANDS

View File

@@ -0,0 +1,657 @@
m4trace:configure.ac:13: -1- AC_INIT([m68k-bdm], [1.4.0], [bdm-devel@lists.sourceforge.net])
m4trace:configure.ac:13: -1- m4_pattern_forbid([^_?A[CHUM]_])
m4trace:configure.ac:13: -1- m4_pattern_forbid([_AC_])
m4trace:configure.ac:13: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS'])
m4trace:configure.ac:13: -1- m4_pattern_allow([^AS_FLAGS$])
m4trace:configure.ac:13: -1- m4_pattern_forbid([^_?m4_])
m4trace:configure.ac:13: -1- m4_pattern_forbid([^dnl$])
m4trace:configure.ac:13: -1- m4_pattern_forbid([^_?AS_])
m4trace:configure.ac:13: -1- AC_SUBST([SHELL], [${CONFIG_SHELL-/bin/sh}])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([SHELL])
m4trace:configure.ac:13: -1- m4_pattern_allow([^SHELL$])
m4trace:configure.ac:13: -1- AC_SUBST([PATH_SEPARATOR])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([PATH_SEPARATOR])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PATH_SEPARATOR$])
m4trace:configure.ac:13: -1- AC_SUBST([PACKAGE_NAME], [m4_ifdef([AC_PACKAGE_NAME], ['AC_PACKAGE_NAME'])])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([PACKAGE_NAME])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_NAME$])
m4trace:configure.ac:13: -1- AC_SUBST([PACKAGE_TARNAME], [m4_ifdef([AC_PACKAGE_TARNAME], ['AC_PACKAGE_TARNAME'])])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([PACKAGE_TARNAME])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_TARNAME$])
m4trace:configure.ac:13: -1- AC_SUBST([PACKAGE_VERSION], [m4_ifdef([AC_PACKAGE_VERSION], ['AC_PACKAGE_VERSION'])])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([PACKAGE_VERSION])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_VERSION$])
m4trace:configure.ac:13: -1- AC_SUBST([PACKAGE_STRING], [m4_ifdef([AC_PACKAGE_STRING], ['AC_PACKAGE_STRING'])])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([PACKAGE_STRING])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_STRING$])
m4trace:configure.ac:13: -1- AC_SUBST([PACKAGE_BUGREPORT], [m4_ifdef([AC_PACKAGE_BUGREPORT], ['AC_PACKAGE_BUGREPORT'])])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([PACKAGE_BUGREPORT])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$])
m4trace:configure.ac:13: -1- AC_SUBST([exec_prefix], [NONE])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([exec_prefix])
m4trace:configure.ac:13: -1- m4_pattern_allow([^exec_prefix$])
m4trace:configure.ac:13: -1- AC_SUBST([prefix], [NONE])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([prefix])
m4trace:configure.ac:13: -1- m4_pattern_allow([^prefix$])
m4trace:configure.ac:13: -1- AC_SUBST([program_transform_name], [s,x,x,])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([program_transform_name])
m4trace:configure.ac:13: -1- m4_pattern_allow([^program_transform_name$])
m4trace:configure.ac:13: -1- AC_SUBST([bindir], ['${exec_prefix}/bin'])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([bindir])
m4trace:configure.ac:13: -1- m4_pattern_allow([^bindir$])
m4trace:configure.ac:13: -1- AC_SUBST([sbindir], ['${exec_prefix}/sbin'])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([sbindir])
m4trace:configure.ac:13: -1- m4_pattern_allow([^sbindir$])
m4trace:configure.ac:13: -1- AC_SUBST([libexecdir], ['${exec_prefix}/libexec'])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([libexecdir])
m4trace:configure.ac:13: -1- m4_pattern_allow([^libexecdir$])
m4trace:configure.ac:13: -1- AC_SUBST([datarootdir], ['${prefix}/share'])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([datarootdir])
m4trace:configure.ac:13: -1- m4_pattern_allow([^datarootdir$])
m4trace:configure.ac:13: -1- AC_SUBST([datadir], ['${datarootdir}'])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([datadir])
m4trace:configure.ac:13: -1- m4_pattern_allow([^datadir$])
m4trace:configure.ac:13: -1- AC_SUBST([sysconfdir], ['${prefix}/etc'])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([sysconfdir])
m4trace:configure.ac:13: -1- m4_pattern_allow([^sysconfdir$])
m4trace:configure.ac:13: -1- AC_SUBST([sharedstatedir], ['${prefix}/com'])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([sharedstatedir])
m4trace:configure.ac:13: -1- m4_pattern_allow([^sharedstatedir$])
m4trace:configure.ac:13: -1- AC_SUBST([localstatedir], ['${prefix}/var'])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([localstatedir])
m4trace:configure.ac:13: -1- m4_pattern_allow([^localstatedir$])
m4trace:configure.ac:13: -1- AC_SUBST([includedir], ['${prefix}/include'])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([includedir])
m4trace:configure.ac:13: -1- m4_pattern_allow([^includedir$])
m4trace:configure.ac:13: -1- AC_SUBST([oldincludedir], ['/usr/include'])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([oldincludedir])
m4trace:configure.ac:13: -1- m4_pattern_allow([^oldincludedir$])
m4trace:configure.ac:13: -1- AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME],
['${datarootdir}/doc/${PACKAGE_TARNAME}'],
['${datarootdir}/doc/${PACKAGE}'])])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([docdir])
m4trace:configure.ac:13: -1- m4_pattern_allow([^docdir$])
m4trace:configure.ac:13: -1- AC_SUBST([infodir], ['${datarootdir}/info'])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([infodir])
m4trace:configure.ac:13: -1- m4_pattern_allow([^infodir$])
m4trace:configure.ac:13: -1- AC_SUBST([htmldir], ['${docdir}'])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([htmldir])
m4trace:configure.ac:13: -1- m4_pattern_allow([^htmldir$])
m4trace:configure.ac:13: -1- AC_SUBST([dvidir], ['${docdir}'])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([dvidir])
m4trace:configure.ac:13: -1- m4_pattern_allow([^dvidir$])
m4trace:configure.ac:13: -1- AC_SUBST([pdfdir], ['${docdir}'])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([pdfdir])
m4trace:configure.ac:13: -1- m4_pattern_allow([^pdfdir$])
m4trace:configure.ac:13: -1- AC_SUBST([psdir], ['${docdir}'])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([psdir])
m4trace:configure.ac:13: -1- m4_pattern_allow([^psdir$])
m4trace:configure.ac:13: -1- AC_SUBST([libdir], ['${exec_prefix}/lib'])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([libdir])
m4trace:configure.ac:13: -1- m4_pattern_allow([^libdir$])
m4trace:configure.ac:13: -1- AC_SUBST([localedir], ['${datarootdir}/locale'])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([localedir])
m4trace:configure.ac:13: -1- m4_pattern_allow([^localedir$])
m4trace:configure.ac:13: -1- AC_SUBST([mandir], ['${datarootdir}/man'])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([mandir])
m4trace:configure.ac:13: -1- m4_pattern_allow([^mandir$])
m4trace:configure.ac:13: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_NAME])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_NAME$])
m4trace:configure.ac:13: -1- AH_OUTPUT([PACKAGE_NAME], [/* Define to the full name of this package. */
#undef PACKAGE_NAME])
m4trace:configure.ac:13: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_TARNAME])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_TARNAME$])
m4trace:configure.ac:13: -1- AH_OUTPUT([PACKAGE_TARNAME], [/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME])
m4trace:configure.ac:13: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_VERSION])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_VERSION$])
m4trace:configure.ac:13: -1- AH_OUTPUT([PACKAGE_VERSION], [/* Define to the version of this package. */
#undef PACKAGE_VERSION])
m4trace:configure.ac:13: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_STRING])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_STRING$])
m4trace:configure.ac:13: -1- AH_OUTPUT([PACKAGE_STRING], [/* Define to the full name and version of this package. */
#undef PACKAGE_STRING])
m4trace:configure.ac:13: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_BUGREPORT])
m4trace:configure.ac:13: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$])
m4trace:configure.ac:13: -1- AH_OUTPUT([PACKAGE_BUGREPORT], [/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT])
m4trace:configure.ac:13: -1- AC_SUBST([DEFS])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([DEFS])
m4trace:configure.ac:13: -1- m4_pattern_allow([^DEFS$])
m4trace:configure.ac:13: -1- AC_SUBST([ECHO_C])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([ECHO_C])
m4trace:configure.ac:13: -1- m4_pattern_allow([^ECHO_C$])
m4trace:configure.ac:13: -1- AC_SUBST([ECHO_N])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([ECHO_N])
m4trace:configure.ac:13: -1- m4_pattern_allow([^ECHO_N$])
m4trace:configure.ac:13: -1- AC_SUBST([ECHO_T])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([ECHO_T])
m4trace:configure.ac:13: -1- m4_pattern_allow([^ECHO_T$])
m4trace:configure.ac:13: -1- AC_SUBST([LIBS])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([LIBS])
m4trace:configure.ac:13: -1- m4_pattern_allow([^LIBS$])
m4trace:configure.ac:13: -1- AC_SUBST([build_alias])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([build_alias])
m4trace:configure.ac:13: -1- m4_pattern_allow([^build_alias$])
m4trace:configure.ac:13: -1- AC_SUBST([host_alias])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([host_alias])
m4trace:configure.ac:13: -1- m4_pattern_allow([^host_alias$])
m4trace:configure.ac:13: -1- AC_SUBST([target_alias])
m4trace:configure.ac:13: -1- AC_SUBST_TRACE([target_alias])
m4trace:configure.ac:13: -1- m4_pattern_allow([^target_alias$])
m4trace:configure.ac:14: -1- AC_CONFIG_AUX_DIR([config])
m4trace:configure.ac:15: -1- AC_CANONICAL_TARGET([])
m4trace:configure.ac:15: -1- AC_CANONICAL_HOST
m4trace:configure.ac:15: -1- AC_CANONICAL_BUILD
m4trace:configure.ac:15: -1- AC_REQUIRE_AUX_FILE([config.sub])
m4trace:configure.ac:15: -1- AC_REQUIRE_AUX_FILE([config.guess])
m4trace:configure.ac:15: -1- AC_SUBST([build], [$ac_cv_build])
m4trace:configure.ac:15: -1- AC_SUBST_TRACE([build])
m4trace:configure.ac:15: -1- m4_pattern_allow([^build$])
m4trace:configure.ac:15: -1- AC_SUBST([build_cpu], [$[1]])
m4trace:configure.ac:15: -1- AC_SUBST_TRACE([build_cpu])
m4trace:configure.ac:15: -1- m4_pattern_allow([^build_cpu$])
m4trace:configure.ac:15: -1- AC_SUBST([build_vendor], [$[2]])
m4trace:configure.ac:15: -1- AC_SUBST_TRACE([build_vendor])
m4trace:configure.ac:15: -1- m4_pattern_allow([^build_vendor$])
m4trace:configure.ac:15: -1- AC_SUBST([build_os])
m4trace:configure.ac:15: -1- AC_SUBST_TRACE([build_os])
m4trace:configure.ac:15: -1- m4_pattern_allow([^build_os$])
m4trace:configure.ac:15: -1- AC_SUBST([host], [$ac_cv_host])
m4trace:configure.ac:15: -1- AC_SUBST_TRACE([host])
m4trace:configure.ac:15: -1- m4_pattern_allow([^host$])
m4trace:configure.ac:15: -1- AC_SUBST([host_cpu], [$[1]])
m4trace:configure.ac:15: -1- AC_SUBST_TRACE([host_cpu])
m4trace:configure.ac:15: -1- m4_pattern_allow([^host_cpu$])
m4trace:configure.ac:15: -1- AC_SUBST([host_vendor], [$[2]])
m4trace:configure.ac:15: -1- AC_SUBST_TRACE([host_vendor])
m4trace:configure.ac:15: -1- m4_pattern_allow([^host_vendor$])
m4trace:configure.ac:15: -1- AC_SUBST([host_os])
m4trace:configure.ac:15: -1- AC_SUBST_TRACE([host_os])
m4trace:configure.ac:15: -1- m4_pattern_allow([^host_os$])
m4trace:configure.ac:15: -1- AC_SUBST([target], [$ac_cv_target])
m4trace:configure.ac:15: -1- AC_SUBST_TRACE([target])
m4trace:configure.ac:15: -1- m4_pattern_allow([^target$])
m4trace:configure.ac:15: -1- AC_SUBST([target_cpu], [$[1]])
m4trace:configure.ac:15: -1- AC_SUBST_TRACE([target_cpu])
m4trace:configure.ac:15: -1- m4_pattern_allow([^target_cpu$])
m4trace:configure.ac:15: -1- AC_SUBST([target_vendor], [$[2]])
m4trace:configure.ac:15: -1- AC_SUBST_TRACE([target_vendor])
m4trace:configure.ac:15: -1- m4_pattern_allow([^target_vendor$])
m4trace:configure.ac:15: -1- AC_SUBST([target_os])
m4trace:configure.ac:15: -1- AC_SUBST_TRACE([target_os])
m4trace:configure.ac:15: -1- m4_pattern_allow([^target_os$])
m4trace:configure.ac:16: -1- AM_INIT_AUTOMAKE([-Wall -Wno-portability -Wno-unsupported dist-bzip2 dist-zip])
m4trace:configure.ac:16: -1- m4_pattern_allow([^AM_[A-Z]+FLAGS$])
m4trace:configure.ac:16: -1- AM_AUTOMAKE_VERSION([1.10])
m4trace:configure.ac:16: -1- AC_REQUIRE_AUX_FILE([install-sh])
m4trace:configure.ac:16: -1- AC_SUBST([INSTALL_PROGRAM])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([INSTALL_PROGRAM])
m4trace:configure.ac:16: -1- m4_pattern_allow([^INSTALL_PROGRAM$])
m4trace:configure.ac:16: -1- AC_SUBST([INSTALL_SCRIPT])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([INSTALL_SCRIPT])
m4trace:configure.ac:16: -1- m4_pattern_allow([^INSTALL_SCRIPT$])
m4trace:configure.ac:16: -1- AC_SUBST([INSTALL_DATA])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([INSTALL_DATA])
m4trace:configure.ac:16: -1- m4_pattern_allow([^INSTALL_DATA$])
m4trace:configure.ac:16: -1- AC_SUBST([am__isrc], [' -I$(srcdir)'])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([am__isrc])
m4trace:configure.ac:16: -1- m4_pattern_allow([^am__isrc$])
m4trace:configure.ac:16: -1- _AM_SUBST_NOTMAKE([am__isrc])
m4trace:configure.ac:16: -1- AC_SUBST([CYGPATH_W])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([CYGPATH_W])
m4trace:configure.ac:16: -1- m4_pattern_allow([^CYGPATH_W$])
m4trace:configure.ac:16: -1- _m4_warn([obsolete], [The macro `AC_FOREACH' is obsolete.
You should run autoupdate.], [../../lib/autoconf/general.m4:196: AC_FOREACH is expanded from...
aclocal.m4:700: _AM_SET_OPTIONS is expanded from...
aclocal.m4:393: AM_INIT_AUTOMAKE is expanded from...
configure.ac:16: the top level])
m4trace:configure.ac:16: -1- AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([PACKAGE])
m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE$])
m4trace:configure.ac:16: -1- AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([VERSION])
m4trace:configure.ac:16: -1- m4_pattern_allow([^VERSION$])
m4trace:configure.ac:16: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE])
m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE$])
m4trace:configure.ac:16: -1- AH_OUTPUT([PACKAGE], [/* Name of package */
#undef PACKAGE])
m4trace:configure.ac:16: -1- AC_DEFINE_TRACE_LITERAL([VERSION])
m4trace:configure.ac:16: -1- m4_pattern_allow([^VERSION$])
m4trace:configure.ac:16: -1- AH_OUTPUT([VERSION], [/* Version number of package */
#undef VERSION])
m4trace:configure.ac:16: -1- AC_REQUIRE_AUX_FILE([missing])
m4trace:configure.ac:16: -1- AC_SUBST([ACLOCAL])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([ACLOCAL])
m4trace:configure.ac:16: -1- m4_pattern_allow([^ACLOCAL$])
m4trace:configure.ac:16: -1- AC_SUBST([AUTOCONF])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([AUTOCONF])
m4trace:configure.ac:16: -1- m4_pattern_allow([^AUTOCONF$])
m4trace:configure.ac:16: -1- AC_SUBST([AUTOMAKE])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([AUTOMAKE])
m4trace:configure.ac:16: -1- m4_pattern_allow([^AUTOMAKE$])
m4trace:configure.ac:16: -1- AC_SUBST([AUTOHEADER])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([AUTOHEADER])
m4trace:configure.ac:16: -1- m4_pattern_allow([^AUTOHEADER$])
m4trace:configure.ac:16: -1- AC_SUBST([MAKEINFO])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([MAKEINFO])
m4trace:configure.ac:16: -1- m4_pattern_allow([^MAKEINFO$])
m4trace:configure.ac:16: -1- AC_SUBST([install_sh])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([install_sh])
m4trace:configure.ac:16: -1- m4_pattern_allow([^install_sh$])
m4trace:configure.ac:16: -1- AC_SUBST([STRIP])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([STRIP])
m4trace:configure.ac:16: -1- m4_pattern_allow([^STRIP$])
m4trace:configure.ac:16: -1- AC_SUBST([INSTALL_STRIP_PROGRAM])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([INSTALL_STRIP_PROGRAM])
m4trace:configure.ac:16: -1- m4_pattern_allow([^INSTALL_STRIP_PROGRAM$])
m4trace:configure.ac:16: -1- AC_REQUIRE_AUX_FILE([install-sh])
m4trace:configure.ac:16: -1- AC_SUBST([mkdir_p], ["$MKDIR_P"])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([mkdir_p])
m4trace:configure.ac:16: -1- m4_pattern_allow([^mkdir_p$])
m4trace:configure.ac:16: -1- AC_SUBST([AWK])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([AWK])
m4trace:configure.ac:16: -1- m4_pattern_allow([^AWK$])
m4trace:configure.ac:16: -1- AC_SUBST([SET_MAKE])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([SET_MAKE])
m4trace:configure.ac:16: -1- m4_pattern_allow([^SET_MAKE$])
m4trace:configure.ac:16: -1- AC_SUBST([am__leading_dot])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([am__leading_dot])
m4trace:configure.ac:16: -1- m4_pattern_allow([^am__leading_dot$])
m4trace:configure.ac:16: -1- AC_SUBST([AMTAR])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([AMTAR])
m4trace:configure.ac:16: -1- m4_pattern_allow([^AMTAR$])
m4trace:configure.ac:16: -1- AC_SUBST([am__tar])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([am__tar])
m4trace:configure.ac:16: -1- m4_pattern_allow([^am__tar$])
m4trace:configure.ac:16: -1- AC_SUBST([am__untar])
m4trace:configure.ac:16: -1- AC_SUBST_TRACE([am__untar])
m4trace:configure.ac:16: -1- m4_pattern_allow([^am__untar$])
m4trace:configure.ac:18: -1- AC_CONFIG_HEADERS([config.h:config.h.in])
m4trace:configure.ac:20: -1- AC_SUBST([CC])
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([CC])
m4trace:configure.ac:20: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:20: -1- AC_SUBST([CFLAGS])
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([CFLAGS])
m4trace:configure.ac:20: -1- m4_pattern_allow([^CFLAGS$])
m4trace:configure.ac:20: -1- AC_SUBST([LDFLAGS])
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([LDFLAGS])
m4trace:configure.ac:20: -1- m4_pattern_allow([^LDFLAGS$])
m4trace:configure.ac:20: -1- AC_SUBST([LIBS])
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([LIBS])
m4trace:configure.ac:20: -1- m4_pattern_allow([^LIBS$])
m4trace:configure.ac:20: -1- AC_SUBST([CPPFLAGS])
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([CPPFLAGS])
m4trace:configure.ac:20: -1- m4_pattern_allow([^CPPFLAGS$])
m4trace:configure.ac:20: -1- AC_SUBST([CC])
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([CC])
m4trace:configure.ac:20: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:20: -1- AC_SUBST([CC])
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([CC])
m4trace:configure.ac:20: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:20: -1- AC_SUBST([CC])
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([CC])
m4trace:configure.ac:20: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:20: -1- AC_SUBST([CC])
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([CC])
m4trace:configure.ac:20: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:20: -1- AC_SUBST([ac_ct_CC])
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([ac_ct_CC])
m4trace:configure.ac:20: -1- m4_pattern_allow([^ac_ct_CC$])
m4trace:configure.ac:20: -1- AC_SUBST([EXEEXT], [$ac_cv_exeext])
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([EXEEXT])
m4trace:configure.ac:20: -1- m4_pattern_allow([^EXEEXT$])
m4trace:configure.ac:20: -1- AC_SUBST([OBJEXT], [$ac_cv_objext])
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([OBJEXT])
m4trace:configure.ac:20: -1- m4_pattern_allow([^OBJEXT$])
m4trace:configure.ac:20: -1- AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([DEPDIR])
m4trace:configure.ac:20: -1- m4_pattern_allow([^DEPDIR$])
m4trace:configure.ac:20: -1- AC_SUBST([am__include])
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([am__include])
m4trace:configure.ac:20: -1- m4_pattern_allow([^am__include$])
m4trace:configure.ac:20: -1- AC_SUBST([am__quote])
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([am__quote])
m4trace:configure.ac:20: -1- m4_pattern_allow([^am__quote$])
m4trace:configure.ac:20: -1- AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
m4trace:configure.ac:20: -1- AC_SUBST([AMDEP_TRUE])
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([AMDEP_TRUE])
m4trace:configure.ac:20: -1- m4_pattern_allow([^AMDEP_TRUE$])
m4trace:configure.ac:20: -1- AC_SUBST([AMDEP_FALSE])
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([AMDEP_FALSE])
m4trace:configure.ac:20: -1- m4_pattern_allow([^AMDEP_FALSE$])
m4trace:configure.ac:20: -1- _AM_SUBST_NOTMAKE([AMDEP_TRUE])
m4trace:configure.ac:20: -1- _AM_SUBST_NOTMAKE([AMDEP_FALSE])
m4trace:configure.ac:20: -1- AC_SUBST([AMDEPBACKSLASH])
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([AMDEPBACKSLASH])
m4trace:configure.ac:20: -1- m4_pattern_allow([^AMDEPBACKSLASH$])
m4trace:configure.ac:20: -1- _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])
m4trace:configure.ac:20: -1- AC_SUBST([CCDEPMODE], [depmode=$am_cv_CC_dependencies_compiler_type])
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([CCDEPMODE])
m4trace:configure.ac:20: -1- m4_pattern_allow([^CCDEPMODE$])
m4trace:configure.ac:20: -1- AM_CONDITIONAL([am__fastdepCC], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_CC_dependencies_compiler_type" = gcc3])
m4trace:configure.ac:20: -1- AC_SUBST([am__fastdepCC_TRUE])
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([am__fastdepCC_TRUE])
m4trace:configure.ac:20: -1- m4_pattern_allow([^am__fastdepCC_TRUE$])
m4trace:configure.ac:20: -1- AC_SUBST([am__fastdepCC_FALSE])
m4trace:configure.ac:20: -1- AC_SUBST_TRACE([am__fastdepCC_FALSE])
m4trace:configure.ac:20: -1- m4_pattern_allow([^am__fastdepCC_FALSE$])
m4trace:configure.ac:20: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_TRUE])
m4trace:configure.ac:20: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_FALSE])
m4trace:configure.ac:21: -1- AC_SUBST([RANLIB])
m4trace:configure.ac:21: -1- AC_SUBST_TRACE([RANLIB])
m4trace:configure.ac:21: -1- m4_pattern_allow([^RANLIB$])
m4trace:configure.ac:22: -1- AC_REQUIRE_AUX_FILE([install-sh])
m4trace:configure.ac:22: -1- AC_SUBST([INSTALL_PROGRAM])
m4trace:configure.ac:22: -1- AC_SUBST_TRACE([INSTALL_PROGRAM])
m4trace:configure.ac:22: -1- m4_pattern_allow([^INSTALL_PROGRAM$])
m4trace:configure.ac:22: -1- AC_SUBST([INSTALL_SCRIPT])
m4trace:configure.ac:22: -1- AC_SUBST_TRACE([INSTALL_SCRIPT])
m4trace:configure.ac:22: -1- m4_pattern_allow([^INSTALL_SCRIPT$])
m4trace:configure.ac:22: -1- AC_SUBST([INSTALL_DATA])
m4trace:configure.ac:22: -1- AC_SUBST_TRACE([INSTALL_DATA])
m4trace:configure.ac:22: -1- m4_pattern_allow([^INSTALL_DATA$])
m4trace:configure.ac:23: -1- AC_SUBST([LEX])
m4trace:configure.ac:23: -1- AC_SUBST_TRACE([LEX])
m4trace:configure.ac:23: -1- m4_pattern_allow([^LEX$])
m4trace:configure.ac:23: -1- AC_SUBST([LEX_OUTPUT_ROOT], [$ac_cv_prog_lex_root])
m4trace:configure.ac:23: -1- AC_SUBST_TRACE([LEX_OUTPUT_ROOT])
m4trace:configure.ac:23: -1- m4_pattern_allow([^LEX_OUTPUT_ROOT$])
m4trace:configure.ac:23: -1- AC_SUBST([LEXLIB])
m4trace:configure.ac:23: -1- AC_SUBST_TRACE([LEXLIB])
m4trace:configure.ac:23: -1- m4_pattern_allow([^LEXLIB$])
m4trace:configure.ac:23: -1- AC_DEFINE_TRACE_LITERAL([YYTEXT_POINTER])
m4trace:configure.ac:23: -1- m4_pattern_allow([^YYTEXT_POINTER$])
m4trace:configure.ac:23: -1- AH_OUTPUT([YYTEXT_POINTER], [/* Define to 1 if `lex\' declares `yytext\' as a `char *\' by default, not a
`char[]\'. */
#undef YYTEXT_POINTER])
m4trace:configure.ac:29: -1- AC_SUBST([CC])
m4trace:configure.ac:29: -1- AC_SUBST_TRACE([CC])
m4trace:configure.ac:29: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:30: -1- AC_SUBST([CC])
m4trace:configure.ac:30: -1- AC_SUBST_TRACE([CC])
m4trace:configure.ac:30: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:31: -1- AC_SUBST([CFLAGS])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([CFLAGS])
m4trace:configure.ac:31: -1- m4_pattern_allow([^CFLAGS$])
m4trace:configure.ac:33: -1- AC_SUBST([AR])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([AR])
m4trace:configure.ac:33: -1- m4_pattern_allow([^AR$])
m4trace:configure.ac:34: -1- AC_SUBST([AR])
m4trace:configure.ac:34: -1- AC_SUBST_TRACE([AR])
m4trace:configure.ac:34: -1- m4_pattern_allow([^AR$])
m4trace:configure.ac:35: -1- AC_SUBST([AS])
m4trace:configure.ac:35: -1- AC_SUBST_TRACE([AS])
m4trace:configure.ac:35: -1- m4_pattern_allow([^AS$])
m4trace:configure.ac:36: -1- AC_SUBST([AS])
m4trace:configure.ac:36: -1- AC_SUBST_TRACE([AS])
m4trace:configure.ac:36: -1- m4_pattern_allow([^AS$])
m4trace:configure.ac:37: -1- AC_SUBST([RANLIB])
m4trace:configure.ac:37: -1- AC_SUBST_TRACE([RANLIB])
m4trace:configure.ac:37: -1- m4_pattern_allow([^RANLIB$])
m4trace:configure.ac:38: -1- AC_SUBST([RANLIB])
m4trace:configure.ac:38: -1- AC_SUBST_TRACE([RANLIB])
m4trace:configure.ac:38: -1- m4_pattern_allow([^RANLIB$])
m4trace:configure.ac:39: -1- AC_SUBST([LD])
m4trace:configure.ac:39: -1- AC_SUBST_TRACE([LD])
m4trace:configure.ac:39: -1- m4_pattern_allow([^LD$])
m4trace:configure.ac:40: -1- AC_SUBST([LD])
m4trace:configure.ac:40: -1- AC_SUBST_TRACE([LD])
m4trace:configure.ac:40: -1- m4_pattern_allow([^LD$])
m4trace:configure.ac:42: -1- AM_PROG_CC_C_O
m4trace:configure.ac:42: -1- AC_DEFINE_TRACE_LITERAL([NO_MINUS_C_MINUS_O])
m4trace:configure.ac:42: -1- m4_pattern_allow([^NO_MINUS_C_MINUS_O$])
m4trace:configure.ac:42: -1- AH_OUTPUT([NO_MINUS_C_MINUS_O], [/* Define to 1 if your C compiler doesn\'t accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O])
m4trace:configure.ac:42: -1- AC_REQUIRE_AUX_FILE([compile])
m4trace:configure.ac:47: -1- AC_SUBST([CPP])
m4trace:configure.ac:47: -1- AC_SUBST_TRACE([CPP])
m4trace:configure.ac:47: -1- m4_pattern_allow([^CPP$])
m4trace:configure.ac:47: -1- AC_SUBST([CPPFLAGS])
m4trace:configure.ac:47: -1- AC_SUBST_TRACE([CPPFLAGS])
m4trace:configure.ac:47: -1- m4_pattern_allow([^CPPFLAGS$])
m4trace:configure.ac:47: -1- AC_SUBST([CPP])
m4trace:configure.ac:47: -1- AC_SUBST_TRACE([CPP])
m4trace:configure.ac:47: -1- m4_pattern_allow([^CPP$])
m4trace:configure.ac:47: -1- AC_SUBST([GREP])
m4trace:configure.ac:47: -1- AC_SUBST_TRACE([GREP])
m4trace:configure.ac:47: -1- m4_pattern_allow([^GREP$])
m4trace:configure.ac:47: -1- AC_SUBST([GREP])
m4trace:configure.ac:47: -1- AC_SUBST_TRACE([GREP])
m4trace:configure.ac:47: -1- m4_pattern_allow([^GREP$])
m4trace:configure.ac:47: -1- AC_SUBST([EGREP])
m4trace:configure.ac:47: -1- AC_SUBST_TRACE([EGREP])
m4trace:configure.ac:47: -1- m4_pattern_allow([^EGREP$])
m4trace:configure.ac:47: -1- AC_SUBST([EGREP])
m4trace:configure.ac:47: -1- AC_SUBST_TRACE([EGREP])
m4trace:configure.ac:47: -1- m4_pattern_allow([^EGREP$])
m4trace:configure.ac:47: -1- AC_DEFINE_TRACE_LITERAL([STDC_HEADERS])
m4trace:configure.ac:47: -1- m4_pattern_allow([^STDC_HEADERS$])
m4trace:configure.ac:47: -1- AH_OUTPUT([STDC_HEADERS], [/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS])
m4trace:configure.ac:48: -1- AH_OUTPUT([HAVE_SYS_IOCTL_H], [/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H])
m4trace:configure.ac:48: -1- AH_OUTPUT([HAVE_SYS_TYPES_H], [/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H])
m4trace:configure.ac:48: -1- AH_OUTPUT([HAVE_SYS_STAT_H], [/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H])
m4trace:configure.ac:48: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H])
m4trace:configure.ac:48: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H])
m4trace:configure.ac:48: -1- AH_OUTPUT([HAVE_MEMORY_H], [/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H])
m4trace:configure.ac:48: -1- AH_OUTPUT([HAVE_STRINGS_H], [/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H])
m4trace:configure.ac:48: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H])
m4trace:configure.ac:48: -1- AH_OUTPUT([HAVE_STDINT_H], [/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H])
m4trace:configure.ac:48: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H])
m4trace:configure.ac:49: -1- AH_OUTPUT([HAVE_SYS_FILE_H], [/* Define to 1 if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H])
m4trace:configure.ac:50: -1- AH_OUTPUT([HAVE_NETINET_IN_H], [/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H])
m4trace:configure.ac:51: -1- AH_OUTPUT([HAVE_SYS_SOCKET_H], [/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H])
m4trace:configure.ac:52: -1- AH_OUTPUT([HAVE_NETDB_H], [/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H])
m4trace:configure.ac:53: -1- AH_OUTPUT([HAVE_NETINET_TCP_H], [/* Define to 1 if you have the <netinet/tcp.h> header file. */
#undef HAVE_NETINET_TCP_H])
m4trace:configure.ac:54: -1- AH_OUTPUT([HAVE_SYS_IOCTL_H], [/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H])
m4trace:configure.ac:55: -1- AH_OUTPUT([HAVE_SIGNAL_H], [/* Define to 1 if you have the <signal.h> header file. */
#undef HAVE_SIGNAL_H])
m4trace:configure.ac:56: -1- AH_OUTPUT([HAVE_FCNTL_H], [/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H])
m4trace:configure.ac:57: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H])
m4trace:configure.ac:58: -1- AH_OUTPUT([HAVE_ARPA_INET_H], [/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H])
m4trace:configure.ac:59: -1- AH_OUTPUT([HAVE_ERRNO_H], [/* Define to 1 if you have the <errno.h> header file. */
#undef HAVE_ERRNO_H])
m4trace:configure.ac:60: -1- AH_OUTPUT([HAVE_TERMIOS_H], [/* Define to 1 if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H])
m4trace:configure.ac:61: -1- AH_OUTPUT([HAVE_TERMIO_H], [/* Define to 1 if you have the <termio.h> header file. */
#undef HAVE_TERMIO_H])
m4trace:configure.ac:62: -1- AH_OUTPUT([HAVE_SGTTY_H], [/* Define to 1 if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H])
m4trace:configure.ac:63: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_STRERROR])
m4trace:configure.ac:63: -1- m4_pattern_allow([^HAVE_DECL_STRERROR$])
m4trace:configure.ac:63: -1- AH_OUTPUT([HAVE_DECL_STRERROR], [/* Define to 1 if you have the declaration of `strerror\', and to 0 if you
don\'t. */
#undef HAVE_DECL_STRERROR])
m4trace:configure.ac:63: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_STRERROR])
m4trace:configure.ac:63: -1- m4_pattern_allow([^HAVE_DECL_STRERROR$])
m4trace:configure.ac:63: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_PERROR])
m4trace:configure.ac:63: -1- m4_pattern_allow([^HAVE_DECL_PERROR$])
m4trace:configure.ac:63: -1- AH_OUTPUT([HAVE_DECL_PERROR], [/* Define to 1 if you have the declaration of `perror\', and to 0 if you don\'t.
*/
#undef HAVE_DECL_PERROR])
m4trace:configure.ac:63: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_PERROR])
m4trace:configure.ac:63: -1- m4_pattern_allow([^HAVE_DECL_PERROR$])
m4trace:configure.ac:64: -1- AC_DEFINE_TRACE_LITERAL([HAVE_SOCKLEN_T])
m4trace:configure.ac:64: -1- m4_pattern_allow([^HAVE_SOCKLEN_T$])
m4trace:configure.ac:64: -1- AH_OUTPUT([HAVE_SOCKLEN_T], [/* Define to 1 if the system has the type `socklen_t\'. */
#undef HAVE_SOCKLEN_T])
m4trace:configure.ac:91: -1- AM_CONDITIONAL([BDM_REMOTE], [test x$bdm_remote = xtrue])
m4trace:configure.ac:91: -1- AC_SUBST([BDM_REMOTE_TRUE])
m4trace:configure.ac:91: -1- AC_SUBST_TRACE([BDM_REMOTE_TRUE])
m4trace:configure.ac:91: -1- m4_pattern_allow([^BDM_REMOTE_TRUE$])
m4trace:configure.ac:91: -1- AC_SUBST([BDM_REMOTE_FALSE])
m4trace:configure.ac:91: -1- AC_SUBST_TRACE([BDM_REMOTE_FALSE])
m4trace:configure.ac:91: -1- m4_pattern_allow([^BDM_REMOTE_FALSE$])
m4trace:configure.ac:91: -1- _AM_SUBST_NOTMAKE([BDM_REMOTE_TRUE])
m4trace:configure.ac:91: -1- _AM_SUBST_NOTMAKE([BDM_REMOTE_FALSE])
m4trace:configure.ac:93: -1- AH_OUTPUT([HAVE_IOPERM], [/* Define to 1 if you have the `ioperm\' function. */
#undef HAVE_IOPERM])
m4trace:configure.ac:132: -1- AM_CONDITIONAL([BDM_IOPERM], [test x$bdm_ioperm = xtrue])
m4trace:configure.ac:132: -1- AC_SUBST([BDM_IOPERM_TRUE])
m4trace:configure.ac:132: -1- AC_SUBST_TRACE([BDM_IOPERM_TRUE])
m4trace:configure.ac:132: -1- m4_pattern_allow([^BDM_IOPERM_TRUE$])
m4trace:configure.ac:132: -1- AC_SUBST([BDM_IOPERM_FALSE])
m4trace:configure.ac:132: -1- AC_SUBST_TRACE([BDM_IOPERM_FALSE])
m4trace:configure.ac:132: -1- m4_pattern_allow([^BDM_IOPERM_FALSE$])
m4trace:configure.ac:132: -1- _AM_SUBST_NOTMAKE([BDM_IOPERM_TRUE])
m4trace:configure.ac:132: -1- _AM_SUBST_NOTMAKE([BDM_IOPERM_FALSE])
m4trace:configure.ac:161: -1- AM_CONDITIONAL([BDM_DRIVER], [test x$bdm_driver = xtrue])
m4trace:configure.ac:161: -1- AC_SUBST([BDM_DRIVER_TRUE])
m4trace:configure.ac:161: -1- AC_SUBST_TRACE([BDM_DRIVER_TRUE])
m4trace:configure.ac:161: -1- m4_pattern_allow([^BDM_DRIVER_TRUE$])
m4trace:configure.ac:161: -1- AC_SUBST([BDM_DRIVER_FALSE])
m4trace:configure.ac:161: -1- AC_SUBST_TRACE([BDM_DRIVER_FALSE])
m4trace:configure.ac:161: -1- m4_pattern_allow([^BDM_DRIVER_FALSE$])
m4trace:configure.ac:161: -1- _AM_SUBST_NOTMAKE([BDM_DRIVER_TRUE])
m4trace:configure.ac:161: -1- _AM_SUBST_NOTMAKE([BDM_DRIVER_FALSE])
m4trace:configure.ac:181: -1- AM_CONDITIONAL([BDMCTRL], [test x$bdm_bdmctrl = xtrue])
m4trace:configure.ac:181: -1- AC_SUBST([BDMCTRL_TRUE])
m4trace:configure.ac:181: -1- AC_SUBST_TRACE([BDMCTRL_TRUE])
m4trace:configure.ac:181: -1- m4_pattern_allow([^BDMCTRL_TRUE$])
m4trace:configure.ac:181: -1- AC_SUBST([BDMCTRL_FALSE])
m4trace:configure.ac:181: -1- AC_SUBST_TRACE([BDMCTRL_FALSE])
m4trace:configure.ac:181: -1- m4_pattern_allow([^BDMCTRL_FALSE$])
m4trace:configure.ac:181: -1- _AM_SUBST_NOTMAKE([BDMCTRL_TRUE])
m4trace:configure.ac:181: -1- _AM_SUBST_NOTMAKE([BDMCTRL_FALSE])
m4trace:configure.ac:192: -1- AM_CONDITIONAL([BDMFLASHLIB], [test x$bdm_flashlib = xtrue])
m4trace:configure.ac:192: -1- AC_SUBST([BDMFLASHLIB_TRUE])
m4trace:configure.ac:192: -1- AC_SUBST_TRACE([BDMFLASHLIB_TRUE])
m4trace:configure.ac:192: -1- m4_pattern_allow([^BDMFLASHLIB_TRUE$])
m4trace:configure.ac:192: -1- AC_SUBST([BDMFLASHLIB_FALSE])
m4trace:configure.ac:192: -1- AC_SUBST_TRACE([BDMFLASHLIB_FALSE])
m4trace:configure.ac:192: -1- m4_pattern_allow([^BDMFLASHLIB_FALSE$])
m4trace:configure.ac:192: -1- _AM_SUBST_NOTMAKE([BDMFLASHLIB_TRUE])
m4trace:configure.ac:192: -1- _AM_SUBST_NOTMAKE([BDMFLASHLIB_FALSE])
m4trace:configure.ac:212: -1- AM_CONDITIONAL([BDMFLASH], [test x$bdm_bdmflash = xtrue])
m4trace:configure.ac:212: -1- AC_SUBST([BDMFLASH_TRUE])
m4trace:configure.ac:212: -1- AC_SUBST_TRACE([BDMFLASH_TRUE])
m4trace:configure.ac:212: -1- m4_pattern_allow([^BDMFLASH_TRUE$])
m4trace:configure.ac:212: -1- AC_SUBST([BDMFLASH_FALSE])
m4trace:configure.ac:212: -1- AC_SUBST_TRACE([BDMFLASH_FALSE])
m4trace:configure.ac:212: -1- m4_pattern_allow([^BDMFLASH_FALSE$])
m4trace:configure.ac:212: -1- _AM_SUBST_NOTMAKE([BDMFLASH_TRUE])
m4trace:configure.ac:212: -1- _AM_SUBST_NOTMAKE([BDMFLASH_FALSE])
m4trace:configure.ac:215: -1- AM_CONDITIONAL([BDMMON], [test x$bdm_bdmmon = xtrue])
m4trace:configure.ac:215: -1- AC_SUBST([BDMMON_TRUE])
m4trace:configure.ac:215: -1- AC_SUBST_TRACE([BDMMON_TRUE])
m4trace:configure.ac:215: -1- m4_pattern_allow([^BDMMON_TRUE$])
m4trace:configure.ac:215: -1- AC_SUBST([BDMMON_FALSE])
m4trace:configure.ac:215: -1- AC_SUBST_TRACE([BDMMON_FALSE])
m4trace:configure.ac:215: -1- m4_pattern_allow([^BDMMON_FALSE$])
m4trace:configure.ac:215: -1- _AM_SUBST_NOTMAKE([BDMMON_TRUE])
m4trace:configure.ac:215: -1- _AM_SUBST_NOTMAKE([BDMMON_FALSE])
m4trace:configure.ac:226: -1- AM_CONDITIONAL([GDBSERVER], [test x$bdm_gdbserver = xtrue])
m4trace:configure.ac:226: -1- AC_SUBST([GDBSERVER_TRUE])
m4trace:configure.ac:226: -1- AC_SUBST_TRACE([GDBSERVER_TRUE])
m4trace:configure.ac:226: -1- m4_pattern_allow([^GDBSERVER_TRUE$])
m4trace:configure.ac:226: -1- AC_SUBST([GDBSERVER_FALSE])
m4trace:configure.ac:226: -1- AC_SUBST_TRACE([GDBSERVER_FALSE])
m4trace:configure.ac:226: -1- m4_pattern_allow([^GDBSERVER_FALSE$])
m4trace:configure.ac:226: -1- _AM_SUBST_NOTMAKE([GDBSERVER_TRUE])
m4trace:configure.ac:226: -1- _AM_SUBST_NOTMAKE([GDBSERVER_FALSE])
m4trace:configure.ac:256: -1- AH_OUTPUT([HAVE_LIBUSB], [/* Define to 1 if you have the `usb\' library (-lusb). */
#undef HAVE_LIBUSB])
m4trace:configure.ac:256: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBUSB])
m4trace:configure.ac:256: -1- m4_pattern_allow([^HAVE_LIBUSB$])
m4trace:configure.ac:265: -1- AM_CONDITIONAL([TBLCF_USB], [test x$bdm_tblcf = xtrue])
m4trace:configure.ac:265: -1- AC_SUBST([TBLCF_USB_TRUE])
m4trace:configure.ac:265: -1- AC_SUBST_TRACE([TBLCF_USB_TRUE])
m4trace:configure.ac:265: -1- m4_pattern_allow([^TBLCF_USB_TRUE$])
m4trace:configure.ac:265: -1- AC_SUBST([TBLCF_USB_FALSE])
m4trace:configure.ac:265: -1- AC_SUBST_TRACE([TBLCF_USB_FALSE])
m4trace:configure.ac:265: -1- m4_pattern_allow([^TBLCF_USB_FALSE$])
m4trace:configure.ac:265: -1- _AM_SUBST_NOTMAKE([TBLCF_USB_TRUE])
m4trace:configure.ac:265: -1- _AM_SUBST_NOTMAKE([TBLCF_USB_FALSE])
m4trace:configure.ac:267: -1- AM_CONDITIONAL([LIBUSB_PATH], [test $ac_libusb_include_dir != NONE])
m4trace:configure.ac:267: -1- AC_SUBST([LIBUSB_PATH_TRUE])
m4trace:configure.ac:267: -1- AC_SUBST_TRACE([LIBUSB_PATH_TRUE])
m4trace:configure.ac:267: -1- m4_pattern_allow([^LIBUSB_PATH_TRUE$])
m4trace:configure.ac:267: -1- AC_SUBST([LIBUSB_PATH_FALSE])
m4trace:configure.ac:267: -1- AC_SUBST_TRACE([LIBUSB_PATH_FALSE])
m4trace:configure.ac:267: -1- m4_pattern_allow([^LIBUSB_PATH_FALSE$])
m4trace:configure.ac:267: -1- _AM_SUBST_NOTMAKE([LIBUSB_PATH_TRUE])
m4trace:configure.ac:267: -1- _AM_SUBST_NOTMAKE([LIBUSB_PATH_FALSE])
m4trace:configure.ac:268: -1- AC_SUBST([LIBUSB_INCLUDE_DIR], ["${ac_libusb_include_dir}"])
m4trace:configure.ac:268: -1- AC_SUBST_TRACE([LIBUSB_INCLUDE_DIR])
m4trace:configure.ac:268: -1- m4_pattern_allow([^LIBUSB_INCLUDE_DIR$])
m4trace:configure.ac:269: -1- AC_SUBST([LIBUSB_LIB_DIR], ["${ac_libusb_lib_dir}"])
m4trace:configure.ac:269: -1- AC_SUBST_TRACE([LIBUSB_LIB_DIR])
m4trace:configure.ac:269: -1- m4_pattern_allow([^LIBUSB_LIB_DIR$])
m4trace:configure.ac:286: -1- AM_CONDITIONAL([WIN32], [test x$bdm_win32 = xtrue])
m4trace:configure.ac:286: -1- AC_SUBST([WIN32_TRUE])
m4trace:configure.ac:286: -1- AC_SUBST_TRACE([WIN32_TRUE])
m4trace:configure.ac:286: -1- m4_pattern_allow([^WIN32_TRUE$])
m4trace:configure.ac:286: -1- AC_SUBST([WIN32_FALSE])
m4trace:configure.ac:286: -1- AC_SUBST_TRACE([WIN32_FALSE])
m4trace:configure.ac:286: -1- m4_pattern_allow([^WIN32_FALSE$])
m4trace:configure.ac:286: -1- _AM_SUBST_NOTMAKE([WIN32_TRUE])
m4trace:configure.ac:286: -1- _AM_SUBST_NOTMAKE([WIN32_FALSE])
m4trace:configure.ac:299: -1- AC_SUBST([BDM_SUBDIRS], [${bdm_subdirs}])
m4trace:configure.ac:299: -1- AC_SUBST_TRACE([BDM_SUBDIRS])
m4trace:configure.ac:299: -1- m4_pattern_allow([^BDM_SUBDIRS$])
m4trace:configure.ac:304: -1- AC_CONFIG_SUBDIRS([libelf])
m4trace:configure.ac:304: -1- AC_SUBST([subdirs], ["$subdirs m4_normalize([libelf])"])
m4trace:configure.ac:304: -1- AC_SUBST_TRACE([subdirs])
m4trace:configure.ac:304: -1- m4_pattern_allow([^subdirs$])
m4trace:configure.ac:310: -1- AC_SUBST([flash_plugin_cc])
m4trace:configure.ac:310: -1- AC_SUBST_TRACE([flash_plugin_cc])
m4trace:configure.ac:310: -1- m4_pattern_allow([^flash_plugin_cc$])
m4trace:configure.ac:314: -1- AM_CONDITIONAL([BUILD_FLASH_PLUGINS], [test x${flash_plugin_cc} != xnone])
m4trace:configure.ac:314: -1- AC_SUBST([BUILD_FLASH_PLUGINS_TRUE])
m4trace:configure.ac:314: -1- AC_SUBST_TRACE([BUILD_FLASH_PLUGINS_TRUE])
m4trace:configure.ac:314: -1- m4_pattern_allow([^BUILD_FLASH_PLUGINS_TRUE$])
m4trace:configure.ac:314: -1- AC_SUBST([BUILD_FLASH_PLUGINS_FALSE])
m4trace:configure.ac:314: -1- AC_SUBST_TRACE([BUILD_FLASH_PLUGINS_FALSE])
m4trace:configure.ac:314: -1- m4_pattern_allow([^BUILD_FLASH_PLUGINS_FALSE$])
m4trace:configure.ac:314: -1- _AM_SUBST_NOTMAKE([BUILD_FLASH_PLUGINS_TRUE])
m4trace:configure.ac:314: -1- _AM_SUBST_NOTMAKE([BUILD_FLASH_PLUGINS_FALSE])
m4trace:configure.ac:315: -1- AC_SUBST([FLASH_PLUGIN_GCC], [${flash_plugin_cc}])
m4trace:configure.ac:315: -1- AC_SUBST_TRACE([FLASH_PLUGIN_GCC])
m4trace:configure.ac:315: -1- m4_pattern_allow([^FLASH_PLUGIN_GCC$])
m4trace:configure.ac:321: -1- AC_CONFIG_FILES([Makefile \
flashlib/Makefile \
lib/Makefile \
tblcf/Makefile \
server/Makefile \
gdbserver/Makefile \
test/Makefile \
bdmabstraction/Makefile \
utils/Makefile])
m4trace:configure.ac:331: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs])
m4trace:configure.ac:331: -1- AC_SUBST_TRACE([LIB@&t@OBJS])
m4trace:configure.ac:331: -1- m4_pattern_allow([^LIB@&t@OBJS$])
m4trace:configure.ac:331: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs])
m4trace:configure.ac:331: -1- AC_SUBST_TRACE([LTLIBOBJS])
m4trace:configure.ac:331: -1- m4_pattern_allow([^LTLIBOBJS$])
m4trace:configure.ac:331: -1- AC_SUBST_TRACE([top_builddir])
m4trace:configure.ac:331: -1- AC_SUBST_TRACE([srcdir])
m4trace:configure.ac:331: -1- AC_SUBST_TRACE([abs_srcdir])
m4trace:configure.ac:331: -1- AC_SUBST_TRACE([top_srcdir])
m4trace:configure.ac:331: -1- AC_SUBST_TRACE([abs_top_srcdir])
m4trace:configure.ac:331: -1- AC_SUBST_TRACE([builddir])
m4trace:configure.ac:331: -1- AC_SUBST_TRACE([abs_builddir])
m4trace:configure.ac:331: -1- AC_SUBST_TRACE([abs_top_builddir])
m4trace:configure.ac:331: -1- AC_SUBST_TRACE([INSTALL])
m4trace:configure.ac:331: -1- AC_SUBST_TRACE([MKDIR_P])

View File

@@ -0,0 +1,5 @@
.deps
Makefile.in
Makefile
libbdmabstraction.a
*.o

View File

@@ -0,0 +1,70 @@
#ifndef BDMDriver_Included_M
#define BDMDriver_Included_M
/* @#Copyright (c) 2000, Brett Wuth. */
/* @#License:
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* File: BDMDriver.h
* Purpose: Control which Linux BDM driver is used.
* Author: Brett Wuth
* Created: 2000-03-27
*
* Initials:
* BCW - Brett Wuth
* @#[ContactWuth:
* Phone: +1 403 627-2460
* E-mail: support@castrov.cuug.ab.ca, wuth@acm.org]
*
* HISTORY:
* $Log: BDMDriver.h,v $
* Revision 1.1 2003/12/29 22:18:49 codewiz
* Move tools/bdm_abstraction to m68k/bdmabstraction and autoconfiscate.
*
* Revision 1.1 2003/06/03 15:42:03 codewiz
* Import userland tools from bdm-fiedler
*
* Revision 1.2 2000/04/20 04:56:22 wuth
* GPL. Abstract flash interface.
*
* Revision 1.1 2000/03/28 20:24:41 wuth
* Break out flash code into separate executable. Make run under Chris Johns BDM driver.
*
* @#[BasedOnTemplate: template.h version 2]
*/
#define BDMDriverFiedler_M (1)
#define BDMDriverJohns_M (2)
#define BDMDriverVersion_M BDMDriverJohns_M
#if BDMDriverVersion_M == BDMDriverFiedler_M
#include <bdmcf.h>
#define _COMPILING_
# include <bdmops.h>
#undef _COMPILING_
#elif BDMDriverVersion_M == BDMDriverJohns_M
#include <BDMlib.h>
#else
# error "BDMDriverVersion_M not set to known value"
#endif
#endif /* BDMDriver_Included_M */
/*** Emacs configuration ***/
/* Local Variables: */
/* mode:C */
/* End: */
/*EOF*/

View File

@@ -0,0 +1,323 @@
/* @#Copyright:
* Copyright (c) 1999, Rolf Fiedler.
* Copyright (c) 1999-2000, Brett Wuth.
*/
/* @#License:
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* File: BDMFlash.c
* Purpose: Flash Driver through BDM
* Author: Rolf Fiedler, Brett Wuth
* Created: 2000-03-27
*
* Initials:
* BCW - Brett Wuth
* @#[ContactWuth:
* Phone: +1 403 627-2460
* E-mail: support@castrov.cuug.ab.ca, wuth@acm.org]
*
* HISTORY:
* $Log: BDMFlash.c,v $
* Revision 1.2 2005/10/24 01:37:25 cjohns
* Fixed includes for building in Windows with MinGW.
*
* Revision 1.1 2003/12/29 22:18:49 codewiz
* Move tools/bdm_abstraction to m68k/bdmabstraction and autoconfiscate.
*
* Revision 1.2 2003/07/04 22:33:01 codewiz
* Applied SST block-erase patch.
*
* Revision 1.1 2003/06/03 15:42:04 codewiz
* Import userland tools from bdm-fiedler
*
* Revision 1.5 2000/08/03 06:29:18 wuth
* MultiProject Sync; Support Micron-style flash; Report flash model
*
* Revision 1.4 2000/07/25 13:51:09 wuth
* Working sector erase. Better error reports.
*
* Revision 1.3 2000/07/14 18:38:55 wuth
* Flash error status; Fix sector erase support; Command line sector erase
*
* Revision 1.2 2000/04/20 04:56:23 wuth
* GPL. Abstract flash interface.
*
* Revision 1.1 2000/03/28 20:24:41 wuth
* Break out flash code into separate executable. Make run under Chris Johns BDM driver.
*
* Based on revision Wuth1 of bdm-fiedler/debug/bdm_abstraction/bdmops.c.
* @#[BasedOnTemplate: template.c version 2]
*/
#include <BDMFlash.h>
#include <assert.h>
#include <BDMTargetAddress.h>
#include <Debug.h>
#include <Flash.h>
#include <stdio.h>
#include <stdlib.h> /* size_t */
#if defined (__WIN32__) && !defined (__CYGWIN__)
#include <winsock.h>
#else
#include <netinet/in.h> /* ntohl, ntohl */
#endif
typedef struct BDMFlash_s
{
int Device; /* file descriptor of BDM device */
unsigned long Base; /* start of flash in BDM's address space */
} BDMFlash_t;
static
FlashError_t
BDMFlashByteRead( void *UserData, unsigned long Location, unsigned char /*out*/ *Byte )
{
BDMFlash_t *BDMFlash = (BDMFlash_t *)UserData;
int Val;
if ((Val = BDMTargetByteRead( BDMFlash->Device, BDMFlash->Base + Location )) < 0)
return (FlashErrorReadAccess_c);
*Byte = (unsigned char) Val;
return (FlashErrorOkay_c);
}
static
FlashError_t
BDMFlashWordRead( void *UserData, unsigned long Location, unsigned short /*out*/ *Word )
{
BDMFlash_t *BDMFlash = (BDMFlash_t *)UserData;
int Val;
if ((Val = BDMTargetWordRead( BDMFlash->Device, BDMFlash->Base + Location )) < 0)
return (FlashErrorReadAccess_c);
*Word = (unsigned short) Val;
return (FlashErrorOkay_c);
}
#if 0 /*BDMTargetLongRead not yet implemented*/
static
FlashError_t
BDMFlashLongRead( void *UserData, unsigned long Location, unsigned long /*out*/ *Long )
{
BDMFlash_t *BDMFlash = (BDMFlash_t *)UserData;
long Val;
if ((Val = BDMTargetLongRead( BDMFlash->Device, BDMFlash->Base + Location )) < 0)
return (FlashErrorRead_c);
*Long = hlton( (unsigned long) Val );
return (FlashErrorOkay_c);
}
#endif
static
FlashError_t
BDMFlashByteWrite( void *UserData, unsigned long Location, unsigned char Byte )
{
BDMFlash_t *BDMFlash = (BDMFlash_t *)UserData;
if (BDMTargetByteWrite( BDMFlash->Device, BDMFlash->Base + Location, Byte ) != 0)
return (FlashErrorWriteAccess_c);
return (FlashErrorOkay_c);
}
static
FlashError_t
BDMFlashWordWrite( void *UserData, unsigned long Location, unsigned short Word )
{
BDMFlash_t *BDMFlash = (BDMFlash_t *)UserData;
if (BDMTargetWordWrite( BDMFlash->Device, BDMFlash->Base + Location, Word ) != 0)
return (FlashErrorWriteAccess_c);
return (FlashErrorOkay_c);
}
static
FlashError_t
BDMFlashLongWrite( void *UserData, unsigned long Location, unsigned long Long )
{
BDMFlash_t *BDMFlash = (BDMFlash_t *)UserData;
if (BDMTargetLongWrite( BDMFlash->Device, BDMFlash->Base + Location, Long ) != 0)
return (FlashErrorWriteAccess_c);
return (FlashErrorOkay_c);
}
static
FlashError_t
BDMFlashElementRead( void *UserData,
unsigned long Location,
unsigned int BytesWide, /* what type of read */
void /*out*/ *Element )
{
FlashError_t Error;
switch (BytesWide)
{
case 1:
Error = BDMFlashByteRead( UserData, Location, Element );
break;
case 2:
Error = BDMFlashWordRead( UserData, Location, Element );
/* BDM functions give us the number in host-order, but we want
* to pass it up in network order because that's the byte order
* that the data was originally in as seen under 68K
* architecture */
*(unsigned short *)Element = htons( *(unsigned short *)Element );
break;
case 4: /* not yet implemented */
default:
return (FlashErrorWidth_c);
}
return (Error);
}
static
FlashError_t
BDMFlashElementWrite( void *UserData,
unsigned long Location,
unsigned int BytesWide, /* what type of write */
void const *Element )
{
FlashError_t Error;
switch (BytesWide)
{
case 1:
Error = BDMFlashByteWrite( UserData, Location, *(unsigned char *)Element );
break;
case 2:
/* We want the value to be written in the same sequence as we
* receive it. The writer (the ColdFire/BDM core) uses network
* order. Therefore the byte order we're receiving it is also
* network order. The BDM functions take values in host order.
* Therefore we need to convert from network order to host
* order. */
Error = BDMFlashWordWrite( UserData, Location, ntohs( *(unsigned short *)Element ) );
break;
case 4:
Error = BDMFlashLongWrite( UserData, Location, ntohl( *(unsigned long *)Element ) );
break;
default:
return (FlashErrorWidth_c);
}
return (Error);
}
static Flash_t Flash;
static BDMFlash_t BDMFlash;
/* configure for arrangement of flash */
FlashError_t
BDMFlashConfigSet( int fd,
unsigned int Base,
unsigned int Chips,
unsigned int Bytes )
{
FlashError_t Error;
PRINTD( "Base = %u, Chips = %u, Bytes = %u\n", Base, Chips, Bytes );
BDMFlash.Device = fd;
BDMFlash.Base = Base;
Error = FlashInit( &Flash,
&BDMFlash,
BDMFlashElementRead,
BDMFlashElementWrite,
Bytes,
1, /* BDM in Big-Endian */
Chips );
return (Error);
}
/* store into flash */
FlashError_t
BDMFlashWrite( unsigned int addr, unsigned char *mem, size_t count)
{
return (FlashWrite( &Flash,
addr,
mem,
count ));
}
/* erase flash */
FlashError_t
BDMFlashErase( void )
{
return (FlashErase( &Flash ));
}
FlashError_t
BDMFlashProbe( FlashStyle_t /*out*/ *Style )
{
*Style = Flash.Style;
return (FlashErrorOkay_c);
}
/* erase flash, addr is base of a sector of a byte-wide flash */
FlashError_t
BDMFlashEraseSector( unsigned int addr )
{
return (FlashEraseSector( &Flash,
addr /* base of sector of byte-wide flash */ ));
}
/* erase flash, addr is base of a block of a byte-wide flash */
FlashError_t
BDMFlashEraseBlock( unsigned int addr )
{
return (FlashEraseBlock( &Flash,
addr /* base of sector of byte-wide flash */ ));
}
FlashError_t
BDMFlashIDRead( FlashID_t /*out*/ *ID )
{
return (FlashIDRead( &Flash, ID ));
}
FlashError_t
BDMFlashDetect( FlashInfo_t const * /*out*/ *FlashInfo )
{
return (FlashDetect( &Flash, FlashInfo ));
}
/*EOF*/

View File

@@ -0,0 +1,117 @@
#ifndef BDMFlash_Included_M
#define BDMFlash_Included_M
/* @#Copyright (c) 2000, Brett Wuth. */
/* @#License:
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* File: BDMFlash.h
* Purpose: Flash Driver through BDM
* Author: Brett Wuth
* Created: 2000-03-27
*
* Initials:
* BCW - Brett Wuth
* @#[ContactWuth:
* Phone: +1 403 627-2460
* E-mail: support@castrov.cuug.ab.ca, wuth@acm.org]
*
* HISTORY:
* $Log: BDMFlash.h,v $
* Revision 1.2 2008/06/16 12:57:49 cjohns
* 2008-06-16 Chris Johns <cjohns@users.sourceforge.net>
*
* * packages/.cvsignore, packages/gpl.txt, packages/m68k-bdm.nsi:
* New.
*
* * flashlib/elf-utils.h: Add elf_handle_init decl.
*
* * utils/Makefile.am: Add warnings flags.
*
* * bdmabstraction/BDMFlash.h, utils/bdmctrl.c, utils/bdmflash.c:
* Fix warnings.
*
* Revision 1.1 2003/12/29 22:18:49 codewiz
* Move tools/bdm_abstraction to m68k/bdmabstraction and autoconfiscate.
*
* Revision 1.2 2003/07/04 22:33:01 codewiz
* Applied SST block-erase patch.
*
* Revision 1.1 2003/06/03 15:42:04 codewiz
* Import userland tools from bdm-fiedler
*
* Revision 1.5 2000/08/03 06:29:18 wuth
* MultiProject Sync; Support Micron-style flash; Report flash model
*
* Revision 1.4 2000/07/25 13:51:09 wuth
* Working sector erase. Better error reports.
*
* Revision 1.3 2000/07/14 18:38:55 wuth
* Flash error status; Fix sector erase support; Command line sector erase
*
* Revision 1.2 2000/04/20 04:56:23 wuth
* GPL. Abstract flash interface.
*
* Revision 1.1 2000/03/28 20:24:41 wuth
* Break out flash code into separate executable. Make run under Chris Johns BDM driver.
*
* @#[BasedOnTemplate: template.h version 2]
*/
#include <Flash.h>
#include <stdlib.h> /* size_t */
#include <BDMTargetAddress.h>
/* configure for arrangement of flash */
FlashError_t
BDMFlashConfigSet( int fd,
unsigned int Base,
unsigned int Chips,
unsigned int Bytes );
/* store into flash */
FlashError_t
BDMFlashWrite( unsigned int addr, unsigned char *mem, size_t count);
/* erase flash */
FlashError_t
BDMFlashErase( void );
FlashError_t
BDMFlashProbe( FlashStyle_t /*out*/ *Style );
/* erase flash, addr is base of a sector of a byte-wide flash */
FlashError_t
BDMFlashEraseSector( unsigned int addr );
/* erase flash, addr is base of a block of a byte-wide flash */
FlashError_t
BDMFlashEraseBlock( unsigned int addr );
FlashError_t
BDMFlashIDRead( FlashID_t /*out*/ *ID );
FlashError_t
BDMFlashDetect( FlashInfo_t const * /*out*/ *FlashInfo );
#endif /* BDMFlash_Included_M */
/*** Emacs configuration ***/
/* Local Variables: */
/* mode:C */
/* End: */
/*EOF*/

View File

@@ -0,0 +1,411 @@
/* @#Copyright:
* Copyright (c) 1997, Rolf Fiedler.
* Copyright (c) 1999-2000, Brett Wuth.
*/
/* @#License:
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* File: BDMTargetAddress.c
* Purpose: Abstract manipulation of target address space through BDM.
* Author: Rolf Fiedler, Brett Wuth
* Created: 2000-03-27
*
* Initials:
* BCW - Brett Wuth
* @#[ContactWuth:
* Phone: +1 403 627-2460
* E-mail: support@castrov.cuug.ab.ca, wuth@acm.org]
*
* HISTORY:
* $Log: BDMTargetAddress.c,v $
* Revision 1.3 2008/06/16 00:01:21 cjohns
* 2008-06-08 Chris Johns <cjohns@users.sourceforge.net>
*
* * libelf/COPYING.LIB, libelf/ChangeLog, libelf/INSTALL,
* libelf/MANIFEST, libelf/Makefile.in, libelf/README,
* libelf/VERSION, libelf/acconfig.h, libelf/aclocal.m4,
* libelf/config.guess, libelf/config.h.in, libelf/config.sub,
* libelf/configure, libelf/configure.in, libelf/install-sh,
* libelf/libelf.pc.in, libelf/mkinstalldirs, libelf/stamp-h.in,
* libelf/lib/32.fsize.c, libelf/lib/32.getehdr.c,
* libelf/lib/32.getphdr.c, libelf/lib/32.getshdr.c,
* libelf/lib/32.newehdr.c, libelf/lib/32.newphdr.c,
* libelf/lib/32.xlatetof.c, libelf/lib/64.xlatetof.c,
* libelf/lib/Makefile.in, libelf/lib/Makefile.w32,
* libelf/lib/assert.c, libelf/lib/begin.c, libelf/lib/build.bat,
* libelf/lib/byteswap.h, libelf/lib/checksum.c, libelf/lib/cntl.c,
* libelf/lib/config.h.w32, libelf/lib/cook.c, libelf/lib/data.c,
* libelf/lib/elf_repl.h, libelf/lib/end.c, libelf/lib/errmsg.c,
* libelf/lib/errno.c, libelf/lib/errors.h, libelf/lib/ext_types.h,
* libelf/lib/fill.c, libelf/lib/flag.c, libelf/lib/gelf.h,
* libelf/lib/gelfehdr.c, libelf/lib/gelfphdr.c,
* libelf/lib/gelfshdr.c, libelf/lib/gelftrans.c,
* libelf/lib/getarhdr.c, libelf/lib/getarsym.c,
* libelf/lib/getbase.c, libelf/lib/getdata.c, libelf/lib/getident.c,
* libelf/lib/getscn.c, libelf/lib/hash.c, libelf/lib/input.c,
* libelf/lib/kind.c, libelf/lib/libelf.def, libelf/lib/libelf.h,
* libelf/lib/memset.c, libelf/lib/ndxscn.c, libelf/lib/newdata.c,
* libelf/lib/newscn.c, libelf/lib/next.c, libelf/lib/nextscn.c,
* libelf/lib/nlist.c, libelf/lib/nlist.h, libelf/lib/opt.delscn.c,
* libelf/lib/private.h, libelf/lib/rand.c, libelf/lib/rawdata.c,
* libelf/lib/rawfile.c, libelf/lib/strptr.c, libelf/lib/swap64.c,
* libelf/lib/sys_elf.h.in, libelf/lib/sys_elf.h.w32,
* libelf/lib/update.c, libelf/lib/verdef.h,
* libelf/lib/verdef_32_tof.c, libelf/lib/verdef_32_tom.c,
* libelf/lib/verdef_64_tof.c, libelf/lib/verdef_64_tom.c,
* libelf/lib/verneed.h, libelf/lib/version.c, libelf/lib/x.elfext.c,
* libelf/lib/x.movscn.c, libelf/lib/x.remscn.c,
* libelf/po/Makefile.in, libelf/po/de.gmo, libelf/po/de.msg,
* libelf/po/de.po, libelf/po/gmo2msg.c, libelf/po/libelf.pot,
* libelf/po/stamp-po: Merge libelf into the BDM package.
*
* * configure.ac, utils/Makefile.am, utils/bdmctrl.c,
* flashlib/Makefile.am, flashlib/bdmfilt.c, flashlib/bdmfilt.h,
* flashlib/bdmflash.c, flashlib/bdmflash.h, flashlib/flash29.c,
* flashlib/flash_filter.c, flashlib/flash_filter.h: Remove all BFD
* references and change to ELF file support.
*
* * flashlib/elf-utils.c, flashlib/elf-utils.h: New.
*
* * driver/bdm.h, driver/bdm-tblcf.c: Add the TBLCF interface
* number.
*
* * bdmabstraction/BDMTargetAddress.c: Add a long write call.
*
* * gdbserver/Makefile.am: Fix the XML to C regen rule.
*
* 2008-06-08 Matthew Riek <matthew.riek@ibiscomputer.com.au>
*
* * flashlib/flashcfm.c, flashlib/flashcfm.h,
* flashlib/compile_flashcfm, utils/mcf52235.test.
*
* Revision 1.2 2005/10/24 01:37:25 cjohns
* Fixed includes for building in Windows with MinGW.
*
* Revision 1.1 2003/12/29 22:18:49 codewiz
* Move tools/bdm_abstraction to m68k/bdmabstraction and autoconfiscate.
*
* Revision 1.1 2003/06/03 15:42:04 codewiz
* Import userland tools from bdm-fiedler
*
* Revision 1.4 2000/09/19 00:28:29 wuth
* cleanly use Fiedler's bdm driver; bdm_mon detects flash errors
*
* Revision 1.3 2000/07/25 13:51:09 wuth
* Working sector erase. Better error reports.
*
* Revision 1.2 2000/04/20 04:56:23 wuth
* GPL. Abstract flash interface.
*
* Revision 1.1 2000/03/28 20:24:41 wuth
* Break out flash code into separate executable. Make run under Chris Johns BDM driver.
*
* Based on revision Wuth1 of bdm-fiedler/debug/bdm_abstraction/bdmops.c.
* @#[BasedOnTemplate: template.c version 2]
*/
#include <BDMTargetAddress.h>
#include <assert.h>
#include <BDMDriver.h>
#include <Debug.h>
#include <stdio.h>
#define PRINTDTRACE() PRINTD( __FILE__ "(%d)\n", __LINE__ )
/* Write byte into target address space through BDM */
int /* 0 if success, or error code */
BDMTargetByteWrite( int fd, unsigned int addr, unsigned char byte )
{
#if BDMDriverVersion_M == BDMDriverFiedler_M
unsigned long word[5];
unsigned long poll;
int ret;
word[0]=BDM_WRITE_CMD | BDM_SIZE_BYTE;
word[1]=(addr>>16);
word[2]=addr & 0xffff;
word[3]=byte;
word[4]=BDM_NOP_CMD;
ret=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(word), (unsigned long)&word);
if(ret<0)
{
PRINTDTRACE();
return ret;
}
if(word[4]==BDM_BERR) {
/* get BDM_NOT_READY after BERR */
unsigned long poll;
poll = BDM_NOP_CMD;
bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
PRINTDTRACE();
return BDM_FAULT_BERR;
}
if(word[4]==BDM_ILLEGAL)
{
PRINTDTRACE();
return BDM_FAULT_NVC;
}
poll=word[4];
while(poll==BDM_NOTREADY) {
poll = BDM_NOP_CMD;
ret=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
if(ret<0)
{
PRINTDTRACE();
return ret;
}
if(poll==BDM_BERR) {
/* get BDM_NOT_READY after BERR */
unsigned long poll;
poll = BDM_NOP_CMD;
bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
PRINTDTRACE();
return BDM_FAULT_BERR;
}
if(poll==BDM_ILLEGAL)
{
PRINTDTRACE();
return BDM_FAULT_NVC;
}
}
return 0;
#else
int Ret = bdmWriteByte( addr, byte );
if (Ret)
PRINTDTRACE();
return (Ret);
#endif
}
/* Write word into target address space through BDM */
int /* 0 if success, or error code */
BDMTargetWordWrite( int fd, unsigned int addr, unsigned short word )
{
#if BDMDriverVersion_M == BDMDriverFiedler_M
unsigned long words[5];
unsigned long poll;
int ret;
words[0]=BDM_WRITE_CMD | BDM_SIZE_WORD;
words[1]=(addr>>16);
words[2]=addr & 0xffff;
words[3]=word;
words[4]=BDM_NOP_CMD;
ret=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(words), (unsigned long)&words);
if(ret<0)
{
PRINTDTRACE();
return ret;
}
if(words[4]==BDM_BERR) {
/* get BDM_NOT_READY after BERR */
unsigned long poll;
poll = BDM_NOP_CMD;
bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
PRINTDTRACE();
return BDM_FAULT_BERR;
}
if(words[4]==BDM_ILLEGAL)
{
PRINTDTRACE();
return BDM_FAULT_NVC;
}
poll=words[4];
while(poll==BDM_NOTREADY) {
poll = BDM_NOP_CMD;
ret=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
if(ret<0)
{
PRINTDTRACE();
return ret;
}
if(poll==BDM_BERR) {
/* get BDM_NOT_READY after BERR */
unsigned long poll;
poll = BDM_NOP_CMD;
bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
PRINTDTRACE();
return BDM_FAULT_BERR;
}
if(poll==BDM_ILLEGAL)
{
PRINTDTRACE();
return BDM_FAULT_NVC;
}
}
return 0;
#else
int Ret = bdmWriteWord( addr, word );
if (Ret)
PRINTDTRACE();
return (Ret);
#endif
}
/* Write long into target address space through BDM */
int /* 0 if success, or error code */
BDMTargetLongWrite( int fd, unsigned int addr, unsigned long Long )
{
#if BDMDriverVersion_M == BDMDriverFiedler_M
assert( 0 ); /* not implemented */
#else
int Ret = bdmWriteLongWord( addr, Long );
if (Ret)
PRINTDTRACE();
return (Ret);
#endif
return (-1);
}
/* Read byte into target address space through BDM */
int /* <0 if error, else byte */
BDMTargetByteRead( int fd, unsigned int addr )
{
#if BDMDriverVersion_M == BDMDriverFiedler_M
unsigned long word[4];
unsigned long poll;
int ret;
word[0]=BDM_READ_CMD | BDM_SIZE_BYTE;
word[1]=(addr>>16) & 0xffff;
word[2]=addr & 0xffff;
word[3]=BDM_NOP_CMD;
ret=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(word), (unsigned long)&word);
if(ret<0)
{
PRINTDTRACE();
return ret;
}
if(word[3]==BDM_BERR) {
/* get BDM_NOT_READY after BERR */
unsigned long poll;
poll = BDM_NOP_CMD;
bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
PRINTDTRACE();
return BDM_FAULT_BERR;
}
if(word[3]==BDM_ILLEGAL)
{
PRINTDTRACE();
return BDM_FAULT_NVC;
}
poll=word[3];
while(poll==BDM_NOTREADY) {
poll = BDM_NOP_CMD;
ret=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
if(ret<0)
{
PRINTDTRACE();
return ret;
}
if(poll==BDM_BERR) {
/* get BDM_NOT_READY after BERR */
unsigned long poll;
poll = BDM_NOP_CMD;
bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
PRINTDTRACE();
return BDM_FAULT_BERR;
}
if(poll==BDM_ILLEGAL)
{
PRINTDTRACE();
return BDM_FAULT_NVC;
}
}
return poll & 0xff;
#else
unsigned char Byte;
if (bdmReadByte( addr, &Byte ) != 0)
{
PRINTDTRACE();
return (-1);
}
return Byte;
#endif
}
/* Read word into target address space through BDM */
int /* <0 if error, else word */
BDMTargetWordRead( int fd, unsigned int addr )
{
#if BDMDriverVersion_M == BDMDriverFiedler_M
unsigned long words[4];
unsigned long poll;
int ret;
words[0]=BDM_READ_CMD | BDM_SIZE_WORD;
words[1]=(addr>>16) & 0xffff;
words[2]=addr & 0xffff;
words[3]=BDM_NOP_CMD;
ret=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(words), (unsigned long)&words);
if(ret<0)
{
PRINTDTRACE();
return ret;
}
if(words[3]==BDM_BERR) {
/* get BDM_NOT_READY after BERR */
unsigned long poll;
poll = BDM_NOP_CMD;
bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
PRINTDTRACE();
return BDM_FAULT_BERR;
}
if(words[3]==BDM_ILLEGAL)
{
PRINTDTRACE();
return BDM_FAULT_NVC;
}
poll=words[3];
while(poll==BDM_NOTREADY) {
poll = BDM_NOP_CMD;
ret=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
if(ret<0)
{
PRINTDTRACE();
return ret;
}
if(poll==BDM_BERR) {
/* get BDM_NOT_READY after BERR */
unsigned long poll;
poll = BDM_NOP_CMD;
bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
PRINTDTRACE();
return BDM_FAULT_BERR;
}
if(poll==BDM_ILLEGAL)
{
PRINTDTRACE();
return BDM_FAULT_NVC;
}
}
return poll & 0xffff;
#else
unsigned short Word;
if (bdmReadWord( addr, &Word ) != 0)
{
PRINTDTRACE();
return (-1);
}
return (Word);
#endif
}
/*EOF*/

View File

@@ -0,0 +1,75 @@
#ifndef BDMTargetAddress_Included_M
#define BDMTargetAddress_Included_M
/* @#Copyright (c) 2000, Brett Wuth. */
/* @#License:
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* File: BDMTargetAddress.h
* Purpose: Abstract manipulation of target address space through BDM.
* Author: Brett Wuth
* Created: 2000-03-27
*
* Initials:
* BCW - Brett Wuth
* @#[ContactWuth:
* Phone: +1 403 627-2460
* E-mail: support@castrov.cuug.ab.ca, wuth@acm.org]
*
* HISTORY:
* $Log: BDMTargetAddress.h,v $
* Revision 1.1 2003/12/29 22:18:49 codewiz
* Move tools/bdm_abstraction to m68k/bdmabstraction and autoconfiscate.
*
* Revision 1.1 2003/06/03 15:42:04 codewiz
* Import userland tools from bdm-fiedler
*
* Revision 1.2 2000/04/20 04:56:23 wuth
* GPL. Abstract flash interface.
*
* Revision 1.1 2000/03/28 20:24:41 wuth
* Break out flash code into separate executable. Make run under Chris Johns BDM driver.
*
* @#[BasedOnTemplate: template.h version 2]
*/
/* Write byte into target address space through BDM */
int /* 0 if success, or error code */
BDMTargetByteWrite( int fd, unsigned int addr, unsigned char byte );
/* Write word into target address space through BDM */
int /* 0 if success, or error code */
BDMTargetWordWrite( int fd, unsigned int addr, unsigned short word );
/* Write long into target address space through BDM */
int /* 0 if success, or error code */
BDMTargetLongWrite( int fd, unsigned int addr, unsigned long Long );
/* Read byte into target address space through BDM */
int /* 0 if success, or error code */
BDMTargetByteRead( int fd, unsigned int addr );
/* Read word into target address space through BDM */
int /* 0 if success, or error code */
BDMTargetWordRead( int fd, unsigned int addr );
#endif /* BDMTargetAddress_Included_M */
/*** Emacs configuration ***/
/* Local Variables: */
/* mode:C */
/* End: */
/*EOF*/

View File

@@ -0,0 +1,64 @@
#ifndef Debug_Included_M
#define Debug_Included_M
/* @#Copyright (c) 2000, Brett Wuth. */
/* @#License:
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* File: Debug.h
* Purpose:
* Author: Brett Wuth
* Created:
*
* Initials:
* BCW - Brett Wuth
* @#[ContactWuth:
* Phone: +1 403 627-2460
* E-mail: support@castrov.cuug.ab.ca, wuth@acm.org]
*
* HISTORY:
* $Log: Debug.h,v $
* Revision 1.1 2003/12/29 22:18:49 codewiz
* Move tools/bdm_abstraction to m68k/bdmabstraction and autoconfiscate.
*
* Revision 1.1 2003/06/03 15:42:04 codewiz
* Import userland tools from bdm-fiedler
*
* Revision 1.2 2000/04/20 04:56:23 wuth
* GPL. Abstract flash interface.
*
* Revision 1.1 2000/03/28 20:24:41 wuth
* Break out flash code into separate executable. Make run under Chris Johns BDM driver.
*
* @#[BasedOnTemplate: template.h version 2]
*/
#include <stdio.h>
/* #define DEBUG */
#ifdef DEBUG
#define PRINTD(args...) printf(##args)
#else
#define PRINTD(args...)
#endif
#endif /* Debug_Included_M */
/*** Emacs configuration ***/
/* Local Variables: */
/* mode:C */
/* End: */
/*EOF*/

1586
m68k/bdmabstraction/Flash.c Normal file

File diff suppressed because it is too large Load Diff

258
m68k/bdmabstraction/Flash.h Normal file
View File

@@ -0,0 +1,258 @@
#ifndef Flash_Included_M
#define Flash_Included_M
/* @#Copyright:
* Copyright (c) 1999, Rolf Fiedler.
* Copyright (c) 1999-2000, Brett Wuth.
*/
/* @#License:
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* File: Flash.h
* Purpose: Algorithm for manipulating flash independent of access
* method.
* Author: Brett Wuth
* Created: 2000-04-15
*
* Initials:
* BCW - Brett Wuth
* @#[ContactWuth:
* Phone: (403) 627-2460
* E-mail: support@castrov.cuug.ab.ca, wuth@acm.org]
*
* #@[MultiProject:
* MultiProject@castrov.cuug.ab.ca Flash Flash.h
* MultiProject@castrov.cuug.ab.ca CVSROOT=:ext:wuth@hulk.adomo.com:/home/cvs linux-development/bdm-fiedler debug/bdm_abstraction/Flash.h
* MultiProject@castrov.cuug.ab.ca CVSROOT=:ext:wuth@hulk.adomo.com:/home/cvs linux-development/ThinClientFlashWrite Flash.h
*
* This file is shared among multiple projects. The normal way to so
* is to create a separate project and have this project depend on it,
* perhaps linking to a library. But for whatever reason this project
* requires the file to be included with it.
*
* To keep your copy of this file in sync with the other copies add
* your e-mail address, the project name and file path to the list
* above. E-mail a copy of the file to the first address in the list
* now and whenever there are changes.]
*
* HISTORY:
* $Log: Flash.h,v $
* Revision 1.1 2003/12/29 22:18:49 codewiz
* Move tools/bdm_abstraction to m68k/bdmabstraction and autoconfiscate.
*
* Revision 1.2 2003/07/04 22:33:01 codewiz
* Applied SST block-erase patch.
*
* Revision 1.1 2003/06/03 15:42:04 codewiz
* Import userland tools from bdm-fiedler
*
* Revision 1.4 2000/08/03 06:29:18 wuth
* MultiProject Sync; Support Micron-style flash; Report flash model
*
* Revision 1.3 2000/07/25 13:51:09 wuth
* Working sector erase. Better error reports.
*
* Revision 1.2 2000/07/14 18:38:55 wuth
* Flash error status; Fix sector erase support; Command line sector erase
*
* Revision 1.1 2000/04/20 04:56:23 wuth
* GPL. Abstract flash interface.
*
* @#[BasedOnTemplate: template.h version 2]
*/
#include <stdlib.h> /* size_t */
typedef enum FlashError_en {
FlashErrorOkay_c, /* no error */
FlashErrorReadAccess_c, /* can't read flash */
FlashErrorWriteAccess_c, /* can't write to flash */
FlashErrorTimeOut_c, /* flash's internal program timed out */
FlashErrorEraseFail_c, /* flash's internal erase program failed */
FlashErrorWriteFail_c, /* flash's internal write program failed */
FlashErrorProtected_c, /* flash is protected from modification */
/* flash produced contents that are unexpected */
FlashErrorUnexpected_c,
/* the specified width of the flash is invalid or not supported */
FlashErrorWidth_c,
/* the style of flash is not supported */
FlashErrorStyle_c,
FlashErrorCount_c /* number of Flash Errors */
} FlashError_t;
extern char const *FlashErrorDescriptionEnglish[FlashErrorCount_c];
typedef enum FlashStyle_en {
FlashStyleUndefined_c,
FlashStyleAMD_c,
FlashStyleMicron_c,
FlashStyleCount_c /* number of Flash Styles */
} FlashStyle_t;
extern char const *FlashStyleName[FlashStyleCount_c];
typedef unsigned short FlashID_t;
typedef enum FlashManufacturer_en {
FlashManufacturerAMD_c = 0x01,
FlashManufacturerFujitsu_c = 0x04,
FlashManufacturerSGSThomson_c = 0x20,
FlashManufacturerAtmel_c = 0x1F,
FlashManufacturerMicron_c = 0x89,
FlashManufacturerTexasInstruments_c = 0x97,
FlashManufacturerHyundai_c = 0xAD,
FlashManufacturerSST_c = 0xBF,
} FlashManufacturer_t;
char const *
FlashManufacturerName( FlashManufacturer_t Manufacturer );
typedef
FlashError_t
(*FlashElementReadFunc_t)( void *UserData,
unsigned long Location,
unsigned int BytesWide, /* what type of read */
void /*out*/ *Element );
typedef
FlashError_t
(*FlashElementWriteFunc_t)( void *UserData,
unsigned long Location,
unsigned int BytesWide, /* what type of write */
void const *Element );
/* Parameters passed to flash routines.
* This is object-based coding to reduce the proliferation
* of arguments passed to each function.
*/
typedef struct Flash_s {
/* Pointer to data which is used by generic Read and Write
* functions. The actual data is of a type specific to the
* particular functions defined. */
void *UserData;
/* Generic function read a single element out of the array of
* interlaced flash chips. The size of an element is defined by
* ChipWidthBytes. */
FlashElementReadFunc_t Read;
/* Generic function read a single element out of the array of
* interlaced flash chips. The size of an element is defined by
* ChipWidthBytes. */
FlashElementWriteFunc_t Write;
/* The number of bytes written or read in a single access */
unsigned int ChipWidthBytes;
/* Whether the hardware accessing the flash is big-endian or
* little-endian. This is not necessarily the endianness of the CPU
* on which this code is executing, because the generic Read and
* Write functions may fetch the data through some other machine.
* Such happens when an Intel-based computer manipulates the flash
* through a BDM cable connected to a Motorola CPU. The flash
* provides status information on the least significant bits. */
int/*Bool*/ BigEndian;
/* The number of flash chips of the same type which are interleaved.
* For instance, if ChipWidthBytes == 2, one chip may provide bytes
* 0, 1, 4, 5, 8, 9, etc. And another chip provides bytes 2, 3, 6,
* 7, 10, 11, etc. */
unsigned int NumParallelChips;
/* The general type of the flash. Different styles have radically
* different algorithms for burning and erasing. */
FlashStyle_t Style;
} Flash_t;
/* Initialiaze the Flash structure */
FlashError_t
FlashInit( Flash_t /*out*/ *Flash,
void *UserData,
FlashElementReadFunc_t Read,
FlashElementWriteFunc_t Write,
unsigned int ChipWidthBytes,
int/*Bool*/ BigEndian,
unsigned int NumParallelChips );
/* store into flash */
FlashError_t
FlashWrite( Flash_t const *Flash,
unsigned long Location,
void const *Data,
size_t Size /*actual rounded up by ChipWidthBytes*/ );
/* erase the whole flash */
FlashError_t
FlashErase( Flash_t const *Flash );
/* erase one sector of the flash */
FlashError_t
FlashEraseSector( Flash_t const *Flash,
unsigned long OffsetInFlash /* sector identified by offset */ );
/* erase one block of the flash */
FlashError_t
FlashEraseBlock( Flash_t const *Flash,
unsigned long OffsetInFlash /* sector identified by offset */ );
typedef struct FlashInfo_s {
FlashID_t ID;
unsigned long Size;
unsigned long loend; /* start of range of sectors all the same size */
unsigned long hiend; /* end of range of sectors all the same size */
unsigned long sec_size; /* size of sectors which are all the same size */
char const *Model;
} FlashInfo_t;
/*sets Flash->Style */
FlashError_t
FlashProbe( Flash_t *Flash );
/* leaves flash in Array Read mode */
FlashError_t
FlashIDRead( Flash_t const *Flash,
FlashID_t /*out*/ *ID );
FlashError_t
FlashDetect( Flash_t const *Flash,
FlashInfo_t const * /*out*/ *FlashInfo );
#endif /* Flash_Included_M */
/*** Emacs configuration ***/
/* Local Variables: */
/* mode:C */
/* End: */
/*EOF*/

View File

@@ -0,0 +1,29 @@
##
## $Id: Makefile.am,v 1.3 2004/01/08 20:37:25 codewiz Exp $
##
## This file is part of a free BDM package
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
AM_CPPFLAGS = -I$(top_srcdir)/driver -I$(top_srcdir)/lib
noinst_LIBRARIES = libbdmabstraction.a
libbdmabstraction_a_SOURCES = \
BDMTargetAddress.c \
BDMFlash.c \
bdmops.c \
Flash.c
noinst_HEADERS = \
bdmcf.h \
BDMDriver.h \
BDMFlash.h \
bdmops.h \
BDMTargetAddress.h \
Debug.h \
Flash.h

View File

@@ -0,0 +1,435 @@
# Makefile.in generated by automake 1.10 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = bdmabstraction
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
ARFLAGS = cru
libbdmabstraction_a_AR = $(AR) $(ARFLAGS)
libbdmabstraction_a_LIBADD =
am_libbdmabstraction_a_OBJECTS = BDMTargetAddress.$(OBJEXT) \
BDMFlash.$(OBJEXT) bdmops.$(OBJEXT) Flash.$(OBJEXT)
libbdmabstraction_a_OBJECTS = $(am_libbdmabstraction_a_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/config/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libbdmabstraction_a_SOURCES)
DIST_SOURCES = $(libbdmabstraction_a_SOURCES)
HEADERS = $(noinst_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BDM_SUBDIRS = @BDM_SUBDIRS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FLASH_PLUGIN_GCC = @FLASH_PLUGIN_GCC@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBUSB_INCLUDE_DIR = @LIBUSB_INCLUDE_DIR@
LIBUSB_LIB_DIR = @LIBUSB_LIB_DIR@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
flash_plugin_cc = @flash_plugin_cc@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I$(top_srcdir)/driver -I$(top_srcdir)/lib
noinst_LIBRARIES = libbdmabstraction.a
libbdmabstraction_a_SOURCES = \
BDMTargetAddress.c \
BDMFlash.c \
bdmops.c \
Flash.c
noinst_HEADERS = \
bdmcf.h \
BDMDriver.h \
BDMFlash.h \
bdmops.h \
BDMTargetAddress.h \
Debug.h \
Flash.h
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bdmabstraction/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign bdmabstraction/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
libbdmabstraction.a: $(libbdmabstraction_a_OBJECTS) $(libbdmabstraction_a_DEPENDENCIES)
-rm -f libbdmabstraction.a
$(libbdmabstraction_a_AR) libbdmabstraction.a $(libbdmabstraction_a_OBJECTS) $(libbdmabstraction_a_LIBADD)
$(RANLIB) libbdmabstraction.a
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BDMFlash.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BDMTargetAddress.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Flash.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bdmops.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LIBRARIES) $(HEADERS)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-exec-am:
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-noinstLIBRARIES ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

274
m68k/bdmabstraction/bdmcf.h Normal file
View File

@@ -0,0 +1,274 @@
#ifndef LINUX_BDM_H
#define LINUX_BDM_H
#include <linux/ioctl.h>
/*
* $Id: bdmcf.h,v 1.1 2003/12/29 22:18:49 codewiz Exp $
*
* Linux Device Driver for P&E Microcomputer Systems Coldfire Cable
* (c) 1997 Rolf Fiedler
*
* this header file is used to interface to a kernel driver and to
* a user-mode lpt driver (using #ifdef USER_MODE)
* therefore it contains prototypes of usermode functions
*
* based on code from and using (roughly) the same API as the
*
* Linux Device Driver for Public Domain BDM Interface
* based on the PD driver package by Scott Howard, Feb 93
* ported to Linux by M.Schraut
* tested for kernel version 1.2.4
* (C) 1995 Technische Universitaet Muenchen, Lehrstuhl fuer Prozessrechner
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* the interface of the kernel mode driver as of June 10th, 1997
*
* there are a number of ioctl's for all non-speed-critial bdm operations
* these operations allow to reset, restart, stop, step and run the chip,
* to exchange data with the bdm interface, and to set the clocking speed
* and debug-level.
*
* the download of code and the reading back of memory are considered
* speed critical, due to the fact that download times should be minimized
* therefore these two operations are supported by the BDM fill and dump
* commands. these commands are issued automatically by read and write
* system calls on the bdm driver
*/
#define BDM_MAJOR_NUMBER 30
/* error codes */
#define BDM_FAULT_UNKNOWN -610 /*Error-definitions*/
#define BDM_FAULT_POWER -611 /* target has no power */
#define BDM_FAULT_CABLE -612 /* target is not connected */
#define BDM_FAULT_RESPONSE -613 /* NOT Ready */
#define BDM_FAULT_RESET -614 /* target is held in reset */
#define BDM_FAULT_PORT -615 /* can not gain permission to access port */
#define BDM_FAULT_BERR -616 /* access led to a bus error */
#define BDM_FAULT_NVC -617 /* no valid command */
/* Debug Levels */
#define BDM_DEBUG_NONE 0
#define BDM_DEBUG_SOME 1
#define BDM_DEBUG_ALL 2
/* supported ioctls */
#define BDM_IOCTL_TYPE 0xaa
enum BDM_IOCTLS {
BDM_INIT, /* no argument */
BDM_DEINIT, /* no argument */
BDM_RESET_CHIP, /* no argument */
BDM_RESTART_CHIP, /* no argument */
BDM_STOP_CHIP, /* no argument */
BDM_STEP_CHIP, /* no argument */
BDM_RUN_CHIP, /* no argument */
BDM_GET_STATUS, /* no argument */
BDM_XCHG_DATA, /* argument - int[], rw variable size */
BDM_DEBUG_LEVEL /* arg = level */
};
#define BDM_INIT_IOC _IO(BDM_IOCTL_TYPE,BDM_INIT)
#define BDM_DEINIT_IOC _IO(BDM_IOCTL_TYPE,BDM_DEINIT)
#define BDM_RESET_CHIP_IOC _IO(BDM_IOCTL_TYPE,BDM_RESET_CHIP)
#define BDM_RESTART_CHIP_IOC _IO(BDM_IOCTL_TYPE,BDM_RESTART_CHIP)
#define BDM_STOP_CHIP_IOC _IO(BDM_IOCTL_TYPE,BDM_STOP_CHIP)
#define BDM_STEP_CHIP_IOC _IO(BDM_IOCTL_TYPE,BDM_STEP_CHIP)
#define BDM_RUN_CHIP_IOC _IO(BDM_IOCTL_TYPE,BDM_RUN_CHIP)
#define BDM_GET_STATUS_IOC _IO(BDM_IOCTL_TYPE,BDM_GET_STATUS)
#define BDM_XCHG_DATA_IOC(size) _IOWR(BDM_IOCTL_TYPE,BDM_XCHG_DATA,size)
#define BDM_DEBUG_LEVEL_IOC _IO(BDM_IOCTL_TYPE,BDM_DEBUG_LEVEL)
/* return codes of get status (or'ed) */
#define BDM_NORETURN 0 /* no error, no ret value */
/* functional bits of ioctl BDM_GET_STATUS */
#define BDM_TARGETRESET (1<<0) /* Target reset */
#define BDM_TARGETHALT (1<<1) /* Target halt */
#define BDM_TARGETSTOPPED (1<<2) /* Target (was already) stopped */
#define BDM_TARGETPOWER (1<<3) /* Power failed */
#define BDM_TARGETNC (1<<4) /* Target not Connected */
#define BDM_FROZEN (1<<5) /* Target (was running before)stopped*/
/* it's determined by hardware from now on */
/* command codes for bdm interface */
#define BDM_RREG_CMD 0x2180
#define BDM_WREG_CMD 0x2080
#define BDM_READ_CMD 0x1900
#define BDM_WRITE_CMD 0x1800
#define BDM_DUMP_CMD 0x1d00
#define BDM_FILL_CMD 0x1c00
#define BDM_GO_CMD 0x0c00
#define BDM_NOP_CMD 0x0000
/* coldfire doesn't support BDM_RSREG_CMD/BDM_WSREG_CMD */
/* coldfire doesn't support BDM_CALL_CMD/BDM_RTS_CMD */
/* added for coldfire */
#define BDM_RCREG_CMD 0x2980
#define BDM_WCREG_CMD 0x2880
#define BDM_RDMREG_CMD 0x2d80
#define BDM_WDMREG_CMD 0x2c80
/* RCREG/WCREG */
#define BDM_REG_CACR 0x002
#define BDM_REG_ACR0 0x004
#define BDM_REG_ACR1 0x005
#define BDM_REG_VBR 0x801
#define BDM_REG_SR 0x80e
#define BDM_REG_RPC 0x80f
#define BDM_REG_RAMBAR 0xc04
#define BDM_REG_MBAR 0xc0f
/* RDMREG/WDMREG */
#define BDM_REG_CSR 0x0 /* Configuration/Status */
#define BDM_REG_RSRVD1 0x1
#define BDM_REG_RSRVD2 0x2
#define BDM_REG_RSRVD3 0x3
#define BDM_REG_RSRVD4 0x4
#define BDM_REG_RSRVD5 0x5
#define BDM_REG_AATR 0x6 /* Address ATtribute breakpoint Register */
#define BDM_REG_TDR 0x7 /* Trigger Definition Register */
#define BDM_REG_PBR 0x8 /* Pc Breakpoint Register */
#define BDM_REG_PBMR 0x9 /* Pc Breakpoint Mask Register */
#define BDM_REG_RSRVD6 0xa
#define BDM_REG_RSRVD7 0xb
#define BDM_REG_ABHR 0xc /* Address Breakpoint H Register */
#define BDM_REG_ABLR 0xd /* Address Breakpoint L Register */
#define BDM_REG_DBR 0xe /* Data Breakpoint Register */
#define BDM_REG_DBMR 0xf /* Data Breakpoint Mask Register */
/* system register for RREG/WREG */
#define BDM_REG_D0 0x0
#define BDM_REG_D1 0x1
#define BDM_REG_D2 0x2
#define BDM_REG_D3 0x3
#define BDM_REG_D4 0x4
#define BDM_REG_D5 0x5
#define BDM_REG_D6 0x6
#define BDM_REG_D7 0x7
#define BDM_REG_A0 0x8
#define BDM_REG_A1 0x9
#define BDM_REG_A2 0xa
#define BDM_REG_A3 0xb
#define BDM_REG_A4 0xc
#define BDM_REG_A5 0xd
#define BDM_REG_A6 0xe
#define BDM_REG_A7 0xf
/* op size for READ/WRITE */
#define BDM_SIZE_BYTE 0x0000
#define BDM_SIZE_WORD 0x0040
#define BDM_SIZE_LONG 0x0080
/* coldfire has trace capability */
/* processor status while trace */
#define BDM_PST_CONTINUE 0x0
#define BDM_PST_BEGIN 0x1
#define BDM_PST_RESERVED 0x2
#define BDM_PST_USERMODE 0x3
#define BDM_PST_PULSE 0x4
#define BDM_PST_BRANCH 0x5
#define BDM_PST_RESERVED2 0x6
#define BDM_PST_RTE 0x7
#define BDM_PST_DDATA1 0x8
#define BDM_PST_DDATA2 0x9
#define BDM_PST_DDATA3 0xa
#define BDM_PST_DDATA4 0xb
#define BDM_PST_EXCEPTION 0xc
#define BDM_PST_EMULATOR 0xd
#define BDM_PST_STOPPED 0xe
#define BDM_PST_HALTED 0xf
/* responses from chip */
/* bdm messages */
#define BDM_VALID 0x00000 /* not a message, but data transfer */
#define BDM_COMPLETE 0x0ffff
#define BDM_NOTREADY 0x10000
#define BDM_BERR 0x10001
#define BDM_ILLEGAL 0x1ffff
/* debug module register definitions */
/* AATR */
#define BDM_AATR_RM (1<<15) /* Read/Write mask */
#define BDM_AATR_SZM (3<<13) /* SiZe Mask */
#define BDM_AATR_TTM (3<<11) /* Transfer Type Mask */
#define BDM_AATR_TMM (7<<8) /* Transfer Modifier Mask */
#define BDM_AATR_R (1<<7) /* Read/write */
#define BDM_AATR_SZ (3<<5) /* SiZe */
#define BDM_AATR_TT (3<<3) /* Tranfer Type */
#define BDM_AATR_TM (7<<0) /* Transfer Modifier */
/* TDR */
#define BDM_TDR_TRC (3<<30) /* Trigger Response Control */
#define BDM_TDR_TRC_DATA (0<<30) /* Trigger Response Control */
#define BDM_TDR_TRC_HALT (1<<30) /* Trigger Response Control */
#define BDM_TDR_TRC_DEBG (2<<30) /* Trigger Response Control */
#define BDM_TDR_EBL2 (1<<29) /* Enable Breakpoint Level */
#define BDM_TDR_EDLW2 (1<<28) /* Enable Data BP for LongWord */
#define BDM_TDR_EDWL2 (1<<27) /* Enable Data BP for Word (Upper) */
#define BDM_TDR_EDWU2 (1<<26) /* Enable Data BP for Word (Lower) */
#define BDM_TDR_EDLL2 (1<<25) /* Enable Data BP for byte (LL) */
#define BDM_TDR_EDLM2 (1<<24) /* Enable Data BP for byte (LM) */
#define BDM_TDR_EDUM2 (1<<23) /* Enable Data BP for byte (UM) */
#define BDM_TDR_EDUU2 (1<<22) /* Enable Data BP for byte (UU) */
#define BDM_TDR_DI2 (1<<21) /* Data breakpoint invert */
#define BDM_TDR_EAI2 (1<<20) /* Enable Address breakpoint inverted */
#define BDM_TDR_EAR2 (1<<19) /* Enable Address breakpoint Range */
#define BDM_TDR_EAL2 (1<<18) /* Enable Address breakpoint Low */
#define BDM_TDR_EPC2 (1<<17) /* Enable PC breakpoint */
#define BDM_TDR_PCI2 (1<<16) /* PC breakpoint Invert */
#define BDM_TDR_EBL1 (1<<13) /* Enable Breakpoint Level */
#define BDM_TDR_EDLW1 (1<<12) /* Enable Data BP for LongWord */
#define BDM_TDR_EDWL1 (1<<11) /* Enable Data BP for Word (Upper) */
#define BDM_TDR_EDWU1 (1<<10) /* Enable Data BP for Word (Lower) */
#define BDM_TDR_EDLL1 (1<<9) /* Enable Data BP for byte (LL) */
#define BDM_TDR_EDLM1 (1<<8) /* Enable Data BP for byte (LM) */
#define BDM_TDR_EDUM1 (1<<7) /* Enable Data BP for byte (UM) */
#define BDM_TDR_EDUU1 (1<<6) /* Enable Data BP for byte (UU) */
#define BDM_TDR_DI1 (1<<5) /* Data breakpoint invert */
#define BDM_TDR_EAI1 (1<<4) /* Enable Address breakpoint inverted */
#define BDM_TDR_EAR1 (1<<3) /* Enable Address breakpoint Range */
#define BDM_TDR_EAL1 (1<<2) /* Enable Address breakpoint Low */
#define BDM_TDR_EPC1 (1<<1) /* Enable PC breakpoint */
#define BDM_TDR_PCI1 (1<<0) /* PC breakpoint Invert */
/* CSR */
#define BDM_CSR_STATUS (15<<28) /* breakpoint status */
# define BDM_CSR_STAT_NOBP 0
# define BDM_CSR_STAT_WAIT1 1
# define BDM_CSR_STAT_TRIGG1 2
# define BDM_CSR_STAT_WAIT2 5
# define BDM_CSR_STAT_TRIGG2 6
#define BDM_CSR_FOF (1<<27) /* Fault-On-Fault */
#define BDM_CSR_TRG (1<<26) /* hardware breakpoint TRiGger */
#define BDM_CSR_HALT (1<<25) /* processor HALT */
#define BDM_CSR_BKPT (1<<24) /* BreaKPoinT assert */
#define BDM_CSR_IPW (1<<16) /* Inhibit Processor Writes to dbg reg. */
#define BDM_CSR_MAP (1<<15) /* MAP processor accesses in emu mode */
#define BDM_CSR_TRC (1<<14) /* emulation mode on TRaCe exception */
#define BDM_CSR_EMU (1<<13) /* force EMUlation mode */
#define BDM_CSR_DDC (3<<11) /* Debug Data Control */
#define BDM_CSR_UHE (1<<10) /* User Halt Enable */
#define BDM_CSR_BTB (3<<8) /* Branch Target Bytes */
#define BDM_CSR_NPL (1<<6) /* NonPipelined Mode */
#define BDM_CSR_IPI (1<<5) /* Ignore Pending Interrupts */
#define BDM_CSR_SSM (1<<4) /* Single Step Mode */
#ifdef USERMODE
int bdm_open(int minor, int flags);
int bdm_ioctl(int minor, unsigned int request, unsigned long arg);
int bdm_read(int minor, unsigned char *p, int count);
int bdm_write(int minor, const unsigned char *p, int count);
void bdm_close(int minor);
#endif
#endif

View File

@@ -0,0 +1,792 @@
/* @#Copyright
* Copyright (c) 1997, Rolf Fiedler.
* Copyright (c) 1999-2000, Brett Wuth.
*/
/* @#License:
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* File: bdmops.c (BDM Operations)
* Purpose:
* Author: Rolf Fiedler
* Created:
*
* Initials:
* BCW - Brett Wuth
* @#[ContactWuth:
* Phone: +1 403 627-2460
* E-mail: support@castrov.cuug.ab.ca, wuth@acm.org]
*
* this is an abstraction layer to have a general target programming interface
* so the programmer doesn't have to bother with motorola's bdm commands.
*
* applications only include bdmops.h and call the functions below
*
* HISTORY:
* $Log: bdmops.c,v $
* Revision 1.2 2005/10/24 01:37:25 cjohns
* Fixed includes for building in Windows with MinGW.
*
* Revision 1.1 2003/12/29 22:18:49 codewiz
* Move tools/bdm_abstraction to m68k/bdmabstraction and autoconfiscate.
*
* Revision 1.2 2003/07/04 22:33:01 codewiz
* Applied SST block-erase patch.
*
* Revision 1.1 2003/06/03 15:42:04 codewiz
* Import userland tools from bdm-fiedler
*
* Revision 1.6 2000/09/19 00:28:29 wuth
* cleanly use Fiedler's bdm driver; bdm_mon detects flash errors
*
* Revision 1.5 2000/07/25 13:51:09 wuth
* Working sector erase. Better error reports.
*
* Revision 1.4 2000/04/20 04:56:23 wuth
* GPL. Abstract flash interface.
*
* Revision 1.3 2000/03/28 20:24:41 wuth
* Break out flash code into separate executable. Make run under Chris Johns BDM driver.
*
* Revision 1.2 1999/07/05 22:09:50 wuth
* Abort if can't sync BDM. Work with Am29F800 flash.
* @#[BasedOnTemplate: template.c version 2]
*/
#define _COMPILING_
# include "bdmops.h"
#undef _COMPILING_
#include <assert.h>
#include "BDMDriver.h"
#include "Debug.h"
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#if defined (__WIN32__) && !defined (__CYGWIN__)
#include <winsock.h>
#else
#include <netinet/in.h>
#endif
/*
* query status
*/
static unsigned long target_status=0;
#if BDMDriverVersion_M == BDMDriverFiedler_M
static int fd;
static void bdm_update_status(unsigned long x)
{
x &= CSR_FOF | CSR_TRG | CSR_HALT | CSR_BKPT; /* these bits ain't sticky */
target_status |= x;
}
static int bdm_read_status(void)
{
unsigned long x;
if(bdm_read_reg(REG_CSR, &x)) return -1;
bdm_update_status(x);
return 0;
}
#endif
/*
* general file handling
*/
/* open bdm-driver */
int /* <0 if error, BDMHandle otherwise */
bdm_init(const char *path)
{
#if BDMDriverVersion_M == BDMDriverFiedler_M
unsigned long tdr, csr;
#ifdef USERMODE
fd=path[strlen(path)-1]-'0'; /* this is so ugly! works with /dev/bdm[0-9]*/
if(fd>3 || fd<0) return -1;
fd=bdm_open(fd, O_RDWR);
if(fd<0) return fd;
#else
fd=bdm_open(path, O_RDWR);
if(fd<0) return fd;
#endif
bdm_clear_status();
tdr = BDM_TDR_TRC_HALT; /* trigger response is halt */
if(bdm_write_reg(REG_TDR, &tdr)) return -1;
csr = BDM_CSR_UHE; /* user halt enable */
if(bdm_write_reg(REG_CSR, &csr)) return -1;
return fd;
#else
int fd=bdmOpen( path );
return (fd);
#endif
}
/* close driver */
void bdm_release(int port)
{
#if BDMDriverVersion_M == BDMDriverFiedler_M
bdm_close(fd);
#else
bdmClose();
#endif
}
/*
* bdm control functions
*/
/* bring chip to running state */
void bdm_run(void)
{
#if BDMDriverVersion_M == BDMDriverFiedler_M
bdm_ioctl(fd, BDM_RUN_CHIP_IOC, 0);
bdm_clear_status();
#else
/* not implemented */
#endif
}
/* bring chip to stopped state */
void bdm_stop(void)
{
#if BDMDriverVersion_M == BDMDriverFiedler_M
bdm_ioctl(fd, BDM_STOP_CHIP_IOC, 0);
bdm_read_status();
#else
/* not implemented */
#endif
}
/* step chip on instruction */
void bdm_step(void)
{
#if BDMDriverVersion_M == BDMDriverFiedler_M
bdm_ioctl(fd, BDM_STEP_CHIP_IOC, 0);
bdm_read_status();
#else
/* not implemented */
#endif
}
/* reset chip and hold in reset state */
void bdm_reset(void)
{
#if BDMDriverVersion_M == BDMDriverFiedler_M
bdm_ioctl(fd, BDM_RESET_CHIP_IOC, 0);
bdm_clear_status();
bdm_read_status();
#else
/* not implemented */
#endif
}
/* restart from reset to running state */
void bdm_restart(void)
{
#if BDMDriverVersion_M == BDMDriverFiedler_M
bdm_ioctl(fd, BDM_RESTART_CHIP_IOC, 0);
bdm_read_status();
#else
/* not implemented */
#endif
}
/*
* data transfer to/from target
*/
int regs_log2phys(CF_REGS which)
{
int i;
struct regs {
int logical;
int physical;
} regs[]= {
{REG_D0, BDM_REG_D0},
{REG_D1, BDM_REG_D1},
{REG_D2, BDM_REG_D2},
{REG_D3, BDM_REG_D3},
{REG_D4, BDM_REG_D4},
{REG_D5, BDM_REG_D5},
{REG_D6, BDM_REG_D6},
{REG_D7, BDM_REG_D7},
{REG_A0, BDM_REG_A0},
{REG_A1, BDM_REG_A1},
{REG_A2, BDM_REG_A2},
{REG_A3, BDM_REG_A3},
{REG_A4, BDM_REG_A4},
{REG_A5, BDM_REG_A5},
{REG_A6, BDM_REG_A6},
{REG_A7, BDM_REG_A7},
/* debug registers */
{REG_CSR, BDM_REG_CSR},
{REG_AATR, BDM_REG_AATR},
{REG_TDR, BDM_REG_TDR},
{REG_PBR, BDM_REG_PBR},
{REG_PBMR, BDM_REG_PBMR},
{REG_ABHR, BDM_REG_ABHR},
{REG_ABLR, BDM_REG_ABLR},
{REG_DBR, BDM_REG_DBR},
{REG_DBMR, BDM_REG_DBMR},
/* configuration registers */
{REG_CACR, BDM_REG_CACR},
{REG_ACR0, BDM_REG_ACR0},
{REG_ACR1, BDM_REG_ACR1},
{REG_VBR, BDM_REG_VBR},
{REG_SR, BDM_REG_SR},
{REG_RPC, BDM_REG_RPC},
{REG_RAMBAR, BDM_REG_RAMBAR},
{REG_MBAR, BDM_REG_MBAR},
{0xffff,0}
};
for(i=0; regs[i].logical!=0xffff; i++) {
if(regs[i].logical == which) return regs[i].physical;
}
return -1;
}
/* read a register from the chip */
int bdm_read_reg(CF_REGS which, unsigned long *value)
{
#if BDMDriverVersion_M == BDMDriverFiedler_M
int i;
if(which <= MAX_USER_REGS) {
unsigned long word[3];
which=regs_log2phys(which);
word[0]=BDM_RREG_CMD | which;
word[1]=BDM_NOP_CMD;
word[2]=BDM_NOP_CMD;
i=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(word), (unsigned long)&word);
if(i<0)
return i;
if(word[1]==BDM_BERR) {
/* get BDM_NOT_READY after BERR */
unsigned long poll;
poll = BDM_NOP_CMD;
bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
return -1;
}
*value = ((word[1] & 0xffff) << 16) | (word[2] & 0xffff);
return 0;
}
if(which <= MAX_CONFIG_REGS) {
unsigned long word[5];
which=regs_log2phys(which);
word[0]=BDM_RCREG_CMD;
word[1]=0;
word[2]=which;
word[3]=BDM_NOP_CMD;
word[4]=BDM_NOP_CMD;
i=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(word), (unsigned long)&word);
if(i<0)
return i;
if(word[4]==BDM_BERR) {
/* get BDM_NOT_READY after BERR */
unsigned long poll;
poll = BDM_NOP_CMD;
bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
return -1;
}
word[0]=word[4];
while(word[0]==BDM_NOTREADY) {
unsigned long poll = BDM_NOP_CMD;
i=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
if(i<0)
return i;
if(poll==BDM_BERR) {
/* get BDM_NOT_READY after BERR */
unsigned long poll;
poll = BDM_NOP_CMD;
bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
return -1;
}
}
*value = ((word[3] & 0xffff) << 16) | (word[4] & 0xffff);
return 0;
}
if(which <= MAX_DEBUG_REGS) {
unsigned long word[3];
which=regs_log2phys(which);
word[0]=BDM_RDMREG_CMD | which;
word[1]=BDM_NOP_CMD;
word[2]=BDM_NOP_CMD;
i=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(word), (unsigned long)&word);
if(i<0)
return i;
if(word[1]==BDM_ILLEGAL)
return -1;
*value = ((word[1] & 0xffff) << 16) | (word[2] & 0xffff);
if(which == REG_CSR) {
bdm_update_status(*value);
}
return 0;
}
return -1;
#else
/* not implemented */
return -1;
#endif
}
/* write a register in the chip */
int bdm_write_reg(CF_REGS which, unsigned long *value)
{
#if BDMDriverVersion_M == BDMDriverFiedler_M
int i;
if(which <= MAX_USER_REGS) {
unsigned long word[4];
which=regs_log2phys(which);
word[0]=BDM_WREG_CMD | which;
word[1]=(*value >> 16) & 0xffff;
word[2]=*value & 0xffff;
word[3]=BDM_NOP_CMD;
i=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(word), (unsigned long)&word);
if(i<0)
return i;
if(word[1]==BDM_BERR) {
/* get BDM_NOT_READY after BERR */
unsigned long poll;
poll = BDM_NOP_CMD;
bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
return -1;
}
return 0;
}
if(which <= MAX_CONFIG_REGS) {
unsigned long word[6];
which=regs_log2phys(which);
word[0]=BDM_WCREG_CMD;
word[1]=0;
word[2]=which;
word[3]=(*value >> 16) & 0xffff;
word[4]=*value & 0xffff;
word[5]=BDM_NOP_CMD;
i=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(word), (unsigned long)&word);
if(i<0)
return i;
if(word[5]==BDM_BERR) {
/* get BDM_NOT_READY after BERR */
unsigned long poll;
poll = BDM_NOP_CMD;
bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
return -1;
}
word[0]=word[5];
while(word[0]==BDM_NOTREADY) {
unsigned long poll = BDM_NOP_CMD;
i=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
if(i<0)
return i;
if(poll==BDM_BERR) {
/* get BDM_NOT_READY after BERR */
unsigned long poll;
poll = BDM_NOP_CMD;
bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
return -1;
}
}
return 0;
}
if(which <= MAX_DEBUG_REGS) {
unsigned long word[4];
which=regs_log2phys(which);
word[0]=BDM_WDMREG_CMD | which;
word[1]=(*value >> 16) & 0xffff;
word[2]=*value & 0xffff;
word[3]=BDM_NOP_CMD;
i=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(word), (unsigned long)&word);
if(i<0)
return i;
if(word[1]==BDM_ILLEGAL)
return -1;
return 0;
}
return -1;
#else
/* not implemented */
return -1;
#endif
}
/* read a block of memory, alignment doesn't matter anymore */
int bdm_read_mem(unsigned int addr, unsigned char *mem, int count)
{
#if BDMDriverVersion_M == BDMDriverFiedler_M
unsigned long word[4], poll;
int read_bytes=0, ret;
int i;
if(!count) return 0;
/* align to long word boundary from target's point of view */
i=4-(addr&3);
for(; i>0 && count>0; i--) {
word[0]=BDM_READ_CMD | BDM_SIZE_BYTE;
word[1]=(addr>>16) & 0xffff;
word[2]=addr & 0xffff;
word[3]=BDM_NOP_CMD;
ret=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(word), (unsigned long)&word);
if(ret<0)
return ret;
if(word[3]==BDM_BERR) {
/* get BDM_NOT_READY after BERR */
unsigned long poll;
poll = BDM_NOP_CMD;
bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
return BDM_FAULT_BERR;
}
if(word[3]==BDM_ILLEGAL)
return BDM_FAULT_NVC;
poll=word[3];
while(poll==BDM_NOTREADY) {
poll = BDM_NOP_CMD;
ret=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
if(ret<0)
return ret;
if(poll==BDM_BERR) {
/* get BDM_NOT_READY after BERR */
unsigned long poll;
poll = BDM_NOP_CMD;
bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
return BDM_FAULT_BERR;
}
if(poll==BDM_ILLEGAL)
return BDM_FAULT_NVC;
}
read_bytes++;
count--;
addr++;
*mem++=(unsigned char)(0xff & poll);
}
if(count>4) {
ret = bdm_read(fd, mem, count & ~3);
}
if(ret < 0) return ret;
read_bytes+=ret;
count-=ret;
addr+=ret;
mem+=ret;
while(count>0) {
word[0]=BDM_READ_CMD | BDM_SIZE_BYTE;
word[1]=(addr>>16) & 0xffff;
word[2]=addr & 0xffff;
word[3]=BDM_NOP_CMD;
ret=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(word), (unsigned long)&word);
if(ret<0)
return ret;
if(word[3]==BDM_BERR) {
/* get BDM_NOT_READY after BERR */
unsigned long poll;
poll = BDM_NOP_CMD;
bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
return BDM_FAULT_BERR;
}
if(word[3]==BDM_ILLEGAL)
return BDM_FAULT_NVC;
poll=word[3];
while(poll==BDM_NOTREADY) {
poll = BDM_NOP_CMD;
ret=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
if(ret<0)
return ret;
if(poll==BDM_BERR) {
/* get BDM_NOT_READY after BERR */
unsigned long poll;
poll = BDM_NOP_CMD;
bdm_ioctl(fd, BDM_XCHG_DATA_IOC(poll), (unsigned long)&poll);
return BDM_FAULT_BERR;
}
if(poll==BDM_ILLEGAL)
return BDM_FAULT_NVC;
}
read_bytes++;
count--;
addr++;
*mem++=(unsigned char)(0xff & poll);
}
return read_bytes;
#else
/* not implemented */
return -1;
#endif
}
#if BDMDriverVersion_M == BDMDriverFiedler_M
static int perform_byte_write(int fd, unsigned int addr, unsigned char *mem)
{
#if BDMDriverVersion_M == BDMDriverFiedler_M
unsigned long word[5];
int ret;
word[0]=BDM_WRITE_CMD | BDM_SIZE_BYTE;
word[1]=(addr>>16) & 0xffff;
word[2]=addr & 0xffff;
word[3]=*mem;
word[4]=BDM_NOP_CMD;
ret=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(word), (unsigned long)&word);
if(ret<0) {
PRINTD("error in bdm_ioctl (0x%08x): %d\n", addr, ret);
return ret;
}
if(word[4]==BDM_BERR) {
/* get BDM_NOT_READY after BERR */
PRINTD("bus error in bdm_ioctl (0x%08x): %d\n", addr, ret);
return BDM_FAULT_BERR;
}
if(word[4]==BDM_ILLEGAL) {
/* get BDM_NOT_READY after ILLEGAL */
PRINTD("illegal cmd in bdm_ioctl (0x%08x): %d\n", addr, ret);
return BDM_FAULT_NVC;
}
while(1) {
word[4] = BDM_NOP_CMD;
ret=bdm_ioctl(fd, BDM_XCHG_DATA_IOC(word[4]), (unsigned long)&word[4]);
if(ret<0) {
PRINTD("error in bdm_ioctl poll (0x%08x): %d\n", addr, ret);
return ret;
}
switch(word[4]) {
case BDM_BERR:
/* get BDM_NOT_READY after BERR */
PRINTD("bus error in bdm_ioctl poll (0x%08x): %d\n", addr, ret);
return BDM_FAULT_BERR;
case BDM_ILLEGAL:
PRINTD("illegal cmd in bdm_ioctl poll (0x%08x): %d\n", addr, ret);
return BDM_FAULT_NVC;
case BDM_COMPLETE:
return 0; /* we've done it ! */
case BDM_NOTREADY:
break;
default:
PRINTD("undefined reponse from target (0x%08x): %d\n", addr, ret);
return BDM_FAULT_BERR;
}
}
#else
/* not implemented */
return -1;
#endif
}
#endif
/* write a block of memory, alignment doesn't matter anymore */
int bdm_write_mem(unsigned int addr, unsigned char *mem, int count)
{
#if BDMDriverVersion_M == BDMDriverFiedler_M
int written=0, ret;
int i;
if(!count) return 0;
PRINTD("entering write_mem...");
/* align to long word boundary from target's point of view */
i=4-(addr&3); /* perform at least one write to set address */
for(; i && count; i--) {
PRINTD("alignment loop and AATR setup: %d\n", i);
ret=perform_byte_write(fd, addr, mem);
if(ret<0) return ret;
mem++;
written++;
count--;
addr++;
}
if(count>4) {
ret = bdm_write(fd, mem, count & ~3);
}
if(ret < 0) {
PRINTD("error in bdm_write: %d\n", ret);
return ret;
}
written+=ret;
count-=ret;
addr+=ret;
mem+=ret;
PRINTD("write syscall wrote %d (%x) bytes.\n", ret, ret);
while(count>0) {
ret=perform_byte_write(fd, addr, mem);
if(ret<0) return ret;
mem++;
written++;
count--;
addr++;
}
PRINTD("bdm_write_mem finished, %d bytes written\n", written);
return written;
#else
/* not implemented */
return -1;
#endif
}
void bdm_clear_status(void)
{
target_status = 0;
}
int bdm_query_status(void)
{
#if BDMDriverVersion_M == BDMDriverFiedler_M
unsigned long x, y /* , z */;
y=0;
x = bdm_ioctl(fd, BDM_GET_STATUS_IOC, 0);
if(x & BDM_TARGETRESET) y |= BDM_STAT_RESET;
if(x & BDM_TARGETHALT) y |= BDM_STAT_PSTHALT;
if(x & BDM_TARGETSTOPPED);
if(x & BDM_TARGETPOWER) return BDM_STAT_NOPWR;
if(x & BDM_TARGETNC) return BDM_STAT_NC;
if(bdm_read_reg(REG_CSR, &x)) return -1;
printf("CSR=%08lx\n", x);
/* z = x & 0x10; USER HALT ENABLE */
/* y = x >> 28; it's better to translate */
x |= target_status;
if(x & CSR_BKPT) y |= BDM_STAT_BKPT;
if(x & CSR_HALT) y |= BDM_STAT_HALT;
if(x & CSR_TRG) y |= BDM_STAT_TRG;
if(x & CSR_FOF) y |= BDM_STAT_FOF;
if(x & CSR_SSM) y |= BDM_STAT_SSM;
switch(x>>28) {
case CSR_STAT_WAIT1:
y |= BDM_STAT_WAIT1;
break;
case CSR_STAT_TRIG1:
y |= BDM_STAT_TRIG1;
break;
case CSR_STAT_WAIT2:
y |= BDM_STAT_WAIT2;
break;
case CSR_STAT_TRIG2:
y |= BDM_STAT_TRIG2;
break;
}
return y;
#else
/* not implemented */
return -1;
#endif
}
/*
* wait for stopped target
*/
int bdm_wait(void)
{
#if BDMDriverVersion_M == BDMDriverFiedler_M
unsigned long x;
while(1) {
usleep(100000);
x = bdm_ioctl(fd, BDM_GET_STATUS_IOC, 0);
if(x & BDM_TARGETRESET) return BDM_STAT_RESET;
if(x & BDM_TARGETHALT) return BDM_STAT_PSTHALT;
if(x & BDM_TARGETSTOPPED) return BDM_STAT_HALT;
if(x & BDM_TARGETPOWER) return BDM_STAT_NOPWR;
if(x & BDM_TARGETNC) return BDM_STAT_NC;
}
#else
/* not implemented */
return -1;
#endif
}
static unsigned long tdr = 0; /* shadow trigger definition register */
/*
* breakpoint control
*/
int bdm_set_pc_bp(unsigned long addr, unsigned long mask)
{
bdm_stop();
if(bdm_write_reg(REG_PBR, &addr)) return -1;
if(bdm_write_reg(REG_PBMR, &mask)) return -1;
tdr = (1 << 30) | (~(3<<30) & tdr); /* trigger response is halt */
tdr |= 1 << 29; /* enable second level trigger breakpoints */
tdr |= 1 << 13; /* enable first level trigger breakpoints */
tdr |= 1 << 1; /* enable PC breakpoint */
tdr &= ~1; /* clear PC breakpoint invert */
if(bdm_write_reg(REG_TDR, &tdr)) return -1;
return 0;
}
int bdm_clear_pc_bp(void)
{
bdm_stop();
tdr &= ~(1 << 1); /* disable PC breakpoint */
if(bdm_write_reg(REG_TDR, &tdr)) return -1;
return 0;
}
int bdm_set_addr_bp(unsigned long from_addr, unsigned long to_addr)
{
unsigned long tmp=0xff05;
bdm_stop();
if(bdm_write_reg(REG_ABLR, &from_addr)) return -1;
if(bdm_write_reg(REG_ABHR, &to_addr)) return -1;
if(bdm_write_reg(REG_AATR, &tmp)) return -1; /* match everything */
tdr = (1 << 30) | (~(3<<30) & tdr); /* trigger response is halt */
tdr &= ~(1 << 29); /* disable second level trigger breakpoints */
tdr |= 1 << 13; /* enable first level trigger breakpoints */
tdr = (tdr & ~(7<<2)) | (2 << 2);
/* enable address range breakpoint */
if(bdm_write_reg(REG_TDR, &tdr)) return -1;
return 0;
}
int bdm_clear_addr_bp(void)
{
bdm_stop();
tdr = (tdr & ~(7<<2)) | (0 << 2);
/* disable address range breakpoint */
if(bdm_write_reg(REG_TDR, &tdr)) return -1;
return 0;
}
int bdm_set_data_bp(unsigned long value, unsigned long mask)
{
bdm_stop();
bdm_write_reg(REG_DBR, &value);
bdm_write_reg(REG_DBMR, &mask);
tdr = (1 << 30) | (~(3<<30) & tdr); /* trigger response is halt */
tdr &= ~(1 << 29); /* disable second level trigger breakpoints */
tdr |= 1 << 13; /* enable first level trigger breakpoints */
tdr = (tdr & ~(0xff<<5)) | (0x80 << 5);
/* enable data breakpoint for long word */
if(bdm_write_reg(REG_TDR, &tdr)) return -1;
return 0;
}
int bdm_clear_data_bp(void)
{
bdm_stop();
tdr = (tdr & ~(0xff<<5)) | (0x00 << 5);
/* disable data breakpoint */
if(bdm_write_reg(REG_TDR, &tdr)) return -1;
return 0;
}

View File

@@ -0,0 +1,246 @@
#ifndef _BDMOPS_H_
#define _BDMOPS_H_
/*
* bdm abstraction for coldfire processors
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef enum CF_REGS {
/* user registers */
REG_D0,
REG_D1,
REG_D2,
REG_D3,
REG_D4,
REG_D5,
REG_D6,
REG_D7,
REG_A0,
REG_A1,
REG_A2,
REG_A3,
REG_A4,
REG_A5,
REG_A6,
REG_A7,
MAX_USER_REGS=REG_A7,
/* RCREG/WCREG */
REG_CACR,
REG_ACR0,
REG_ACR1,
REG_VBR,
REG_SR,
REG_RPC,
REG_RAMBAR,
REG_MBAR,
MAX_CONFIG_REGS=REG_MBAR,
/* RDMREG/WDMREG */
REG_CSR,
REG_AATR,
REG_TDR,
REG_PBR,
REG_PBMR,
REG_ABHR,
REG_ABLR,
REG_DBR,
REG_DBMR,
MAX_DEBUG_REGS=REG_DBMR,
MAX_REGS
} CF_REGS;
#ifdef REG_NAMES
struct reg_names {
CF_REGS id;
const char name[8];
} reg_names[]={
/* user registers */
{ REG_D0, "D0"},
{ REG_D1, "D1"},
{ REG_D2, "D2"},
{ REG_D3, "D3"},
{ REG_D4, "D4"},
{ REG_D5, "D5"},
{ REG_D6, "D6"},
{ REG_D7, "D7"},
{ REG_A0, "A0"},
{ REG_A1, "A1"},
{ REG_A2, "A2"},
{ REG_A3, "A3"},
{ REG_A4, "A4"},
{ REG_A5, "A5"},
{ REG_A6, "A6"},
{ REG_A7, "A7"},
/* RCREG/WCREG */
{ REG_CACR, "CACR"},
{ REG_ACR0, "ACR0"},
{ REG_ACR1, "ACR1"},
{ REG_VBR, "VBR"},
{ REG_SR, "SR"},
{ REG_RPC, "RPC"},
{ REG_RAMBAR, "RAMBAR"},
{ REG_MBAR, "MBAR"},
/* RDMREG/WDMREG */
{ REG_CSR, "CSR"},
{ REG_AATR, "AATR"},
{ REG_TDR, "TDR"},
{ REG_PBR, "PBR"},
{ REG_PBMR, "PBMR"},
{ REG_ABHR, "ABHR"},
{ REG_ABLR, "ABLR"},
{ REG_DBR, "DBR"},
{ REG_DBMR, "DBMR"},
{ 0xffff, ""}
};
#endif
/* debug module register definitions */
/* AATR */
#define AATR_RM (1<<15) /* Read/Write mask */
#define AATR_SZM (3<<13) /* SiZe Mask */
#define AATR_TTM (3<<11) /* Transfer Type Mask */
#define AATR_TMM (7<<8) /* Transfer Modifier Mask */
#define AATR_R (1<<7) /* Read/write */
#define AATR_SZ (3<<5) /* SiZe */
#define AATR_TT (3<<3) /* Tranfer Type */
#define AATR_TM (7<<0) /* Transfer Modifier */
/* TDR */
#define TDR_TRC (3<<30) /* Trigger Response Control */
#define TDR_EBL2 (1<<29) /* Enable Breakpoint Level */
#define TDR_EDLW2 (1<<28) /* Enable Data BP for LongWord */
#define TDR_EDWL2 (1<<27) /* Enable Data BP for Word (Upper) */
#define TDR_EDWU2 (1<<26) /* Enable Data BP for Word (Lower) */
#define TDR_EDLL2 (1<<25) /* Enable Data BP for byte (LL) */
#define TDR_EDLM2 (1<<24) /* Enable Data BP for byte (LM) */
#define TDR_EDUM2 (1<<23) /* Enable Data BP for byte (UM) */
#define TDR_EDUU2 (1<<22) /* Enable Data BP for byte (UU) */
#define TDR_DI2 (1<<21) /* Data breakpoint invert */
#define TDR_EAI2 (1<<20) /* Enable Address breakpoint inverted */
#define TDR_EAR2 (1<<19) /* Enable Address breakpoint Range */
#define TDR_EAL2 (1<<18) /* Enable Address breakpoint Low */
#define TDR_EPC2 (1<<17) /* Enable PC breakpoint */
#define TDR_PCI2 (1<<16) /* PC breakpoint Invert */
#define TDR_EBL1 (1<<13) /* Enable Breakpoint Level */
#define TDR_EDLW1 (1<<12) /* Enable Data BP for LongWord */
#define TDR_EDWL1 (1<<11) /* Enable Data BP for Word (Upper) */
#define TDR_EDWU1 (1<<10) /* Enable Data BP for Word (Lower) */
#define TDR_EDLL1 (1<<9) /* Enable Data BP for byte (LL) */
#define TDR_EDLM1 (1<<8) /* Enable Data BP for byte (LM) */
#define TDR_EDUM1 (1<<7) /* Enable Data BP for byte (UM) */
#define TDR_EDUU1 (1<<6) /* Enable Data BP for byte (UU) */
#define TDR_DI1 (1<<5) /* Data breakpoint invert */
#define TDR_EAI1 (1<<4) /* Enable Address breakpoint inverted */
#define TDR_EAR1 (1<<3) /* Enable Address breakpoint Range */
#define TDR_EAL1 (1<<2) /* Enable Address breakpoint Low */
#define TDR_EPC1 (1<<1) /* Enable PC breakpoint */
#define TDR_PCI1 (1<<0) /* PC breakpoint Invert */
/* CSR */
#define CSR_STATUS (15<<28) /* breakpoint status */
# define CSR_STAT_NOBP 0
# define CSR_STAT_WAIT1 1
# define CSR_STAT_TRIG1 2
# define CSR_STAT_WAIT2 5
# define CSR_STAT_TRIG2 6
#define CSR_FOF (1<<27) /* Fault-On-Fault */
#define CSR_TRG (1<<26) /* hardware breakpoint TRiGger */
#define CSR_HALT (1<<25) /* processor HALT */
#define CSR_BKPT (1<<24) /* BreaKPoinT assert */
#define CSR_IPW (1<<16) /* Inhibit Processor Writes to dbg reg. */
#define CSR_MAP (1<<15) /* MAP processor accesses in emu mode */
#define CSR_TRC (1<<14) /* emulation mode on TRaCe exception */
#define CSR_EMU (1<<13) /* force EMUlation mode */
#define CSR_DDC (3<<11) /* Debug Data Control */
#define CSR_UHE (1<<10) /* User Halt Enable */
#define CSR_BTB (3<<8) /* Branch Target Bytes */
#define CSR_NPL (1<<6) /* NonPipelined Mode */
#define CSR_IPI (1<<5) /* Ignore Pending Interrupts */
#define CSR_SSM (1<<4) /* Single Step Mode */
/*
* this is an abstraction layer to have a general target programming interface
* so the programmer doesn't have to bother with motorola's bdm commands.
*
* applications only include bdmops.h and call the functions below
*/
/* open bdm-driver */
int /* <0 if error, BDMHandle otherwise */
bdm_init(const char *path);
/* close driver */
void bdm_release(int port);
/* bring chip to running state */
void bdm_run(void);
/* bring chip to stopped state */
void bdm_stop(void);
/* step chip on instruction */
void bdm_step(void);
/* reset chip and hold in reset state */
void bdm_reset(void);
/* restart from reset to running state */
void bdm_restart(void);
/* read a register from the chip */
int bdm_read_reg(CF_REGS which, unsigned long *value);
/* write a register in the chip */
int bdm_write_reg(CF_REGS which, unsigned long *value);
/* read a block of memory, alignment doesn't matter anymore */
int bdm_read_mem(unsigned int addr, unsigned char *mem, int count);
/* write a block of memory, alignment doesn't matter anymore */
int bdm_write_mem(unsigned int addr, unsigned char *mem, int count);
/* set program counter break point */
int bdm_set_pc_bp(unsigned long addr, unsigned long mask);
int bdm_clear_pc_bp(void);
/* set program counter break point */
int bdm_set_addr_bp(unsigned long from_addr, unsigned long to_addr);
int bdm_clear_addr_bp(void);
/* set program counter break point */
int bdm_set_data_bp(unsigned long value, unsigned long mask);
int bdm_clear_daat_bp(void);
/* bdm query status */
void bdm_clear_status(void);
int bdm_query_status(void);
#define BDM_STAT_BKPT (1<<0)
#define BDM_STAT_HALT (1<<1)
#define BDM_STAT_TRG (1<<2)
#define BDM_STAT_FOF (1<<3)
#define BDM_STAT_SSM (1<<4)
#define BDM_STAT_WAIT1 (1<<5)
#define BDM_STAT_TRIG1 (1<<6)
#define BDM_STAT_WAIT2 (1<<7)
#define BDM_STAT_TRIG2 (1<<8)
#define BDM_STAT_RESET (1<<9)
#define BDM_STAT_NOPWR (1<<10)
#define BDM_STAT_PSTHALT (1<<11)
#define BDM_STAT_NC (1<<12)
/* bdm wait for stopped target */
int bdm_wait(void);
#ifdef _COMPILING_
# ifdef USERMODE
int bdm_open(int minor, int flags);
int bdm_ioctl(int minor, unsigned int request, unsigned long arg);
int bdm_read(int minor, unsigned char *p, int count);
int bdm_write(int minor, const unsigned char *p, int count);
void bdm_close(int minor);
# else
# define bdm_open open
# define bdm_ioctl ioctl
# define bdm_read read
# define bdm_write write
# define bdm_close close
# endif
#endif
#endif

115
m68k/config.h.in Normal file
View File

@@ -0,0 +1,115 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
/* Define to 1 if you have the declaration of `perror', and to 0 if you don't.
*/
#undef HAVE_DECL_PERROR
/* Define to 1 if you have the declaration of `strerror', and to 0 if you
don't. */
#undef HAVE_DECL_STRERROR
/* Define to 1 if you have the <errno.h> header file. */
#undef HAVE_ERRNO_H
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `ioperm' function. */
#undef HAVE_IOPERM
/* Define to 1 if you have the `usb' library (-lusb). */
#undef HAVE_LIBUSB
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define to 1 if you have the <netinet/tcp.h> header file. */
#undef HAVE_NETINET_TCP_H
/* Define to 1 if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H
/* Define to 1 if you have the <signal.h> header file. */
#undef HAVE_SIGNAL_H
/* Define to 1 if the system has the type `socklen_t'. */
#undef HAVE_SOCKLEN_T
/* 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 <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 <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* 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 <termios.h> header file. */
#undef HAVE_TERMIOS_H
/* Define to 1 if you have the <termio.h> header file. */
#undef HAVE_TERMIO_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
/* Name of package */
#undef PACKAGE
/* 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
/* Version number of package */
#undef VERSION
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
`char[]'. */
#undef YYTEXT_POINTER

2
m68k/config/.cvsignore Normal file
View File

@@ -0,0 +1,2 @@
compile
ylwrap

View File

@@ -0,0 +1,93 @@
dnl @synopsis AX_CFLAGS_WARN_ALL [(shellvar)]
dnl
dnl Try to find a compiler option that enables most reasonable warnings.
dnl This macro is directly derived from VL_PROG_CC_WARNINGS which is
dnl split up into two AX_CFLAGS_WARN_ALL and AX_CFLAGS_WARN_ALL_ANSI
dnl
dnl For the GNU CC compiler it will be -Wall (and -ansi -pedantic)
dnl The result is added to the shellvar being CFLAGS by default.
dnl
dnl Currently this macro knows about GCC, Solaris C compiler,
dnl Digital Unix C compiler, C for AIX Compiler, HP-UX C compiler,
dnl IRIX C compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90
dnl (Unicos 10.0.0.8) C compiler.
dnl
dnl @version $Id: ax_cflags_warn_all.m4,v 1.1 2004/01/08 20:34:22 codewiz Exp $
dnl @author Guido Draheim <guidod@gmx.de>
dnl
AC_DEFUN([AX_CFLAGS_WARN_ALL],
[AC_MSG_CHECKING(m4_ifval($1,$1,CFLAGS) for maximum warnings)
AC_CACHE_VAL(ac_cv_cflags_warn_all,
[ac_cv_cflags_warn_all="no, unknown"
AC_LANG_SAVE
AC_LANG_C
ac_save_CFLAGS="$CFLAGS"
for ac_arg dnl
in "-pedantic % -Wall" dnl GCC
"-xstrconst % -v" dnl Solaris C
"-std1 % -verbose -w0 -warnprotos" dnl Digital Unix
"-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
"-ansi -ansiE % -fullwarn" dnl IRIX
"+ESlit % +w1" dnl HP-UX C
"-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
"-h conform % -h msglevel 2" dnl Cray C (Unicos)
#
do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
AC_TRY_COMPILE([],[return 0;],
[ac_cv_cflags_warn_all=`echo $ac_arg | sed -e 's,.*% *,,'`
break])
done
CFLAGS="$ac_save_CFLAGS"
AC_LANG_RESTORE
])
case ".$ac_cv_cflags_warn_all" in
.|.no,*) AC_MSG_RESULT($ac_cv_cflags_warn_all) ;;
*) m4_ifval($1,$1,CFLAGS)="$m4_ifval($1,$1,CFLAGS) dnl
$ac_cv_cflags_warn_all"
AC_MSG_RESULT($ac_cv_cflags_warn_all) ;;
esac])
dnl the only difference - the LANG selection... and the default FLAGS
AC_DEFUN([AX_CXXFLAGS_WARN_ALL],
[AC_MSG_CHECKING(m4_ifval($1,$1,CXXFLAGS) for maximum warnings)
AC_CACHE_VAL(ac_cv_cxxflags_warn_all,
[ac_cv_cxxflags_warn_all="no, unknown"
AC_LANG_SAVE
AC_LANG_CXX
ac_save_CXXFLAGS="$CXXFLAGS"
for ac_arg dnl
in "-pedantic % -Wall" dnl GCC
"-xstrconst % -v" dnl Solaris C
"-std1 % -verbose -w0 -warnprotos" dnl Digital Unix
"-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
"-ansi -ansiE % -fullwarn" dnl IRIX
"+ESlit % +w1" dnl HP-UX C
"-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
"-h conform % -h msglevel 2" dnl Cray C (Unicos)
#
do CXXFLAGS="$ac_save_CXXFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
AC_TRY_COMPILE([],[return 0;],
[ac_cv_cxxflags_warn_all=`echo $ac_arg | sed -e 's,.*% *,,'`
break])
done
CXXFLAGS="$ac_save_CXXFLAGS"
AC_LANG_RESTORE
])
case ".$ac_cv_cxxflags_warn_all" in
.|.no,*) AC_MSG_RESULT($ac_cv_cxxflags_warn_all) ;;
*) m4_ifval($1,$1,CXXFLAGS)="$m4_ifval($1,$1,CXXFLAGS) dnl
$ac_cv_cxxflags_warn_all"
AC_MSG_RESULT($ac_cv_cxxflags_warn_all) ;;
esac])
dnl implementation tactics:
dnl the for-argument contains a list of options. The first part of
dnl these does only exist to detect the compiler - usually it is
dnl a global option to enable -ansi or -extrawarnings. All other
dnl compilers will fail about it. That was needed since a lot of
dnl compilers will give false positives for some option-syntax
dnl like -Woption or -Xoption as they think of it is a pass-through
dnl to later compile stages or something. The "%" is used as a
dnl delimimiter. A non-option comment can be given after "%%" marks.

43
m68k/config/bootstrap Executable file
View File

@@ -0,0 +1,43 @@
#! /bin/sh
#
# $Id: bootstrap,v 1.8 2008/09/19 07:17:29 cjohns Exp $
#
# Copyright (c) 2002, Cybertec Pty Ltd.
# All rights reserved.
#
# Bootstrap the auto* stuff.
#
configure_list=`find . -name configure.ac | sed -e "s/^\.\///g"`
if [ ! -d config ]; then
mkdir config || \
{ echo "error: cannot make a config directory" >&2
{ (exit 1); exit 1; }; }
fi
am_version=$(automake --version 2>&1 | head -n 1 | awk '{ print $4 }' | sed -e 's/\.//')
if test $am_version -lt 17;
then
echo "Automake 1.7 or higher is required! Aborting...";
exit 1;
fi
for c in $configure_list
do
echo "Processing $c"
config=`echo $c | sed -e "s/[^\/]*\//..\//g" -e "s/configure.ac/config/g"`
curr_pwd=$(pwd)
cd `dirname $c`
aclocal -I config
grep -q "AC_CONFIG_HEADERS" configure.ac && autoheader
automake -Wno-portability -Wno-unsupported --foreign --add-missing --copy
autoconf --warnings=all -Wno-portability
autoheader
cd $curr_pwd
done

142
m68k/config/compile Executable file
View File

@@ -0,0 +1,142 @@
#! /bin/sh
# Wrapper for compilers which do not understand `-c -o'.
scriptversion=2005-05-14.22
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand `-c -o'.
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file `INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
esac
ofile=
cfile=
eat=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as `compile cc -o foo foo.c'.
# So we strip `-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no `-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# `.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
# Create the lock directory.
# Note: use `[/.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

1500
m68k/config/config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

1616
m68k/config/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

584
m68k/config/depcomp Executable file
View File

@@ -0,0 +1,584 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2006-10-15.18
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test -f "$tmpdepfile"; then :
else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

507
m68k/config/install-sh Executable file
View File

@@ -0,0 +1,507 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2006-10-14.15
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
posix_glob=
posix_mkdir=
# Desired mode of installed file.
mode=0755
chmodcmd=$chmodprog
chowncmd=
chgrpcmd=
stripcmd=
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=
dst=
dir_arg=
dstarg=
no_target_directory=
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
-c (ignored)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
--help display this help and exit.
--version display version info and exit.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) shift
continue;;
-d) dir_arg=true
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
shift
shift
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t) dstarg=$2
shift
shift
continue;;
-T) no_target_directory=true
shift
continue;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
done
if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dstarg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dstarg"
shift # fnord
fi
shift # arg
dstarg=$arg
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
trap '(exit $?); exit' 1 2 13 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src ;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dstarg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dstarg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst ;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dstarg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix=/ ;;
-*) prefix=./ ;;
*) prefix= ;;
esac
case $posix_glob in
'')
if (set -f) 2>/dev/null; then
posix_glob=true
else
posix_glob=false
fi ;;
esac
oIFS=$IFS
IFS=/
$posix_glob && set -f
set fnord $dstdir
shift
$posix_glob && set +f
IFS=$oIFS
prefixes=
for d
do
test -z "$d" && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# Now rename the file to the real destination.
{ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
|| {
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
if test -f "$dst"; then
$doit $rmcmd -f "$dst" 2>/dev/null \
|| { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
&& { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
|| {
echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
} || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

367
m68k/config/missing Executable file
View File

@@ -0,0 +1,367 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2006-05-10.23
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case $1 in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
esac
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program).
case $1 in
lex|yacc)
# Not GNU programs, they don't have --version.
;;
tar)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case $1 in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case $f in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if test ! -f y.tab.h; then
echo >y.tab.h
fi
if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '
/^@setfilename/{
s/.* \([^ ]*\) *$/\1/
p
q
}' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file
;;
tar)
shift
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case $firstarg in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case $firstarg in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

161
m68k/config/mkinstalldirs Executable file
View File

@@ -0,0 +1,161 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
scriptversion=2006-05-11.19
# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain.
#
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
IFS=" "" $nl"
errstatus=0
dirmode=
usage="\
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
Create each directory DIR (with mode MODE, if specified), including all
leading file name components.
Report bugs to <bug-automake@gnu.org>."
# process command line arguments
while test $# -gt 0 ; do
case $1 in
-h | --help | --h*) # -h for help
echo "$usage"
exit $?
;;
-m) # -m PERM arg
shift
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
dirmode=$1
shift
;;
--version)
echo "$0 $scriptversion"
exit $?
;;
--) # stop option processing
shift
break
;;
-*) # unknown option
echo "$usage" 1>&2
exit 1
;;
*) # first non-opt arg
break
;;
esac
done
for file
do
if test -d "$file"; then
shift
else
break
fi
done
case $# in
0) exit 0 ;;
esac
# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
# mkdir -p a/c at the same time, both will detect that a is missing,
# one will create a, then the other will try to create a and die with
# a "File exists" error. This is a problem when calling mkinstalldirs
# from a parallel make. We use --version in the probe to restrict
# ourselves to GNU mkdir, which is thread-safe.
case $dirmode in
'')
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
else
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because `.' already
# exists.
test -d ./-p && rmdir ./-p
test -d ./--version && rmdir ./--version
fi
;;
*)
if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
test ! -d ./--version; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
else
# Clean up after NextStep and OpenStep mkdir.
for d in ./-m ./-p ./--version "./$dirmode";
do
test -d $d && rmdir $d
done
fi
;;
esac
for file
do
case $file in
/*) pathcomp=/ ;;
*) pathcomp= ;;
esac
oIFS=$IFS
IFS=/
set fnord $file
shift
IFS=$oIFS
for d
do
test "x$d" = x && continue
pathcomp=$pathcomp$d
case $pathcomp in
-*) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=
chmod "$dirmode" "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
fi
fi
pathcomp=$pathcomp/
done
done
exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

223
m68k/config/ylwrap Executable file
View File

@@ -0,0 +1,223 @@
#! /bin/sh
# ylwrap - wrapper for lex/yacc invocations.
scriptversion=2005-05-14.22
# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
case "$1" in
'')
echo "$0: No files given. Try \`$0 --help' for more information." 1>&2
exit 1
;;
--basedir)
basedir=$2
shift 2
;;
-h|--h*)
cat <<\EOF
Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]...
Wrapper for lex/yacc invocations, renaming files as desired.
INPUT is the input file
OUTPUT is one file PROG generates
DESIRED is the file we actually want instead of OUTPUT
PROGRAM is program to run
ARGS are passed to PROG
Any number of OUTPUT,DESIRED pairs may be used.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v|--v*)
echo "ylwrap $scriptversion"
exit $?
;;
esac
# The input.
input="$1"
shift
case "$input" in
[\\/]* | ?:[\\/]*)
# Absolute path; do nothing.
;;
*)
# Relative path. Make it absolute.
input="`pwd`/$input"
;;
esac
pairlist=
while test "$#" -ne 0; do
if test "$1" = "--"; then
shift
break
fi
pairlist="$pairlist $1"
shift
done
# The program to run.
prog="$1"
shift
# Make any relative path in $prog absolute.
case "$prog" in
[\\/]* | ?:[\\/]*) ;;
*[\\/]*) prog="`pwd`/$prog" ;;
esac
# FIXME: add hostname here for parallel makes that run commands on
# other machines. But that might take us over the 14-char limit.
dirname=ylwrap$$
trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15
mkdir $dirname || exit 1
cd $dirname
case $# in
0) $prog "$input" ;;
*) $prog "$@" "$input" ;;
esac
ret=$?
if test $ret -eq 0; then
set X $pairlist
shift
first=yes
# Since DOS filename conventions don't allow two dots,
# the DOS version of Bison writes out y_tab.c instead of y.tab.c
# and y_tab.h instead of y.tab.h. Test to see if this is the case.
y_tab_nodot="no"
if test -f y_tab.c || test -f y_tab.h; then
y_tab_nodot="yes"
fi
# The directory holding the input.
input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`
# Quote $INPUT_DIR so we can use it in a regexp.
# FIXME: really we should care about more than `.' and `\'.
input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'`
while test "$#" -ne 0; do
from="$1"
# Handle y_tab.c and y_tab.h output by DOS
if test $y_tab_nodot = "yes"; then
if test $from = "y.tab.c"; then
from="y_tab.c"
else
if test $from = "y.tab.h"; then
from="y_tab.h"
fi
fi
fi
if test -f "$from"; then
# If $2 is an absolute path name, then just use that,
# otherwise prepend `../'.
case "$2" in
[\\/]* | ?:[\\/]*) target="$2";;
*) target="../$2";;
esac
# We do not want to overwrite a header file if it hasn't
# changed. This avoid useless recompilations. However the
# parser itself (the first file) should always be updated,
# because it is the destination of the .y.c rule in the
# Makefile. Divert the output of all other files to a temporary
# file so we can compare them to existing versions.
if test $first = no; then
realtarget="$target"
target="tmp-`echo $target | sed s/.*[\\/]//g`"
fi
# Edit out `#line' or `#' directives.
#
# We don't want the resulting debug information to point at
# an absolute srcdir; it is better for it to just mention the
# .y file with no path.
#
# We want to use the real output file name, not yy.lex.c for
# instance.
#
# We want the include guards to be adjusted too.
FROM=`echo "$from" | sed \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
TARGET=`echo "$2" | sed \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \
-e "s,$FROM,$TARGET," "$from" >"$target" || ret=$?
# Check whether header files must be updated.
if test $first = no; then
if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
echo "$2" is unchanged
rm -f "$target"
else
echo updating "$2"
mv -f "$target" "$realtarget"
fi
fi
else
# A missing file is only an error for the first file. This
# is a blatant hack to let us support using "yacc -d". If -d
# is not specified, we don't want an error when the header
# file is "missing".
if test $first = yes; then
ret=1
fi
fi
shift
shift
first=no
done
else
ret=$?
fi
# Remove the directory.
cd ..
rm -rf $dirname
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

9817
m68k/configure vendored Executable file

File diff suppressed because it is too large Load Diff

331
m68k/configure.ac Normal file
View File

@@ -0,0 +1,331 @@
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Use the config/bootstrap file to generate the configure.
dnl
dnl This file is part of a free BDM package
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
AC_PREREQ(2.59)
AC_INIT([m68k-bdm],[1.4.0],[bdm-devel@lists.sourceforge.net])
AC_CONFIG_AUX_DIR(config)
AC_CANONICAL_TARGET([])
AM_INIT_AUTOMAKE([-Wall -Wno-portability -Wno-unsupported dist-bzip2 dist-zip])
AC_CONFIG_HEADERS(config.h:config.h.in)
AC_PROG_CC
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PROG_LEX()
dnl bernie: we should fix all warnings before enabling this
dnl AX_CFLAGS_WARN_ALL
CFLAGS=${CFLAGS-"-Wall -O2 -g"}
AC_CHECK_TOOL(CC, gcc, gcc)
AC_SUBST(CC)
AC_SUBST(CFLAGS)
AC_CHECK_TOOL(AR, ar, ar)
AC_SUBST(AR)
AC_CHECK_TOOL(AS, as, as)
AC_SUBST(AS)
AC_CHECK_TOOL(RANLIB, ranlib, ranlib)
AC_SUBST(RANLIB)
AC_CHECK_TOOL(LD, ld, ld)
AC_SUBST(LD)
AM_PROG_CC_C_O
dnl
dnl Used in the gdbserver.
dnl
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/ioctl.h)
AC_CHECK_HEADERS(sys/file.h)
AC_CHECK_HEADERS(netinet/in.h)
AC_CHECK_HEADERS(sys/socket.h)
AC_CHECK_HEADERS(netdb.h)
AC_CHECK_HEADERS(netinet/tcp.h)
AC_CHECK_HEADERS(sys/ioctl.h)
AC_CHECK_HEADERS(signal.h)
AC_CHECK_HEADERS(fcntl.h)
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(arpa/inet.h)
AC_CHECK_HEADERS(errno.h)
AC_CHECK_HEADERS(termios.h)
AC_CHECK_HEADERS(termio.h)
AC_CHECK_HEADERS(sgtty.h)
AC_CHECK_DECLS([strerror, perror])
AC_CHECK_TYPES(socklen_t, [], [],
[#include <sys/types.h>
#include <sys/socket.h>
])
dnl
dnl Handle our configuration options.
dnl
AC_ARG_ENABLE(debug,
[ --enable-debug Turn on debug information (enabled)],
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
esac],
[debug=true])
AC_ARG_ENABLE(remote,
[ --enable-remote Turn on the remote protocol (enabled)],
[case "${enableval}" in
yes) bdm_remote=true ;;
no) bdm_remote=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-remote) ;;
esac],
[bdm_remote=true])
AM_CONDITIONAL(BDM_REMOTE, test x$bdm_remote = xtrue)
AC_CHECK_FUNCS(ioperm)
case ${host} in
*freebsd*)
ac_ioperm=yes
;;
*)
if test "$ac_cv_func_ioperm" = yes; then
ac_ioperm=yes
fi
;;
esac
AC_MSG_CHECKING([direct ioperm hardware access])
AC_ARG_ENABLE(ioperm,
[ --enable-ioperm Turn on direct ioperm hardware access (autodetected)],
[case "${enableval}" in
yes)
AC_MSG_RESULT([yes (enabled by user)])
bdm_ioperm=true
;;
no)
AC_MSG_RESULT([no (disabled by user)])
bdm_ioperm=false
;;
*)
AC_MSG_ERROR(bad value ${enableval} for --enable-ioperm)
;;
esac],
[
if test "$ac_ioperm" = yes; then
AC_MSG_RESULT([yes (autodetected)])
bdm_ioperm=true
else
AC_MSG_RESULT([no (autodetected)])
bdm_ioperm=false
fi
])
AM_CONDITIONAL(BDM_IOPERM, test x$bdm_ioperm = xtrue)
AC_MSG_CHECKING([for kernel driver support])
AC_ARG_ENABLE(driver,
[ --enable-driver Turn on driver support (autodetected)],
[case "${enableval}" in
yes)
AC_MSG_RESULT([yes (enabled by user)])
bdm_driver=true
;;
no)
AC_MSG_RESULT([no (disabled by user)])
bdm_driver=false
;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-driver) ;;
esac],
[
case "$target_os" in
darwin*)
AC_MSG_RESULT([no (autodetected)])
bdm_driver=false
;;
*)
AC_MSG_RESULT([yes (autodetected)])
bdm_driver=true
;;
esac
])
AM_CONDITIONAL(BDM_DRIVER, test x$bdm_driver = xtrue)
AC_ARG_ENABLE(server,
[ --enable-server Turn on server support (enabled)],
[case "${enableval}" in
yes) bdm_server=true ;;
no) bdm_server=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-server) ;;
esac],
[bdm_server=true])
AC_ARG_ENABLE(bdmctrl,
[ --enable-bdmctrl Turn on bdmctrl support (disabled)],
[case "${enableval}" in
yes) bdm_bdmctrl=true ;;
no) bdm_bdmctrl=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-bdmctrl) ;;
esac],
[bdm_bdmctrl=true])
AM_CONDITIONAL(BDMCTRL, test x$bdm_bdmctrl = xtrue)
AC_ARG_ENABLE(flashlib,
[ --enable-flashlib Turn on flashlib support (enabled)],
[case "${enableval}" in
yes) bdm_flashlib=true ;;
no) bdm_flashlib=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-flashlib) ;;
esac],
[bdm_flashlib=true])
AM_CONDITIONAL(BDMFLASHLIB, test x$bdm_flashlib = xtrue)
AC_ARG_ENABLE(bdmflash,
[ --enable-bdmflash Build the bdmflash utility (enabled)],
[case "${enableval}" in
yes) bdm_bdmflash=true ;;
no) bdm_bdmflash=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-bdmflash) ;;
esac],
[bdm_bdmflash=true])
AC_ARG_ENABLE(bdmmon,
[ --enable-bdmmon Build the bdmmon utility (enabled)],
[case "${enableval}" in
yes) bdm_bdmmon=true ;;
no) bdm_bdmmon=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-bdmmon) ;;
esac],
[bdm_bdmmon=true])
AM_CONDITIONAL(BDMFLASH, test x$bdm_bdmflash = xtrue)
AS_IF([test x$LEX != xflex], [bdm_bdmmon=false])
AM_CONDITIONAL(BDMMON, test x$bdm_bdmmon = xtrue)
AC_ARG_ENABLE(gdbserver,
[ --enable-gdbserver Build the GDB Remote Server (enabled)],
[case "${enableval}" in
yes) bdm_gdbserver=true ;;
no) bdm_gdbserver=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-gdbserver) ;;
esac],
[bdm_gdbserver=true])
AM_CONDITIONAL(GDBSERVER, test x$bdm_gdbserver = xtrue)
AC_ARG_ENABLE(tblcf,
[ --enable-tblcf Build the Turbo BDM Light Coldfire USB driver (enabled)],
[case "${enableval}" in
yes) bdm_tblcf=true ;;
no) bdm_tblcf=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-tblcf) ;;
esac],
[bdm_tblcf=true])
case ${host} in
*mingw*)
ac_libusb_include_dir_part=include
ac_libusb_lib_dir=lib/gcc
;;
*)
ac_libusb_include_dir_part=include
ac_libusb_lib_dir=lib
;;
esac
AC_ARG_WITH(libusb-dir,
[ --with-libusb-dir=DIR path for libusb package ($ac_libusb_include_dir_part/usb.h, $ac_libusb_lib_dir/libusb.a)],
[ ac_libusb_include_dir=$withval/$ac_libusb_include_dir_part
ac_libusb_lib_dir=$withval/$ac_libusb_lib_dir ],
[ ac_libusb_include_dir=NONE
ac_libusb_lib_dir=NONE ]
)
AS_IF([test x$bdm_tblcf = xtrue],
[AS_IF([test "$ac_libusb_include_dir" != "NONE"],
[ac_tmp_ldflags=${LDFLAGS}
LDFLAGS="$LDFLAGS -L $ac_libusb_lib_dir"])
AC_CHECK_LIB(usb, usb_init, ,
[AC_MSG_ERROR([Could not find libusb. Try --with-libusb-dir.])])
AS_IF([test "$ac_libusb_include_dir" != "NONE"],
[LDFLAGS=$ac_tmp_ldflags])])
AM_CONDITIONAL(TBLCF_USB, test x$bdm_tblcf = xtrue)
AM_CONDITIONAL(LIBUSB_PATH, test $ac_libusb_include_dir != NONE)
AC_SUBST(LIBUSB_INCLUDE_DIR, "${ac_libusb_include_dir}")
AC_SUBST(LIBUSB_LIB_DIR, "${ac_libusb_lib_dir}")
dnl
dnl If on a Win32 target such as MinGW do not build
dnl the server.
dnl
case ${host} in
*mingw*)
bdm_win32=true
bdm_server=false
;;
*)
bdm_win32=false
;;
esac
AM_CONDITIONAL(WIN32, test x$bdm_win32 = xtrue)
dnl
dnl Collect list of subdirectories to build
dnl
bdm_subdirs="lib"
AS_IF([test x$bdm_tblcf = xtrue], bdm_subdirs="${bdm_subdirs} tblcf")
AS_IF([test x$bdm_server = xtrue], bdm_subdirs="${bdm_subdirs} server")
AS_IF([test x$bdm_flashlib = xtrue], bdm_subdirs="${bdm_subdirs} flashlib")
AS_IF([test x$bdm_bdmflash = xtrue -o x$bdm_bdmmon = xtrue],
bdm_subdirs="${bdm_subdirs} bdmabstraction")
AS_IF([test x$bdm_gdbserver = xtrue], bdm_subdirs="${bdm_subdirs} gdbserver")
bdm_subdirs="libelf ${bdm_subdirs} test utils"
AC_SUBST(BDM_SUBDIRS, ${bdm_subdirs})
dnl
dnl Configure libelf
dnl
AC_CONFIG_SUBDIRS(libelf)
dnl
dnl Check if a m68k GCC compiler is present and can be used.
dnl
AC_PATH_PROGS([flash_plugin_cc],
[m68k-elf-gcc m68k-rtems4.9-gcc m68k-rtems4.8-gcc],
[none],
[/usr/local/bin:/opt/rtems-4.9/bin:/opt/rtems-4.8/bin])
AM_CONDITIONAL(BUILD_FLASH_PLUGINS, test x${flash_plugin_cc} != xnone)
AC_SUBST(FLASH_PLUGIN_GCC, ${flash_plugin_cc})
dnl
dnl Output the Makefiles and config.h.
dnl
AC_CONFIG_FILES(Makefile \
flashlib/Makefile \
lib/Makefile \
tblcf/Makefile \
server/Makefile \
gdbserver/Makefile \
test/Makefile \
bdmabstraction/Makefile \
utils/Makefile)
AC_OUTPUT

224
m68k/driver/ChangeLog Normal file
View File

@@ -0,0 +1,224 @@
2004-04-24 Bernardo Innocenti <bernie@develer.com>
* bdm.c: Fix CPU32 with ICD cable. Contributed by Aaron J. Grier
<aaron@frye.com>.
2004-04-18 Bernardo Innocenti <bernie@develer.com>
* openbsd/openbsd-bdm.c: Add OpenBSD driver derived from the FreeBSD
driver by an unknown author. Contributed by Aaron J. Grier
<aaron@frye.com>.
2001-12-12 Chris Johns <cjohns@ybertec.com.au>
* bdm.c: ICD step fix from Thomas Andrews (tandrews@mindspring.co.za).
2001-04-15 Chris Johns <cjohns@cybertec.com.au>
* bdm.c: Merged Keith Outwater performance changes into the driver.
2000-11-15 Chris Johns <ccj@acm.org>
* bdm.h:
The driver ver, cpu type and if type ioctls were the wrong size.
* bdm.h: New version.
* bdm.c: Changes to support FreeBSD's memcpy in kernel type operations.
Fixed a bug with return of error codes in the ioctl handler.
2000-09-02 Chris Johns <ccj@acm.org>
* bdm.c: ICD fixes from Alexander Aganichev <aaganichev@hypercom.com>.
* bdm.h: New version.
Fixed ICD spelling. Patch from Alexander Aganichev <aaganichev@hypercom.com>.
2000-08-31 Chris Johns <ccj@acm.org>
* bdm.h: New version.
22000-08-03 Chris Johns <ccj@acm.org>
* bdm.h: New minor version number.
* bdm.c:
Changed the CF ctrl port init value to 0x00. This value is correct.
Merged an IDC patch from Adam Kropelin <akropel1@rochester.rr.com>.
2000-06-27 Chris Johns <ccj@acm.org>
* bdm.c: Changed the control register default value to 0x0f which
allowed the driver to work on a DELL 500MHz Pentium III
machine.
2000-06-25 Chris Johns <ccj@acm.org>
* bdm.h: New version for the CF long reset.
* bdm.c:
Slowed the reset down on the Coldfire. The PLL needs time to up.
2000-05-31 Chris Johns <ccj@acm.org>
* bdm.c, bdm.h: Support for IDC added.
2000-05-27 Chris Johns <ccj@acm.org>
* bdm.c: Change all bdm* functions to bdmDev* to stop clashes
Win9x builds.
2000-05-18 Chris Johns <ccj@acm.org>
* bdm.h: Error bits as shifted values.
New version.
2000-05-17 Chris Johns <ccj@acm.org>
* bdm.c: Moved Coldfire variables in struct BDM for multi port support.
Added Coldfire debug module version detection and then
selection of PST support based on it. Ver B uses PST (5307).
Longer reset delays.
Removed setting the DSI signal to 0 on each bit.
Added support to detect false halt conditions by attempting
to read the PC twice. If you can the target has halted.
The cache is invalidated only if it is enabled.
Debug trace clean ups.
2000-03-30 Chris Johns <ccj@acm.org>
* bdm.h: Added the timeout error code. This is used by the remote
interface.
* bdm.c: Changed the delay in the hardware init for the CPU32.
2000-03-30 Chris Johns <ccj@acm.org>
* Makefile: Added the USE_PST support. Moved to clean OS structure.
* linux-bdm.c: New file.
12000-03-30 Chris Johns <ccj@acm.org>
* bdm.h: Added the timeout error code. This is used by the remote
interface.
* bdm.c: Changed the delay in the hardware init for the CPU32.
1999-10-23 Chris Johns <ccj@acm.org>
* bdm.c:
Remved the Linux specific parts to allow easier OS integration.
* bdm.h: Merged in the SCO changes.
1999-05-25 source <ccj@acm.org>
* Makefile:
It seems that depmod complains about unresolved symbols even
when the driver loads and works properly. I don't know what's
changed in Linux to cause this, but for now just get rid of
the depmod.
1999-03-18 Chris Johns <ccj@acm.org>
* bdm.c: Add support for 2.2.xx kernels.
Fri Jan 15 05:43:55 1999 Chris Johns <ccj@acm.org>
* bdm.c:
Added Coldfire support to invalidate the cache when get status detects
a change of state from running to stopped, or when go or step commands
are issued.
Sat Jan 9 03:04:03 1999 Chris Johns <ccj@acm.org>
* bdm.c: Remove the `sti()' calls in the `bdm_sleep' function.
Tue Jan 5 07:39:40 1999 Chris Johns <ccj@acm.org>
* bdm.h, bdm.c: Merged David Fiddes 5307 bkpt signal hold patch.
Sat Dec 12 04:23:28 1998 Chris Johns <ccj@acm.org>
* bdm.c: Fixed the region control logic in open.
Fixed printing csr.
Extended some of the timeouts in the CF driver.
Fixed some incorrect labels.
Fixed a lock up bug after a bus error.
* bdm.h: New version.
* Makefile: Fixed the modversions.
Sat Oct 31 05:06:15 1998 Chris Johns <ccj@acm.org>
* Makefile: Always over-write the installed header and lib.
* bdm.c: Fixed tabs, and forced the SR to be 16bit.
Sun Oct 18 04:38:00 1998 Chris Johns <ccj@acm.org>
* bdm.c: Added support for generating a bus if no repsonse is
always being returned from the BDM module.
Wed Oct 14 14:32:04 1998 Chris Johns <ccj@acm.org>
* bdm.c: Mask pending interrupts in single-step mode.
Fixed the status handling. It now uses the csr register. It is cached
to handle the fact the status bits are set for only one read.
Wed Oct 14 10:55:33 1998 Chris Johns <ccj@acm.org>
* bdm.c:
Added support for the Coldfire BDM and P&E interface. This has only
been tested inthe 5206.
* bdm.h: Added support for the Coldfire BDM.
* Makefile: Changed the prefix to the default of /usr.
Fri Oct 31 20:58:23 1997 eric <eric@skatter.usask.ca>
* Makefile: Fit into RTEMS distribution.
Thu Aug 21 15:38:28 1997 eric <eric@skatter.usask.ca>
* bdm.c: Fix up error on minor device check in bdm_open.
Remove erroneous comment in init_module.
Improve log messages in init_module.
Wed Jun 11 16:59:06 1997 eric <eric@skatter.usask.ca>
* bdm.c:
Removed code which sent an extra BDM_FILL_CMD for word or byte values.
Cleaned up some formatting.
Wed Feb 19 17:15:06 1997 eric <eric@skatter.usask.ca>
* bdm.c, bdm.h: Add `set debug level' ioctl.
Fri Feb 7 15:10:49 1997 eric <eric@skatter.usask.ca>
* Makefile: Add a single `prefix'.
Make directories if necessary when installing.
* bdm.c: Clean up some debugging messages.
Thu Feb 6 22:08:52 1997 eric <eric@skatter.usask.ca>
* Makefile: Add module installation to install target.
* bdm.c: Don't release ports that have been stolen from another driver.
* bdm.c:
Install driver even if I/O ports are claimed by some other driver.
I don't really like doing this, but the alternative would be to
require that the parallel port (LP) driver be unloaded before
the BDM driver could be loaded.
* bdm.c: More init_module message cleanup.
* bdm.c: Fix up init_module message.
* Makefile, bdm.c, bdm.h: Initial revision

1108
m68k/driver/bdm-cf-pe.c Normal file

File diff suppressed because it is too large Load Diff

946
m68k/driver/bdm-cpu32.c Normal file
View File

@@ -0,0 +1,946 @@
/*
* Motorola Background Debug Mode Driver
* Copyright (C) 1995 W. Eric Norum
* Copyright (C) 1998-2008 Chris Johns
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* W. Eric Norum
* Saskatchewan Accelerator Laboratory
* University of Saskatchewan
* 107 North Road
* Saskatoon, Saskatchewan, CANADA
* S7N 5C6
*
* eric@skatter.usask.ca
*
* Coldfire support by:
* Chris Johns
* chris@contemporary.net.au
*
*/
/*
* PD (Eric's) CPU32 Interface
*
* Parallel port bit assignments
*
* Status register (bits 0-2 not used):
* +---+---+---+---+---+---+---+---+
* | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
* +---+---+---+---+---+---+---+---+
* | | | | |
* | | | | +--- Target FREEZE line
* | | | | 1 - Target is in background mode
* | | | | 0 - Target is not background mode
* | | | |
* | | | +------- Not used
* | | |
* | | +----------- Serial data from target
* | | 1 - `0' from target
* | | 0 - `1' from target
* | |
* | +--------------- Target power
* | 1 - Target power is ON
* | 0 - Target power is OFF
* |
* +------------------- Target connected
* 1 - Target is connected
* 0 - Target is not connected
*
* Control register (bits 4-7 not used):
* +---+---+---+---+
* | 3 | 2 | 1 | 0 |
* +---+---+---+---+
* | | | |
* | | | +--- Target BKPT* /DSCLK line
* | | | Write 1 - Drive BKPT* /DSCLK line LOW
* | | | Write 0 - Allow BKPT* /DSCLK line to go HIGH
* | | | Allow flip-flop to control BKPT* /DSCLK line
* | | |
* | | +------- Target RESET* line
* | | Write 1 - Force RESET* LOW
* | | Write 0 - Allow monitoring of RESET*
* | | Read 1 - RESET* is LOW
* | | Read 0 - RESET* is HIGH
* | |
* | +----------- Serial data to target
* | Write 0 - Send `0' to target
* | Write 1 - Send `1' to target
* |
* +--------------- Control single-step flip-flop
* Write 1 - Clear flip-flop
* BKPT* /DSCLK is controlled by bit 0.
* Write 0 - Allow flip-flop operation
* Falling edge of IFETCH* /DSI clocks a `1'
* into the flip-flop and drive BKPT* /DSCLK
* LOW, causing a breakpoint.
*/
#define CPU32_PD_SR_CONNECTED (0x80)
#define CPU32_PD_SR_POWERED (0x40)
#define CPU32_PD_SR_DATA_BAR (0x20)
#define CPU32_PD_SR_FROZEN (0x08)
#define CPU32_PD_CR_NOT_SINGLESTEP (0x08)
#define CPU32_PD_CR_DATA (0x04)
#define CPU32_PD_CR_FORCE_RESET (0x02)
#define CPU32_PD_CR_RESET_STATUS (0x02)
#define CPU32_PD_CR_CLOCKBAR_BKPT (0x01)
/*
* ICD interface.
*
* Parallel port bit assignments
*
* Status register
* +---+---+---+---+---+---+---+---+
* | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
* +---+---+---+---+---+---+---+---+
* | | | | |
* | | | | +--- Not used
* | | | +------- Not used
* | | +----------- Not used
* | |
* | +--------------- Target FREEZE line
* | 1 - Target is in background mode
* | 0 - Target is not background mode
* |
* +------------------- Serial data from target
* 1 - `0' from target
* 0 - `1' from target
*
* Data register
* +---+---+---+---+---+---+---+---+
* | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
* +---+---+---+---+---+---+---+---+
* | | | | | | | |
* | | | | | | | +--- Serial data to target
* | | | | | | | Write 1: Send 1 to target
* | | | | | | | Write 0: Send 0 to target
* | | | | | | | Signal gets to target, if OE is 1
* | | | | | | | and target is in FREEZE mode
* | | | | | | |
* | | | | | | +------- Clock
* | | | | | | if target in freeze mode, then:
* | | | | | | Write 1: drive BKPT* /DSCLK 1
* | | | | | | Write 0: drive BKPT* /DSCLK 0
* | | | | | |
* | | | | | +----------- BREAK
* | | | | | if target not in freeze mode, then:
* | | | | | Write 0: drive BKPT* /DSCLK 0
* | | | | | line determines single stepping
* | | | | | on leaving BGND mode:
* | | | | | Write 0: do single step
* | | | | | Write 1: continue normally
* | | | | |
* | | | | +--------------- RESET
* | | | | Write 0: pull reset low
* | | | | Write 1: release reset line
* | | | |
* | | | +--- OE
* | | | Write 0 - DSI is tristated
* | | | Write 1 - DSI pin is forced to level of serial data
* | | |
* | | +------- LED
* | | Write 1 - turn on LED
* | | Write 0 - turn off LED
* | |
* | +----------- ERROR
* | Write 0 - BERR output is tristated
* | Write 1 - BERR is pulled low
* |
* +--------------- spare
*/
#define CPU32_ICD_DSI (1 << 0) /* data shift input Host->MCU */
#define CPU32_ICD_DSCLK (1 << 1) /* data shift clock / breakpoint pin */
#define CPU32_ICD_STEP_OUT (1 << 2) /* set low to force breakpoint */
#define CPU32_ICD_RST_OUT (1 << 3) /* set low to force reset on MCU */
#define CPU32_ICD_OE (1 << 4) /* set to a 1 to enable DSI */
#define CPU32_ICD_FORCE_BERR (1 << 6) /* set to a 1 to force BERR on target */
#define CPU32_ICD_FREEZE (1 << 6) /* */
#define CPU32_ICD_DSO (1 << 7) /* */
/*
************************************************************************
* CPU32 for PD/ICD interface support routines *
************************************************************************
*/
/*
* CPU32 system register mapping. See bdm.h for the user values.
*/
static int cpu32_sysreg_map[BDM_REG_VBR + 1] =
{ 0x0, /* BDM_REG_RPC */
0x1, /* BDM_REG_PCC */
0xb, /* BDM_REG_SR */
0xc, /* BDM_REG_USP */
0xd, /* BDM_REG_SSP */
0xe, /* BDM_REG_SFC */
0xf, /* BDM_REG_DFC */
0x8, /* BDM_REG_ATEMP */
0x9, /* BDM_REG_FAR */
0xa /* BDM_REG_VBR */
};
/* need by cpu32_read_sysreg() */
static int cpu32_write_sysreg (struct BDM *self, struct BDMioctl *ioc, int mode);
static int cpu32_icd_stop_chip (struct BDM *self);
/*
* Clock a word to/from the target
*/
static int
cpu32_serial_clock (struct BDM *self, unsigned short wval, int holdback)
{
return (self->serial_clock) (self, wval, holdback);
}
/*
* Get target status
*/
static int
cpu32_pd_get_status (struct BDM *self)
{
unsigned char sr = inb (self->statusPort);
int ret;
if (!(sr & CPU32_PD_SR_CONNECTED))
ret = BDM_TARGETNC;
else if (!(sr & CPU32_PD_SR_POWERED))
ret = BDM_TARGETPOWER;
else
ret = (sr & CPU32_PD_SR_FROZEN ? BDM_TARGETSTOPPED : 0) |
(inb (self->controlPort) & CPU32_PD_CR_RESET_STATUS ? BDM_TARGETRESET : 0);
if (self->debugFlag > 1)
PRINTF (" cpu32_pd_get_status -- Status Port:0x%02x Status:0x%04x\n",
sr, ret);
return ret;
}
/*
* Hardware initialization
*/
static int
cpu32_pd_init_hardware (struct BDM *self)
{
int status;
/*
* Force breakpoint
*/
outb (CPU32_PD_CR_NOT_SINGLESTEP | CPU32_PD_CR_CLOCKBAR_BKPT, self->controlPort);
udelay (100);
outb (CPU32_PD_CR_FORCE_RESET | CPU32_PD_CR_CLOCKBAR_BKPT, self->controlPort);
bdm_sleep (HZ / 100);
outb (CPU32_PD_CR_CLOCKBAR_BKPT, self->controlPort);
udelay (10);
outb (CPU32_PD_CR_NOT_SINGLESTEP | CPU32_PD_CR_CLOCKBAR_BKPT, self->controlPort);
udelay (100);
status = cpu32_pd_get_status (self);
if (self->debugFlag)
PRINTF (" cpu32_pd_init_hardware: status:0x%02x control port:0x%02x\n",
status, inb (self->controlPort));
return status;
}
/*
* Clock a word to/from the target
*/
static int
cpu32_pd_serial_clock (struct BDM *self, unsigned short wval, int holdback)
{
unsigned long shiftRegister;
unsigned char dataBit;
unsigned int counter;
unsigned int status = cpu32_pd_get_status (self);
if (status & BDM_TARGETRESET)
return BDM_FAULT_RESET;
if (status & BDM_TARGETNC)
return BDM_FAULT_CABLE;
if (status & BDM_TARGETPOWER)
return BDM_FAULT_POWER;
shiftRegister = wval;
counter = 17 - holdback;
while (counter--) {
dataBit = ((shiftRegister & 0x10000) ? CPU32_PD_CR_DATA : 0);
shiftRegister <<= 1;
outb (dataBit | CPU32_PD_CR_NOT_SINGLESTEP | CPU32_PD_CR_CLOCKBAR_BKPT,
self->controlPort);
bdm_delay (self->delayTimer + 1);
if ((inb (self->statusPort) & CPU32_PD_SR_DATA_BAR) == 0)
shiftRegister |= 1;
outb (dataBit | CPU32_PD_CR_NOT_SINGLESTEP, self->controlPort);
bdm_delay ((self->delayTimer >> 1) + 1);
}
self->readValue = shiftRegister & 0x1FFFF;
if (self->debugFlag)
PRINTF (" cpu32_pd_serial_clock -- send 0x%05x receive 0x%05x\n",
wval, self->readValue);
if (self->readValue & 0x10000) {
if (self->readValue == 0x10001)
return BDM_FAULT_BERR;
else if (self->readValue != 0x10000)
return BDM_FAULT_NVC;
}
return 0;
}
/*
* Restart chip and stop on first instruction fetch
*/
static int
cpu32_pd_restart_chip (struct BDM *self)
{
int check;
if (self->debugFlag)
PRINTF (" cpu32_pd_restart_chip\n");
outb (CPU32_PD_CR_FORCE_RESET | CPU32_PD_CR_CLOCKBAR_BKPT, self->controlPort);
udelay (10);
outb (CPU32_PD_CR_CLOCKBAR_BKPT, self->controlPort);
udelay (10);
outb (CPU32_PD_CR_NOT_SINGLESTEP | CPU32_PD_CR_CLOCKBAR_BKPT, self->controlPort);
for (check = 0 ; check < 1000 ; check++) {
if (inb (self->statusPort) & CPU32_PD_SR_FROZEN)
return 0;
}
return BDM_FAULT_RESPONSE;
}
/*
* Restart chip and disable background debugging mode
*/
static int
cpu32_pd_release_chip (struct BDM *self)
{
if (self->debugFlag)
PRINTF (" cpu32_pd_release_chip\n");
outb (CPU32_PD_CR_NOT_SINGLESTEP | CPU32_PD_CR_FORCE_RESET, self->controlPort);
udelay (10);
outb (CPU32_PD_CR_NOT_SINGLESTEP, self->controlPort);
return 0;
}
/*
* Restart chip, enable background debugging mode, halt on first fetch
*
* The software from the Motorola BBS tries to have the target
* chip begin execution, but that doesn't work very reliably.
* The RESETH* line rises rather slowly, so sometimes the BKPT* / DSCLK
* would be seen low, and sometimes it wouldn't.
*/
static int
cpu32_pd_reset_chip (struct BDM *self)
{
if (self->debugFlag)
PRINTF (" cpu32_pd_reset_chip\n");
outb (CPU32_PD_CR_CLOCKBAR_BKPT | CPU32_PD_CR_FORCE_RESET,
self->controlPort);
udelay (10);
outb (CPU32_PD_CR_CLOCKBAR_BKPT, self->controlPort);
udelay (10);
outb (CPU32_PD_CR_CLOCKBAR_BKPT | CPU32_PD_CR_NOT_SINGLESTEP,
self->controlPort);
return 0;
}
/*
* Force the target into background debugging mode
*/
static int
cpu32_pd_stop_chip (struct BDM *self)
{
int check;
if (self->debugFlag)
PRINTF (" cpu32_pd_stop_chip\n");
if (inb (self->statusPort) & CPU32_PD_SR_FROZEN)
return 0;
outb (CPU32_PD_CR_NOT_SINGLESTEP | CPU32_PD_CR_CLOCKBAR_BKPT,
self->controlPort);
for (check = 0 ; check < 1000 ; check++) {
if (inb (self->statusPort) & CPU32_PD_SR_FROZEN)
return 0;
}
return BDM_FAULT_RESPONSE;
}
/*
* Make the target execute a single instruction and
* reenter background debugging mode
*/
static int
cpu32_pd_step_chip (struct BDM *self)
{
int check;
unsigned char dataBit;
int err;
if (self->debugFlag)
PRINTF (" cpu32_pd_step_chip\n");
err = cpu32_serial_clock (self, BDM_GO_CMD, 1);
if (err)
return err;
/*
* Send the last bit of the command
*/
dataBit = (BDM_GO_CMD & 0x1) ? CPU32_PD_CR_DATA : 0;
outb (dataBit | CPU32_PD_CR_NOT_SINGLESTEP | CPU32_PD_CR_CLOCKBAR_BKPT,
self->controlPort);
bdm_delay (self->delayTimer + 1);
/*
* Enable single-step
*/
outb (dataBit | CPU32_PD_CR_CLOCKBAR_BKPT, self->controlPort);
bdm_delay (1);
outb (dataBit, self->controlPort);
/*
* Wait for step to complete
* The software from the Motorola BBS doesn't do this, but
* omitting the `outb' operation leaves a race condition the
* next time cpu32_serial_clock is called.
*
* The first output operation in bdmSerialClock sends
* `dataBit | CPU32_CR_NOT_SINGLESTEP | CPU32_CR_CLOCKBAR_BKPT' to the
* control port. If the flip flop in the external circuit
* clears before the `CPU32_CR_CLOCKBAR_BKPT' pin of the '132 goes
* low, there is a narrow glitch on the BKPT* / DSCLK pin, which
* clocks a garbage bit into the target chip.
*/
for (check = 0 ; check < 1000 ; check++) {
if (inb (self->statusPort) & CPU32_PD_SR_FROZEN) {
outb (CPU32_PD_CR_CLOCKBAR_BKPT, self->controlPort);
return 0;
}
}
return BDM_FAULT_RESPONSE;
}
/*
* Get target status
*/
static int
cpu32_icd_get_status (struct BDM *self)
{
unsigned char sr = inb (self->statusPort);
int ret;
ret = sr & CPU32_ICD_FREEZE ? BDM_TARGETSTOPPED : 0;
if (self->debugFlag > 1)
PRINTF (" cpu32_icd_get_status -- Status Port:0x%02x Status:0x%04x\n",
sr, ret);
return ret;
}
/*
* Hardware initialization
*/
static int
cpu32_icd_init_hardware (struct BDM *self)
{
int status;
/*
* Force breakpoint
*/
outb (CPU32_ICD_STEP_OUT | CPU32_ICD_DSCLK | CPU32_ICD_RST_OUT, self->dataPort);
udelay (10);
status = cpu32_icd_get_status (self);
if (self->debugFlag)
PRINTF (" cpu32_icd_init_hardware: status:0x%02x, data port:0x%02x\n",
status, inb (self->dataPort));
return status;
}
/*
* Clock a word to/from the target
*/
static int
cpu32_icd_serial_clock (struct BDM *self, unsigned short wval, int holdback)
{
unsigned long shiftRegister;
unsigned char dataBit;
unsigned int counter;
unsigned int status = cpu32_icd_get_status (self);
if (status & BDM_TARGETRESET)
return BDM_FAULT_RESET;
if (status & BDM_TARGETNC)
return BDM_FAULT_CABLE;
if (status & BDM_TARGETPOWER)
return BDM_FAULT_POWER;
if(!(status & BDM_TARGETSTOPPED)) {
if (self->debugFlag)
PRINTF (" cpu32_icd_serial_clock -- stop target first\n");
if (cpu32_icd_stop_chip (self) == BDM_FAULT_RESPONSE) {
if (self->debugFlag)
PRINTF (" cpu32_icd_serial_clock -- can\'t stop it\n");
return BDM_FAULT_RESPONSE;
}
}
shiftRegister = wval;
counter = 17 - holdback;
while (counter--) {
dataBit = ((shiftRegister & 0x10000) ? CPU32_ICD_DSI : 0);
shiftRegister <<= 1;
outb (dataBit | CPU32_ICD_RST_OUT | CPU32_ICD_OE | CPU32_ICD_STEP_OUT,
self->dataPort);
bdm_delay (self->delayTimer + 1);
if ((inb (self->statusPort) & CPU32_ICD_DSO) == 0)
shiftRegister |= 1;
outb (dataBit | CPU32_ICD_RST_OUT | CPU32_ICD_OE | CPU32_ICD_STEP_OUT | CPU32_ICD_DSCLK,
self->dataPort);
bdm_delay ((self->delayTimer >> 1) + 1);
}
if (holdback == 0) {
outb (CPU32_ICD_RST_OUT | CPU32_ICD_STEP_OUT | CPU32_ICD_DSCLK,
self->dataPort);
bdm_delay (self->delayTimer + 1);
}
outb (CPU32_ICD_RST_OUT | CPU32_ICD_STEP_OUT | CPU32_ICD_DSCLK,
self->dataPort);
self->readValue = shiftRegister & 0x1FFFF;
if (self->debugFlag)
PRINTF (" cpu32_icd_serial_clock -- send 0x%05x, receive 0x%05x\n",
wval, self->readValue);
if (self->readValue & 0x10000) {
if (self->readValue == 0x10001)
return BDM_FAULT_BERR;
else if (self->readValue != 0x10000)
return BDM_FAULT_NVC;
}
return 0;
}
/*
* Force the target into background debugging mode
*/
static int
cpu32_icd_stop_chip (struct BDM *self)
{
int check;
int pass;
if (self->debugFlag)
PRINTF (" cpu32_icd_stop_chip: ");
/* if FREEZE is already high, we're stopped and we're done here */
if (inb (self->statusPort) & CPU32_ICD_FREEZE) {
if (self->debugFlag)
PRINTF ("already stopped\n");
return 0;
}
/* try multiple times... */
for (pass = 0; pass < 14; pass++) {
/* even times, simply assert DSCLK and RESET */
if (pass%2 == 0) {
outb (CPU32_ICD_DSCLK | CPU32_ICD_RST_OUT, self->dataPort);
}
/* odd times, yank BERR as well, in case the target is wedged */
else {
outb (CPU32_ICD_DSCLK | CPU32_ICD_RST_OUT | CPU32_ICD_FORCE_BERR,
self->dataPort);
}
/* now hang around and wait for the freeze line to come up
* XXX we're depending on a nop loop for timing? arrrgh!
*/
for (check = 0 ; check < (1000 + ((pass+1)%2) * 9000) ; check++) {
if (inb (self->statusPort) & CPU32_ICD_FREEZE) {
/* if freeze line is high we're OK
* XXX let reset go too?
*/
if (self->debugFlag)
PRINTF("stopped after %d bdm_delays\n", check);
outb (CPU32_ICD_RST_OUT, self->dataPort);
return 0;
}
bdm_delay (10);
}
}
/* we've failed... */
outb (CPU32_ICD_RST_OUT, self->dataPort);
if (self->debugFlag)
PRINTF("failed!\n");
return BDM_FAULT_RESPONSE;
}
/*
* Restart chip and stop on first instruction fetch
*/
static int
cpu32_icd_restart_chip (struct BDM *self)
{
if (self->debugFlag)
PRINTF (" cpu32_icd_restart_chip\n");
outb (CPU32_ICD_DSCLK, self->dataPort);
udelay (1);
return cpu32_icd_stop_chip (self);
}
/*
* Restart chip and disable background debugging mode
*/
static int
cpu32_icd_release_chip (struct BDM *self)
{
if (self->debugFlag)
PRINTF (" cpu32_icd_release_chip\n");
outb (CPU32_ICD_DSCLK | CPU32_ICD_STEP_OUT, self->dataPort);
udelay (10);
outb (CPU32_ICD_DSCLK | CPU32_ICD_RST_OUT | CPU32_ICD_STEP_OUT, self->dataPort);
udelay (10);
return 0;
}
/*
* Restart chip, enable background debugging mode, halt on first fetch
*
* The software from the Motorola BBS tries to have the target
* chip begin execution, but that doesn't work very reliably.
* The RESETH* line rises rather slowly, so sometimes the BKPT* / DSCLK
* would be seen low, and sometimes it wouldn't.
*/
static int
cpu32_icd_reset_chip (struct BDM *self)
{
if (self->debugFlag)
PRINTF (" cpu32_icd_reset_chip\n");
/*
* Assert RESET*, BKPT*, and BREAK*
*/
outb (0, self->dataPort);
udelay (100);
/*
* Deassert RESET (CPU must see BKPT* asserted at rising edge of RESET*)
* Leaving BKPT* and BREAK* asserted gets us ready for first data txfer
* as per Figure 7-8 in CPU32RM/AD
*/
outb (CPU32_ICD_RST_OUT, self->dataPort);
udelay (100);
return 0;
}
/*
* Make the target execute a single instruction and
* reenter background debugging mode
*/
static int
cpu32_icd_step_chip (struct BDM *self)
{
unsigned char dataBit;
int err;
if (self->debugFlag)
PRINTF (" cpu32_step_chip\n");
err = cpu32_serial_clock (self, BDM_GO_CMD, 1);
if (err)
return err;
/*
* Send the last bit of the command
*/
dataBit = (BDM_GO_CMD & 0x1) ? CPU32_ICD_DSI : 0;
outb (dataBit | CPU32_ICD_OE | CPU32_ICD_STEP_OUT | CPU32_ICD_RST_OUT,
self->dataPort);
bdm_delay (self->delayTimer + 1);
outb (dataBit | CPU32_ICD_OE | CPU32_ICD_RST_OUT, self->dataPort);
bdm_delay (1);
/* Raise CPU32_ICD_DSCLK before dropping CPU32_ICD_OEA */
outb (CPU32_ICD_DSCLK | CPU32_ICD_OE | CPU32_ICD_RST_OUT, self->dataPort);
bdm_delay (1);
outb (CPU32_ICD_DSCLK | CPU32_ICD_RST_OUT, self->dataPort);
return cpu32_icd_stop_chip (self);
}
/*
* Read system register
*/
static int
cpu32_read_sysreg (struct BDM *self, struct BDMioctl *ioc, int mode)
{
int err, cmd;
unsigned short msw, lsw;
/*
* CPU32 MBAR require sfc support, make it look like
* a register.
*/
if (ioc->address == BDM_REG_MBAR) {
struct BDMioctl mbar_ioc;
unsigned long sfc;
mbar_ioc.address = BDM_REG_SFC;
if ((err = cpu32_read_sysreg (self, &mbar_ioc,
BDM_SYS_REG_MODE_MAPPED)) < 0)
return err;
sfc = mbar_ioc.value;
mbar_ioc.address = BDM_REG_SFC;
mbar_ioc.value = 7;
if ((err = cpu32_write_sysreg (self, &mbar_ioc,
BDM_SYS_REG_MODE_MAPPED)) < 0)
return err;
mbar_ioc.address = 0x3FF00;
if ((err = bdmDrvReadLongWord (self, &mbar_ioc)) < 0)
return err;
ioc->value = mbar_ioc.value;
mbar_ioc.address = BDM_REG_SFC;
mbar_ioc.value = sfc;
if ((err = cpu32_write_sysreg (self, &mbar_ioc,
BDM_SYS_REG_MODE_MAPPED)) < 0)
return err;
return 0;
}
if (ioc->address > BDM_REG_VBR)
return BDM_FAULT_NVC;
if (mode != BDM_SYS_REG_MODE_MAPPED)
cmd = ioc->address & 0xffff;
else
cmd = cpu32_sysreg_map[ioc->address];
if (cmd == -1) {
ioc->value = 0;
if (self->debugFlag)
PRINTF (" cpu32_read_sysreg - Reg(%d):0x%x is not mapped; ignored\n",
mode, ioc->address);
return 0;
}
cmd |= BDM_RSREG_CMD;
if (((err = cpu32_serial_clock (self, cmd, 0)) != 0) ||
((err = bdmBitBashFetchWord (self, &msw)) != 0) ||
((err = bdmBitBashFetchWord (self, &lsw)) != 0))
return err;
ioc->value = (msw << 16) | lsw;
return 0;
}
/*
* Write system register
*/
static int
cpu32_write_sysreg (struct BDM *self, struct BDMioctl *ioc, int mode)
{
int err, cmd;
/*
* CPU32 MBAR require dfc support, make it look like
* a register.
*/
if (ioc->address == BDM_REG_MBAR) {
struct BDMioctl mbar_ioc;
unsigned long dfc;
mbar_ioc.address = BDM_REG_DFC;
if ((err = cpu32_read_sysreg (self, &mbar_ioc,
BDM_SYS_REG_MODE_MAPPED)) < 0)
return err;
dfc = mbar_ioc.value;
mbar_ioc.address = BDM_REG_DFC;
mbar_ioc.value = 7;
if ((err = cpu32_write_sysreg (self, &mbar_ioc,
BDM_SYS_REG_MODE_MAPPED)) < 0)
return err;
mbar_ioc.address = 0x3FF00;
mbar_ioc.value = ioc->value;
if ((err = bdmDrvWriteLongWord (self, &mbar_ioc)) < 0)
return err;
mbar_ioc.address = BDM_REG_DFC;
mbar_ioc.value = dfc;
if ((err = cpu32_write_sysreg (self, &mbar_ioc,
BDM_SYS_REG_MODE_MAPPED)) < 0)
return err;
return 0;
}
if (ioc->address > BDM_REG_VBR)
return BDM_FAULT_NVC;
if (mode != BDM_SYS_REG_MODE_MAPPED)
cmd = ioc->address & 0xffff;
else
cmd = cpu32_sysreg_map[ioc->address];
cmd = BDM_WSREG_CMD;
if (((err = cpu32_serial_clock (self, cmd, 0)) != 0) ||
((err = cpu32_serial_clock (self, ioc->value >> 16, 0)) != 0) ||
((err = cpu32_serial_clock (self, ioc->value, 0)) != 0))
return err;
return 0;
}
/*
* Generate a bus error for the ICD interface
*/
static int
cpu32_icd_gen_bus_error (struct BDM *self)
{
if (self->debugFlag)
PRINTF(" cpu32_icd_gen_bus_error\n");
outb (CPU32_ICD_FORCE_BERR | CPU32_ICD_RST_OUT, self->dataPort);
udelay (400);
outb (CPU32_ICD_RST_OUT, self->dataPort);
return BDM_FAULT_BERR;
}
/*
* Generate a bus error as the access has failed. This is
* not supported on the CPU32 with PD interface.
* (the 7-chip PD interface generates it automatically in hardware
*/
static int
cpu32_gen_bus_error (struct BDM *self)
{
if (self->debugFlag > 1)
PRINTF(" cpu32_gen_bus_error\n");
return 0;
}
/*
* Restart target execution
*/
static int
cpu32_run_chip (struct BDM *self)
{
return cpu32_serial_clock (self, BDM_GO_CMD, 0);
}
#ifdef BDM_BIT_BASH_PORT
/*
* Bit Bash the BDM port. No status checks. I assume you know what is happening at
* a low level with the BDM hardware if you are using this interface.
*/
static int
cpu32_bit_bash (struct BDM *self, unsigned short mask, unsigned short bits)
{
unsigned char ctrl_port = 0;
if (self->debugFlag)
PRINTF (" cpu32_bit_bash: mask=%04x, bits=%04x\n", mask, bits);
self->bit_bash_bits &= ~mask;
self->bit_bash_bits |= bits;
if (self->bit_bash_bits & BDM_BB_RESET)
ctrl_port |= CPU32_CR_FORCE_RESET;
if ((self->bit_bash_bits & BDM_BB_BKPT) == 0)
ctrl_port |= CPU32_CR_CLOCKBAR_BKPT;
return 0;
}
#endif
/*
* Initialise the BDM structure for a CPU32
*/
static int
cpu32_pd_init_self (struct BDM *self)
{
int reg;
self->processor = BDM_CPU32;
self->interface = BDM_CPU32_ERIC;
self->get_status = cpu32_pd_get_status;
self->init_hardware = cpu32_pd_init_hardware;
self->serial_clock = cpu32_pd_serial_clock;
self->gen_bus_error = cpu32_gen_bus_error;
self->read_sysreg = cpu32_read_sysreg;
self->write_sysreg = cpu32_write_sysreg;
self->restart_chip = cpu32_pd_restart_chip;
self->release_chip = cpu32_pd_release_chip;
self->reset_chip = cpu32_pd_reset_chip;
self->stop_chip = cpu32_pd_stop_chip;
self->run_chip = cpu32_run_chip;
self->step_chip = cpu32_pd_step_chip;
#ifdef BDM_BIT_BASH_PORT
self->bit_bash = cpu32_bit_bash;
self->bit_bash_bits = 0;
#endif
for (reg = 0; reg < BDM_MAX_SYSREG; reg++)
self->shadow_sysreg[reg] = 0;
return 0;
}
static int
cpu32_icd_init_self (struct BDM *self)
{
int reg;
self->processor = BDM_CPU32;
self->interface = BDM_CPU32_ICD;
self->get_status = cpu32_icd_get_status;
self->init_hardware = cpu32_icd_init_hardware;
self->serial_clock = cpu32_icd_serial_clock;
self->gen_bus_error = cpu32_icd_gen_bus_error;
self->restart_chip = cpu32_icd_restart_chip;
self->release_chip = cpu32_icd_release_chip;
self->reset_chip = cpu32_icd_reset_chip;
self->stop_chip = cpu32_icd_stop_chip;
self->run_chip = cpu32_run_chip;
self->step_chip = cpu32_icd_step_chip;
self->fill_buf = bdmBitBashFillBuf;
self->send_buf = bdmBitBashSendBuf;
self->read_sysreg = cpu32_read_sysreg;
self->read_proreg = bdmBitBashReadProcessorRegister;
self->read_long_word = bdmBitBashReadLongWord;
self->read_word = bdmBitBashReadWord;
self->read_byte = bdmBitBashReadByte;
self->write_sysreg = cpu32_write_sysreg;
self->write_proreg = bdmBitBashWriteProcessorRegister;
self->write_long_word = bdmBitBashWriteLongWord;
self->write_word = bdmBitBashWriteWord;
self->write_byte = bdmBitBashWriteByte;
#ifdef BDM_BIT_BASH_PORT
self->bit_bash = cpu32_bit_bash;
self->bit_bash_bits = 0;
#endif
for (reg = 0; reg < BDM_MAX_SYSREG; reg++)
self->shadow_sysreg[reg] = 0;
return 0;
}

1100
m68k/driver/bdm-tblcf.c Normal file

File diff suppressed because it is too large Load Diff

1392
m68k/driver/bdm.c Normal file

File diff suppressed because it is too large Load Diff

268
m68k/driver/bdm.h Normal file
View File

@@ -0,0 +1,268 @@
/*
* Motorola Background Debug Mode Driver
* Copyright (C) 1995 W. Eric Norum
* Copyright (C) 1998 Chris Johns
*
* Based on:
* 1. `A Background Debug Mode Driver Package for Motorola's
* 16- and 32-Bit Microcontrollers', Scott Howard, Motorola
* Canada, 1993.
* 2. `Linux device driver for public domain BDM Interface',
* M. Schraut, Technische Universitaet Muenchen, Lehrstuhl
* fuer Prozessrechner, 1995.
*
* Extended to support the ColdFire BDM interface using the P&E
* module which comes with the EVB. Currently only tested with the
* 5206 (5V) device.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* W. Eric Norum
* Saskatchewan Accelerator Laboratory
* University of Saskatchewan
* 107 North Road
* Saskatoon, Saskatchewan, CANADA
* S7N 5C6
*
* eric@skatter.usask.ca
*
* Coldfire support by:
* Chris Johns
* chris@contemporary.net.au
*
*/
#ifndef _BDM_H_
#define _BDM_H_
/*
* Version of the driver.
*/
#define BDM_DRV_VERSION 0x020d
/*
* Hook for Linux kernel
*/
#define BDM_MAJOR_NUMBER 34
/*
* Allocation of the minor numbers. The number of minors per interface
* must be a factor of 2.
*/
#define BDM_MINORS_PER_IFACE 4
#define BDM_IFACE_MINOR(m) (m & (BDM_MINORS_PER_IFACE - 1))
#define BDM_IFACE(m) (m / BDM_MINORS_PER_IFACE)
#define BDM_NUM_OF_MINORS (BDM_NUM_OF_IFACES * BDM_MINORS_PER_IFACE)
/*
* Processors
*/
#define BDM_CPU32 0
#define BDM_COLDFIRE 1
/*
* Interfaces, used of offset the major number.
*/
#define BDM_CPU32_ERIC 0
#define BDM_CPU32_PD BDM_CPU32_ERIC
#define BDM_COLDFIRE_PE 1
#define BDM_CPU32_ICD 2
#define BDM_COLDFIRE_TBLCF 3
#define BDM_NUM_OF_IFACES 4 /* last */
/*
* Error codes
*/
#define BDM_FAULT_UNKNOWN 210
#define BDM_FAULT_POWER 211
#define BDM_FAULT_CABLE 212
#define BDM_FAULT_RESPONSE 213
#define BDM_FAULT_RESET 214
#define BDM_FAULT_PORT 215
#define BDM_FAULT_BERR 216
#define BDM_FAULT_NVC 217
#define BDM_FAULT_TIMEOUT 218
#define BDM_FAULT_FORCED_TA 219
/*
* Structure for I/O requests
* Address and value are in host-endian order
*/
struct BDMioctl {
unsigned long int address;
unsigned long int value;
};
/*
* The ioctl codes. If these change insure the remote client and server
* interfaces are kept in sync. Assumes Cygwin does not define Win32.
*/
#if !defined (_IO)
#if defined (__WIN32__)
#include <winsock2.h>
#else
#include <sys/ioctl.h>
#endif
#endif
/*
* If the OS does not provide any ioctl support as found on
* some Unix systems then provide something.
*/
#if !defined (_IO)
#undef _IOR
#undef _IOW
#undef _IOWR
#define _IO(x,y) ((x<<8)|y|0x00000)
#define _IOR(x,y,t) ((x<<8)|y|0x10000)
#define _IOW(x,y,t) ((x<<8)|y|0x20000)
#define _IOWR(x,y,t) ((x<<8)|y|0x30000)
#endif
#if !defined (_IOWR)
#if !defined (IOC_OUTIN)
#define IOC_OUTIN 0x10000000 /* copy in parameters */
#endif
#define _IOWR(x,y,t) (IOC_OUTIN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
#endif
#define BDM_INIT _IO('B', 0)
#define BDM_RESET_CHIP _IO('B', 1)
#define BDM_RESTART_CHIP _IO('B', 2)
#define BDM_STOP_CHIP _IO('B', 3)
#define BDM_STEP_CHIP _IO('B', 4)
#define BDM_GET_STATUS _IOR('B', 5, int)
#define BDM_SPEED _IOW('B', 6, int)
#define BDM_DEBUG _IOW('B', 7, int)
#define BDM_RELEASE_CHIP _IO('B', 8)
#define BDM_GO _IO('B', 9)
/*
* Input/output requests
*/
/*
* Addition for general register access.
*
* Note, the control and debug registers has been added at the start
* so the other allocated number do not change.
*/
#define BDM_READ_CTLREG _IOWR('B', 16, struct BDMioctl)
#define BDM_WRITE_CTLREG _IOW('B', 17, struct BDMioctl)
#define BDM_READ_DBREG _IOWR('B', 18, struct BDMioctl)
#define BDM_WRITE_DBREG _IOW('B', 19, struct BDMioctl)
#define BDM_READ_REG _IOWR('B', 20, struct BDMioctl)
#define BDM_READ_SYSREG _IOWR('B', 21, struct BDMioctl)
#define BDM_READ_LONGWORD _IOWR('B', 22, struct BDMioctl)
#define BDM_READ_WORD _IOWR('B', 23, struct BDMioctl)
#define BDM_READ_BYTE _IOWR('B', 24, struct BDMioctl)
#define BDM_WRITE_REG _IOW('B', 25, struct BDMioctl)
#define BDM_WRITE_SYSREG _IOW('B', 26, struct BDMioctl)
#define BDM_WRITE_LONGWORD _IOW('B', 27, struct BDMioctl)
#define BDM_WRITE_WORD _IOW('B', 28, struct BDMioctl)
#define BDM_WRITE_BYTE _IOW('B', 29, struct BDMioctl)
/*
* Detect the driver version, processor or interface type
*/
#define BDM_GET_DRV_VER _IOR('B', 30, int)
#define BDM_GET_CPU_TYPE _IOR('B', 31, int)
#define BDM_GET_IF_TYPE _IOR('B', 32, int)
/*
* Coldfire specific call to control the use of the
* PST signals. This is only needed on 5206e targets that
* use the PST signals for IO.
*/
#define BDM_GET_CF_PST _IOR('B', 33, int)
#define BDM_SET_CF_PST _IOR('B', 34, int)
/*
* bits in status word returned by BDM_GET_STATUS ioctl
*/
#define BDM_TARGETRESET (1 << 0) /* Target reset */
#define BDM_TARGETHALT (1 << 1) /* Target halt */
#define BDM_TARGETSTOPPED (1 << 2) /* Target stopped */
#define BDM_TARGETPOWER (1 << 3) /* Power failed */
#define BDM_TARGETNC (1 << 4) /* Target not connected */
/*
* Register codes for BDM_READ_SYSREG/BDM_WRITE_SYSREG ioctls
*
* These are the control and debug registers for the CPU32 and
* Coldfire processor.
*
* These are ony logical numbers not the actual registers values used
* on the BDM port. The driver maps these to the correct command and
* register pair .
*
* Using only the one call keeps the changes to Eric's library and gdb
* code to a minimum.
*
* The WR only registers are shadowed in the driver.
*/
#define BDM_REG_RPC 0x0 /* CPU32, Coldfire */
#define BDM_REG_PCC 0x1 /* CPU32 */
#define BDM_REG_SR 0x2 /* CPU32, Coldfire */
#define BDM_REG_USP 0x3 /* CPU32 */
#define BDM_REG_SSP 0x4 /* CPU32 */
#define BDM_REG_SFC 0x5 /* CPU32 */
#define BDM_REG_DFC 0x6 /* CPU32 */
#define BDM_REG_ATEMP 0x7 /* CPU32 */
#define BDM_REG_FAR 0x8 /* CPU32 */
#define BDM_REG_VBR 0x9 /* CPU32, Coldfire */
#define BDM_REG_CACR 0xa /* Coldfire */
#define BDM_REG_ACR0 0xb /* Coldfire */
#define BDM_REG_ACR1 0xc /* Coldfire */
#define BDM_REG_RAMBAR 0xd /* Coldfire */
#define BDM_REG_MBAR 0xe /* Coldfire */
#define BDM_REG_CSR 0xf /* Coldfire */
#define BDM_REG_AATR 0x10 /* WR only, Coldfire */
#define BDM_REG_TDR 0x11 /* WR only, Coldfire */
#define BDM_REG_PBR 0x12 /* WR only, Coldfire */
#define BDM_REG_PBMR 0x13 /* WR only, Coldfire */
#define BDM_REG_ABHR 0x14 /* WR only, Coldfire */
#define BDM_REG_ABLR 0x15 /* WR only, Coldfire */
#define BDM_REG_DBR 0x16 /* WR only, Coldfire */
#define BDM_REG_DBMR 0x17 /* WR only, Coldfire */
#define BDM_MAX_SYSREG (BDM_REG_DBMR + 1)
/*
* Register codes for BDM_READ_REG/BDM_WRITE_REG ioctls
*/
#define BDM_REG_D0 0x0
#define BDM_REG_D1 0x1
#define BDM_REG_D2 0x2
#define BDM_REG_D3 0x3
#define BDM_REG_D4 0x4
#define BDM_REG_D5 0x5
#define BDM_REG_D6 0x6
#define BDM_REG_D7 0x7
#define BDM_REG_A0 0x8
#define BDM_REG_A1 0x9
#define BDM_REG_A2 0xa
#define BDM_REG_A3 0xb
#define BDM_REG_A4 0xc
#define BDM_REG_A5 0xd
#define BDM_REG_A6 0xe
#define BDM_REG_A7 0xf /* use this for the stack pointer */
#endif /* _BDM_H_ */

View File

@@ -0,0 +1,8 @@
bus_if.h
device_if.h
isa_if.h
setdefs.h
setdef0.c
setdef1.c
bdm.ko
bdm.8.gz

View File

@@ -0,0 +1,16 @@
2001-02-03 Chris Johns <ccj@acm.org>
* bdm.8,
bus_if.h,
.cvsignore,
device_if.h,
freebsd-bdm.c,
isa_if.h,
Makefile,
setdef0.c,
setdef1.c,
setdefs.h,
unbdm,
README:
New file.

View File

@@ -0,0 +1,28 @@
# $Id: Makefile,v 1.1 2003/06/02 15:15:54 codewiz Exp $
#
# James Housley's FreeBSD kernel module makefile.
#
.PATH: ${.CURDIR}
KERN = /usr/src/sys/kern
KMOD = bdm
SRCS = bus_if.h device_if.h isa_if.h freebsd-bdm.c
MAN8 = bdm.8
CFLAGS += -DBDM_MODULE -Wall -I..
machine:
@${ECHO} ${.TARGET} "->" /usr/src/sys/i386/include; \
ln -s /usr/src/sys/i386/include ${.TARGET}
@:
@${ECHO} ${.TARGET} "->" /usr/src/sys; \
ln -s /usr/src/sys ${.TARGET}
afterinstall:
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
${.CURDIR}/bdm ${DESTDIR}/usr/bin
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
${.CURDIR}/unbdm ${DESTDIR}/usr/bin
.include <bsd.kmod.mk>

View File

@@ -0,0 +1,39 @@
Motorola Background Debug Mode Driver for FreeBSD
By Greg Tunnock <gtunnock@RedfernNetworks.com> on 5-Sep-00.
Redfern Broadband Networks, Eveleigh, NSW, Australia
http://www.RedfernNetworks.com
The BDM driver is built as a FreeBSD kernel module. Not as a driver that
can be linked into the kernel. The BDM kernel module is loaded and unloaded
at runtime, with the bdm and unbdm scripts.
The BDM kernel module is built as part of the FreeBSD kernel sources. The
/usr/src/sys sources distribution needs to be installed before the BDM
kernel module can be built. The Makefile assumes the kernel sources are
installed at /usr/src/sys.
The device special files need to be created as root, with
../../local_scripts/MAKEDEV.
The BDM kernel module has been built and tested with FreeBSD 4.0, the
Coldfire processor and P&E Coldfire interface.
To build:
$ make
To install (as root):
# make install
# ../../local_scripts/MAKEDEV
To load BDM kernel module:
$ /usr/bin/bdm
To unload BDM kernel module:
$ /usr/bin/unbdm

2
m68k/driver/freebsd/bdm Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
/sbin/kldload bdm

20
m68k/driver/freebsd/bdm.8 Normal file
View File

@@ -0,0 +1,20 @@
.\"
.Dd June 19, 1997
.Dt BDM 8
.Os FreeBSD
.Sh NAME
.Nm bdm
.Nd load the background debug module driver kernel module
.Sh SYNOPSIS
.Nm bdm
.Sh DESCRIPTION
The
.Nm
utility loads the background debug module driver kernel module.
.Sh FILES
.Bl -tag -width /lkm/bdm_mod.o
.It Pa /lkm/bdm_mod.o
background debug module loadable kernel module.
.Sh "SEE ALSO"
.Xr lkm 4 ,
.Xr modload 8

View File

@@ -0,0 +1,500 @@
/*
* Motorola Background Debug Mode Driver
* Copyright (C) 2000 James Housley
* Copyright (C) 2000 Chris Johns
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* FreeBSD support by: (Started May 9, 2000)
* James Housley
* The Housleys dot Net
* 65 Frank's Lane
* Hanover, MA 02339, USA
*
* jim@thehousleys.net
*
* Chris Johns & Greg Tunnock
* Redfern Broadband Networks.
* Continued FreeBSD port, Sep 2000
* This porting effort has been made possible by Redfern Broadband
* Networks.
*
* ccj@acm.org
*
*/
#define BDM_DEFAULT_DEBUG 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/conf.h>
#include <sys/buf.h>
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/uio.h>
#include <sys/syslog.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
#include <machine/clock.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/pmap.h>
#include <i386/isa/isa.h>
#include <i386/isa/isa_device.h>
#include <i386/isa/timerreg.h>
#include <sys/errno.h>
#include <unistd.h>
#include <sys/ioccom.h>
/*
************************************************************************
* FreeBSD Driver Structures *
************************************************************************
*/
#define UNIT(d) ((unsigned int)(minor(d) & 0x07))
/*
************************************************************************
* UNIX driver support routines *
************************************************************************
*/
/*
* Function prototypes.
*/
static int init_module (void);
static void os_lock_module (void);
static void os_unlock_module (void);
static int bdmprobe (void);
static void bdmattach (void);
static void bdmdetach (void);
static void bdm_outb (int port, int value);
/*
* Delay for a while so target can keep up.
*/
static void
bdm_delay (int counter)
{
while (counter--) {
__asm volatile ("nop");
}
}
/*
* Wait a longer while .
*/
static char BDMsleep;
static void
bdm_sleep (u_int time)
{
tsleep((void *)&BDMsleep, ((PZERO + 8)| PCATCH), "bdmslp", (int)time);
}
/*
************************************************************************
* OS worker functions. *
************************************************************************
*/
static int
os_claim_io_ports (char *name, unsigned int base, unsigned int num)
{
return 0;
}
static int
os_release_io_ports (unsigned int base, unsigned int num)
{
return 0;
}
static int
os_copy_in (void *dst, void *src, int size)
{
(void)memcpy(dst, src, (size_t)size);
return 0;
}
static int
os_copy_out (void *dst, void *src, int size)
{
(void)memcpy(dst, src, (size_t)size);
return 0;
}
/**
* Moves data from user-space address to kernel-space address.
*
* This is provide for Operating Systems with separate move and copy
* strategies. If an OS doesn't have a move strategy this function will
* be the same as os_copy_in().
*
* Param dst Kernel-space address to copy to.
* Param src User-space address to copy from.
* Param size Number of bytes to copy.
*
* Returns 0 if successful.
*/
static int
os_move_in (void *dst, void *src, int size)
{
return uiomove((caddr_t)dst, size, (struct uio *)src);
}
#define BUF_INCREMENTED_BY_MOVE_IN
/**
* Moves data from kernel-space address to user-space address.
*
* This is provide for Operating Systems with separate move and copy
* strategies. If an OS doesn't have a move strategy this function will
* be the same as os_copy_out().
*
* Param dst User-space address to copy to.
* Param src Kernel-space address to copy from.
* Param size Number of bytes to copy.
*
* Returns 0 if successful.
*/
static int
os_move_out (void *dst, void *src, int size)
{
return uiomove((caddr_t)src, size, (struct uio *)dst);
}
#define BUF_INCREMENTED_BY_MOVE_OUT
static void
os_lock_module ()
{
}
static void
os_unlock_module ()
{
}
/*
* Big hack to get around differences in outb
*/
static void
bdm_outb (int port, int value)
{
outb (port, value);
}
#undef outb
#define outb(value, port) bdm_outb (port, value)
/*
************************************************************************
* Mappings to FreeBSD *
************************************************************************
*/
#define PRINTF printf
#define udelay(x) DELAY (x)
#define MINOR(x) minor (x)
#define HZ hz
/*
************************************************************************
* Include the driver code *
************************************************************************
*/
#include "../bdm.c"
/*
************************************************************************
* Good old-fashioned UNIX driver entry points *
************************************************************************
*/
static int
freebsd_bdm_open (dev_t dev, int flags, int fmt, struct proc *p)
{
return bdm_open (MINOR (dev));
}
static int
freebsd_bdm_close (dev_t dev, int fflag, int devtype, struct proc *p)
{
return bdm_close (MINOR (dev));
}
static int
freebsd_bdm_read (dev_t dev, struct uio *uio, int flag)
{
return bdm_read (UNIT (dev), (char *)uio, uio->uio_resid);
}
static int
freebsd_bdm_write (dev_t dev, struct uio * uio, int ioflag)
{
return bdm_write (UNIT (dev), (char *)uio, uio->uio_resid);
}
static int
freebsd_bdm_ioctl (dev_t dev, u_long cmd, caddr_t arg, int flag, struct proc *p)
{
return bdm_ioctl (UNIT(dev), cmd, (unsigned long)arg);
}
/*
* Driver entry points
*/
static int bdm_dev_registered = 0;
void cleanup_module (void);
/*
* Hook driver into kernel
*/
static int
init_module ()
{
int minor;
PRINTF ("bdm_init_module %d.%d, " __DATE__ ", " __TIME__ "\n",
BDM_DRV_VERSION >> 8, BDM_DRV_VERSION & 0xff);
bdm_dev_registered = 1;
/*
* Set up port numbers
*/
for (minor = 0 ;
minor < (sizeof bdm_device_info / sizeof bdm_device_info[0]) ;
minor++) {
int port;
struct BDM *self = &bdm_device_info[minor];
/*
* First set the default debug level.
*/
self->debugFlag = BDM_DEFAULT_DEBUG;
/*
* Choose a port number
*/
switch (BDM_IFACE_MINOR (minor)) {
case 0: port = 0x378; break; /* LPT1 */
case 1: port = 0x278; break; /* LPT2 */
case 2: port = 0x3bc; break; /* LPT3 */
case 3: port = 0x2bc; break; /* LPT4, ccj - made this up :-) */
default:
PRINTF ("BDM driver has no address for LPT%d.\n", BDM_IFACE_MINOR (minor) + 1);
cleanup_module ();
return EIO;
}
/*
* See if the port exists
*/
self->exists = 1;
outb (0x00, port);
bdm_delay (50);
if (inb (port) != 0x00) {
self->exists = 0;
if (self->debugFlag)
PRINTF ("BDM driver cannot detect LPT%d.\n", BDM_IFACE_MINOR (minor) + 1);
continue;
}
sprintf (self->name, "bdm%d", minor);
self->portBase = self->dataPort = port;
self->statusPort = port + 1;
self->controlPort = port + 2;
self->delayTimer = 0;
switch (BDM_IFACE (minor)) {
case BDM_CPU32_PD: cpu32_pd_init_self (self); break;
case BDM_CPU32_ICD: cpu32_icd_init_self (self); break;
case BDM_COLDFIRE_PE: cf_pe_init_self (self); break;
default:
PRINTF ("BDM driver has no interface for minor number\n");
cleanup_module ();
return EIO;
}
}
return 0;
}
/*
* Unhook module from kernel
*/
void
cleanup_module (void)
{
int minor;
for (minor = 0 ;
minor < (sizeof bdm_device_info / sizeof bdm_device_info[0]) ;
minor++) {
struct BDM *self = &bdm_device_info[minor];
if (self->exists && self->portsAreMine)
;
}
if (bdm_dev_registered) {
bdm_dev_registered = 0;
PRINTF ("BDM driver unregistered.\n");
}
}
#ifdef KLD_MODULE
#include <sys/exec.h>
#include <sys/sysent.h>
#define CDEV_MAJOR 34
static struct cdevsw bdm_cdevsw = {
freebsd_bdm_open, /* open */
freebsd_bdm_close, /* close */
freebsd_bdm_read, /* read */
freebsd_bdm_write, /* write */
freebsd_bdm_ioctl, /* ioctl */
nopoll, /* poll */
nommap, /* mmap */
nostrategy, /* strategy */
"bdm", /* name */
CDEV_MAJOR, /* major */
nodump, /* dump */
nopsize, /* psize */
0, /* flags */
-1 /* bmaj */
};
/*
* Table of BDM devices.
*/
static struct {
char *name; /* Name in /dev. */
int minor; /* Device minor number. */
dev_t dev; /* Device structure, once attached. */
} bdm_devs[] = {
{ "bdmcpu320", 0, 0 },
{ "bdmcpu321", 1, 0 },
{ "bdmcpu322", 2, 0 },
{ "bdmcf0", 4, 0 },
{ "bdmcf1", 5, 0 },
{ "bdmcf2", 6, 0 },
{ "bdmicd0", 8, 0 },
{ "bdmicd1", 9, 0 },
{ "bdmicd2", 10, 0 }
};
#define NUMOF_DEVS (sizeof(bdm_devs)/sizeof(bdm_devs[0]))
static int
bdmprobe ()
{
/* For now, always report the BDM driver is able to drive the BDM hardware. */
return 0;
}
static void
bdmattach ()
{
int i;
for (i = 0; i < NUMOF_DEVS; i++) {
bdm_devs[i].dev
= make_dev(&bdm_cdevsw, bdm_devs[i].minor, 0, 0, 0666, bdm_devs[i].name);
}
}
static void
bdmdetach()
{
int i;
for (i = 0; i < NUMOF_DEVS; i++) {
if (bdm_devs[i].dev) {
destroy_dev(bdm_devs[i].dev);
bdm_devs[i].dev = 0;
}
}
}
static int
bdm_load(void)
{
int err;
PRINTF("BDM init_module\n %s\n %s\n %s\n",
"$RCSfile: freebsd-bdm.c,v $", "$Revision: 1.2 $", "$Date: 2003/09/20 22:21:16 $");
PRINTF(" Version %s\n Compiled at %s %s\n",
"PD-interface",
__DATE__, __TIME__);
err = bdmprobe ();
if (err) {
PRINTF ("BDM driver: probe failed\n");
return err;
}
bdmattach ();
err = init_module();
if (err) {
PRINTF ("BDM driver: load failed\n");
bdmdetach ();
return err;
}
PRINTF ("BDM driver: loaded\n");
return 0;
}
static int
bdm_unload(void)
{
bdmdetach ();
PRINTF ("BDM driver: unloaded\n");
return 0;
}
static int
bdm_mod_event(module_t mod, int type, void *data)
{
switch (type) {
case MOD_LOAD:
return bdm_load();
case MOD_UNLOAD:
return bdm_unload();
default:
break;
}
return 0;
}
static moduledata_t bdm_mod = {
"bdm",
bdm_mod_event,
NULL,
};
DECLARE_MODULE(bdm, bdm_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
#endif /* KLD_MODULE */

2
m68k/driver/freebsd/unbdm Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
/sbin/kldunload -n bdm.ko

555
m68k/driver/ioperm/ioperm.c Normal file
View File

@@ -0,0 +1,555 @@
/*
* Motorola Background Debug Mode Driver
* Copyright (C) 2003 Chris Johns
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* I/O Permssion support by:
* Chris Johns
* cjohns@users.sourceforge.net
*
*/
#include <config.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
#ifdef HAVE_IOPERM
#include <sys/io.h>
#endif
#include <sys/param.h>
#include <sys/stat.h>
#include "tblcf.h"
#include "tblcf_usb.h"
#ifdef __FreeBSD__
#include <machine/cpufunc.h>
/*
* Need to swap around the parameters to the outb call to match Linux.
*/
static inline void fb_outb (u_int port, u_char data)
{
outb (port, data);
}
#undef outb
#define outb(d, p) fb_outb(p, d)
#endif
#define BDM_DEFAULT_DEBUG 0
static int debugLevel = BDM_DEFAULT_DEBUG;
#ifndef HAVE_IOPERM
static FILE* dev_io_handle;
#endif
/*
************************************************************************
* Override the C library function. *
************************************************************************
*/
int
driver_close (int fd)
{
return close (fd);
}
int
driver_read (int fd, char *buf, size_t count)
{
return read (fd, buf, count);
}
int
driver_write (int fd, char *buf, size_t count)
{
return write (fd, buf, count);
}
int
driver_ioctl (int fd, unsigned long int request, ...)
{
va_list args;
unsigned long *arg;
va_start (args, request);
arg = va_arg (args, unsigned long *);
return ioctl (fd, request, arg);
}
int
driver_open (const char *pathname, int flags)
{
return open (pathname, flags);
}
#define open ioperm_bdm_open
#define close ioperm_bdm_close
#define ioctl ioperm_bdm_ioctl
#define read ioperm_bdm_read
#define write ioperm_bdm_write
/*
************************************************************************
* Add the missing the write/read define. *
************************************************************************
*/
#define IOC_OUTIN 0x10000000 /* copy in parameters */
//#define _IOWR(x,y,t) (IOC_OUTIN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
/*
************************************************************************
* Unix driver support routines *
************************************************************************
*/
#define udelay usleep
/*
* Delay for a while so target can keep up.
*/
void
bdm_delay (int counter)
{
volatile unsigned long junk;
while (counter--) {
junk++;
}
}
#ifndef HZ
#define HZ 1000
#endif
/*
* Delay specified number of milliseconds
*/
void
bdm_sleep (unsigned long time)
{
usleep (time * (100 * (1000 / HZ)));
}
/*
************************************************************************
* OS worker functions. *
************************************************************************
*/
int
os_claim_io_ports (char *name, unsigned int base, unsigned int num)
{
/*
* I am told ioperm handles this.
*/
return 0;
}
int
os_release_io_ports (unsigned int base, unsigned int num)
{
return 0;
}
#define os_move_in os_copy_in
int
os_copy_in (void *dst, void *src, int size)
{
/*
* We run in the application and talk directly to the hardware.
*/
memcpy (dst, src, size);
return 0;
}
#define os_move_out os_copy_out
int
os_copy_out (void *dst, void *src, int size)
{
memcpy (dst, src, size);
return 0;
}
void
os_lock_module ()
{
}
void
os_unlock_module ()
{
}
#ifdef interface
#undef interface
#endif
/*
************************************************************************
* Include the driver code *
************************************************************************
*/
#include "bdm.c"
/*
************************************************************************
* Good old-fashioned UNIX driver entry points *
************************************************************************
*/
static int bdm_dev_registered = 0;
static int bdm_driver_open = 0;
/*
* Unhook module from kernel
*/
static void
bdm_cleanup_module (int fd)
{
if (bdm_dev_registered)
{
if ((fd >= 0) &&
(((unsigned) fd) < (sizeof (bdm_device_info) / sizeof (*bdm_device_info))))
{
struct BDM *self = &bdm_device_info[fd];
#ifdef HAVE_IOPERM
ioperm (self->portBase, 3, 0);
#else
if (dev_io_handle)
{
fclose (dev_io_handle);
dev_io_handle = NULL;
}
#endif
bdm_dev_registered = 0;
#ifdef BDM_VER_MESSAGE
bdmInfo ("BDM driver unregistered.\n");
#endif
}
}
else
driver_close (fd);
}
/*
* Try and get access to the port via ioperm. If you fail flag this and let
* the library try for a real driver.
*/
int
ioperm_bdm_init (int minor)
{
unsigned short port;
unsigned char data;
struct BDM *self;
#ifdef BDM_VER_MESSAGE
bdmInfo ("bdm_init %d.%d, " __DATE__ ", " __TIME__ "\n",
BDM_DRV_VERSION >> 8, BDM_DRV_VERSION & 0xff);
#endif
/*
* Choose a port number
*/
switch (BDM_IFACE_MINOR (minor))
{
case 0: port = 0x378; break; /* LPT1 */
case 1: port = 0x278; break; /* LPT2 */
case 2: port = 0x3bc; break; /* LPT3 */
case 3: port = 0x9400; break; /* PCI parallel port cards */
default:
bdmInfo ("BDM driver has no address for LPT%d.\n",
BDM_IFACE_MINOR (minor) + 1);
errno = EIO;
return -1;
}
/*
* Set up the port.
*/
self = &bdm_device_info[minor];
/*
* First set the default debug level.
*/
self->debugFlag = BDM_DEFAULT_DEBUG;
/*
* Try the ioperm() call to claim standard parallel ports.
*
* For PCI parallel port adaptors in extended IO space, use
* iopl() instead.
*/
#ifdef HAVE_IOPERM
if (port < 0x400)
{
if (ioperm (port, 3, 1) < 0)
return -1;
}
else
{
if (iopl(3) != 0)
return -1;
}
#else
if (!dev_io_handle)
{
dev_io_handle = fopen("/dev/io", "rw");
if (!dev_io_handle)
return -1;
}
#endif
/*
* See if the port exists
*/
self->exists = 1;
bdm_dev_registered = 1;
outb (0x00, port);
udelay (50);
data = inb (port);
if (data != 0x00)
{
self->exists = 0;
if (self->debugFlag)
bdmInfo ("BDM driver cannot detect LPT%d.\n",
BDM_IFACE_MINOR (minor) + 1);
bdm_cleanup_module (minor);
errno = EIO;
return -3;
}
sprintf (self->name, "bdm%d", minor);
self->portBase = self->dataPort = port;
self->statusPort = port + 1;
self->controlPort = port + 2;
self->delayTimer = 0;
switch (BDM_IFACE (minor))
{
case BDM_CPU32_PD: cpu32_pd_init_self (self); break;
case BDM_CPU32_ICD: cpu32_icd_init_self (self); break;
case BDM_COLDFIRE_PE: cf_pe_init_self (self); break;
default:
bdmInfo ("BDM driver has no interface for minor number\n");
bdm_cleanup_module (minor);
errno = EIO;
return -1;
}
return 0;
}
/*
* The device is a device name of the form /dev/bdmcpu320 or
* /dev/bdmcf0 where the /dev/bdm must be present
* the next field can be cpu32 or cf followed by
* a number which is the port.
*
* It can also be a udev created symlink to the USB bus node.
*/
static int remoteOpen (const char *name);
int
ioperm_bdm_open (const char *devname, int flags, ...)
{
const char* device = devname;
int port = -1;
int result = 0;
if (bdm_dev_registered)
{
bdmInfo ("BDM driver is already registered (Please report to BDM project).\n");
errno = EIO;
return -2;
}
if (strncmp (device, "/dev/bdm", sizeof ("/dev/bdm") - 1) == 0)
{
device += sizeof ("/dev/bdm") - 1;
if (strncmp (device, "cpu32", 5) == 0)
{
port = 0;
device += 5; /* s.b. 5 */
}
else if (strncmp (device, "icd", 3) == 0)
{
port = 8;
device += 3;
}
else if (strncmp (device, "cf", 2) == 0)
{
port = 4;
device += 2;
}
else
{
errno = ENOENT;
result = -1;
}
if (result == 0)
{
port += strtoul (device, 0, 0);
result = ioperm_bdm_init (port);
}
}
if ((result == 0) && (port == -1))
{
bdmInfo ("trying usb driver: %s\n", devname);
result = usb_bdm_init (device);
if (result < -1)
return -1;
port = 0;
}
/*
* See if the ioperm or usb call failed. Try to open the driver. If no
* driver is found, prepend localhost and try for a local server.
* This make an /dev/bdmcf0 open automatically attempt to open a
* bdmServer. This local server may be using ioperm or usb so no driver.
*/
if (result < 0)
{
if (result == -1)
{
int fd;
bdmInfo ("trying kernel driver: %s\n", devname);
if ((fd = driver_open (devname, flags)) < 0) {
if ((strlen (devname) + sizeof ("localhost")) < 128)
{
char lname[128];
strcpy (lname, "localhost:");
strcat (lname, devname);
bdmInfo ("trying bdm server: %s\n", lname);
return remoteOpen (lname);
}
return -1;
}
bdm_driver_open = 1;
return fd;
}
return -1;
}
errno = bdm_open (port);
if (errno)
return -1;
bdm_dev_registered = 1;
return port;
}
int
ioperm_bdm_close (int fd)
{
if (bdm_driver_open)
{
bdm_driver_open = 0;
return driver_close (fd);
}
bdm_close (fd);
bdm_cleanup_module (fd);
return 0;
}
unsigned long
ioperm_bdm_read (int fd, char *buf, unsigned long count)
{
if (bdm_driver_open)
return driver_read (fd, buf, count);
errno = bdm_read (fd, buf, count);
if (errno)
return -1;
return count;
}
unsigned long
ioperm_bdm_write (int fd, char *buf, unsigned long count)
{
if (bdm_driver_open)
return driver_write (fd, buf, count);
errno = bdm_write (fd, buf, count);
if (errno)
return -1;
return count;
}
int
ioperm_bdm_ioctl (int fd, unsigned int cmd, ...)
{
va_list args;
unsigned long *arg;
int iarg;
int err = 0;
va_start (args, cmd);
arg = va_arg (args, unsigned long *);
if (bdm_driver_open)
return driver_ioctl (fd, cmd, arg);
/*
* Pick up the argument
*/
if (!bdm_dev_registered) {
switch (cmd) {
case BDM_DEBUG:
err = os_copy_in ((void*) &iarg, (void*) arg, sizeof iarg);
break;
}
if (err)
return err;
if (debugLevel > 3)
bdmInfo ("ioperm_bdm_ioctl cmd:0x%08x\n", cmd);
switch (cmd) {
case BDM_DEBUG:
debugLevel = iarg;
break;
}
}
errno = bdm_ioctl (fd, cmd, (unsigned long) arg);
if (errno)
return -1;
return 0;
}

View File

@@ -0,0 +1,3 @@
*.cmd
bdm.ko
bdm.mod.c

View File

@@ -0,0 +1,14 @@
ifneq ($(KERNELRELEASE),)
obj-m := bdm.o
else
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
install:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install
endif

374
m68k/driver/linux-2.6/bdm.c Normal file
View File

@@ -0,0 +1,374 @@
/*
* Motorola Background Debug Mode Driver
* Copyright (C) 1995 W. Eric Norum
* Copyright (C) 1998 Chris Johns
*
* Based on:
* 1. `A Background Debug Mode Driver Package for Motorola's
* 16- and 32-Bit Microcontrollers', Scott Howard, Motorola
* Canada, 1993.
* 2. `Linux device driver for public domain BDM Interface',
* M. Schraut, Technische Universitaet Muenchen, Lehrstuhl
* fuer Prozessrechner, 1995.
*
* Extended to support the ColdFire BDM interface using the P&E
* module which comes with the EVB. Currently only tested with the
* 5206 (5V) device.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* W. Eric Norum
* Saskatchewan Accelerator Laboratory
* University of Saskatchewan
* 107 North Road
* Saskatoon, Saskatchewan, CANADA
* S7N 5C6
*
* eric@skatter.usask.ca
*
* Coldfire support by:
* Chris Johns
* Objective Design Systems
* 35 Cairo Street
* Cammeray, Sydney, 2062, Australia
*
* ccj@acm.org
*
* 22/10/1999 -- CCJ (ccj@acm.org)
* Move the linux specific parts into a separate directory
* and file.
*
* 17/05/2003 -- Bernardo Innocenti <bernie@develer.com>
* Port to kernel 2.5.x
*/
#define BDM_DEFAULT_DEBUG 0
#include <linux/autoconf.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/fs.h>
#include <linux/ioport.h>
#include <linux/in.h>
#include <linux/mm.h>
#include <linux/delay.h>
#include <asm/io.h>
#include <asm/segment.h>
#include <asm/uaccess.h>
#include <linux/errno.h>
#include <linux/kdev_t.h>
/*
************************************************************************
* UNIX driver support routines *
************************************************************************
*/
/*
* Delay for a while so target can keep up.
*/
static void
bdm_delay (int counter)
{
while (counter--) {
asm volatile ("nop");
}
}
/*
* Wait a longer while .
*/
static void
bdm_sleep (u_int time)
{
current->state = TASK_INTERRUPTIBLE;
schedule_timeout (time);
}
/*
************************************************************************
* OS worker functions. *
************************************************************************
*/
static int
os_claim_io_ports (char *name, unsigned int base, unsigned int num)
{
if (!request_region (base, 4, name))
return EBUSY;
return 0;
}
static int
os_release_io_ports (unsigned int base, unsigned int num)
{
release_region (base, 4);
return 0;
}
#define os_move_in os_copy_in
static int
os_copy_in (void *dst, void *src, int size)
{
if (copy_from_user (dst, src, size))
return EFAULT;
return 0;
}
#define os_move_out os_copy_out
static int
os_copy_out (void *dst, void *src, int size)
{
if (copy_to_user (dst, src, size))
return EFAULT;
return 0;
}
static void
os_lock_module (void)
{
/* FIXME: we should check for failure here! */
try_module_get(THIS_MODULE);
}
static void
os_unlock_module (void)
{
module_put(THIS_MODULE);
}
/*
************************************************************************
* Mapping to Linux kernel functions *
************************************************************************
*/
#define PRINTF printk
/*
************************************************************************
* Include the driver code *
************************************************************************
*/
#include "../bdm.c"
/*
************************************************************************
* Good old-fashioned UNIX driver entry points *
************************************************************************
*/
static int
linux_bdm_open (struct inode *inode, struct file *file)
{
return -bdm_open (iminor(inode));
}
/*
* The old Linux driver set the control port back to the value it
* had when the device was opened. This is good when the port is
* being shared between the BDM interface and a printer, but has
* the unfortunate side effect of freezing the target. This makes
* it inconvenient to use the debugger, or a downloader program,
* since the target freezes as soon as the debugger, or downloader,
* exits.
*/
static int
linux_bdm_release (struct inode *inode, struct file *file)
{
bdm_close (iminor(inode));
return 0;
}
static ssize_t
linux_bdm_read (struct file *file, char *buf, size_t count, loff_t *offp)
{
int err;
err = bdm_read (iminor(file->f_dentry->d_inode), buf, count);
if (err)
return -err;
return count;
}
static ssize_t
linux_bdm_write (struct file *file, const char *buf, size_t count, loff_t *offp)
{
int err;
err = bdm_write (iminor(file->f_dentry->d_inode), (char*) buf, count);
if (err)
return -err;
return count;
}
static int
linux_bdm_ioctl (struct inode *inode,
struct file *file,
unsigned int cmd,
unsigned long arg)
{
return -bdm_ioctl (iminor(inode), cmd, arg);
}
/*
* Driver entry points
*/
static struct file_operations bdm_fops;
static int bdm_dev_registered = 0;
static void linux_bdm_exit(void);
/*
* Hook driver into kernel
*/
static int __init
linux_bdm_init (void)
{
unsigned int minor;
printk ("bdm_init_module %d.%d, " __DATE__ ", " __TIME__ "\n",
BDM_DRV_VERSION >> 8, BDM_DRV_VERSION & 0xff);
/*
* Set up entry points
* This used to be done with a static initializer, but the layout
* of the structure seems to change substantially between kernel
* versions.
*/
memset (&bdm_fops, 0, sizeof bdm_fops);
bdm_fops.read = linux_bdm_read;
bdm_fops.write = linux_bdm_write;
bdm_fops.ioctl = linux_bdm_ioctl;
bdm_fops.open = linux_bdm_open;
bdm_fops.release = linux_bdm_release;
/*
* Register with kernel
*/
if (register_chrdev (BDM_MAJOR_NUMBER, "bdm", &bdm_fops)) {
printk ("Unable to get major number %d for BDM driver.\n", BDM_MAJOR_NUMBER);
return -EIO;
}
bdm_dev_registered = 1;
/*
* Set up port numbers
*/
for (minor = 0 ;
minor < (sizeof bdm_device_info / sizeof bdm_device_info[0]) ;
minor++) {
int port;
struct BDM *self = &bdm_device_info[minor];
/*
* First set the default debug level.
*/
self->debugFlag = BDM_DEFAULT_DEBUG;
/*
* Choose a port number
*/
switch (BDM_IFACE_MINOR (minor)) {
case 0: port = 0x378; break; /* LPT1 */
case 1: port = 0x278; break; /* LPT2 */
case 2: port = 0x3bc; break; /* LPT3 */
case 3: port = 0x9400; break; /* PCI parallel port card (bernie) */
default:
printk ("BDM driver has no address for LPT%d.\n", BDM_IFACE_MINOR (minor) + 1);
linux_bdm_exit();
return -EIO;
}
/*
* See if the port exists
*/
self->exists = 1;
outb (0x00, port);
udelay (50);
if (inb (port) != 0x00) {
self->exists = 0;
if (self->debugFlag)
printk ("BDM driver cannot detect LPT%d.\n", BDM_IFACE_MINOR (minor) + 1);
continue;
}
sprintf (self->name, "bdm%d", minor);
self->portBase = self->dataPort = port;
self->statusPort = port + 1;
self->controlPort = port + 2;
self->delayTimer = 0;
switch (BDM_IFACE (minor)) {
case BDM_CPU32_PD: cpu32_pd_init_self (self); break;
case BDM_CPU32_ICD: cpu32_icd_init_self (self); break;
case BDM_COLDFIRE_PE: cf_pe_init_self (self); break;
default:
printk ("BDM driver has no interface for minor number\n");
cleanup_module();
return -EIO;
}
}
return 0;
}
/*
* Unhook module from kernel
*/
static void __exit
linux_bdm_exit (void)
{
unsigned int minor;
for (minor = 0 ;
minor < (sizeof bdm_device_info / sizeof bdm_device_info[0]) ;
minor++) {
struct BDM *self = &bdm_device_info[minor];
if (self->exists && self->portsAreMine)
release_region (self->portBase, 4);
}
if (bdm_dev_registered) {
bdm_dev_registered = 0;
if (unregister_chrdev (BDM_MAJOR_NUMBER, "bdm"))
printk ("Unable to unregister BDM driver.\n");
else
printk ("BDM driver unregistered.\n");
}
}
module_init(linux_bdm_init);
module_exit(linux_bdm_exit);
MODULE_LICENSE("GPL");

View File

@@ -0,0 +1,83 @@
2001-04-25 Chris Johns <cjohns@cybertec.com.au>
* linux-bdm.c: Still need the config modules check.
* Makefile: Do not force module versions on. Detect it now.
* linux-bdm.c:
Use config.h (autoconfig.h) to detect if module version numbers are
enabled. On RH7.0 you still get warnings.
2001-04-22 Chris Johns <cjohns@cybertec.com.au>
* Makefile: Changed to better support RH7.0 systems.
2001-02-03 Chris Johns <cjohns@cybertec.com.au>
* linux-bdm.c: Changed to support the new memory move interface.
2000-09-03 Chris Johns <ccj@acm.org>
* linux-bdm.c: Fixed the ICD spelling.
22000-08-03 Chris Johns <ccj@acm.org>
* linux-bdm.c:
Merged a patch from Frank Haverkamp <haver@ibr.cs.tu-bs.de> which
makes the driver more robust in the face of kernel data
structure changes.
2000-06-27 Chris Johns <ccj@acm.org>
* Makefile: Use a full path to depmod as `/sbin' may not be in root's
path when doing an install.
2000-05-31 Chris Johns <ccj@acm.org>
* Makefile:
Added the system include path incase another gcc is installed.
Removed the PST define. It is automatic now.
* linux-bdm.c: Support for the IDC interface.
2000-03-30 Chris Johns <ccj@acm.org>
* Makefile: Added the USE_PST support. Moved to clean OS structure.
* linux-bdm.c: New file.
1999-05-25 eric <>
* Makefile:
It seems that depmod complains about unresolved symbols even
when the driver loads and works properly. I don't know what's
changed in Linux to cause this, but for now just get rid of
the depmod.
1998-12-12 Chris Johns <ccj@acm.org>
* Makefile: Fixed the modversions.
1998-10-31 Chris Johns <ccj@acm.org>
* Makefile: Always over-write the installed header and lib.
1998-10-14 Chris Johns <ccj@acm.org>
* Makefile: Changed the prefix to the default of /usr.
1997-11-01 eric <>
* Makefile: Fit into RTEMS distribution.
1997-02-08 eric <>
* Makefile: Add a single `prefix'.
Make directories if necessary when installing.
1997-02-07 eric <>
* Makefile: Add module installation to install target.
* Makefile: New file.

102
m68k/driver/linux/Makefile Normal file
View File

@@ -0,0 +1,102 @@
#*******************************************************************
# Motorola m68k BDM Driver for Linux Kernel and GNU Debugger
#
# Makefile-mod - Makefile for regular compilation
# through Linux kernel rules
#
# This file must be renamed or linked to Makefile
#
# (C) Copyright 1999 by Pavel Pisa
#
# The BDM driver is distributed under the Gnu General Public Licence.
# See file COPYING for details.
#*******************************************************************/
# Use "make MODULE_NAME=foobar" if you want to give the driver module
# a different name. This might be useful if you want to install both,
# Chris's and Pavel's drivers at the same machine.
DEFAULT_MODULE_NAME=m68k-bdm
MODULE_NAME=$(DEFAULT_MODULE_NAME)
ifneq ($(MODULE_NAME),linux-bdm)
CLEAN_MODULE_TEMP=rm -f $(MODULE_NAME).c
endif
# currently running kernel
CURRENT=$(shell uname -r)
KERNEL_NEW=$(shell if [ -d /lib/modules/$(CURRENT)/build ] ; \
then echo yes ; else echo no ; fi )
# Where to look for kernel
#KERNEL_LOCATION=/usr/src/linux
#KERNEL_LOCATION=/usr/src/kernel/$(CURRENT)
#KERNEL_LOCATION=/lib/modules/$(CURRENT)/build
#KERNEL_LOCATION=/usr/src/linux-2.2.19
#KERNEL_LOCATION=/usr/src/linux-2.5.60
ifndef KERNEL_LOCATION
ifeq ($(KERNEL_NEW),yes)
KERNEL_LOCATION=/lib/modules/$(CURRENT)/build
MODULE_CHAR_LOC=/lib/modules/$(CURRENT)/kernel/drivers/char
else
KERNEL_LOCATION=/usr/src/linux
MODULE_CHAR_LOC=/lib/modules/$(CURRENT)/misc
endif
endif
# Test for latest 2.5.xx and future 2.6.xx kernels
KERNEL_VERSION := $(shell awk -F\" '/REL/ {print $$2}' \
$(KERNEL_LOCATION)/include/linux/version.h | awk -F\- '{print $$1}')
KERNEL_MODULE_V26 := $(shell echo $(KERNEL_VERSION) \
| sed -n 's/^.*2\.[5-9]\..*$$/yes/p')
# Target object file if any
O_TARGET :=
# Regular object files
O_OBJS = $(MODULE_NAME).o
# Objects with exported symbols (-DEXPORT_SYMTAB)
OX_OBJS =
# Module objects
M_OBJS = $(O_OBJS)
# Module only objects with exported symbols (-DEXPORT_SYMTAB)
MX_OBJS =
# Kernel only objects
L_OBJS =
# Kernel only objects with exported symbols (-DEXPORT_SYMTAB)
LX_OBJS =
# Additional CFLAGS
EXTRA_CFLAGS =
# Linux 2.4.2 build system needs next
obj-m += $(O_OBJS)
ifndef KERNEL_MODULE_V26
FINAL_MODULE_OBJS=$(obj-m)
else
FINAL_MODULE_OBJS=$(obj-m:%.o=%.ko)
endif
all : make_this_module
install : install_this_module
$(MODULE_NAME).c: linux-bdm.c ../bdm.c ../bdm.h
cp $< $@
make_this_module: $(MODULE_NAME).c
DIR=`pwd`; (cd $(KERNEL_LOCATION); make SUBDIRS=$$DIR modules)
$(CLEAN_MODULE_TEMP)
install_this_module: make_this_module
su -c "mkdir -v -p $(MODULE_CHAR_LOC) && cp -v $(FINAL_MODULE_OBJS) $(MODULE_CHAR_LOC)"
$(CLEAN_MODULE_TEMP)
clean:
rm -f $(M_OBJS) $(MX_OBJS) *.ko .*.o.flags .*.o.cmd .*.ko.cmd .depend *~
ifndef KERNEL_MODULE_V26
export TOPDIR=$(KERNEL_LOCATION)
include $(KERNEL_LOCATION)/Rules.make
endif

View File

@@ -0,0 +1,441 @@
/*
* Motorola Background Debug Mode Driver
* Copyright (C) 1995 W. Eric Norum
* Copyright (C) 1998 Chris Johns
*
* Based on:
* 1. `A Background Debug Mode Driver Package for Motorola's
* 16- and 32-Bit Microcontrollers', Scott Howard, Motorola
* Canada, 1993.
* 2. `Linux device driver for public domain BDM Interface',
* M. Schraut, Technische Universitaet Muenchen, Lehrstuhl
* fuer Prozessrechner, 1995.
*
* Extended to support the ColdFire BDM interface using the P&E
* module which comes with the EVB. Currently only tested with the
* 5206 (5V) device.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* W. Eric Norum
* Saskatchewan Accelerator Laboratory
* University of Saskatchewan
* 107 North Road
* Saskatoon, Saskatchewan, CANADA
* S7N 5C6
*
* eric@skatter.usask.ca
*
* Coldfire support by:
* Chris Johns
* Objective Design Systems
* 35 Cairo Street
* Cammeray, Sydney, 2062, Australia
*
* ccj@acm.org
*
* 22/10/1999 -- CCJ (ccj@acm.org)
* Move the linux specific parts into a separate directory
* and file.
*/
#define BDM_DEFAULT_DEBUG 0
#include <linux/config.h>
#if CONFIG_MODVERSIONS
#define MODVERSIONS
#include <linux/modversions.h>
#endif
#include <linux/module.h>
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/fs.h>
#include <linux/ioport.h>
#include <linux/in.h>
#include <linux/mm.h>
#include <linux/delay.h>
#include <asm/io.h>
#include <asm/segment.h>
#if (LINUX_VERSION_CODE > 131336)
#include <asm/uaccess.h>
#endif /* LINUX_VERSION_CODE */
#include <linux/errno.h>
/*
************************************************************************
* UNIX driver support routines *
************************************************************************
*/
/*
* Delay for a while so target can keep up.
*/
static void
bdm_delay (int counter)
{
while (counter--) {
asm volatile ("nop");
}
}
/*
* Wait a longer while .
*/
static void
bdm_sleep (u_int time)
{
current->state = TASK_INTERRUPTIBLE;
#if (LINUX_VERSION_CODE > 0x020101) /* 2.1.1 ?? */
schedule_timeout (time);
#else
current->timeout = jiffies + time;
schedule ();
#endif
}
/*
************************************************************************
* Some Linux driver compatability code - for older kernels *
************************************************************************
*/
#if (LINUX_VERSION_CODE < 131336)
static int copy_from_user (void *to, const void *from_user, unsigned long len)
{
int error;
error = verify_area (VERIFY_READ, from_user, len);
if (error)
return len;
memcpy_fromfs (to, from_user, len);
return 0;
}
static int copy_to_user (void *to_user, const void *from, unsigned long len)
{
int error;
error = verify_area (VERIFY_WRITE, to_user, len);
if (error)
return len;
memcpy_tofs (to_user, from, len);
return 0;
}
#endif /* LINUX_VERSION_CODE */
/*
************************************************************************
* OS worker functions. *
************************************************************************
*/
static int
os_claim_io_ports (char *name, unsigned int base, unsigned int num)
{
if (check_region (base, 4))
return EBUSY;
request_region (base, 4, name);
return 0;
}
static int
os_release_io_ports (unsigned int base, unsigned int num)
{
release_region (base, 4);
return 0;
}
#define os_move_in os_copy_in
static int
os_copy_in (void *dst, void *src, int size)
{
if (copy_from_user (dst, src, size))
return EFAULT;
return 0;
}
#define os_move_out os_copy_out
static int
os_copy_out (void *dst, void *src, int size)
{
if (copy_to_user (dst, src, size))
return EFAULT;
return 0;
}
static void
os_lock_module (void)
{
MOD_INC_USE_COUNT;
}
static void
os_unlock_module (void)
{
MOD_DEC_USE_COUNT;
}
/*
************************************************************************
* Mapping to Linux kernel functions *
************************************************************************
*/
#define PRINTF printk
/*
************************************************************************
* Include the driver code *
************************************************************************
*/
#include "../bdm.c"
/*
************************************************************************
* Good old-fashioned UNIX driver entry points *
************************************************************************
*/
static int
linux_bdm_open (struct inode *inode, struct file *file)
{
return -bdm_open (MINOR (inode->i_rdev));
}
/*
* The old Linux driver set the control port back to the value it
* had when the device was opened. This is good when the port is
* being shared between the BDM interface and a printer, but has
* the unfortunate side effect of freezing the target. This makes
* it inconvenient to use the debugger, or a downloader program,
* since the target freezes as soon as the debugger, or downloader,
* exits.
*/
#if (LINUX_VERSION_CODE > 0x020101) /* 2.1.1 ?? */
static int
linux_bdm_release (struct inode *inode, struct file *file)
#else
static void
linux_bdm_release (struct inode *inode, struct file *file)
#endif
{
bdm_close (MINOR (inode->i_rdev));
#if (LINUX_VERSION_CODE > 0x020101) /* 2.1.1 ?? */
return 0;
#endif
}
#if (LINUX_VERSION_CODE > 0x020101) /* 2.1.1 ?? */
static ssize_t
linux_bdm_read (struct file *file, char *buf, size_t count, loff_t *offp)
#else
static int
linux_bdm_read (struct inode *inode, struct file *file, char *buf, int count)
#endif
{
unsigned int minor;
int err;
#if (LINUX_VERSION_CODE > 0x020101) /* 2.1.1 ?? */
minor = MINOR (file->f_dentry->d_inode->i_rdev);
#else
minor = MINOR (inode->i_rdev);
#endif
err = bdm_read (minor, buf, count);
if (err)
return -err;
return count;
}
#if (LINUX_VERSION_CODE > 0x020101) /* 2.1.1 ?? */
static ssize_t
linux_bdm_write (struct file *file, const char *buf, size_t count, loff_t *offp)
#else
static int
linux_bdm_write (struct inode *inode, struct file *file, const char *buf, int count)
#endif
{
unsigned int minor;
int err;
#if (LINUX_VERSION_CODE > 0x020101) /* 2.1.1 ?? */
minor = MINOR (file->f_dentry->d_inode->i_rdev);
#else
minor = MINOR (inode->i_rdev);
#endif
err = bdm_write (minor, (char*) buf, count);
if (err)
return -err;
return count;
}
static int
linux_bdm_ioctl (struct inode *inode,
struct file *file,
unsigned int cmd,
unsigned long arg)
{
return -bdm_ioctl (MINOR (inode->i_rdev), cmd, arg);
}
/*
* Driver entry points
*/
static struct file_operations bdm_fops;
static int bdm_dev_registered = 0;
void cleanup_module (void);
/*
* Hook driver into kernel
*/
int
init_module (void)
{
unsigned int minor;
printk ("bdm_init_module %d.%d, " __DATE__ ", " __TIME__ "\n",
BDM_DRV_VERSION >> 8, BDM_DRV_VERSION & 0xff);
/*
* Set up entry points
* This used to be done with a static initializer, but the layout
* of the structure seems to change substantially between kernel
* versions.
*/
memset (&bdm_fops, 0, sizeof bdm_fops);
bdm_fops.read = linux_bdm_read;
bdm_fops.write = linux_bdm_write;
bdm_fops.ioctl = linux_bdm_ioctl;
bdm_fops.open = linux_bdm_open;
bdm_fops.release = linux_bdm_release;
/*
* Register with kernel
*/
if (register_chrdev (BDM_MAJOR_NUMBER, "bdm", &bdm_fops)) {
printk ("Unable to get major number %d for BDM driver.\n", BDM_MAJOR_NUMBER);
return -EIO;
}
bdm_dev_registered = 1;
/*
* Set up port numbers
*/
for (minor = 0 ;
minor < (sizeof bdm_device_info / sizeof bdm_device_info[0]) ;
minor++) {
int port;
struct BDM *self = &bdm_device_info[minor];
/*
* First set the default debug level.
*/
self->debugFlag = BDM_DEFAULT_DEBUG;
/*
* Choose a port number
*/
switch (BDM_IFACE_MINOR (minor)) {
case 0: port = 0x378; break; /* LPT1 */
case 1: port = 0x278; break; /* LPT2 */
case 2: port = 0x3bc; break; /* LPT3 */
case 3: port = 0x2bc; break; /* LPT4, ccj - made this up :-) */
default:
printk ("BDM driver has no address for LPT%d.\n", BDM_IFACE_MINOR (minor) + 1);
cleanup_module();
return -EIO;
}
/*
* See if the port exists
*/
self->exists = 1;
outb (0x00, port);
udelay (50);
if (inb (port) != 0x00) {
self->exists = 0;
if (self->debugFlag)
printk ("BDM driver cannot detect LPT%d.\n", BDM_IFACE_MINOR (minor) + 1);
continue;
}
sprintf (self->name, "bdm%d", minor);
self->portBase = self->dataPort = port;
self->statusPort = port + 1;
self->controlPort = port + 2;
self->delayTimer = 0;
switch (BDM_IFACE (minor)) {
case BDM_CPU32_PD: cpu32_pd_init_self (self); break;
case BDM_CPU32_ICD: cpu32_icd_init_self (self); break;
case BDM_COLDFIRE_PE: cf_pe_init_self (self); break;
default:
printk ("BDM driver has no interface for minor number\n");
cleanup_module();
return -EIO;
}
}
return 0;
}
/*
* Unhook module from kernel
*/
void
cleanup_module (void)
{
unsigned int minor;
for (minor = 0 ;
minor < (sizeof bdm_device_info / sizeof bdm_device_info[0]) ;
minor++) {
struct BDM *self = &bdm_device_info[minor];
if (self->exists && self->portsAreMine)
release_region (self->portBase, 4);
}
if (bdm_dev_registered) {
bdm_dev_registered = 0;
if (unregister_chrdev (BDM_MAJOR_NUMBER, "bdm"))
printk ("Unable to unregister BDM driver.\n");
else
printk ("BDM driver unregistered.\n");
}
}

View File

@@ -0,0 +1,9 @@
COMPILEHEADERS?=/var/obj/amd/kaben2/var/obj/NetBSD/1.6/src/sys/arch/i386/compile/GENERIC
KERNELHEADERS?=/projects/NetBSD/1.6/src/sys
openbsd-bdm.o: openbsd-bdm.c ../bdm.c
cc -O2 -D_KERNEL \
-I$(COMPILEHEADERS) -I$(KERNELHEADERS) -c openbsd-bdm.c
clean:
rm openbsd-bdm.o

View File

@@ -0,0 +1,58 @@
Motorola Background Debug Mode Driver for OpenBSD
The BDM driver is built as a OpenBSD loadable kernel module, not as
a driver that can be linked into the kernel. The BDM kernel module
is loaded and unloaded at runtime, with the modload and modunload
commands.
The BDM kernel module has been built and tested with OpenBSD 2.9,
the Coldfire processor and P&E Coldfire interface. The code is
a port of the current FreeBSD driver.
To build:
=========
- ensure kernel was builit with 'option LKM'
- ensure /etc/rc.securelevel securelevel=-1 to allow loading modules
- compile driver using following command
cc -O2 -D_KERNEL -I/sys -c openbsd-bdm.c
To install (as root):
=====================
- mkdir /usr/lkm
- cp openbsd-bdm.o /usr/lkm/.
- cp bdm-install.sh /usr/lkm/.
- add the following to /etc/rc.securelevel (for auto load on startup)
if [ -r /usr/lkm/openbsd-bdm.o ]
then
echo -n ' openbsd-bdm'
/sbin/modload -o bdm.o -ebdm -p /usr/lkm/bdm-install.sh /usr/lkm/openbsd-bdm.o >/dev/null
fi
- add the following to /etc/rc.shutdown (for auto unload on shutdown)
if [ -r /usr/lkm/openbsd-bdm.o ]
then
/sbin/modunload -n bdm >/dev/null
fi
To load BDM kernel module:
==========================
- modload -o bdm.o -ebdm -p bdm-install.sh openbsd-bdm.o
To unload BDM kernel module:
============================
- modunload -n bdm
To build gdb5.0:
================
- apply gdb-bdm patches
- edit $GDBSRC/gdb/configure.host
- copy following netbsd line to add support for openbsd host
i[3456]86-*-netbsd*) ... to
i[3456]86-*-openbsd*) ...
- build gdb using standard configure/make all/make install

View File

@@ -0,0 +1,40 @@
#!/bin/sh
MAJOR=`modstat -n bdm | tail -1 | awk '{print $3}'`
if [ ! -c /dev/bdmcpu320 ]
then
mknod -m 666 /dev/bdmcpu320 c $MAJOR 0
fi
if [ ! -c /dev/bdmcpu321 ]
then
mknod -m 666 /dev/bdmcpu321 c $MAJOR 1
fi
if [ ! -c /dev/bdmcpu322 ]
then
mknod -m 666 /dev/bdmcpu322 c $MAJOR 2
fi
if [ ! -c /dev/bdmcf0 ]
then
mknod -m 666 /dev/bdmcf0 c $MAJOR 4
fi
if [ ! -c /dev/bdmcf1 ]
then
mknod -m 666 /dev/bdmcf1 c $MAJOR 5
fi
if [ ! -c /dev/bdmcf2 ]
then
mknod -m 666 /dev/bdmcf2 c $MAJOR 6
fi
if [ ! -c /dev/bdmidc0 ]
then
mknod -m 666 /dev/bdmidc0 c $MAJOR 8
fi
if [ ! -c /dev/bdmidc1 ]
then
mknod -m 666 /dev/bdmidc1 c $MAJOR 9
fi
if [ ! -c /dev/bdmidc2 ]
then
mknod -m 666 /dev/bdmidc2 c $MAJOR 10
fi
echo "created bdm devices, major number $MAJOR"
ls -l /dev/bdm*

View File

@@ -0,0 +1,443 @@
/*
* Motorola Background Debug Mode Driver
* Copyright (C) 2000 James Housley
* Copyright (C) 2000 Chris Johns
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* FreeBSD support by: (Started May 9, 2000)
* James Housley
* The Housleys dot Net
* 65 Frank's Lane
* Hanover, MA 02339, USA
*
* jim@thehousleys.net
*
* Chris Johns & Greg Tunnock
* Redfern Broadband Networks.
* Continued FreeBSD port, Sep 2000
* This porting effort has been made possible by Redfern Broadband
* Networks.
*
* ccj@acm.org
*
*/
#define BDM_DEFAULT_DEBUG 0
#include <sys/param.h>
#include <sys/fcntl.h>
#include <sys/systm.h>
#include <sys/ioctl.h>
#include <sys/exec.h>
#include <sys/conf.h>
#include <sys/lkm.h>
#include <sys/proc.h>
#include <sys/buf.h>
#include <sys/kernel.h>
#include <sys/uio.h>
#include <sys/syslog.h>
#include <uvm/uvm.h>
#include <uvm/uvm_param.h>
#include <uvm/uvm_pmap.h>
#include <sys/errno.h>
#include <sys/ioccom.h>
/*
************************************************************************
* OpenBSD Driver Structures *
************************************************************************
*/
#define UNIT(d) ((unsigned int)(minor(d) & 0x07))
/*
************************************************************************
* UNIX driver support routines *
************************************************************************
*/
/*
* Function prototypes.
*/
static int init_module (void);
static void os_lock_module (void);
static void os_unlock_module (void);
static int bdmprobe (void);
static void bdmattach (void);
static void bdmdetach (void);
static void bdm_outb (int port, int value);
/*
* Delay for a while so target can keep up.
*/
static void
bdm_delay (int counter)
{
while (counter--) {
__asm volatile ("nop");
}
}
/*
* Wait a longer while .
*/
static char BDMsleep;
static void
bdm_sleep (u_int time)
{
tsleep((void *)&BDMsleep, ((PZERO + 8)| PCATCH), "bdmslp", (int)time);
}
/*
************************************************************************
* OS worker functions. *
************************************************************************
*/
static int
os_claim_io_ports (char *name, unsigned int base, unsigned int num)
{
return 0;
}
static int
os_release_io_ports (unsigned int base, unsigned int num)
{
return 0;
}
static int
os_copy_in (void *dst, void *src, int size)
{
(void)memcpy(dst, src, (size_t)size);
return 0;
}
static int
os_copy_out (void *dst, void *src, int size)
{
(void)memcpy(dst, src, (size_t)size);
return 0;
}
/**
* Moves data from user-space address to kernel-space address.
*
* This is provide for Operating Systems with separate move and copy
* strategies. If an OS doesn't have a move strategy this function will
* be the same as os_copy_in().
*
* Param dst Kernel-space address to copy to.
* Param src User-space address to copy from.
* Param size Number of bytes to copy.
*
* Returns 0 if successful.
*/
static int
os_move_in (void *dst, void *src, int size)
{
return uiomove((caddr_t)dst, size, (struct uio *)src);
}
#define BUF_INCREMENTED_BY_MOVE_IN
/**
* Moves data from kernel-space address to user-space address.
*
* This is provide for Operating Systems with separate move and copy
* strategies. If an OS doesn't have a move strategy this function will
* be the same as os_copy_out().
*
* Param dst User-space address to copy to.
* Param src Kernel-space address to copy from.
* Param size Number of bytes to copy.
*
* Returns 0 if successful.
*/
static int
os_move_out (void *dst, void *src, int size)
{
return uiomove((caddr_t)src, size, (struct uio *)dst);
}
#define BUF_INCREMENTED_BY_MOVE_OUT
static void
os_lock_module ()
{
}
static void
os_unlock_module ()
{
}
/*
* Big hack to get around differences in outb
*/
static void
bdm_outb (int port, int value)
{
outb (port, value);
}
#undef outb
#define outb(value, port) bdm_outb (port, value)
/*
************************************************************************
* Mappings to OpenBSD *
************************************************************************
*/
#define PRINTF printf
#define udelay(x) DELAY (x)
#define MINOR(x) minor (x)
#define HZ hz
/*
************************************************************************
* Include the driver code *
************************************************************************
*/
#include "../bdm.c"
/*
************************************************************************
* Good old-fashioned UNIX driver entry points *
************************************************************************
*/
static int
openbsd_bdm_open (dev_t dev, int flags, int fmt, struct proc *p)
{
return bdm_open (MINOR (dev));
}
static int
openbsd_bdm_close (dev_t dev, int fflag, int devtype, struct proc *p)
{
return bdm_close (MINOR (dev));
}
static int
openbsd_bdm_read (dev_t dev, struct uio *uio, int flag)
{
return bdm_read (MINOR (dev), (char *)uio, uio->uio_resid);
}
static int
openbsd_bdm_write (dev_t dev, struct uio * uio, int ioflag)
{
return bdm_write (MINOR (dev), (char *)uio, uio->uio_resid);
}
static int
openbsd_bdm_ioctl (dev_t dev, u_long cmd, caddr_t arg, int flag, struct proc *p)
{
return bdm_ioctl (MINOR (dev), cmd, (unsigned long)arg);
}
/*
* Driver entry points
*/
static int bdm_dev_registered = 0;
void cleanup_module (void);
/*
* Hook driver into kernel
*/
static int
init_module ()
{
int minor;
PRINTF ("bdm_init_module %d.%d, " __DATE__ ", " __TIME__ "\n",
BDM_DRV_VERSION >> 8, BDM_DRV_VERSION & 0xff);
bdm_dev_registered = 1;
/*
* Set up port numbers
*/
for (minor = 0 ;
minor < (sizeof bdm_device_info / sizeof bdm_device_info[0]) ;
minor++) {
int port;
struct BDM *self = &bdm_device_info[minor];
/*
* First set the default debug level.
*/
self->debugFlag = BDM_DEFAULT_DEBUG;
/*
* Choose a port number
*/
switch (BDM_IFACE_MINOR (minor)) {
case 0: port = 0x378; break; /* LPT1 */
case 1: port = 0x278; break; /* LPT2 */
case 2: port = 0x3bc; break; /* LPT3 */
case 3: port = 0x2bc; break; /* LPT4, ccj - made this up :-) */
default:
PRINTF ("BDM driver has no address for LPT%d.\n", BDM_IFACE_MINOR (minor) + 1);
cleanup_module ();
return EIO;
}
/*
* See if the port exists
*/
self->exists = 1;
outb (0x00, port);
bdm_delay (50);
if (inb (port) != 0x00) {
self->exists = 0;
if (self->debugFlag)
PRINTF ("BDM driver cannot detect LPT%d.\n", BDM_IFACE_MINOR (minor) + 1);
continue;
}
sprintf (self->name, "bdm%d", minor);
self->portBase = self->dataPort = port;
self->statusPort = port + 1;
self->controlPort = port + 2;
self->delayTimer = 0;
switch (BDM_IFACE (minor)) {
case BDM_CPU32_PD: cpu32_pd_init_self (self); break;
case BDM_CPU32_ICD: cpu32_icd_init_self (self); break;
case BDM_COLDFIRE_PE: cf_pe_init_self (self); break;
default:
PRINTF ("BDM driver has no interface for minor number\n");
cleanup_module ();
return EIO;
}
}
return 0;
}
/*
* Unhook module from kernel
*/
void
cleanup_module (void)
{
int minor;
for (minor = 0 ;
minor < (sizeof bdm_device_info / sizeof bdm_device_info[0]) ;
minor++) {
struct BDM *self = &bdm_device_info[minor];
if (self->exists && self->portsAreMine)
;
}
if (bdm_dev_registered) {
bdm_dev_registered = 0;
PRINTF ("BDM driver unregistered.\n");
}
}
static struct cdevsw openbsd_devsw =
{
openbsd_bdm_open, /* open */
openbsd_bdm_close, /* close */
openbsd_bdm_read, /* read */
openbsd_bdm_write, /* write */
openbsd_bdm_ioctl, /* ioctl */
(void *)nullop, /* stop */
(void *)NULL, /* tty */
(void *)nullop, /* select */
(void *)nullop, /* mmap */
NULL /* strategy */
};
MOD_DEV("bdm", LM_DT_CHAR, BDM_MAJOR_NUMBER, &openbsd_devsw)
static int
bdmprobe ()
{
/* For now, always report the BDM driver is able to drive the BDM hardware. */
return 0;
}
static int
bdm_load(void)
{
int err;
PRINTF("BDM init_module\n %s\n %s\n %s\n",
"$RCSfile: openbsd-bdm.c,v $", "$Revision: 1.1 $", "$Date: 2004/04/18 16:51:21 $");
PRINTF(" Version %s\n Compiled at %s %s\n",
"PD-interface",
__DATE__, __TIME__);
err = bdmprobe ();
if (err) {
PRINTF ("BDM driver: probe failed\n");
return err;
}
err = init_module();
if (err) {
PRINTF ("BDM driver: load failed\n");
return err;
}
PRINTF ("BDM driver: loaded\n");
return 0;
}
static int
bdm_unload(void)
{
PRINTF ("BDM driver: unloaded\n");
return 0;
}
static int
bdm_handler(struct lkm_table *lkmtp, int cmd)
{
int iStatus = 0;
struct lkm_dev *args = lkmtp->private.lkm_dev;
switch ( cmd ) {
case LKM_E_LOAD:
iStatus = bdm_load();
break;
case LKM_E_UNLOAD:
iStatus = bdm_unload();
break;
}
return ( iStatus );
}
int bdm(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, bdm_handler, lkm_nofunc, lkm_nofunc);
}

20
m68k/driver/sco/Makefile Normal file
View File

@@ -0,0 +1,20 @@
CFLAGS= -DSCO -D_INKERNEL=1 -DUSE_PST=1 -I..
DRIVER= bdm
all: Driver.o
Driver.o: ../bdm.h ../bdm.c sco.c
$(CC) $(CFLAGS) -c -o Driver.o sco.c
install: Driver.o
if /etc/conf/bin/idcheck -p $(DRIVER); \
then \
/etc/conf/bin/idinstall -k -a $(DRIVER); \
else \
/etc/conf/bin/idinstall -k -u $(DRIVER); \
fi
clean:
rm -f Driver.o

1
m68k/driver/sco/Master Normal file
View File

@@ -0,0 +1 @@
bdm Iocirw Hci bdm 0 0 0 4 -1

8
m68k/driver/sco/Node Normal file
View File

@@ -0,0 +1,8 @@
bdm bdmcp0 c 0
bdm bdmcp1 c 1
bdm bdmcp2 c 2
bdm bdmcp3 c 3
bdm bdmcf0 c 4
bdm bdmcf1 c 5
bdm bdmcf2 c 6
bdm bdmcf3 c 7

51
m68k/driver/sco/README Normal file
View File

@@ -0,0 +1,51 @@
How to use the SCO BDM driver
-----------------------------
1. Type "make" to build the driver. I have only tested it when compiled
with the SCO compiler. It does compile with "gcc", so you may be in
luck if thats the path taht you follow.
2. Edit "System" and set the entry that corresponds to your parallel port
to 'Y'.
3. Login as root and type "make install". This will put the driver into
the kernel.
4. Re-build the kernel by running "/etc/conf/bin/idbuild -y" as root, and
the reboot to activate the driver.
5. Build yourself a GDB with BDM support (documented somewhere else :-)
6. Run gdb on the executable you want to debug. At the prompt turn on BDM
with "target bdm /dev/XXXX". The driver automatically installs all the
possible devices in /dev:
/dev/bdmcp0 - CPU32 on LP0
/dev/bdmcp1 - CPU32 on LP1
/dev/bdmcp2 - CPU32 on LP2
/dev/bdmcp3 - CPU32 on LP3
/dev/bdmcf0 - Coldfire on LP0
/dev/bdmcf1 - Coldfire on LP1
/dev/bdmcf2 - Coldfire on LP2
/dev/bdmcf3 - Coldfire on LP3
7. Happy debugging.
Compiling the rest of the tree
------------------------------
1. The Makfile in the lib directory needs the ranlib removed and some
other options like -Wall taken out for the SCO compiler.
2. The Makefile in the test directory needs the "-lbfd -liberty" taken
out.
3. If you do want to use parts of the library that require the BFD library
then you will have to work through that on your own :-)
Copyright (C) 1999 David McCullough (davidm@stallion.oz.au)

36
m68k/driver/sco/Space.c Normal file
View File

@@ -0,0 +1,36 @@
/****************************************************************************/
/*
* Do all our LP setup through the standard System/Sdevice setup
*/
/****************************************************************************/
#include "config.h"
/****************************************************************************/
unsigned int bdm_ports[] = {
#ifdef BDM_0
BDM_0_SIOA,
#else
-1,
#endif
#ifdef BDM_1
BDM_1_SIOA,
#else
-1,
#endif
#ifdef BDM_2
BDM_2_SIOA,
#else
-1,
#endif
#ifdef BDM_3
BDM_3_SIOA,
#else
-1,
#endif
};
int bdm_debug_level = 0;
/****************************************************************************/

4
m68k/driver/sco/System Normal file
View File

@@ -0,0 +1,4 @@
bdm Y 0 0 0 0 378 37b 0 0
bdm N 1 0 0 0 278 27b 0 0
bdm N 2 0 0 0 3bc 3bf 0 0
bdm N 3 0 0 0 2bc 2bf 0 0

276
m68k/driver/sco/sco.c Normal file
View File

@@ -0,0 +1,276 @@
/****************************************************************************/
/*
* Motorola Background Debug Mode Driver for SCO based on the linux one
* which it needs to compile.
*
* Copyright (C) 1999 David McCullough (davidm@stallion.oz.au)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* 22/10/1999 -- CCJ (ccj@acm.org)
* Altered to match the split driver code.
*
*/
#define BDM_DEFAULT_DEBUG 0
#include <sys/param.h>
#include <sys/types.h>
#include <sys/immu.h>
#include <sys/dir.h>
#include <sys/user.h>
#include <sys/sysmacros.h>
#include <sys/errno.h>
#include <sys/conf.h>
#include "bdm.h"
/****************************************************************************
* UNIX driver support routines *
****************************************************************************/
/*
* Big hack to get around differences in outb under SCO
*/
void
bdm_outb (int port, int value)
{
outb (port, value);
}
#define outb(value, port) bdm_outb (port, value)
/****************************************************************************
* Other tings we need to compile *
****************************************************************************/
#define PRINTF printf
#define udelay(x) bdm_delay (x)
#define MINOR(x) minor (x)
/****************************************************************************
* Delay for a while so target can keep up. *
****************************************************************************/
static void
bdm_delay (int counter)
{
while (counter--)
__asm ("nop");
}
/****************************************************************************
* Wait a longer while. This function sleeps *
****************************************************************************/
static void
bdm_sleep (u_int time)
{
delay(time);
}
/****************************************************************************
* OS worker functions. *
****************************************************************************/
static int
os_claim_io_ports (unsigned int base, unsigned int num)
{
return 0;
}
static int
os_release_io_ports (unsigned int base, unsigned int num)
{
return 0;
}
static int
os_copy_in (void *dst, void *src, int size)
{
if (copyin (src, dst, size) < 0)
return EFAULT;
return 0;
}
static int
os_copy_out (void *dst, void *src, int size)
{
if (copyout (src, dst, size) < 0)
return EFAULT;
return 0;
}
static void
os_lock_module ()
{
}
static void
os_unlock_module ()
{
}
/****************************************************************************
* Include the BBM code *
****************************************************************************/
#include "bdm.c"
/****************************************************************************
* The real driver code starts here *
****************************************************************************/
int
bdminit ()
{
int minor, found;
static char hex_digit[] = "0123456789ABCDEF";
/*
* Set up port numbers
*/
found = 0;
for (minor = 0;
minor < (sizeof bdm_device_info / sizeof bdm_device_info[0]);
minor++) {
extern int bdm_ports[], bdm_debug_level; /* see Space.c */
int port, i;
struct BDM *self = &bdm_device_info[minor];
/*
* First set the default debug level. I use a variable
* here so I can set it with a debugger or just change
* space.c and rebuild the kernel.
*/
self->debugFlag = bdm_debug_level;
/*
* Choose a port number
*/
i = BDM_IFACE_MINOR (minor);
if (i >= 0 && i < 4)
port = bdm_ports[i];
else
port = -1;
if (port == -1) {
self->exists = 0;
continue;
}
/*
* See if the port exists
*/
self->exists = 1;
outb (0x00, port);
udelay (50);
if (inb (port) != 0x00) {
self->exists = -1;
if (self->debugFlag)
printk("BDM driver cannot detect device %d(addr=0x%x).\n",
BDM_IFACE_MINOR(minor), port);
}
bcopy ("bdm\0\0\0", self->name, 6);
self->name[4] = hex_digit[(minor & 0xf0) >> 4];
self->name[5] = hex_digit[minor & 0xf];
self->portBase = self->dataPort = port;
self->statusPort = port + 1;
self->controlPort = port + 2;
switch (BDM_IFACE (minor)) {
case BDM_CPU32_PD: cpu32_pd_init_self (self); break;
case BDM_CPU32_ICD: cpu32_icd_init_self (self); break;
case BDM_COLDFIRE_PE: cf_pe_init_self (self); break;
default:
self->exists = -2;
if (self->debugFlag)
printk("BDM driver has no interface for minor number %d\n",
minor);
break;
}
if (self->exists) {
printcfg("bdm", port, 4, -1, -1,
"%d minor=%d v%d.%d, " __DATE__ ", " __TIME__,
self->exists, minor,
BDM_DRV_VERSION >> 8, BDM_DRV_VERSION & 0xff);
found++;
if (self->exists < 0)
self->exists = 0;
}
}
if (!found)
printcfg("bdm", 0, 0, -1, -1,
"NO-PORTS v%d.%d, " __DATE__ ", " __TIME__,
BDM_DRV_VERSION >> 8, BDM_DRV_VERSION & 0xff);
return(0);
}
/******************************************************************************/
int
bdmopen (dev_t dev, int flag, int type)
{
u.u_error = bdm_open (MINOR(dev));
return 0;
}
/******************************************************************************/
int
bdmclose (dev_t dev, int flag, int type)
{
u.u_error = bdm_close (MINOR(dev));
return 0;
}
/******************************************************************************/
int
bdmioctl (dev_t dev, int cmd, int arg, int mode)
{
u.u_error = bdm_ioctl (MINOR(dev), cmd, arg);
return 0;
}
/******************************************************************************/
int
bdmread (dev_t dev)
{
u.u_error = bdm_read (MINOR (dev), u.u_base, u.u_count);
u.u_base += u.u_count;
u.u_count = 0;
return(0);
}
/******************************************************************************/
int
bdmwrite (dev_t dev)
{
u.u_error = bdm_write (MINOR (dev), u.u_base, u.u_count);
u.u_base += u.u_count;
u.u_count = 0;
return (0);
}
/******************************************************************************/

44
m68k/driver/win/ChangeLog Normal file
View File

@@ -0,0 +1,44 @@
2002-02-10 Chris Johns <cjohns@cybertec.com.au>
* win-bdm.c:
Do not provide a stat as it effects programs using stat, eg Insight.
2001-09-01 Chris Johns <cjohns@cybertec.com.au>
* win-bdm.c: Fixed the GiveIO patches to compile under Cygwin.
2001-04-15 Chris Johns <cjohns@cybertec.com.au>
* win9x-bdm.c:
Merged in the changes from Rick Haubenstricker <rickh@perceptron.com> to
support NT and the GiveIO driver. This file should be moved to win-bdm.c
and the lib makefile updated but it is a change that is not important.
2001-02-03 Chris Johns <ccj@acm.org>
* win9x-bdm.c:
Enabled support for TCP, so the driver supports remote connections.
2000-09-02 Chris Johns <ccj@acm.org>
* win9x-bdm.c:
Fixed cpu32 support. Patch from Howard Loewen <loewenhw@mb.sympatico.ca>.
22000-06-27 Chris Johns <ccj@acm.org>
* win9x-bdm.c: The usleep takes micro seconds and it was being given
milli seconds. Delays did not work.
2000-06-07 Chris Johns <ccj@acm.org>
* win9x-bdm.c:
Moved the open/close etc definitions to this file from the lib.
2000-05-31 Chris Johns <ccj@acm.org>
* win9x-bdm.c: Support for the IDC interface.
2000-05-27 Chris Johns <ccj@acm.org>
* win9x-io.h, win9x-bdm.c: New file.

535
m68k/driver/win/win-bdm.c Normal file
View File

@@ -0,0 +1,535 @@
/*
* Motorola Background Debug Mode Driver
* Copyright (C) 1998-2007 Chris Johns
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Windows support by:
* Chris Johns
* Contemporary Software
* chris@contemporary.net.au
*
* Michael Cooper
* Integrated Chipware
* 1861 Wiehle Ave.
* Reston, Virginia 20190, USA
* mikec@chipware.com
*
* Rick Haubenstricker
* Perceptron, Inc
* 47827 Halyard Dr
* Plymouth, Michigan 48170, USA
* rickh@perceptron.com
*
*/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <windows.h>
#include <win/win-io.h>
#define BDM_DEFAULT_DEBUG 0
static int debugLevel = BDM_DEFAULT_DEBUG;
/*
************************************************************************
* Override the C library function. *
************************************************************************
*/
int
win32_remote_close (int fd)
{
return close (fd);
}
int
win32_remote_read (int fd, char *buf, size_t count)
{
return read (fd, buf, count);
}
int
win32_remote_write (int fd, char *buf, size_t count)
{
return write (fd, buf, count);
}
int
stat (const char *file_name, struct stat *buf)
{
if (strncmp (file_name, "/dev/bdm", sizeof ("/dev/bdm") - 1) == 0 )
{
return 0 ;
}
else /* Check for real file */
{
int fd = open(file_name,O_RDONLY);
if ( fd > 0 )
{
int status = fstat(fd, buf);
close(fd);
return status;
}
else
{
return fd;
}
}
}
#define open win_bdm_open
#define close win_bdm_close
#define ioctl win_bdm_ioctl
#define read win_bdm_read
#define write win_bdm_write
/*
************************************************************************
* Windows driver support routines *
************************************************************************
*/
#define udelay usleep
#if !defined (__CYGWIN__)
#ifndef HZ
#define HZ 100
#endif
void
usleep(int usecs)
{
LARGE_INTEGER lpc;
LONGLONG lpc2;
LONGLONG current_usecs;
LONGLONG final_usecs;
static int first_time = 1;
static LARGE_INTEGER lpf;
static LONGLONG lpf2;
/*
* First time through, get frequency of high-resolution
* performance counter (value is counts per second)
*/
if (first_time) {
QueryPerformanceFrequency (&lpf);
lpf2 = *(LONGLONG *) &lpf;
first_time = 0;
}
/*
* Get current value of high-resolution performance counter
* (value in counts)
*/
QueryPerformanceCounter (&lpc);
lpc2 = *(LONGLONG *)&lpc;
/*
* Calculate desired final time in usecs
*/
final_usecs = ((lpc2 * (LONGLONG) 1000000) / lpf2) + (LONGLONG) usecs;
/*
* Loop until current count when converted to usecs is greater
* than final time
*/
do {
/*
* Get current value of high-resolution performance
* counter (value in counts)
*/
QueryPerformanceCounter (&lpc);
lpc2 = *(LONGLONG *) &lpc;
/*
* Calculate current time in usecs
*/
current_usecs = (lpc2 * (LONGLONG) 1000000 / lpf2);
}
while (current_usecs < final_usecs);
}
#endif
/*
* Delay for a while so target can keep up.
*/
void
bdm_delay (int counter)
{
while (counter--) {
#if defined (__GNUC__)
asm volatile ("nop");
#else
__asm nop
#endif
}
}
/*
* Delay specified number of milliseconds
*/
void
bdm_sleep (unsigned long time)
{
usleep (time * (1000 * (100 / HZ)));
}
/*
************************************************************************
* OS worker functions. *
************************************************************************
*/
int
os_claim_io_ports (char *name, unsigned int base, unsigned int num)
{
/*
* FIXME: Not sure what happens here. Dos Win9x how someelse has
* port through some sort of virtual device driver thingy ?
*/
return 0;
}
int
os_release_io_ports (unsigned int base, unsigned int num)
{
/*
* FIXME: See comment above.
*/
return 0;
}
#define os_move_in os_copy_in
int
os_copy_in (void *dst, void *src, int size)
{
/*
* We run in the application and talk directly to the hardware.
*/
memcpy (dst, src, size);
return 0;
}
#define os_move_out os_copy_out
int
os_copy_out (void *dst, void *src, int size)
{
memcpy (dst, src, size);
return 0;
}
void
os_lock_module ()
{
}
void
os_unlock_module ()
{
}
#ifdef interface
#undef interface
#endif
/*
************************************************************************
* Include the driver code *
************************************************************************
*/
#include "bdm.c"
/*
************************************************************************
* Good old-fashioned UNIX driver entry points *
************************************************************************
*/
static int bdm_dev_registered = 0;
/*
* Unhook module from kernel
*/
static void bdm_cleanup_module (void)
{
if (bdm_dev_registered) {
bdm_dev_registered = 0;
fprintf (stderr, "BDM driver unregistered.\n");
}
}
/*
* Basically just detect the port.
*/
int
win_bdm_init ()
{
int minor;
HANDLE h;
OSVERSIONINFO osvi;
BOOL bOsVersionInfoEx;
if (bdm_dev_registered)
return 0;
/*
* Determine which operating system in use, if NT or 2000,
* we need to enable the port.
*/
ZeroMemory (&osvi, sizeof(OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (!(bOsVersionInfoEx = GetVersionEx ((LPOSVERSIONINFO) &osvi))) {
/*
* If OSVERSIONINFOEX doesn't work, try OSVERSIONINFO.
*/
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
if (! GetVersionEx ((OSVERSIONINFO *) &osvi)) {
fprintf (stderr, "error: unsupported Windows version.\n");
errno = EIO;
return -1;
}
}
if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
/*
* Open access to parallel port using giveio
*/
h = CreateFile ("\\\\.\\giveio", GENERIC_READ, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (h == INVALID_HANDLE_VALUE) {
fprintf (stderr, "error: could not access the GiveIO device.\n");
errno = EIO;
return -1;
}
CloseHandle (h);
}
#ifdef BDM_VER_MESSAGE
fprintf (stderr, "bdm_init %d.%d, " __DATE__ ", " __TIME__ "\n",
BDM_DRV_VERSION >> 8, BDM_DRV_VERSION & 0xff);
#endif
/*
* Set up port numbers
*/
for (minor = 0 ;
minor < (sizeof(bdm_device_info) / sizeof(bdm_device_info[0])) ;
minor++) {
unsigned short port;
struct BDM *self = &bdm_device_info[minor];
/*
* First set the default debug level.
*/
self->debugFlag = BDM_DEFAULT_DEBUG;
/*
* Choose a port number
*/
switch (BDM_IFACE_MINOR (minor)) {
case 0: port = 0x378; break; /* LPT1 */
case 1: port = 0x278; break; /* LPT2 */
case 2: port = 0x3bc; break; /* LPT3 */
case 3: port = 0x2bc; break; /* LPT4, ccj - made this up :-) */
default:
fprintf (stderr, "BDM driver has no address for LPT%d.\n",
BDM_IFACE_MINOR (minor) + 1);
bdm_cleanup_module();
errno = EIO;
return -1;
}
/*
* See if the port exists
*/
self->exists = 1;
outb (0x00, port);
udelay (50);
if (inb (port) != 0x00) {
self->exists = 0;
if (self->debugFlag)
fprintf (stderr, "BDM driver cannot detect LPT%d.\n",
BDM_IFACE_MINOR (minor) + 1);
continue;
}
sprintf (self->name, "bdm%d", minor);
self->portBase = self->dataPort = port;
self->statusPort = port + 1;
self->controlPort = port + 2;
self->delayTimer = 0;
switch (BDM_IFACE (minor)) {
case BDM_CPU32_PD: cpu32_pd_init_self (self); break;
case BDM_CPU32_ICD: cpu32_icd_init_self (self); break;
case BDM_COLDFIRE_PE: cf_pe_init_self (self); break;
case BDM_COLDFIRE_TBLCF: break;
default:
fprintf (stderr, "BDM driver has no interface for minor number\n");
bdm_cleanup_module();
errno = EIO;
return -1;
}
}
bdm_dev_registered = 1;
return 0;
}
/*
* The device is a device name of the form /dev/bdmcpu320 or
* /dev/bdmcf0 where the /dev/bdm must be present
* the next field can be cpu32 or cf followed by
* a number which is the port.
*/
int
win_bdm_open (const char *device, int flags, ...)
{
int port = 0;
if (strncmp (device, "/dev/bdm", sizeof ("/dev/bdm") - 1) == 0)
{
if (win_bdm_init () < 0)
return -1;
device += sizeof ("/dev/bdm") - 1;
if (strncmp (device, "cpu32", 5) == 0)
{
port = 0;
device += 5; /* s.b. 5 */
}
/* Allow ICD access under cygwin */
else if (strncmp (device, "icd", 3) == 0)
{
port = 8;
device += 3;
}
else if (strncmp (device, "cf", 2) == 0)
{
port = 4;
device += 2;
}
else
{
errno = ENOENT;
return -1;
}
port += strtoul (device, 0, 0);
}
else
{
if (usb_bdm_init (device) < 0)
return -1;
}
errno = bdm_open (port);
if (errno)
return -1;
return port;
}
int
win_bdm_close (int fd)
{
bdm_close (fd);
return 0;
}
unsigned long
win_bdm_read (int fd, char *buf, unsigned long count)
{
errno = bdm_read (fd, buf, count);
if (errno)
return -1;
return count;
}
unsigned long
win_bdm_write (int fd, char *buf, unsigned long count)
{
errno = bdm_write (fd, buf, count);
if (errno)
return -1;
return count;
}
int
win_bdm_ioctl (int fd, unsigned int cmd, ...)
{
va_list args;
unsigned long *arg;
int iarg;
int err = 0;
va_start (args, cmd);
arg = va_arg (args, unsigned long *);
/*
* Pick up the argument
*/
if (!bdm_dev_registered) {
switch (cmd) {
case BDM_DEBUG:
err = os_copy_in ((void*) &iarg, (void*) arg, sizeof iarg);
break;
}
if (err)
return err;
if (debugLevel > 3)
fprintf (stderr, "win_bdm_ioctl cmd:0x%08x\n", cmd);
switch (cmd) {
case BDM_DEBUG:
debugLevel = iarg;
break;
}
}
errno = bdm_ioctl (fd, cmd, (unsigned long) arg);
if (errno)
return -1;
return 0;
}

103
m68k/driver/win/win-io.h Normal file
View File

@@ -0,0 +1,103 @@
#ifndef _ASM_IO_H
#define _ASM_IO_H
/*
* From the Linux kernel with the kernel section removed.
*/
/*
* This file contains the definitions for the x86 IO instructions
* inb/inw/inl/outb/outw/outl and the "string versions" of the same
* (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing"
* versions of the single-IO instructions (inb_p/inw_p/..).
*
* This file is not meant to be obfuscating: it's just complicated
* to (a) handle it all in a way that makes gcc able to optimize it
* as well as possible and (b) trying to avoid writing the same thing
* over and over again with slight variations and possibly making a
* mistake somewhere.
*/
/*
* Thanks to James van Artsdalen for a better timing-fix than
* the two short jumps: using outb's to a nonexistent port seems
* to guarantee better timings even on fast machines.
*
* On the other hand, I'd like to be sure of a non-existent port:
* I feel a bit unsafe about using 0x80 (should be safe, though)
*
* Linus
*/
/*
* Bit simplified and optimized by Jan Hubicka
*/
#ifdef SLOW_IO_BY_JUMPING
#define __SLOW_DOWN_IO "\njmp 1f\n1:\tjmp 1f\n1:"
#else
#define __SLOW_DOWN_IO "\noutb %%al,$0x80"
#endif
#ifdef REALLY_SLOW_IO
#define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO
#else
#define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO
#endif
/*
* Talk about misusing macros..
*/
#define __OUT1(s,x) \
extern inline void out##s(unsigned x value, unsigned short port) {
#define __OUT2(s,s1,s2) \
__asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1"
#define __OUT(s,s1,x) \
__OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "Nd" (port)); } \
__OUT1(s##_p,x) __OUT2(s,s1,"w") __FULL_SLOW_DOWN_IO : : "a" (value), "Nd" (port));} \
#define __IN1(s) \
extern inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v;
#define __IN2(s,s1,s2) \
__asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0"
#define __IN(s,s1,i...) \
__IN1(s) __IN2(s,s1,"w") : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \
__IN1(s##_p) __IN2(s,s1,"w") __FULL_SLOW_DOWN_IO : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \
#define __INS(s) \
extern inline void ins##s(unsigned short port, void * addr, unsigned long count) \
{ __asm__ __volatile__ ("cld ; rep ; ins" #s \
: "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
#define __OUTS(s) \
extern inline void outs##s(unsigned short port, const void * addr, unsigned long count) \
{ __asm__ __volatile__ ("cld ; rep ; outs" #s \
: "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
#define RETURN_TYPE unsigned char
__IN(b,"")
#undef RETURN_TYPE
#define RETURN_TYPE unsigned short
__IN(w,"")
#undef RETURN_TYPE
#define RETURN_TYPE unsigned int
__IN(l,"")
#undef RETURN_TYPE
__OUT(b,"b",char)
__OUT(w,"w",short)
__OUT(l,,int)
__INS(b)
__INS(w)
__INS(l)
__OUTS(b)
__OUTS(w)
__OUTS(l)
#endif

4
m68k/flashlib/.cvsignore Normal file
View File

@@ -0,0 +1,4 @@
.deps
Makefile
Makefile.in
libbdmflash.a

109
m68k/flashlib/Makefile.am Normal file
View File

@@ -0,0 +1,109 @@
##
## $Id: Makefile.am,v 1.10 2008/09/09 11:48:50 cjohns Exp $
##
## This file is part of a free BDM package
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
AM_CPPFLAGS = -I$(srcdir)/../libelf/lib -I../libelf/lib \
-I$(srcdir)/../driver -I$(srcdir)/../lib \
-DPREFIX="$(prefix)"
lib_LIBRARIES = libbdmflash.a
include_HEADERS = \
bdmfilt.h \
bdmflash.h \
flash_filter.h \
flash29.h \
flashcfm.h \
flashintelc3.h
libbdmflash_a_SOURCES = \
elf-utils.c \
bdmfilt.c \
bdmflash.c \
flash_filter.c \
flash29.c \
flashcfm.c \
flashintelc3.c
if BUILD_FLASH_PLUGINS
#
# Flash Plug-In Source
#
fpi_source = $(1).c $(1).h
#
# Flash Plug-In Target
#
fpi_target = $(foreach target, $(2), $(1)-$(target).plugin)
#
# Full instruction set range for the Coldfire plus the CPU32.
#
fpi_multilib = \
cpu32 \
5206 \
5206e \
5307 \
5407 \
54455 \
5475
#
# The list of plugins we have.
#
fpi_flash29 = flash29
fpi_flash29_targets = $(fpi_multilib)
fpi_flash29_source = $(call fpi_source, flash29)
fpi_flash29_plugins = $(call fpi_target, flash29, $(fpi_flash29_targets))
fpi_flashcfm = flashcfm
fpi_flashcfm_targets = \
5206 \
5206e \
54455
fpi_flashcfm_source = $(call fpi_source, flashcfm)
fpi_flashcfm_plugins = $(call fpi_target, flashcfm, $(fpi_flashcfm_targets))
fpi_flashintelc3 = flashintelc3
fpi_flashintelc3_targets = $(fpi_multilib)
fpi_flashintelc3_source = $(call fpi_source, flashintelc3)
fpi_flashintelc3_plugins = $(call fpi_target, flashintelc3, $(fpi_flashintelc3_targets))
fpi_plugins = \
$(fpi_flash29_plugins) \
$(fpi_flashcfm_plugins) \
$(fpi_flashintelc3_plugins)
all-local: \
$(fpi_plugins)
$(fpi_flash29_plugins): $(fpi_flash29_source)
$(srcdir)/m68k-bdm-compile-plugin @FLASH_PLUGIN_GCC@ $< $@
$(fpi_flashcfm_plugins): $(fpi_flashcfm_source)
$(srcdir)/m68k-bdm-compile-plugin @FLASH_PLUGIN_GCC@ $< $@
$(fpi_flashintelc3_plugins): $(fpi_flashintelc3_source)
$(srcdir)/m68k-bdm-compile-plugin @FLASH_PLUGIN_GCC@ $< $@
install-data-local: \
$(fpi_plugins)
test -z "$(prefix)/share/m68k-bdm/plugins" || \
mkdir -p "$(prefix)/share/m68k-bdm/plugins"; \
for f in $^; do \
install -m 644 $$f $(prefix)/share/m68k-bdm/plugins/$$f; \
done
clean-local:
rm -f *.plugin
endif
EXTRA_DIST = README $(fpi_plugins)

575
m68k/flashlib/Makefile.in Normal file
View File

@@ -0,0 +1,575 @@
# Makefile.in generated by automake 1.10 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = flashlib
DIST_COMMON = README $(include_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
libLIBRARIES_INSTALL = $(INSTALL_DATA)
LIBRARIES = $(lib_LIBRARIES)
ARFLAGS = cru
libbdmflash_a_AR = $(AR) $(ARFLAGS)
libbdmflash_a_LIBADD =
am_libbdmflash_a_OBJECTS = elf-utils.$(OBJEXT) bdmfilt.$(OBJEXT) \
bdmflash.$(OBJEXT) flash_filter.$(OBJEXT) flash29.$(OBJEXT) \
flashcfm.$(OBJEXT) flashintelc3.$(OBJEXT)
libbdmflash_a_OBJECTS = $(am_libbdmflash_a_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/config/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libbdmflash_a_SOURCES)
DIST_SOURCES = $(libbdmflash_a_SOURCES)
includeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(include_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BDM_SUBDIRS = @BDM_SUBDIRS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FLASH_PLUGIN_GCC = @FLASH_PLUGIN_GCC@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBUSB_INCLUDE_DIR = @LIBUSB_INCLUDE_DIR@
LIBUSB_LIB_DIR = @LIBUSB_LIB_DIR@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
flash_plugin_cc = @flash_plugin_cc@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I$(srcdir)/../libelf/lib -I../libelf/lib \
-I$(srcdir)/../driver -I$(srcdir)/../lib \
-DPREFIX="$(prefix)"
lib_LIBRARIES = libbdmflash.a
include_HEADERS = \
bdmfilt.h \
bdmflash.h \
flash_filter.h \
flash29.h \
flashcfm.h \
flashintelc3.h
libbdmflash_a_SOURCES = \
elf-utils.c \
bdmfilt.c \
bdmflash.c \
flash_filter.c \
flash29.c \
flashcfm.c \
flashintelc3.c
#
# Flash Plug-In Source
#
@BUILD_FLASH_PLUGINS_TRUE@fpi_source = $(1).c $(1).h
#
# Flash Plug-In Target
#
@BUILD_FLASH_PLUGINS_TRUE@fpi_target = $(foreach target, $(2), $(1)-$(target).plugin)
#
# Full instruction set range for the Coldfire plus the CPU32.
#
@BUILD_FLASH_PLUGINS_TRUE@fpi_multilib = \
@BUILD_FLASH_PLUGINS_TRUE@ cpu32 \
@BUILD_FLASH_PLUGINS_TRUE@ 5206 \
@BUILD_FLASH_PLUGINS_TRUE@ 5206e \
@BUILD_FLASH_PLUGINS_TRUE@ 5307 \
@BUILD_FLASH_PLUGINS_TRUE@ 5407 \
@BUILD_FLASH_PLUGINS_TRUE@ 54455 \
@BUILD_FLASH_PLUGINS_TRUE@ 5475
#
# The list of plugins we have.
#
@BUILD_FLASH_PLUGINS_TRUE@fpi_flash29 = flash29
@BUILD_FLASH_PLUGINS_TRUE@fpi_flash29_targets = $(fpi_multilib)
@BUILD_FLASH_PLUGINS_TRUE@fpi_flash29_source = $(call fpi_source, flash29)
@BUILD_FLASH_PLUGINS_TRUE@fpi_flash29_plugins = $(call fpi_target, flash29, $(fpi_flash29_targets))
@BUILD_FLASH_PLUGINS_TRUE@fpi_flashcfm = flashcfm
@BUILD_FLASH_PLUGINS_TRUE@fpi_flashcfm_targets = \
@BUILD_FLASH_PLUGINS_TRUE@ 5206 \
@BUILD_FLASH_PLUGINS_TRUE@ 5206e \
@BUILD_FLASH_PLUGINS_TRUE@ 54455
@BUILD_FLASH_PLUGINS_TRUE@fpi_flashcfm_source = $(call fpi_source, flashcfm)
@BUILD_FLASH_PLUGINS_TRUE@fpi_flashcfm_plugins = $(call fpi_target, flashcfm, $(fpi_flashcfm_targets))
@BUILD_FLASH_PLUGINS_TRUE@fpi_flashintelc3 = flashintelc3
@BUILD_FLASH_PLUGINS_TRUE@fpi_flashintelc3_targets = $(fpi_multilib)
@BUILD_FLASH_PLUGINS_TRUE@fpi_flashintelc3_source = $(call fpi_source, flashintelc3)
@BUILD_FLASH_PLUGINS_TRUE@fpi_flashintelc3_plugins = $(call fpi_target, flashintelc3, $(fpi_flashintelc3_targets))
@BUILD_FLASH_PLUGINS_TRUE@fpi_plugins = \
@BUILD_FLASH_PLUGINS_TRUE@ $(fpi_flash29_plugins) \
@BUILD_FLASH_PLUGINS_TRUE@ $(fpi_flashcfm_plugins) \
@BUILD_FLASH_PLUGINS_TRUE@ $(fpi_flashintelc3_plugins)
EXTRA_DIST = README $(fpi_plugins)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign flashlib/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign flashlib/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-libLIBRARIES: $(lib_LIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
@list='$(lib_LIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
$(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
else :; fi; \
done
@$(POST_INSTALL)
@list='$(lib_LIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
p=$(am__strip_dir) \
echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
$(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
else :; fi; \
done
uninstall-libLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
rm -f "$(DESTDIR)$(libdir)/$$p"; \
done
clean-libLIBRARIES:
-test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
libbdmflash.a: $(libbdmflash_a_OBJECTS) $(libbdmflash_a_DEPENDENCIES)
-rm -f libbdmflash.a
$(libbdmflash_a_AR) libbdmflash.a $(libbdmflash_a_OBJECTS) $(libbdmflash_a_LIBADD)
$(RANLIB) libbdmflash.a
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bdmfilt.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bdmflash.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-utils.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flash29.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flash_filter.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flashcfm.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flashintelc3.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
@list='$(include_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
$(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
done
uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(include_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
rm -f "$(DESTDIR)$(includedir)/$$f"; \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
@BUILD_FLASH_PLUGINS_FALSE@all-local:
all-am: Makefile $(LIBRARIES) $(HEADERS) all-local
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
@BUILD_FLASH_PLUGINS_FALSE@install-data-local:
@BUILD_FLASH_PLUGINS_FALSE@clean-local:
clean: clean-am
clean-am: clean-generic clean-libLIBRARIES clean-local mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-data-local install-includeHEADERS
install-dvi: install-dvi-am
install-exec-am: install-libLIBRARIES
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-includeHEADERS uninstall-libLIBRARIES
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am all-local check check-am clean \
clean-generic clean-libLIBRARIES clean-local ctags distclean \
distclean-compile distclean-generic distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-data-local install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-includeHEADERS install-info \
install-info-am install-libLIBRARIES install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-includeHEADERS uninstall-libLIBRARIES
@BUILD_FLASH_PLUGINS_TRUE@all-local: \
@BUILD_FLASH_PLUGINS_TRUE@ $(fpi_plugins)
@BUILD_FLASH_PLUGINS_TRUE@$(fpi_flash29_plugins): $(fpi_flash29_source)
@BUILD_FLASH_PLUGINS_TRUE@ $(srcdir)/m68k-bdm-compile-plugin @FLASH_PLUGIN_GCC@ $< $@
@BUILD_FLASH_PLUGINS_TRUE@$(fpi_flashcfm_plugins): $(fpi_flashcfm_source)
@BUILD_FLASH_PLUGINS_TRUE@ $(srcdir)/m68k-bdm-compile-plugin @FLASH_PLUGIN_GCC@ $< $@
@BUILD_FLASH_PLUGINS_TRUE@$(fpi_flashintelc3_plugins): $(fpi_flashintelc3_source)
@BUILD_FLASH_PLUGINS_TRUE@ $(srcdir)/m68k-bdm-compile-plugin @FLASH_PLUGIN_GCC@ $< $@
@BUILD_FLASH_PLUGINS_TRUE@install-data-local: \
@BUILD_FLASH_PLUGINS_TRUE@ $(fpi_plugins)
@BUILD_FLASH_PLUGINS_TRUE@ test -z "$(prefix)/share/m68k-bdm/plugins" || \
@BUILD_FLASH_PLUGINS_TRUE@ mkdir -p "$(prefix)/share/m68k-bdm/plugins"; \
@BUILD_FLASH_PLUGINS_TRUE@ for f in $^; do \
@BUILD_FLASH_PLUGINS_TRUE@ install -m 644 $$f $(prefix)/share/m68k-bdm/plugins/$$f; \
@BUILD_FLASH_PLUGINS_TRUE@ done
@BUILD_FLASH_PLUGINS_TRUE@clean-local:
@BUILD_FLASH_PLUGINS_TRUE@ rm -f *.plugin
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -0,0 +1,33 @@
2008-08-04 Chris Johns <cjohns@users.sourceforge.net>
Plug-in Multilib Map
=========================
This table provides the mapping table for the plugins for the processors in the
Coldfire family. This mapping is based on the instruction set supported by each
processor. A reduction could be made is the FPU was not included. It currently
is.
processor in
5206:
5202, 5204, 5206, 5249, 5250, 5230, 5272
5206e:
5206e, 5207, 5208, 5210a, 5211a, 5211, 5212, 5213, 5214, 5216, 52221,
52223, 52230, 52231, 52231, 52232, 52233, 52234, 52235, 5224, 5225, 5232,
5233, 5234, 5235, 523x, 5270, 5271, 5274, 5274, 5275, 5280, 5281, 5282,
528x
5307:
5307, 5327, 5328, 5329, 532x, 5372, 5373, 537x
5407:
5407
54455:
54450, 54451, 54452, 54453, 54454, 54455
5475:
5470, 5471, 5472, 5473, 5474, 5475, 547x, 5480, 5481, 5482, 5483, 5484,
5485, 548x

113
m68k/flashlib/README Normal file
View File

@@ -0,0 +1,113 @@
README
=========================
2003-12-28 Josef Wolf (jw@raven.inka.de)
2008-06-27 Matthew Riek (matthew.riek@ibiscomputer.com.au)
Flashlib is invoked using bdmctrl. See the *.test script files in
bdm/m68k/utils as examples on how to bootstrap a board and invoke flashlib
for flashing. See also bdm/m68k/utils/README.bdmctrl
Overview
=========================
Following is a rough overview of the flashlib architecture:
filter:
The filter is the main interface to the application. The application
don't really need to know about the flash driver details. Filter's
write_memory() function is the flashing aequivalent of the memcpy()
function. write_memory can write to flash or ram, depending on
the memory region of the write.
driver:
A driver is the implementation of a specific flashing algorithm.
examples are flash29, flashcfm and flashintelc3. If the algorithm
or chip definition for your flash is not supported, you will need
to either add a chip to the chip tables (flash29 and flashintelc3)
or you will have to write a new driver.
chip description:
The chip description describes details of a flash chip. What
information needs to be stored in the description is up to
the driver. Most drivers will probably want to store at least
chip-type and bus-interface. Some flash drivers (such as flashcfm)
don't need a chip description table. Instead, you can configure
the required bits such as flash register offsets using flash_set_var.
flash region:
A flash region describes specific flash chips (depending on the
bus interface). The most important information herein is the
base-address, the length, the driver and the chip description.
plugin:
A driver that can be downloaded and executed on the target.
Note that you don't _need_ plugins. You can use host only mode,
which is very slow, plugins just make flashing much much faster.
A plugin is simply compiling just the driver '.c' file for your
target. For example, If you have a 29 series flash chip on your
board, you would compile flash29.c using your cross compiler
toolchain. Only a few header files are needed (the associated
header file flash29.h, flash_filter.h and stdint.h. note that
when you compile the drivers as a plugin, you must define
HOST_FLASHING as 0. (-DHOST_FLASHING=0 for gcc). You need to
compile with -mpcrel such that the code is relocatable. I have
compiled all current drivers successfully using a m68k-elf gnu
toolchain (version 4.3.0), and with the m68k-rtems4.9 toolchain.
m68k-elf-gcc -DHOST_FLASHING=0 -O2 -Wall -fomit-frame-pointer \
-mpcrel -m<CPU> -Wcast-align -Wstrict-prototypes \
-Wmissing-prototypes -c -o <driver>.plugin <driver>.c
where <driver> is one of flashcfm, flash29 or flashintelc3.
and <CPU> is your 68k arch, such as 5200, 5307, 528x etc.
There is a script provided which compiles the plugins which
takes 2 args, your compiler and your target. eg:
>./compile_plugins m68k-elf-gcc 5200
or
>./compile_plugins m68k-rtems4.9-gcc 5200
you will need to copy the plugins to the working folder you
invoke the bdmctrl scripts from.
host-only mode:
All operations are piped through the BDM interface. This is
extremely slow but very useful for bootstrapping/debugging.
Spend the time to compile plugins for your target
host-assisted mode:
Host downloads plugin. The actual flashing operation is executed
by the plugin. This is the preferred operation mode for flashing
under host-control.
target-only mode:
This mode is for operation without a host. compile filter and
drivers for the target with HOST_FLASHING = 0. This could be used
for boot loaders etc. This option has not been completed, there
are a few FIXME's noted in the flash_filter.c where bit's for
target-only mode remain unimplemented. uses of malloc, free,
strdup may need to be provided with hooks in this mode.
How to write a new driver
=========================
Best is to start with a copy of flash29.[ch]. You should rename the
init_flash29() function and add the new function to the algorithm[] array
in flash_filter.c. Next is to give a new value to the driver_magic string.
This name should be unique because it is used to identify the driver
that belongs to a loaded plugin. Change the download_struct() function to
download the chip description structure of the new driver properly to the
target. Make sure byte orderings and alignment is not messed up while
downloading.

58
m68k/flashlib/bdmfilt.c Normal file
View File

@@ -0,0 +1,58 @@
#include <bdmfilt.h>
#include <errno.h>
#include <string.h>
int bdmlib_load_use_lma=0;
bdmlib_bfilt_t * bdmlib_bfilt=NULL;
int
bdmfilt_wrb_filt(bdmlib_bfilt_t * filt, uint32_t in_adr,
unsigned int size, unsigned char * bl_ptr)
{
int ret, part_ret;
unsigned int part_size;
if (!size) return 0;
while (filt) {
if((in_adr<=filt->end_adr)&&
(in_adr+size-1>=filt->begin_adr)) {
ret = 0;
if(in_adr<filt->begin_adr) {
part_size=filt->begin_adr-in_adr;
part_ret=bdmlib_wrb_filt(filt->next,in_adr,part_size,bl_ptr);
ret+=part_ret;
if(part_ret!=part_size) return ret;
in_adr+=part_size;
bl_ptr+=part_size;
size-=part_size;
}
part_size=filt->end_adr-in_adr+1;
if (part_size>=size) {
part_size=size;
size=0;
} else size-=part_size;
part_ret=filt->wrb_filt(filt,in_adr,part_size,bl_ptr);
ret+=part_ret;
if(part_ret!=part_size) {
dbprintf("write error on filt write, address 0x%lx size %d acknowledged %d errno %d\n",
(long)in_adr, part_size, part_ret, errno);
return ret;
}
in_adr+=part_size;
bl_ptr+=part_size;
if(!size) return ret;
ret+=bdmlib_wrb_filt(filt->next,in_adr,size,bl_ptr);
return ret;
}
filt=filt->next;
}
/* regular memory block write */
if ((ret = bdmlib_write_block(in_adr, size, bl_ptr)) != size) {
dbprintf("write error on block write, written %d acknowledged %d errno %d\n",
size, ret, errno);
return ret;
}
return ret;
}

36
m68k/flashlib/bdmfilt.h Normal file
View File

@@ -0,0 +1,36 @@
/*
* $Id: bdmfilt.h,v 1.4 2008/06/16 00:01:21 cjohns Exp $
*/
#ifndef BDMFILT_H
#define BDMFILT_H
#include <sys/types.h>
#include <stdint.h>
/* support of filtered write for flash programming */
typedef struct bdmlib_bfilt{
struct bdmlib_bfilt *next;
uint32_t begin_adr;
uint32_t end_adr;
int filt_id;
unsigned int flags;
int (*wrb_filt)(struct bdmlib_bfilt *, uint32_t , unsigned int, unsigned char * );
void *info;
void *state;
}bdmlib_bfilt_t;
#define BDMLIB_FILT_ERROR 0x08
#define BDMLIB_FILT_ERASED 0x10
#define BDMLIB_FILT_AUTO 0x20
#define BDMLIB_FILT_FLASH 0x40
int bdmlib_load_use_lma; /* use LMA instead of VMA for load */
bdmlib_bfilt_t * bdmlib_bfilt;
int
bdmlib_wrb_filt(bdmlib_bfilt_t * bdmlib_bfilt, uint32_t in_adr,
unsigned int size, unsigned char * bl_ptr);
#endif /* BDMFILT_H */

989
m68k/flashlib/bdmflash.c Normal file
View File

@@ -0,0 +1,989 @@
/*******************************************************************
Flash programming algorithms for use with BDM flash utility
bdmflash.c - test driver implementation
(C) Copyright 2000-2003 by Pavel Pisa <pisa@waltz.felk.cvut.cz>
This souce is distributed under the Gnu General Public Licence.
See file COPYING for details.
Source could be used under any other license for embeded systems,
but in such case enhancements must be sent to original author.
If some of contributors does not agree with above two lines,
he can delete them and only GPL will apply.
*******************************************************************/
/*
Revision history
2001-01-16 Added experimental support of single 8 bit flash memory
based on Avi Cohen Stuart <astuart@baan.nl> changes
2001-07-10 Added support for amd_29f010 with x8x2 configuration
based on John S. Gwynne <jsg@jsgpc.mrcday.com> changes
Trying to solve x8x2 race condition with shortest
possible code - needs more tests
2001-08-30 Added alg-info for at_49f040 with x8x2 configuration
x8x2 configuration needs more testing, may be broken
2003-05-19 Added initial support for x32 memory configurations.
The x16x2 and x8x4 should work as well. Changes were
motivated by Andrei Smirnov <andrei.s@myrealbox.com>
code, but his small update results in deeper code redesign.
This could enable to support page writes for modern versions
of FLASH memories in future.
2003-11-09 The first attempt to port into Chris's branch
*/
#include <sys/types.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <BDMlib.h>
#include "bdmfilt.h"
#include "bdmflash.h"
/* predefined flash algorithms metods */
int bdmflash_check_id_x32(const flash_alg_info_t *alg, uint32_t addr, flash_d_t retid[2]);
int bdmflash_prog_x32(const flash_alg_info_t *alg, uint32_t addr, const void *data, long count);
int bdmflash_erase_x32(const flash_alg_info_t *alg, uint32_t addr, long size);
int bdmflash_check_id_x16(const flash_alg_info_t *alg, uint32_t addr, flash_d_t retid[2]);
int bdmflash_prog_x16(const flash_alg_info_t *alg, uint32_t addr, const void *data, long count);
int bdmflash_erase_x16(const flash_alg_info_t *alg, uint32_t addr, long size);
int bdmflash_check_id_x8(const flash_alg_info_t *alg, uint32_t addr, flash_d_t retid[2]);
int bdmflash_prog_x8(const flash_alg_info_t *alg, uint32_t addr, const void *data, long count);
int bdmflash_erase_x8(const flash_alg_info_t *alg, uint32_t addr, long size);
/* predefined flash types */
flash_alg_info_t amd_29f800_x16={
check_id: bdmflash_check_id_x16,
prog: bdmflash_prog_x16,
erase: bdmflash_erase_x16,
addr_mask: 0xfffff, /* 1MB */
reg1_addr: 0x555*2,
reg2_addr: 0x2aa*2,
sec_size: 0x10000,
width: FLASH_ALG_BITS_x16,
cmd_unlock1:0xaa, /* reg1 */
cmd_unlock2:0x55, /* reg2 */
cmd_rdid: 0x90, /* reg1 */
cmd_prog: 0xa0, /* reg1 */
cmd_erase: 0x80, /* reg1 */
cmd_reset: 0xf0, /* any */
erase_all: 0x10, /* reg1 */
erase_sec: 0x30, /* sector */
fault_bit: 0x20,
manid: 1,
devid: 0x2258,
alg_name: "amd29f800"
};
flash_alg_info_t amd_29f400_x16={
check_id: bdmflash_check_id_x16,
prog: bdmflash_prog_x16,
erase: bdmflash_erase_x16,
addr_mask: 0x7ffff, /* 0.5MB */
reg1_addr: 0x555*2,
reg2_addr: 0x2aa*2,
sec_size: 0x10000,
width: FLASH_ALG_BITS_x16,
cmd_unlock1:0xaa, /* reg1 */
cmd_unlock2:0x55, /* reg2 */
cmd_rdid: 0x90, /* reg1 */
cmd_prog: 0xa0, /* reg1 */
cmd_erase: 0x80, /* reg1 */
cmd_reset: 0xf0, /* any */
erase_all: 0x10, /* reg1 */
erase_sec: 0x30, /* sector */
fault_bit: 0x20,
manid: 1,
devid: 0x22ab,
alg_name: "amd29f400"
};
flash_alg_info_t amd_29f040_x8={
check_id: bdmflash_check_id_x8,
prog: bdmflash_prog_x8,
erase: bdmflash_erase_x8,
addr_mask: 0x7ffff, /* 0.5MB */
reg1_addr: 0x555,
reg2_addr: 0x2aa,
sec_size: 0x10000,
width: FLASH_ALG_BITS_x8,
cmd_unlock1:0xaa, /* reg1 */
cmd_unlock2:0x55, /* reg2 */
cmd_rdid: 0x90, /* reg1 */
cmd_prog: 0xa0, /* reg1 */
cmd_erase: 0x80, /* reg1 */
cmd_reset: 0xf0, /* any */
erase_all: 0x10, /* reg1 */
erase_sec: 0x30, /* sector */
fault_bit: 0x20,
manid: 1,
devid: 0xa4,
alg_name: "amd29f040"
};
flash_alg_info_t amd_29f010_x8x2={
check_id: bdmflash_check_id_x16,
prog: bdmflash_prog_x16,
erase: bdmflash_erase_x16,
addr_mask: 0x3ffff, /* 2x128kB = 256kB */
reg1_addr: 0x5555*2,
reg2_addr: 0x2aaa*2,
sec_size: 0x10000,
width: FLASH_ALG_BITS_x8x2,
cmd_unlock1:0xaaaa, /* reg1 */
cmd_unlock2:0x5555, /* reg2 */
cmd_rdid: 0x9090, /* reg1 */
cmd_prog: 0xa0a0, /* reg1 */
cmd_erase: 0x8080, /* reg1 */
cmd_reset: 0xf0f0, /* any */
erase_all: 0x1010, /* reg1 */
erase_sec: 0x3030, /* sector */
fault_bit: 0x2020,
manid: 0x0101,
devid: 0x2020,
alg_name: "amd29f010x2"
};
flash_alg_info_t at_49f040_x8x2={
check_id: bdmflash_check_id_x16,
prog: bdmflash_prog_x16,
erase: bdmflash_erase_x16,
addr_mask: 0xfffff, /* 2x0.5MB = 1MB */
reg1_addr: 0x5555*2,
reg2_addr: 0x2aaa*2,
sec_size: 0x10000,
width: FLASH_ALG_BITS_x8x2,
cmd_unlock1:0xaaaa, /* reg1 */
cmd_unlock2:0x5555, /* reg2 */
cmd_rdid: 0x9090, /* reg1 */
cmd_prog: 0xa0a0, /* reg1 */
cmd_erase: 0x8080, /* reg1 */
cmd_reset: 0xf0f0, /* any */
erase_all: 0x1010, /* reg1 */
erase_sec: 0x3030, /* sector */
fault_bit: 0x2020,
manid: 0x1F1F,
devid: 0x1313,
alg_name: "at49f040x2"
};
#ifdef WITH_TARGET_BUS32
flash_alg_info_t amd_29f080_x8x4={
check_id: bdmflash_check_id_x32,
prog: bdmflash_prog_x32,
erase: bdmflash_erase_x32,
addr_mask: 0x3fffff, /* 4x1MB */
reg1_addr: 0x555*4,
reg2_addr: 0x2aa*4,
sec_size: 0x10000,
width: FLASH_ALG_BITS_x8x4,
cmd_unlock1:0xaaaaaaaa, /* reg1 */
cmd_unlock2:0x55555555, /* reg2 */
cmd_rdid: 0x90909090, /* reg1 */
cmd_prog: 0xa0a0a0a0, /* reg1 */
cmd_erase: 0x80808080, /* reg1 */
cmd_reset: 0xf0f0f0f0, /* any */
erase_all: 0x10101010, /* reg1 */
erase_sec: 0x30303030, /* sector */
fault_bit: 0x20202020,
manid: 0x01010101,
devid: 0xd5d5d5d5,
alg_name: "amd29f080x4"
};
#endif /* WITH_TARGET_BUS32 */
/* please keep sorted by flash sizes, smallest first */
flash_alg_info_t *flash_alg_infos_def[]={
&amd_29f010_x8x2, /* 256 kB */
&amd_29f040_x8, /* 512 kB */
&amd_29f400_x16, /* 512 kB */
&amd_29f800_x16, /* 1 MB */
&at_49f040_x8x2, /* 1 MB */
#ifdef WITH_TARGET_BUS32
&amd_29f080_x8x4, /* 4 MB */
#endif /* WITH_TARGET_BUS32 */
NULL
};
flash_alg_info_t **flash_alg_infos=flash_alg_infos_def;
#if 0
#define FLASH_WR32(adr,val) (*(volatile uint32_t*)(adr)=(val))
#define FLASH_RD32(adr) (*(volatile uint32_t*)(adr))
#define FLASH_WR16(adr,val) (*(volatile uint16_t*)(adr)=(val))
#define FLASH_RD16(adr) (*(volatile uint16_t*)(adr))
#define FLASH_WR8(adr,val) (*(volatile unsigned int8_t*)(adr)=(val))
#define FLASH_RD8(adr) (*(volatile unsigned int8_t*)(adr))
#elif 0
#define FLASH_WR32(adr,val) \
({ \
if(bdmlib_write_var(adr,BDM_SIZE_LONG,val)<0) \
goto mem_op_error; \
val; \
})
#define FLASH_RD32(adr) \
({ uint32_t temp_val; \
if(bdmlib_read_var(adr,BDM_SIZE_LONG,&temp_val)<0) \
goto mem_op_error; \
temp_val; \
})
#define FLASH_WR16(adr,val) \
({ \
if(bdmlib_write_var(adr,BDM_SIZE_WORD,val)<0) \
goto mem_op_error; \
val; \
})
#define FLASH_RD16(adr) \
({ uint16_t temp_val; \
if(bdmlib_read_var(adr,BDM_SIZE_WORD,&temp_val)<0) \
goto mem_op_error; \
temp_val; \
})
#define FLASH_WR8(adr,val) \
({ \
if(bdmlib_write_var(adr,BDM_SIZE_BYTE,val)<0) \
goto mem_op_error; \
val; \
})
#define FLASH_RD8(adr) \
({ unsigned int8_t temp_val; \
if(bdmlib_read_var(adr,BDM_SIZE_BYTE,&temp_val)<0) \
goto mem_op_error; \
temp_val; \
})
#else
#define FLASH_WR32(adr,val) \
({ \
if(bdmWriteLongWord((unsigned long)adr,val)<0) \
goto mem_op_error; \
val; \
})
#define FLASH_RD32(adr) \
({ unsigned long temp_val; \
if(bdmReadLongWord((unsigned long)adr,&temp_val)<0) \
goto mem_op_error; \
temp_val; \
})
#define FLASH_WR16(adr,val) \
({ \
if(bdmWriteWord((unsigned long)adr,val)<0) \
goto mem_op_error; \
val; \
})
#define FLASH_RD16(adr) \
({ unsigned short temp_val; \
if(bdmReadWord((unsigned long)adr,&temp_val)<0) \
goto mem_op_error; \
temp_val; \
})
#define FLASH_WR8(adr,val) \
({ \
if(bdmWriteByte((unsigned long)adr,val)<0) \
goto mem_op_error; \
val; \
})
#define FLASH_RD8(adr) \
({ unsigned char temp_val; \
if(bdmReadByte((unsigned long)adr,&temp_val)<0) \
goto mem_op_error; \
temp_val; \
})
#endif
static
int bdmflash_prepval_x16(uint16_t *pval, uint32_t addr, const void *data, long count)
{
if(!((long)addr&1) && (count>=2)){
*pval=(((unsigned char*)data)[0]<<8)|(((unsigned char*)data)[1]);
return 2;
}
if(!count) return count;
if(!((long)addr&1)){
*pval=(((unsigned char*)data)[0]<<8) | FLASH_RD8(addr+1);
}else{
*pval=(FLASH_RD8(addr-1)<<8) | (((unsigned char*)data)[0]);
}
return 1;
mem_op_error:
return -4;
}
#ifdef WITH_TARGET_BUS32
static
int bdmflash_prepval_x32(uint32_t *pval, uint32_t addr, const void *data, long count)
{
int offs=(long)addr&3;
int rest=4-offs;
uint32_t val=0;
if(!offs && (count>=4)){
*pval=((uint32_t)((unsigned char*)data)[0]<<24)|((uint32_t)((unsigned char*)data)[1]<<16)|
(((unsigned char*)data)[2]<<8)|(((unsigned char*)data)[3]);
return 4;
}
if(!count) return count;
if(count>rest) count=rest;
while(offs){
val<<=8;
val|=FLASH_RD8(addr-offs);
offs--;
}
while(offs<count){
val<<=8;
val|=((unsigned char*)data)[offs];
offs++;
}
while(offs<rest){
val<<=8;
val|=FLASH_RD8(addr+offs);
offs++;
}
*pval=val;
return count;
mem_op_error:
return -4;
}
#endif /* WITH_TARGET_BUS32 */
/*******************************************************************/
/* routines for 16 bit wide Intel or AMD flash or two interleaved
8 bit flashes */
int bdmflash_check_id_x16(const flash_alg_info_t *alg, uint32_t addr, flash_d_t retid[2])
{
int ret=0;
uint16_t devid, manid;
uint32_t a=addr&~alg->addr_mask;
/* reset */
FLASH_WR16(a,alg->cmd_reset);
/* security sequence */
FLASH_WR16(a+alg->reg1_addr,alg->cmd_unlock1);
if(alg->cmd_unlock2)
FLASH_WR16(a+alg->reg2_addr,alg->cmd_unlock2);
/* read manufacturer ID */
FLASH_WR16(a+alg->reg1_addr,alg->cmd_rdid);
manid=FLASH_RD16(a+0);
if(manid!=alg->manid) ret=-1;
/* reset */
FLASH_WR16(a,alg->cmd_reset);
/* security sequence */
FLASH_WR16(a+alg->reg1_addr,alg->cmd_unlock1);
if(alg->cmd_unlock2)
FLASH_WR16(a+alg->reg2_addr,alg->cmd_unlock2);
/* read device ID */
FLASH_WR16(a+alg->reg1_addr,alg->cmd_rdid);
devid=FLASH_RD16(a+2);
if(devid!=alg->devid) ret=-1;
/* reset */
FLASH_WR16(a,alg->cmd_reset);
if(retid)
{retid[0]=manid;retid[1]=devid;};
return ret;
mem_op_error:
return -5;
}
int bdmflash_prog_x16(const flash_alg_info_t *alg, uint32_t addr,
const void *data, long count)
{
int ret;
uint16_t old,new,fault,val;
uint32_t a=addr&~alg->addr_mask;
ret=bdmflash_prepval_x16(&val,addr,data,count);
if(ret<=0)
return ret;
addr=addr&~1l;
/* check if FLASH needs programming */
if(1){
old=FLASH_RD16(addr);
if(old==val) return ret;
}
/* security sequence */
FLASH_WR16(a+alg->reg1_addr,alg->cmd_unlock1);
if(alg->cmd_unlock2)
FLASH_WR16(a+alg->reg2_addr,alg->cmd_unlock2);
/* program command */
FLASH_WR16(a+alg->reg1_addr,alg->cmd_prog);
FLASH_WR16(addr,val);
/* wait for result */
old=FLASH_RD16(addr);
while((new=FLASH_RD16(addr))!=old){
if((fault=old&new&alg->fault_bit)){
old=new;
/* check for some false fault at finish or race of x8x2 */
if(!(old^=(new=FLASH_RD16(addr)))) break; /* finished now */
else{
/* one chip of x8x2 configuration can finish earlier */
if(!(old&0x00ff)||(fault&0x00ff))
if(!(old&0xff00)||(fault&0xff00))
{ret=-2;break;}
}
}
old=new;
}
/* reset */
FLASH_WR16(a,alg->cmd_reset);
if((FLASH_RD16(addr)!=val) && (ret>=0)) ret=-3;
return ret;
mem_op_error:
return -5;
}
int bdmflash_erase_x16(const flash_alg_info_t *alg, uint32_t addr, long size)
{
uint16_t old,new,fault;
int ret=0;
uint32_t a=addr&~alg->addr_mask;
/* reset */
FLASH_WR16(a,alg->cmd_reset);
/* security sequence */
FLASH_WR16(a+alg->reg1_addr,alg->cmd_unlock1);
if(alg->cmd_unlock2)
FLASH_WR16(a+alg->reg2_addr,alg->cmd_unlock2);
/* erase command */
FLASH_WR16(a+alg->reg1_addr,alg->cmd_erase);
/* security sequence */
FLASH_WR16(a+alg->reg1_addr,alg->cmd_unlock1);
if(alg->cmd_unlock2)
FLASH_WR16(a+alg->reg2_addr,alg->cmd_unlock2);
/* select erase range */
a=addr;
if(size==0)
FLASH_WR16(a+alg->reg1_addr,alg->erase_all);
else{
FLASH_WR16(addr,alg->erase_sec);
}
/* wait for result */
old=FLASH_RD16(addr);
while((new=FLASH_RD16(addr))!=old){
if((fault=old&new&alg->fault_bit)){
old=new;
/* check for some false fault at finish or race of x8x2 */
if(!(old^=(new=FLASH_RD16(addr)))) break; /* finished now */
else{
/* one chip of x8x2 configuration can finish earlier */
if(!(old&0x00ff)||(fault&0x00ff))
if(!(old&0xff00)||(fault&0xff00))
{ret=-2;break;}
}
}
old=new;
}
/* reset */
FLASH_WR16(a,alg->cmd_reset);
if(FLASH_RD16(addr)!=0xffff) ret--;
return ret;
mem_op_error:
return -5;
}
/*******************************************************************/
/* routines for single 8 bit wide Intel or AMD flash */
int bdmflash_check_id_x8(const flash_alg_info_t *alg, uint32_t addr,
flash_d_t retid[2])
{
int ret=0;
uint16_t devid, manid;
uint32_t a=addr&~alg->addr_mask;
/* reset */
FLASH_WR8(a,alg->cmd_reset);
/* security sequence */
FLASH_WR8(a+alg->reg1_addr,alg->cmd_unlock1);
if(alg->cmd_unlock2)
FLASH_WR8(a+alg->reg2_addr,alg->cmd_unlock2);
/* read manufacturer ID */
FLASH_WR8(a+alg->reg1_addr,alg->cmd_rdid);
manid=FLASH_RD8(a+0);
if(manid!=alg->manid) ret=-1;
/* reset */
FLASH_WR8(a,alg->cmd_reset);
/* security sequence */
FLASH_WR8(a+alg->reg1_addr,alg->cmd_unlock1);
if(alg->cmd_unlock2)
FLASH_WR8(a+alg->reg2_addr,alg->cmd_unlock2);
/* read device ID */
FLASH_WR8(a+alg->reg1_addr,alg->cmd_rdid);
devid=FLASH_RD8(a+1);
if(devid!=alg->devid) ret=-1;
/* reset */
FLASH_WR8(a,alg->cmd_reset);
if(retid)
{retid[0]=manid;retid[1]=devid;};
return ret;
mem_op_error:
return -5;
}
int bdmflash_prog_x8(const flash_alg_info_t *alg, uint32_t addr, const void *data, long count)
{
int ret=1;
unsigned char old,new,val;
uint32_t a=addr&~alg->addr_mask;
val=*(unsigned char*)data;
/* check if FLASH needs programming */
if(1){
old=FLASH_RD8(addr);
if(old==val) return ret;
}
/* security sequence */
FLASH_WR8(a+alg->reg1_addr,alg->cmd_unlock1);
if(alg->cmd_unlock2)
FLASH_WR8(a+alg->reg2_addr,alg->cmd_unlock2);
/* program command */
FLASH_WR8(a+alg->reg1_addr,alg->cmd_prog);
FLASH_WR8(addr,val);
/* wait for result */
old=FLASH_RD8(addr);
while((new=FLASH_RD8(addr))!=old){
if((old&alg->fault_bit)&&(new&alg->fault_bit)){
if((FLASH_RD8(addr))!=new) ret=-2;
break;
}
old=new;
}
/* reset */
FLASH_WR8(a,alg->cmd_reset);
if((FLASH_RD8(addr)!=val) && (ret>=0)) ret=-3;
return ret;
mem_op_error:
return -5;
}
int bdmflash_erase_x8(const flash_alg_info_t *alg, uint32_t addr, long size)
{
unsigned char old,new;
int ret=0;
uint32_t a=addr&~alg->addr_mask;
/* reset */
FLASH_WR8(a,alg->cmd_reset);
/* security sequence */
FLASH_WR8(a+alg->reg1_addr,alg->cmd_unlock1);
if(alg->cmd_unlock2)
FLASH_WR8(a+alg->reg2_addr,alg->cmd_unlock2);
/* erase command */
FLASH_WR8(a+alg->reg1_addr,alg->cmd_erase);
/* security sequence */
FLASH_WR8(a+alg->reg1_addr,alg->cmd_unlock1);
if(alg->cmd_unlock2)
FLASH_WR8(a+alg->reg2_addr,alg->cmd_unlock2);
/* select erase range */
a=addr;
if(size==0)
FLASH_WR8(a+alg->reg1_addr,alg->erase_all);
else{
FLASH_WR8(addr,alg->erase_sec);
}
old=FLASH_RD8(addr);
while((new=FLASH_RD8(addr))!=old){
if((old&alg->fault_bit)&&(new&alg->fault_bit)){
if((FLASH_RD8(addr))!=new) ret=-2;
break;
}
old=new;
}
/* reset */
FLASH_WR8(a,alg->cmd_reset);
if(FLASH_RD16(addr)!=0xffff) ret--;
return ret;
mem_op_error:
return -5;
}
/*******************************************************************/
/* routines for two/four interleaved 16/8 bit wide Intel or AMD flashes */
#ifdef WITH_TARGET_BUS32
int bdmflash_check_id_x32(const flash_alg_info_t *alg, uint32_t addr, flash_d_t retid[2])
{
int ret=0;
uint32_t devid, manid;
uint32_t a=addr&~alg->addr_mask;
/* reset */
FLASH_WR32(a,alg->cmd_reset);
/* security sequence */
FLASH_WR32(a+alg->reg1_addr,alg->cmd_unlock1);
if(alg->cmd_unlock2)
FLASH_WR32(a+alg->reg2_addr,alg->cmd_unlock2);
/* read manufacturer ID */
FLASH_WR32(a+alg->reg1_addr,alg->cmd_rdid);
/* bank slecets swapped as i suspect (360DK only) !!!!!! */
/*manid=FLASH_RD32(a+0xc); */
manid=FLASH_RD32(a+0);
if(manid!=alg->manid) ret=-1;
/* reset */
FLASH_WR32(a,alg->cmd_reset);
/* security sequence */
FLASH_WR32(a+alg->reg1_addr,alg->cmd_unlock1);
if(alg->cmd_unlock2)
FLASH_WR32(a+alg->reg2_addr,alg->cmd_unlock2);
/* read device ID */
FLASH_WR32(a+alg->reg1_addr,alg->cmd_rdid);
devid=FLASH_RD32(a+4);
if(devid!=alg->devid) ret=-1;
/* reset */
FLASH_WR32(a,alg->cmd_reset);
if(retid)
{retid[0]=manid;retid[1]=devid;};
return ret;
mem_op_error:
return -5;
}
int bdmflash_prog_x32(const flash_alg_info_t *alg, uint32_t addr,
const void *data, long count)
{
int ret=4;
uint32_t old,new,fault,val;
uint32_t a=addr&~alg->addr_mask;
ret=bdmflash_prepval_x32(&val,addr,data,count);
if(ret<=0)
return ret;
addr=addr&~3l;
/* check if FLASH needs programming */
if(1){
old=FLASH_RD32(addr);
if(old==val) return ret;
}
/* security sequence */
FLASH_WR32(a+alg->reg1_addr,alg->cmd_unlock1);
if(alg->cmd_unlock2)
FLASH_WR32(a+alg->reg2_addr,alg->cmd_unlock2);
/* program command */
FLASH_WR32(a+alg->reg1_addr,alg->cmd_prog);
FLASH_WR32(addr,val);
/* wait for result */
old=FLASH_RD32(addr);
while((new=FLASH_RD32(addr))!=old){
if((fault=old&new&alg->fault_bit)){
old=new;
/* check for some false fault at finish or race of x8x2 */
if(!(old^=(new=FLASH_RD32(addr)))) break; /* finished now */
else{
/* one chip of x16x2 or x8x4 configuration can finish earlier */
if(!(old&0x000000ff)||(fault&0x000000ff))
if(!(old&0x0000ff00)||(fault&0x0000ff00))
if(!(old&0x00ff0000)||(fault&0x00ff0000))
if(!(old&0xff000000)||(fault&0xff000000))
{ret=-2;break;}
}
}
old=new;
}
/* reset */
FLASH_WR32(a,alg->cmd_reset);
if((FLASH_RD32(addr)!=val) && (ret>=0)) ret=-3;
return ret;
mem_op_error:
return -5;
}
int bdmflash_erase_x32(const flash_alg_info_t *alg, uint32_t addr, long size)
{
uint32_t old,new,fault;
int ret=0;
uint32_t a=addr&~alg->addr_mask;
/* reset */
FLASH_WR32(a,alg->cmd_reset);
/* security sequence */
FLASH_WR32(a+alg->reg1_addr,alg->cmd_unlock1);
if(alg->cmd_unlock2)
FLASH_WR32(a+alg->reg2_addr,alg->cmd_unlock2);
/* erase command */
FLASH_WR32(a+alg->reg1_addr,alg->cmd_erase);
/* security sequence */
FLASH_WR32(a+alg->reg1_addr,alg->cmd_unlock1);
if(alg->cmd_unlock2)
FLASH_WR32(a+alg->reg2_addr,alg->cmd_unlock2);
/* select erase range */
a=addr;
if(size==0)
FLASH_WR32(a+alg->reg1_addr,alg->erase_all);
else{
FLASH_WR32(addr,alg->erase_sec);
}
/* wait for result */
old=FLASH_RD32(addr);
while((new=FLASH_RD32(addr))!=old){
if((fault=old&new&alg->fault_bit)){
old=new;
/* check for some false fault at finish or race of x16x2 or x8x4 */
if(!(old^=(new=FLASH_RD32(addr)))) break; /* finished now */
else{
/* one chip of x16x2 or x8x4 configuration can finish earlier */
if(!(old&0x000000ff)||(fault&0x000000ff))
if(!(old&0x0000ff00)||(fault&0x0000ff00))
if(!(old&0x00ff0000)||(fault&0x00ff0000))
if(!(old&0xff000000)||(fault&0xff000000))
{ret=-2;break;}
}
}
old=new;
}
/* reset */
FLASH_WR32(a,alg->cmd_reset);
if(FLASH_RD32(addr)!=0xffffffff) ret--;
return ret;
mem_op_error:
return -5;
}
#endif /* WITH_TARGET_BUS32 */
/*******************************************************************/
/* flash type independent check_id */
int bdmflash_check_id(const flash_alg_info_t *alg, uint32_t addr, flash_d_t retid[2])
{
if(alg->check_id)
return alg->check_id(alg, addr, retid);
else
return -10; /* we really need to define error constants in future */
}
/* flash type independent program one location */
int bdmflash_prog(const flash_alg_info_t *alg, uint32_t addr, const void *data, long count)
{
if(alg->prog)
return alg->prog(alg,addr,data,count);
else
return -10;
}
/* flash type independent erase region */
int bdmflash_erase(const flash_alg_info_t *alg, uint32_t addr, long size)
{
if(alg->erase)
return alg->erase(alg,addr,size);
else
return -10;
}
const flash_alg_info_t *
bdmflash_alg_from_id(flash_d_t id[2])
{
int i;
const flash_alg_info_t *alg;
for(i=0;(alg=flash_alg_infos_def[i])!=NULL;i++)
if((alg->manid==id[0])&&(alg->devid==id[0]))
return alg;
return NULL;
}
const flash_alg_info_t *
bdmflash_alg_probe(uint32_t flash_adr)
{
int i;
const flash_alg_info_t *alg,*alg1;
flash_d_t testid[2];
for(i=0;(alg=flash_alg_infos_def[i])!=NULL;i++){
if(bdmflash_check_id(alg,flash_adr,testid)>=0)
return alg;
alg1=bdmflash_alg_from_id(testid);
if(alg1!=NULL)
if(bdmflash_check_id(alg1,flash_adr,testid)>=0)
return alg1;
}
return NULL;
}
int
bdmflash_wrb_filt(bdmlib_bfilt_t * filt, uint32_t in_adr,
unsigned int size, unsigned char * bl_ptr)
{
int offs=0,res;
flash_d_t val;
const flash_alg_info_t *alg=(flash_alg_info_t*)filt->info;
#if 0
if(alg->width!=FLASH_ALG_BITS_x8) {
/* 16 bit wide flash write path */
if((u_long)in_adr&1) {
in_adr-=1;
val=(FLASH_RD16(in_adr)&0xff00)|bl_ptr[offs];
if((res=bdmflash_prog(alg, in_adr, val))<0) {
fprintf(stderr, "flash byte write error %d at 0x%lx\n",
res,(u_long)in_adr);
return offs;
}
in_adr+=2;
size-=1;
offs+=1;
}
while(size>=2) {
val=(bl_ptr[offs]<<8)|bl_ptr[offs+1];
if((res=bdmflash_prog(alg, in_adr, val))<0) {
fprintf(stderr, "flash write error %d at 0x%lx\n",
res,(u_long)in_adr);
return offs;
}
in_adr+=2;
size-=2;
offs+=2;
}
if(size) {
val=(FLASH_RD16(in_adr)&0x00ff)|(bl_ptr[offs]<<8);
if((res=bdmflash_prog(alg, in_adr, val))<0) {
fprintf(stderr, "flash byte write error %d at 0x%lx\n",
res,(u_long)in_adr);
return offs;
}
size-=1;
offs+=1;
}
}
#endif
while(size>=1) {
val=bl_ptr[offs];
if((res=bdmflash_prog(alg, in_adr, bl_ptr+offs, size))<=0) {
fprintf(stderr, "flash write error %d at 0x%lx\n",
res,(u_long)in_adr);
return offs;
}
in_adr+=res;
size-=res;
offs+=res;
}
return offs;
#if 0
mem_op_error:
fprintf(stderr, "bdm memory access error\n");
return 0;
#endif
}
int
bdmflash_erase_filt(bdmlib_bfilt_t * filt, uint32_t in_adr, unsigned int size)
{
int res=0;
const flash_alg_info_t *alg=(flash_alg_info_t*)filt->info;
if(!in_adr)
in_adr=filt->begin_adr;
res=bdmflash_erase(alg, in_adr,size);
if(res<0)
fprintf(stderr, "flash erase error %d\n",res);
return res;
}
#if 0
/* slow version of blank check */
int
bdmflash_blankck_filt(bdmlib_bfilt_t * filt, uint32_t in_adr, unsigned int size)
{
int errors=0;
if(!in_adr||!size){
in_adr=filt->begin_adr;
size=filt->end_adr-in_adr+1;
}
if(((long)in_adr&1)&&size){
if(FLASH_RD8(in_adr)!=0xff){
fprintf(stderr,"blank check error at 0x%06lX",(long)in_adr);
errors++;
}
in_adr++; size--;
}
while(size>=2){
if(FLASH_RD16(in_adr)!=0xffff){
if(errors<5){
if(errors) fprintf(stderr,",0x%06lX",(long)in_adr);
else fprintf(stderr,"blank check error at 0x%06lX",(long)in_adr);
}else if(errors==5) fprintf(stderr, " and more");
errors++;
}
if(!((long)in_adr&0xfff)) bdmlib_propeller(stdout);
in_adr+=2; size-=2;
}
if(size){
if(FLASH_RD8(in_adr)!=0xff){
if(errors) fprintf(stderr,",0x%06lX",(long)in_adr);
else fprintf(stderr,"blank check error at 0x%06lX",(long)in_adr);
errors++;
}
}
if(errors) fprintf(stderr,"\n");
return errors;
mem_op_error:
fprintf(stderr, "bdm memory access error\n");
return -5;
}
#else
/* hopefully faster version of blank check */
int
bdmflash_blankck_filt(bdmlib_bfilt_t * filt, uint32_t in_adr,
unsigned int size)
{
int errors=0, in_buf;
unsigned char buf[1024], *p;
if(!in_adr||!size){
in_adr=filt->begin_adr;
size=filt->end_adr-in_adr+1;
}
while(size){
if(size<sizeof(buf)) in_buf=size;
else in_buf=sizeof(buf);
if(bdmlib_read_block(in_adr,in_buf,buf)!=in_buf)
goto mem_op_error;
size-=in_buf;
for(p=buf;in_buf--;in_adr++,p++){
if(*p!=0xff){
if(errors<10){
if(errors) fprintf(stderr,",0x%06lX",(long)in_adr);
else fprintf(stderr,"blank check error at 0x%06lX",(long)in_adr);
}else if(errors==10) fprintf(stderr, " and more");
errors++;
}
}
bdmlib_propeller((u_long)in_adr, stdout);
}
if(errors) fprintf(stderr,"\n");
return errors;
mem_op_error:
fprintf(stderr, "\nbdm memory access error\n");
return -5;
}
#endif

75
m68k/flashlib/bdmflash.h Normal file
View File

@@ -0,0 +1,75 @@
#ifndef BDMFLASH_H
#define BDMFLASH_H
#include <sys/types.h>
#include <stdint.h>
#define FLASH_ALG_BITS_x8 0
#define FLASH_ALG_BITS_x16 2
#define FLASH_ALG_BITS_x8x2 3
#define FLASH_ALG_BITS_x32 4
#define FLASH_ALG_BITS_x16x2 5
#define FLASH_ALG_BITS_x8x4 7
#define WITH_TARGET_BUS32
#ifndef WITH_TARGET_BUS32
typedef uint16_t flash_d_t; /* Type able to store one flash location */
#else /* WITH_TARGET_BUS32 */
typedef uint32_t flash_d_t; /* Type able to store one flash location */
#endif /* WITH_TARGET_BUS32 */
/* Structure describing programming operations for flash type */
typedef struct flash_alg_info {
/* Sets retid to manufacturer and type ID, returns <0 in case of error */
int (*check_id)(const struct flash_alg_info *alg, uint32_t addr, flash_d_t retid[2]);
/* Programs one location of flash and returns number of programmed bytes */
int (*prog)(const struct flash_alg_info *alg, uint32_t addr, const void *data, long count);
/* Erase all sectors overlaped by region from addr of size bytes, size=0 => erase all */
/* This version is capable only of full erase (size=0) and one sector (size=1) */
int (*erase)(const struct flash_alg_info *alg, uint32_t addr, long size);
/* Numeric and string fields follows */
uint32_t addr_mask; /* Mask to take offset inside flash */
uint32_t reg1_addr; /* Flash control register 1 */
uint32_t reg2_addr; /* Flash control register 2 */
uint32_t sec_size; /* block size of bigger blocks */
flash_d_t width; /* FLASH_ALG_BITS_x8 .. 8 bit data bus,
FLASH_ALG_BITS_x16 .. 16 bit data,
FLASH_ALG_BITS_x8x2 .. two interleaved 8 bit */
flash_d_t cmd_unlock1;/* first byte of command sequence */
flash_d_t cmd_unlock2;/* second byte of command sequence */
flash_d_t cmd_rdid; /* read identifier */
flash_d_t cmd_prog; /* program one loc */
flash_d_t cmd_erase; /* erase command */
flash_d_t cmd_reset; /* leave program mode */
flash_d_t erase_all; /* erase all */
flash_d_t erase_sec; /* erase sector */
flash_d_t fault_bit; /* programing of location failed */
flash_d_t manid; /* manufacturer ID */
flash_d_t devid; /* device ID */
char *alg_name; /* informative flash type name */
} flash_alg_info_t;
int bdmflash_check_id(const flash_alg_info_t *alg, uint32_t addr,
flash_d_t retid[2]);
int bdmflash_prog(const flash_alg_info_t *alg, uint32_t addr, const void *data, long count);
int bdmflash_erase(const flash_alg_info_t *alg, uint32_t addr, long size);
flash_alg_info_t **flash_alg_infos;
const flash_alg_info_t *bdmflash_alg_from_id(flash_d_t id[2]);
const flash_alg_info_t *bdmflash_alg_probe(uint32_t flash_adr);
int bdmflash_wrb_filt(bdmlib_bfilt_t * filt, uint32_t in_adr,
unsigned int size, u_char * bl_ptr);
int bdmflash_erase_filt(bdmlib_bfilt_t * filt, uint32_t in_adr, unsigned int size);
int bdmflash_blankck_filt(bdmlib_bfilt_t * filt, uint32_t in_adr, unsigned int size);
int bdmflash_check_id(const flash_alg_info_t *alg, uint32_t addr, flash_d_t retid[2]);
#endif /* BDMFLASH_H */

448
m68k/flashlib/elf-utils.c Executable file
View File

@@ -0,0 +1,448 @@
/*
* $Id: elf-utils.c,v 1.2 2008/07/31 01:53:44 cjohns Exp $
*
* Motorola Background Debug Mode Driver
* Copyright (C) 2008 Chris Johns
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
*
* ELF Support for libelf.
*/
#include <fcntl.h>
#include <string.h>
#include <stdint.h>
#include <elf-utils.h>
#if defined (__WIN32__)
#define ELF_OPEN_MODE (O_RDONLY | O_BINARY)
#else
#define ELF_OPEN_MODE (O_RDONLY)
#endif
void
elf_handle_init (elf_handle* handle)
{
memset (handle, 0, sizeof (*handle));
}
int
elf_open (const char* file, elf_handle* handle, elf_output output)
{
if (handle->fd)
{
if (output)
output ("elf-utils: ELF handle already initialised\n");
return 0;
}
if (elf_version (EV_CURRENT) == EV_NONE)
{
if (output)
output ("elf-utils: ELF library initialization failed: %s\n",
elf_errmsg (-1));
return 0;
}
handle->output = output;
if ((handle->fd = open (file, ELF_OPEN_MODE, 0)) < 0)
{
if (handle->output)
output ("elf-utils: open %s failed\n", file);
return 0;
}
if ((handle->elf = elf_begin (handle->fd, ELF_C_READ, NULL)) == NULL)
{
close (handle->fd);
handle->fd = 0;
if (handle->output)
output ("elf-utils: elf_begin failed: %s\n", elf_errmsg (-1));
return 0;
}
handle->file = strdup (file);
handle->ek = elf_kind (handle->elf);
/*
* Check the executable header.
*/
if (gelf_getehdr (handle->elf, &handle->ehdr) == NULL)
{
if (handle->output)
output ("elf-utils: elf_getehdr failed: %s\n", elf_errmsg (-1));
elf_close (handle);
return 0;
}
if (handle->ehdr.e_machine != EM_68K)
{
if (handle->output)
output ("elf-utils: machine type not Motorola 68000\n");
elf_close (handle);
return 0;
}
if ((handle->ehdr.e_type != ET_REL) && (handle->ehdr.e_type != ET_EXEC))
{
output ("elf-utils: file type no relocable or executable\n");
elf_close (handle);
return 0;
}
if ((handle->eclass = gelf_getclass (handle->elf)) == ELFCLASSNONE)
{
if (handle->output)
output ("elf-utils: elf_getclass failed: %s\n", elf_errmsg (-1));
elf_close (handle);
return 0;
}
/*
* No 64-bit Coldfires yet !
*/
if (handle->eclass != ELFCLASS32)
{
if (handle->output)
output ("elf-utils: ELF 64-bit, only 32-bit support: %s\n",
handle->file);
elf_close (handle);
return 0;
}
if (elf_getshnum (handle->elf, &handle->shnum) == 0)
{
if (handle->output)
output ("elf-utils: elf_getshnum failed: %s\n", elf_errmsg (-1));
elf_close (handle);
return 0;
}
if (elf_getshstrndx (handle->elf, &handle->shstrndx) == 0)
{
if (handle->output)
output ("elf-utils: elf_getshstrndx failed: %s\n", elf_errmsg (-1));
elf_close (handle);
return 0;
}
if (elf_getphnum (handle->elf, &handle->phnum) == 0)
{
if (handle->output)
output ("elf-utils: elf_getphnum failed: %s\n", elf_errmsg (-1));
elf_close (handle);
return 0;
}
return 1;
}
int
elf_close (elf_handle* handle)
{
if (!handle->fd)
return 0;
elf_end (handle->elf);
close (handle->fd);
free (handle->file);
handle->elf = NULL;
handle->file = NULL;
handle->fd = 0;
return 1;
}
int
elf_has_symbol_table (elf_handle* handle)
{
Elf_Scn* section = NULL;
while ((section = elf_nextscn (handle->elf, section)) != 0)
{
GElf_Shdr shdr;
if (gelf_getshdr (section, &shdr) != &shdr)
{
if (shdr.sh_type == SHT_SYMTAB)
{
Elf_Data* data = NULL;
data = elf_getdata (section, data);
if ((data == NULL) || (data->d_size == 0))
return 0;
return 1;
}
}
}
return 0;
}
int
elf_get_symbol (elf_handle* handle, const char* label, GElf_Sym* sym)
{
Elf_Scn* section = NULL;
while ((section = elf_nextscn (handle->elf, section)) != 0)
{
GElf_Shdr shdr;
if (gelf_getshdr (section, &shdr) == &shdr)
{
if (shdr.sh_type == SHT_SYMTAB)
{
Elf_Data* data = NULL;
int symbol = 0;
char* name;
data = elf_getdata (section, data);
if ((data == NULL) || (data->d_size == 0))
return 0;
while (gelf_getsym (data, symbol, sym) == sym)
{
name = elf_strptr (handle->elf,
shdr.sh_link, (size_t) sym->st_name);
if (!name)
{
if (handle->output)
handle->output ("elf-utils: find symbol: %s\n",
elf_errmsg (elf_errno ()));
return 0;
}
if (strcmp (label, name) == 0)
return 1;
symbol++;
}
}
}
}
return 0;
}
int
elf_get_section_hdr (elf_handle* handle, int secindex, GElf_Shdr* shdr)
{
Elf_Scn* section = NULL;
int count = 1;
while ((section = elf_nextscn (handle->elf, section)) != 0)
{
if (count == secindex)
{
if (gelf_getshdr (section, shdr) == shdr)
{
return 1;
}
}
count++;
}
return 0;
}
void*
elf_get_section_data (elf_handle* handle, int secindex, uint32_t* size)
{
Elf_Scn* section = NULL;
int count = 1;
*size = 0;
while ((section = elf_nextscn (handle->elf, section)) != 0)
{
if (count == secindex)
{
Elf_Data* data = NULL;
void* buffer;
data = elf_getdata (section, data);
if (data == NULL)
return NULL;
*size = (uint32_t) data->d_size;
return data->d_buf;
}
count++;
}
return 0;
}
void*
elf_get_section_data_sym (elf_handle* handle, const char* label)
{
GElf_Sym esym;
if (elf_get_symbol (handle, label, &esym))
{
Elf_Scn* section = NULL;
int count = 1;
while ((section = elf_nextscn (handle->elf, section)) != 0)
{
if (count == esym.st_shndx)
{
Elf_Data* data = NULL;
data = elf_getdata (section, data);
if ((data == NULL) || (data->d_size == 0))
return NULL;
return ((uint8_t *) data->d_buf) + esym.st_value;
}
count++;
}
}
return NULL;
}
int
elf_map_over_sections (elf_handle* handle, elf_section_handler handler,
const char* sname)
{
/*
* We need to iterate over the sections, and then for each section we decide
* to load, we need to find the program header for that section. we match
* the program header by finding the program header that has the same virtaul
* address range. This yields us with the physical address which is needed
* to know where to load the section on the target. I don't know if this is
* the correct way to do this, if not, please fix.
*/
Elf_Scn* section = NULL;
int count = 1;
size_t num_headers = 0;
if (elf_getphnum (handle->elf, &num_headers) == 0)
{
if (handle->output)
handle->output ("elf-utils: elf_getphnum error\n");
return 0;
}
while ((section = elf_nextscn (handle->elf, section)) != 0)
{
GElf_Shdr shdr;
if (gelf_getshdr (section, &shdr) == &shdr) {
const char* name;
name = elf_strptr (handle->elf, handle->shstrndx, shdr.sh_name);
if (!sname || (strcmp (sname, name) == 0))
{
/*
* Find a LOAD program header in the same virtual address range.
*/
GElf_Addr vaddr = shdr.sh_addr - shdr.sh_offset;
GElf_Phdr phdr;
size_t i;
for (i = 0; i < num_headers; ++i)
{
if (gelf_getphdr (handle->elf, i, &phdr) != &phdr)
{
if (handle->output)
handle->output ("elf-utils: gelf_getphdr error\n");
return 0;
}
if(phdr.p_type == PT_LOAD)
{
if(phdr.p_vaddr <= shdr.sh_addr &&
phdr.p_vaddr + phdr.p_memsz > shdr.sh_addr)
break;
}
}
if(!handler (handle, (i == num_headers) ? 0 : &phdr, &shdr, name, count))
return 0;
}
}
++count;
}
return 1;
}
#define PRINT_FORMAT " %-12s %d\n"
#define PRINT_FORMAT_X " %-12s 0x%x\n"
void
elf_show_exeheader (elf_handle* handle)
{
#define EHDR_PRINT_FIELD(N) do { \
handle->output (PRINT_FORMAT ,#N, (uintmax_t) handle->ehdr.N); \
} while (0)
char* s;
if (!handle->output)
return;
switch (handle->ek)
{
case ELF_K_AR:
s = "ar(1) archive";
break;
case ELF_K_ELF:
s = "elf object";
break;
case ELF_K_NONE:
s = "data";
break;
default:
s = "unrecognized";
}
handle->output ("%s: %s\n", handle->file, s);
EHDR_PRINT_FIELD (e_type);
EHDR_PRINT_FIELD (e_machine);
EHDR_PRINT_FIELD (e_version);
EHDR_PRINT_FIELD (e_entry);
EHDR_PRINT_FIELD (e_phoff);
EHDR_PRINT_FIELD (e_shoff);
EHDR_PRINT_FIELD (e_flags);
EHDR_PRINT_FIELD (e_ehsize);
EHDR_PRINT_FIELD (e_phentsize);
EHDR_PRINT_FIELD (e_shentsize);
handle->output (PRINT_FORMAT, "(shnum)", (uintmax_t) handle->shnum);
handle->output (PRINT_FORMAT, "(shstrndx)", (uintmax_t) handle->shstrndx);
handle->output (PRINT_FORMAT, "(phnum)", (uintmax_t) handle->phnum);
}
void
elf_show_symbol (elf_handle* handle, GElf_Sym* esym)
{
#define ESYM_PRINT_FIELD(N) do { \
handle->output (PRINT_FORMAT_X ,#N, (uintmax_t) esym->N); \
} while (0)
if (!handle->output)
return;
ESYM_PRINT_FIELD (st_name);
ESYM_PRINT_FIELD (st_value);
ESYM_PRINT_FIELD (st_size);
ESYM_PRINT_FIELD (st_info);
ESYM_PRINT_FIELD (st_other);
ESYM_PRINT_FIELD (st_shndx);
}

76
m68k/flashlib/elf-utils.h Executable file
View File

@@ -0,0 +1,76 @@
/*
* Motorola Background Debug Mode Driver
* Copyright (C) 2008 Chris Johns
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
*
* ELF Support for libelf.
*/
#if !defined (_ELF_UTILS_H_)
#define _ELF_UTILS_H_
#define __LIBELF_INTERNAL__ 1
#include <gelf.h>
/*
* Output routine.
*/
typedef int (*elf_output) (const char *format, ...);
/*
* Handle to access the file via libelf.
*/
typedef struct
{
char* file;
int fd;
Elf* elf;
Elf_Kind ek;
GElf_Ehdr ehdr;
int eclass;
size_t shnum;
size_t shstrndx;
size_t phnum;
elf_output output;
} elf_handle;
/*
* Section handler.
*/
typedef int (*elf_section_handler) (elf_handle* handle,
GElf_Phdr* phdr,
GElf_Shdr* shdr,
const char* sname,
int sindex);
void elf_handle_init (elf_handle* handle);
int elf_open (const char* file, elf_handle* handle, elf_output output);
int elf_close (elf_handle* handle);
int elf_get_symbol (elf_handle* handle, const char* label, GElf_Sym* sym);
int elf_get_section_hdr (elf_handle* handle, int secindex, GElf_Shdr* shdr);
void* elf_get_section_data (elf_handle* handle, int secindex,
uint32_t* size);
void* elf_get_section_data_sym (elf_handle* handle, const char* label);
int elf_map_over_sections (elf_handle* handle,
elf_section_handler handler, const char* sname);
void elf_show_exeheader (elf_handle* handle);
void elf_show_symbol (elf_handle* handle, GElf_Sym* esym);
#endif

689
m68k/flashlib/flash29.c Normal file
View File

@@ -0,0 +1,689 @@
/* $Id: flash29.c,v 1.6 2008/07/31 01:53:44 cjohns Exp $
*
* Driver for 29Fxxx and 49Fxxx flash chips.
*
* 2003-12-28 Josef Wolf (jw@raven.inka.de)
*
* Portions of this program which I authored may be used for any purpose
* so long as this notice is left intact.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/* This piece of code arose from ad-hoc code-snippets which I threw into
discussions on the bdm-devel mailing list and in private mails to Pavel
Pisa. I have put those pieces together, removed compiler-errors, rewrote
them several times and optimized somewhat.
This code supports:
- 29Fxxx and 49Fxxx types of flash chips.
- Host-only, target-assisted and target-only operation modes.
- Bus widths of 1, 2 and 4 bytes.
- Chip widths of 1, 2 and 4 bytes.
- Autodetection of known chips on arbitrary bus/chip width combinations.
- Fast bypass unlock programming mode on chips that support it.
- Unaligned programming.
*/
/* Todo:
CSI command set? What is this?
CFI specification http://www.amd.com/products/nvd/overview/cfi.html
*/
#include "flash29.h"
#include "flash_filter.h"
#if HOST_FLASHING
# include <stdio.h>
# include <BDMlib.h>
#endif
/* This defines details for the flash algorithm.
*/
typedef struct
{
uint32_t cmd_unlock1;
uint32_t cmd_unlock2;
uint32_t cmd_reset;
uint32_t cmd_autoselect;
uint32_t cmd_program;
uint32_t cmd_erase;
uint32_t cmd_chiperase;
uint32_t cmd_secterase;
uint32_t cmd_bypass;
uint32_t cmd_resbypass1;
uint32_t cmd_resbypass2;
uint32_t timeout_mask;
uint32_t adr_unlock1;
uint32_t adr_unlock2;
} alg_info_t;
typedef struct
{
const char *name;
const uint32_t manufacturer, device_id;
const uint32_t size; /* in bytes */
const alg_info_t *alg_info;
} chip_t;
typedef struct
{
const alg_info_t *alg_info; /* algorithm information */
uint32_t adr; /* base adress of the chip */
uint32_t size; /* in bytes */
uint32_t chip_width; /* 1->8bit, 2->16bit, 4->32bit */
uint32_t bus_width; /* 1->8bit, 2->16bit, 4->32bit */
uint32_t wait_adr; /* address to check when waiting for erase */
/* From here on, everything is redundant. The only reason to maintain this
redundant information is optimization. */
uint32_t reg1; /* address of unlock register 1 */
uint32_t reg2; /* address of unlock register 2 */
/* This information is placed at the end of the struct because
download_struct() don't need to fiddle around with it. */
void (*wr_func) (uint32_t, uint32_t); /* write function */
uint32_t(*rd_func) (uint32_t); /* read function */
uint32_t bus_mask; /* Mask to get bus_width lowest bytes */
uint32_t chip_mask; /* Mask to get chip_width lowest bytes */
uint32_t shift; /* shift for multiplication by bus_width */
} chiptype_t;
static const alg_info_t alg_29_std = { /* standard 29fxx chips */
0xaaaaaaaa, /* unlock 1 command */
0x55555555, /* unlock 2 command */
0xf0f0f0f0, /* res */
0x90909090, /* asel */
0xa0a0a0a0, /* prog */
0x80808080, /* erase */
0x10101010, /* chiperase */
0x30303030, /* secterase */
0x00000000, /* no unlock bypass */
0x90909090, /* unlock bypass res1 */
0x00000000, /* unlock bypass res2 */
0x20, /* timeout bitmask */
0x555, /* register 1 */
0x2aa, /* register 5 */
};
static const alg_info_t alg_29_unl = { /* 29fxx with unlock bypass mode */
0xaaaaaaaa, /* unlock 1 command */
0x55555555, /* unlock 2 command */
0xf0f0f0f0, /* res */
0x90909090, /* asel */
0xa0a0a0a0, /* prog */
0x80808080, /* erase */
0x10101010, /* chiperase */
0x30303030, /* secterase */
0x20202020, /* unlock bypass */
0x90909090, /* unlock bypass res1 */
0x00000000, /* unlock bypass res2 */
0x20, /* timeout bitmask */
0x555, /* register 1 */
0x2aa, /* register 5 */
};
static const alg_info_t alg_49 = { /* 49fxx and 39fxx chips */
0xaaaaaaaa, /* unlock 1 command */
0x55555555, /* unlock 2 command */
0xf0f0f0f0, /* res */
0x90909090, /* asel */
0xa0a0a0a0, /* prog */
0x80808080, /* erase */
0x10101010, /* chiperase */
0x30303030, /* secterase *//* Block erase ? */
0x00000000, /* no unlock bypass */
0x90909090, /* unlock bypass res1 */
0x00000000, /* unlock bypass res2 */
0x00, /* no timeout support */
0x5555, /* register 1 */
0x2aaa, /* register 5 */
};
/* Here come the known chips.
*/
static const chip_t chips[] = {
{"Am29LV001BT", 0x01, 0xed, 0x20000, &alg_29_unl}, /* AMD */
{"Am29LV001BB", 0x01, 0x6d, 0x20000, &alg_29_unl}, /* AMD */
{"Am29LV002T", 0x01, 0x40, 0x40000, &alg_29_std}, /* AMD */
{"Am29LV002B", 0x01, 0xc2, 0x40000, &alg_29_std}, /* AMD */
{"Am29LV004T", 0x01, 0xb5, 0x80000, &alg_29_std}, /* AMD */
{"Am29LV004B", 0x01, 0xb6, 0x80000, &alg_29_std}, /* AMD */
{"Am29LV008BT", 0x01, 0x3e, 0x100000, &alg_29_unl}, /* AMD */
{"Am29LV008BB", 0x01, 0x37, 0x100000, &alg_29_unl}, /* AMD */
{"Am29LV017B", 0x01, 0xc8, 0x200000, &alg_29_unl}, /* AMD */
{"Am29F010B", 0x01, 0x20, 0x20000, &alg_29_std}, /* AMD */
{"At49F040", 0x1f, 0x13, 0x80000, &alg_49}, /* Atmel */
{"Am29F040B", 0x01, 0xa4, 0x80000, &alg_29_std}, /* AMD */
{"Am29F400BT", 0x01, 0x2223, 0x80000, &alg_29_std}, /* AMD */
{"Am29F400BB", 0x01, 0x22ab, 0x80000, &alg_29_std}, /* AMD */
{"MBM29F400TC", 0x04, 0x2223, 0x80000, &alg_29_std}, /* Fujitsu */
{"MBM29F400BC", 0x04, 0x22ab, 0x80000, &alg_29_std}, /* Fujitsu */
{"M29F400BB", 0x20, 0x22d6, 0x80000, &alg_29_unl}, /* ST */
{"M29F400BB", 0x20, 0x22d5, 0x80000, &alg_29_unl}, /* ST */
{"Am29F080B", 0x01, 0xd5, 0x100000, &alg_29_std}, /* AMD */
{"Am29F800BT", 0x01, 0x22d6, 0x100000, &alg_29_std}, /* AMD */
{"Am29F800BB", 0x01, 0x2258, 0x100000, &alg_29_std}, /* AMD */
{"Am29PL160C", 0x01, 0x2245, 0x200000, &alg_29_unl}, /* AMD */
{"Am29LV160B", 0x01, 0x2249, 0x200000, &alg_29_unl}, /* AMD */
{"M29LV160B", 0x20, 0x2249, 0x200000, &alg_29_unl}, /* ST */
{"HY29LV160B", 0xad, 0x2249, 0x200000, &alg_29_unl}, /* HYRIX */
{"MX29LV160B", 0xc2, 0x2245, 0x200000, &alg_29_unl}, /* MACRONIX */
{"TC58FVB160A", 0x98, 0x0043, 0x200000, &alg_29_unl}, /* TOSHIBA */
{"Am29LV320B", 0x01, 0x22f9, 0x400000, &alg_29_unl}, /* AMD */
{"HY29LV320B", 0xad, 0x227d, 0x400000, &alg_29_unl}, /* HYRIX */
{"MX29LV320B", 0xc2, 0x22a8, 0x400000, &alg_29_unl}, /* MACRONIX */
{"TC58FVM5B2A", 0x98, 0x0055, 0x400000, &alg_29_unl}, /* TOSHIBA */
{"TC58FVM5B3A", 0x98, 0x0050, 0x400000, &alg_29_unl}, /* TOSHIBA */
{"Am29LV640MB", 0x01, 0x227e, 0x800000, &alg_29_unl}, /* AMD */
{"M29W640DB", 0x20, 0x22df, 0x800000, &alg_29_unl}, /* ST */
{"MBM29DLV640E", 0x04, 0x227e, 0x800000, &alg_29_std}, /* FUJITSU */
{"MX29LV640MB", 0xc2, 0x22cb, 0x800000, &alg_29_unl}, /* MACRONIX */
{"TC58FVM6B2A", 0x98, 0x0058, 0x800000, &alg_29_unl}, /* TOSHIBA */
{"Sst39VF1601", 0xbf, 0x234b, 0x200000, &alg_49}, /* SST */
{"Sst39VF1602", 0xbf, 0x234a, 0x200000, &alg_49}, /* SST */
{"Sst39VF3201", 0xbf, 0x235b, 0x400000, &alg_49}, /* SST */
{"Sst39VF3202", 0xbf, 0x235a, 0x400000, &alg_49}, /* SST */
{"Sst39VF6401", 0xbf, 0x236b, 0x800000, &alg_49}, /* SST */
{"Sst39VF6402", 0xbf, 0x236a, 0x800000, &alg_49}, /* SST */
};
/* define the actual access functions to the flash. There are three orthogonal
aspects for the access functions:
1. Every bus_width needs its own set of functions because we need to access
the chips with bus_width width. This is to avoid the access be split up
into several accesses, which could abort a started command.
2. Bus accesses need two functions: one for reading and one for writing.
3. In addition, we need a second set of functions for host-assisted access.
*/
#if HOST_FLASHING
# define DEFINE_READ_FUNC(funcname,vartype,bdmfunc) \
static uint32_t funcname (uint32_t adr) { \
vartype val; \
if (bdmfunc (adr, &val) < 0) \
fprintf (stderr, #bdmfunc "(0x%08lx,xxx): %s\n", \
adr, bdmErrorString()); \
return (uint32_t) val; \
}
# define DEFINE_WRITE_FUNC(funcname,vartype,bdmfunc) \
static void funcname (uint32_t adr, uint32_t val) { \
if (bdmfunc (adr, val) < 0) \
fprintf (stderr, #bdmfunc "(0x%08lx,0x%08x): %s\n", \
adr, val, bdmErrorString()); \
}
#else
# define DEFINE_READ_FUNC(funcname,vartype,bdmfunc) \
static uint32_t funcname (uint32_t adr) { \
return *(volatile vartype *)adr; \
}
# define DEFINE_WRITE_FUNC(funcname,vartype,bdmfunc) \
static void funcname (uint32_t adr,uint32_t val) { \
*(volatile vartype *)adr = val; \
}
#endif
DEFINE_READ_FUNC(chip_rd_char, unsigned char, bdmReadByte)
DEFINE_READ_FUNC(chip_rd_word, unsigned short, bdmReadWord)
DEFINE_READ_FUNC(chip_rd_long, unsigned long, bdmReadLongWord)
DEFINE_WRITE_FUNC(chip_wr_char, uint8_t, bdmWriteByte)
DEFINE_WRITE_FUNC(chip_wr_word, uint16_t, bdmWriteWord)
DEFINE_WRITE_FUNC(chip_wr_long, uint32_t, bdmWriteLongWord)
/* We need a unique symbol to associate a (target-based) plugin with its
(host-based) driver.
*/
static char driver_magic[] = "flash29";
/* Populate the the chiptype structure with bus_width specific information.
This information is redundant. It is maintained here only for
optimizations.
*/
static void
set_chip_access(chiptype_t * ct, uint32_t bus_width)
{
ct->bus_width = bus_width;
switch (bus_width) {
case 1:
ct->shift = 0;
ct->bus_mask = 0x0ff;
ct->wr_func = chip_wr_char;
ct->rd_func = chip_rd_char;
break;
case 2:
ct->shift = 1;
ct->bus_mask = 0x0ffff;
ct->wr_func = chip_wr_word;
ct->rd_func = chip_rd_word;
break;
case 4:
ct->shift = 2;
ct->bus_mask = 0x0ffffffff;
ct->wr_func = chip_wr_long;
ct->rd_func = chip_rd_long;
break;
}
ct->chip_mask = (0x100 << ((ct->chip_width - 1) << 3)) - 1;
}
/* Wait for the chip to complete an erase/program command. Pavel Pisa mentioned
that there's probably a racing condition in this code, so we will need to
take a closer look on this one.
*/
static int
wait_chip(chiptype_t * ct, uint32_t adr, uint32_t expect)
{
uint32_t i;
uint32_t rval;
uint32_t bus_mask = ct->bus_mask;
uint32_t chip_mask = ct->chip_mask;
uint32_t tout_mask = ct->alg_info->timeout_mask;
uint32_t(*rd_func) (uint32_t) = ct->rd_func;
uint32_t last_val = (rd_func(adr) & bus_mask);
while ((rval = (rd_func(adr) & bus_mask)) != (expect & bus_mask)) {
/* We don't want to loop forever when we accidentally try to program an
EPROM. So we expect at least one toggle-bit to change. */
if (last_val == rval)
return 0;
/* loop over chips */
for (i = 0; i < ct->bus_width; i += ct->chip_width) {
/* shift to get bits of this chip onto the lowest bits. */
uint32_t shift = i << 3;
uint32_t shifted_chip_mask = chip_mask << shift;
/* check whether chip i signalled timeout. */
if ((rval >> shift) & tout_mask)
return 0;
/* check whether chip i returned expected data. */
if (!(((rval ^ expect) & shifted_chip_mask))) {
/* Yes, we're not interested in results from this chip anymore. */
bus_mask &= ~shifted_chip_mask;
}
}
last_val = rval;
}
return 1;
}
#if HOST_FLASHING
static char *
prog_entry(void)
{
return "flash29_prog";
}
#endif
/* The actual programming function
*/
static uint32_t
flash29_prog(void *chip_descr,
uint32_t pos, unsigned char *data, uint32_t cnt)
{
uint32_t i, align;
void (*wr_func) (uint32_t, uint32_t);
uint32_t val = 0;
chiptype_t *ct = chip_descr;
uint32_t reg1 = ct->reg1;
uint32_t reg2 = ct->reg2;
uint32_t siz = ct->bus_width;
const alg_info_t *alg_info = ct->alg_info;
uint32_t cmd_bypass = alg_info->cmd_bypass;
uint32_t cmd_reset = alg_info->cmd_reset;
uint32_t cmd_prog = alg_info->cmd_program;
uint32_t cmd_unlock1 = alg_info->cmd_unlock1;
uint32_t cmd_unlock2 = alg_info->cmd_unlock2;
set_chip_access(ct, siz);
wr_func = ct->wr_func;
/* handle unaligned programming */
align = pos & ((1 << (siz - 1)) - 1);;
pos &= ~align;
for (i = 0; i < align; i++) {
val <<= 8;
val |= chip_rd_char(pos + i);
}
if (cmd_bypass) {
wr_func(reg1, cmd_reset);
wr_func(reg1, cmd_unlock1);
wr_func(reg2, cmd_unlock2);
wr_func(reg1, cmd_bypass);
}
i = 0;
#if FLASH_OPTIMIZE_FOR_SPEED
switch (siz) {
# if FLASH_BUS_WIDTH1
case 1:
for (; i < cnt; i++) {
if (!cmd_bypass) {
chip_wr_char(reg1, cmd_reset);
chip_wr_char(reg1, cmd_unlock1);
chip_wr_char(reg2, cmd_unlock2);
}
chip_wr_char(reg1, cmd_prog);
val = *data++;
chip_wr_char(pos, val);
if (!wait_chip(ct, pos, val))
break; /* error out */
pos++;
}
# endif
# if FLASH_BUS_WIDTH2
case 2:
if (align)
goto W1;
while (i < cnt) {
val = (val << 8) | *data++;
W1:val =
(val << 8) | (i++ <
cnt ? *data++ : chip_rd_char(pos + 1));
if (!cmd_bypass) {
chip_wr_word(reg1, cmd_reset);
chip_wr_word(reg1, cmd_unlock1);
chip_wr_word(reg2, cmd_unlock2);
}
chip_wr_word(reg1, cmd_prog);
chip_wr_word(pos, val);
if (!wait_chip(ct, pos, val))
break; /* error out */
pos += 2;
i++;
val = 0;
}
break;
# endif
# if FLASH_BUS_WIDTH4
case 4:
switch (align) {
case 1:
goto L1;
case 2:
goto L2;
case 3:
goto L3;
}
while (i < cnt) {
val = (val << 8) | *data++;
L1:val =
(val << 8) | (i++ <
cnt ? *data++ : chip_rd_char(pos + 1));
L2:val =
(val << 8) | (i++ <
cnt ? *data++ : chip_rd_char(pos + 2));
L3:val =
(val << 8) | (i++ <
cnt ? *data++ : chip_rd_char(pos + 3));
if (!cmd_bypass) {
chip_wr_long(reg1, cmd_reset);
chip_wr_long(reg1, cmd_unlock1);
chip_wr_long(reg2, cmd_unlock2);
}
chip_wr_long(reg1, cmd_prog);
chip_wr_long(pos, val);
if (!wait_chip(ct, pos, val))
break; /* error out */
pos += 4;
i++;
val = 0;
}
break;
# endif
}
#else
while (i < cnt) {
uint32_t j;
for (j = 0; j < siz - align; j++) {
val <<= 8;
val |= i + j < cnt ? *data++ : chip_rd_char(pos + j);
}
if (!cmd_bypass) {
wr_func(reg1, cmd_reset);
wr_func(reg1, cmd_unlock1);
wr_func(reg2, cmd_unlock2);
}
wr_func(reg1, cmd_prog);
wr_func(pos, val);
if (!wait_chip(ct, pos, val))
break; /* error out */
pos += siz;
i += siz;
val = 0;
align = 0;
}
#endif
if (cmd_bypass) {
wr_func(reg1, ct->alg_info->cmd_resbypass1);
wr_func(reg2, ct->alg_info->cmd_resbypass2);
}
return i > cnt ? cnt : i;
}
/* Initiate erase operation. Sector address is relative to chip-base.
With sector address==-1, the whole chip is erased. The erase operation
can be called several times before flash_29_erase_wait() is called for
simultanous erasure of multiple sectors.
*/
static void
flash29_erase(void *chip_descr, int32_t sector_address)
{
chiptype_t *ct = chip_descr;
uint32_t reg1 = ct->reg1;
uint32_t reg2 = ct->reg2;
const alg_info_t *alg_info = ct->alg_info;
void (*wr_func) (uint32_t, uint32_t) = ct->wr_func;
wr_func(reg1, alg_info->cmd_reset);
wr_func(reg1, alg_info->cmd_unlock1);
wr_func(reg2, alg_info->cmd_unlock2);
wr_func(reg1, alg_info->cmd_erase);
wr_func(reg1, alg_info->cmd_unlock1);
wr_func(reg2, alg_info->cmd_unlock2);
if (sector_address >= 0 && sector_address < ct->size) {
ct->wait_adr = ct->adr + (sector_address << ct->shift);
wr_func(ct->wait_adr, alg_info->cmd_secterase);
} else {
ct->wait_adr = ct->adr;
wr_func(reg1, alg_info->cmd_chiperase);
}
}
/* wait for queued erasing operations to finish
*/
static int
flash29_erase_wait(void *chip_descr)
{
chiptype_t *ct = chip_descr;
return wait_chip(ct, ct->wait_adr, ct->bus_mask);
}
#if HOST_FLASHING
/* read the chip ID
*/
static uint32_t
read_id(chiptype_t * ct, int adr)
{
unsigned int ret;
uint32_t reg1 = ct->reg1;
uint32_t reg2 = ct->reg2;
const alg_info_t *alg_info = ct->alg_info;
void (*wr_func) (uint32_t, uint32_t) = ct->wr_func;
wr_func(reg1, alg_info->cmd_reset);
wr_func(reg1, alg_info->cmd_unlock1);
wr_func(reg2, alg_info->cmd_unlock2);
wr_func(reg1, alg_info->cmd_autoselect);
ret = ct->rd_func(ct->adr + (adr << ct->shift));
wr_func(reg1, alg_info->cmd_reset);
return ret;
}
/* autodetect a 29Fxxx type chip
*/
static uint32_t
flash29_search_chip(void *chip_descr, char *description, uint32_t pos)
{
chiptype_t *ct = chip_descr;
int i, j, bw, cw;
uint32_t m, d;
uint32_t exp;
const alg_info_t *alg_info;
const chip_t *chip;
ct->adr = pos;
for (bw = 4; bw; bw >>= 1) {
for (cw = bw; cw; cw >>= 1) {
ct->chip_width = cw;
set_chip_access(ct, bw);
for (i = 0; i < NUMOF(chips); i++) {
chip = &chips[i];
ct->size = chip->size * (bw / cw);
ct->alg_info = alg_info = chip->alg_info;
ct->reg1 = pos + ((alg_info->adr_unlock1) << (ct->shift));
ct->reg2 = pos + ((alg_info->adr_unlock2) << (ct->shift));
if ((m = read_id(ct, 0)) != chip->manufacturer)
continue;
exp = 0;
for (j = 0; j < bw; j += cw) {
exp <<= ((cw - 1) << 3);
exp |= (chip->device_id) & (ct->chip_mask);
}
if ((d = read_id(ct, 1)) != exp)
continue;
/* check if we are just reading ram */
if (m == ct->rd_func(pos) && d == ct->rd_func(pos + (1 << ct->shift)))
return 0;
if (description) {
sprintf(description, "%10s @ 0x%08lx..0x%08lx "
"bw:%d cw:%d manuf:0x%02lx device:0x%04lx size:0x%08lx",
chip->name, pos, pos + ct->size, bw, cw, m, d, ct->size);
}
return ct->size;
}
}
}
return 0;
}
# define CHIP_WR(base,str,field,val) \
chip_wr_long((base)+(((unsigned char*)&((str)->field)) - \
((unsigned char*)str)), \
(val));
/* FIXME: this function assumes that data sizes and alignment requirements
on target and host are identical.
*/
static int
download_struct(void *chip_descr, uint32_t adr)
{
chiptype_t *ct = chip_descr;
const alg_info_t *alg = ct->alg_info;
uint32_t alg_adr = adr + sizeof(*ct);
CHIP_WR(adr, ct, alg_info, alg_adr);
CHIP_WR(adr, ct, adr, ct->adr);
CHIP_WR(adr, ct, size, ct->size);
CHIP_WR(adr, ct, chip_width, ct->chip_width);
CHIP_WR(adr, ct, bus_width, ct->bus_width);
CHIP_WR(adr, ct, reg1, ct->reg1);
CHIP_WR(adr, ct, reg2, ct->reg2);
CHIP_WR(alg_adr, alg, cmd_unlock1, alg->cmd_unlock1);
CHIP_WR(alg_adr, alg, cmd_unlock2, alg->cmd_unlock2);
CHIP_WR(alg_adr, alg, cmd_reset, alg->cmd_reset);
CHIP_WR(alg_adr, alg, cmd_program, alg->cmd_program);
CHIP_WR(alg_adr, alg, cmd_bypass, alg->cmd_bypass);
CHIP_WR(alg_adr, alg, cmd_resbypass1, alg->cmd_resbypass1);
CHIP_WR(alg_adr, alg, cmd_resbypass2, alg->cmd_resbypass2);
CHIP_WR(alg_adr, alg, timeout_mask, alg->timeout_mask);
return alg_adr + sizeof(*alg);
}
void
init_flash29(int num)
{
register_algorithm(num, driver_magic, sizeof(chiptype_t),
download_struct,
flash29_search_chip,
flash29_erase, 0, flash29_erase_wait, flash29_prog,
prog_entry);
}
#else
void
init_flash29(int num)
{
register_algorithm(num, driver_magic, 0, 0, 0,
flash29_erase, 0, flash29_erase_wait, flash29_prog, 0);
}
#endif

47
m68k/flashlib/flash29.h Normal file
View File

@@ -0,0 +1,47 @@
/* $Id: flash29.h,v 1.2 2008/07/31 01:53:44 cjohns Exp $
*
* Header for 29Fxxx and 49Fxxx flash driver.
*
* 2003-12-28 Josef Wolf (jw@raven.inka.de)
*
* Portions of this program which I authored may be used for any purpose
* so long as this notice is left intact.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/* This function will be called by flash_filter and is responsible to register
the driver
*/
void init_flash29(int num);
/* following #define's should probably be set by configure
*/
/* Setting this to 0 produces more generic (and compact) code which is able
to program all bus widths at the expense of performance. Setting this
to 1 approximately doubles the programming speed on a 20MHz 68332 with
Am29F400 in 16-bit-mode.
*/
#define FLASH_OPTIMIZE_FOR_SPEED 0
/* When FLASH_OPTIMIZE_FOR_SPEED==1, selecting only required bus widths can
reduce size of generated code
*/
#define FLASH_BUS_WIDTH1 1
#define FLASH_BUS_WIDTH2 1
#define FLASH_BUS_WIDTH4 1
#if FLASH_OPTIMIZE_FOR_SPEED
# if ( !FLASH_BUS_WIDTH1 && !FLASH_BUS_WIDTH2 && !FLASH_BUS_WIDTH4 )
# error At least one bus width must be defined when FLASH_OPTIMIZE_FOR_SPEED!=0
# endif
#endif

View File

@@ -0,0 +1,654 @@
/* $Id: flash_filter.c,v 1.7 2008/09/09 11:48:50 cjohns Exp $
*
* Flash filtering layer.
*
* 2003-12-28 Josef Wolf (jw@raven.inka.de)
* 2008 Chris Johns (cjohns@users.sourceforge.net)
*
* Portions of this program which I authored may be used for any purpose
* so long as this notice is left intact.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/* This code was inspired by the filtering code from Pavel Pisa. But it was
written from scratch to achieve stronger data encapsulation and enable
target-mode plugins. For the long run, it should be extended for
target-only operation mode.
CCJ : Remove BFD support and replaced with libelf.
*/
#include "flash29.h"
#include "flashcfm.h"
#include "flashintelc3.h"
#include "flash_filter.h"
#if HOST_FLASHING
# include <errno.h>
# include <stdint.h>
# include <stdio.h>
# include <limits.h>
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <unistd.h>
# include <elf-utils.h>
# include <BDMlib.h>
#endif
#define mkstring(_s) #_s
/* Interface to flash modules.
*/
typedef struct
{
void (*init) (int);
int struct_size;
char *driver_magic;
int (*download_struct) (void *, uint32_t);
uint32_t (*search_chip) (void *, char *, uint32_t);
void (*erase) (void *, int32_t);
int (*blank_chk) (void *, int32_t);
int (*erase_wait) (void *);
uint32_t (*prog) (void *, uint32_t, unsigned char *, uint32_t);
char *(*prog_entry) (void);
unsigned char *p_code;
uint32_t p_entry;
uint32_t p_len;
uint32_t ram;
uint32_t len;
} alg_t;
/* Known flashing algorithms
*/
alg_t algorithm[] = {
{init_flash29},
{init_flashcfm},
{init_flashintelc3},
};
/* Description of memory areas.
*/
typedef struct area_s
{
uint32_t adr;
uint32_t end; /* last byte inclusive */
alg_t *alg;
void *chip_descriptor;
struct area_s *next;
} area_t;
/* Memory areas. Assume RAM for unregistered areas.
*/
static area_t ram_area = { 0, ~0, NULL, NULL, NULL, };
static area_t *area = NULL;
/* Maximum size of a chip_descriptor. Since the chip-descriptor is algorithm's
internal information, we don't know the size of the descriptor until we
know which algorithm to use. Therefore we need to allocate a maximum size
for autodetection.
*/
static int maxsiz = 0;
/* Variables.
*/
typedef struct variable_s
{
struct variable_s *next;
const char *name;
uint32_t value;
} variable_t;
static variable_t *s_variables = 0;
/* Initialize all known algorithms, determine maximum size of chip descriptors
and register RAM for whole address range.
*/
static void
init (void)
{
int i;
if (area)
return; /* Already initialized */
for (i = 0; i < NUMOF(algorithm); i++) {
algorithm[i].p_code = 0;
algorithm[i].init(i);
if (maxsiz < algorithm[i].struct_size)
maxsiz = algorithm[i].struct_size;
}
area = &ram_area; /* register RAM fallback for whole address range */
}
/* This is the callback for the init functions of the basic flash modules.
Each flash module shall register itself with this function.
Doing it this way keeps algorithm's private data private and minimizes
pollution of namespace.
*/
void
register_algorithm(int num,
char *driver_magic,
int struct_size,
int (*download_struct) (void *, uint32_t),
uint32_t (*search_chip) (void *, char *, uint32_t),
void (*erase) (void *, int32_t),
int (*blank_chk) (void *, int32_t),
int (*erase_wait) (void *),
uint32_t (*prog) (void *, uint32_t, unsigned char *,
uint32_t), char *(*prog_entry) (void))
{
algorithm[num].driver_magic = strdup(driver_magic); /* FIXME */
algorithm[num].struct_size = struct_size;
algorithm[num].download_struct = download_struct;
algorithm[num].search_chip = search_chip;
algorithm[num].erase = erase;
algorithm[num].blank_chk = blank_chk;
algorithm[num].erase_wait = erase_wait;
algorithm[num].prog = prog;
algorithm[num].prog_entry = prog_entry;
algorithm[num].p_code = NULL;
algorithm[num].p_entry = 0;
algorithm[num].p_len = 0;
algorithm[num].ram = 0;
algorithm[num].len = 0;
}
/* Search memory area where ADR belongs to.
*/
static area_t *
search_area (adr)
{
area_t *a;
for (a = area; a; a = a->next)
if (a->adr <= adr && a->end >= adr)
return a;
return NULL;
}
#if HOST_FLASHING
/* register target flash plugins. The adr/len defines a RAM area on the
target that can be used to download plugin and contents.
*/
int
elf_flash_plugin_load(int (*prfunc) (const char *format, ...),
uint32_t adr, uint32_t len, const char *fname)
{
struct stat sb;
elf_handle handle;
const char *dmagic;
const char* prefix = mkstring (PREFIX);
char* name = (char*) fname;
int i;
elf_handle_init(&handle);
if (name[0] != '/')
{
if (stat (name, &sb) < 0)
{
if (errno == ENOENT)
{
if (prefix[strlen (prefix) - 1] != '/')
{
name = strdup (prefix);
name = strcat (name, "/");
}
else
name = strdup (prefix);
name = strcat (name, "share/m68k-bdm/plugins/");
name = strcat (name, fname);
if (stat (name, &sb) < 0)
{
if (errno == ENOENT)
{
prfunc ("cannot find plugin: %s\n", fname);
prfunc ("searched:\n .\n %s: ", mkstring (PREFIX));
return 0;
}
}
}
}
}
if (!elf_open (name, &handle, prfunc))
{
if (prfunc)
prfunc ("open %s failed", name);
return 0;
}
dmagic = elf_get_section_data_sym(&handle, "driver_magic");
if (!dmagic)
{
if (prfunc)
prfunc ("no 'driver_magic' symbol found");
elf_close (&handle);
return 0;
}
for (i = 0; i < NUMOF(algorithm); i++)
{
uint32_t value;
GElf_Sym entrysym;
GElf_Shdr shdr;
void *data;
uint32_t size;
if (!STREQ(dmagic, algorithm[i].driver_magic))
continue;
if (!elf_get_symbol(&handle, algorithm[i].prog_entry(), &entrysym))
{
if (prfunc)
prfunc("could not find prog entry symbol %s",
algorithm[i].prog_entry());
elf_close(&handle);
return 0;
}
if (!elf_get_section_hdr(&handle, entrysym.st_shndx, &shdr))
{
if (prfunc)
prfunc("could not get section header for prog entry");
elf_close(&handle);
return 0;
}
data = elf_get_section_data(&handle, entrysym.st_shndx, &size);
if (!data)
{
if (prfunc)
prfunc("could not get section data for prog entry");
elf_close(&handle);
return 0;
}
algorithm[i].p_entry = entrysym.st_value;
algorithm[i].p_len = size;
algorithm[i].p_code = malloc(size);
memcpy(algorithm[i].p_code, data, size);
algorithm[i].ram = adr;
algorithm[i].len = len;
break;
}
if (prfunc)
{
if (i < NUMOF(algorithm))
prfunc("%s loaded, size:%d", dmagic, algorithm[i].p_len);
else
prfunc("no algorithm %s found", dmagic);
}
elf_close(&handle);
return 1;
}
int
srec_flash_plugin_load(int (*prfunc) (const char *format, ...),
uint32_t adr, uint32_t len, const char *fname)
{
return 0;
}
int
flash_plugin(int (*prfunc) (const char *format, ...),
uint32_t adr, uint32_t len, char *argv[])
{
int cnt;
init();
for (cnt = 0; argv[cnt]; cnt++)
{
if (!elf_flash_plugin_load(prfunc, adr, len, argv[cnt]))
if (!srec_flash_plugin_load(prfunc, adr, len, argv[cnt]))
if (prfunc)
prfunc("no suitable loader found: %s", argv[cnt]);
}
return 0;
}
#endif
static int
prog_clone(area_t * area, uint32_t adr, unsigned char *data, uint32_t size)
{
#if HOST_FLASHING
char driver_magic[1024]; /* FIXME: should be dynamically */
uint32_t mem;
uint32_t len;
static uint32_t entry = 0;
static uint32_t content = 0;
static area_t *last_area = NULL;
uint32_t sp, ra;
uint32_t sent = 0;
uint32_t num;
unsigned long wrote_num = 0;
int cpu_type;
if (!area->alg)
return 0;
if (bdmGetProcessor(&cpu_type) < 0)
return 0;
if (!area->alg->p_code) {
/* No plugin loaded -> use host-only mode. */
return area->alg->prog (area->chip_descriptor, adr, data, size);
}
mem = area->alg->ram;
len = area->alg->len;
if (area != last_area) {
/* Download plugin and chip descriptor into target. */
entry = area->alg->download_struct (area->chip_descriptor, mem);
bdmWriteMemory (entry, area->alg->p_code, area->alg->p_len);
content = entry + area->alg->p_len;
last_area = area;
}
while (sent < size) {
sp = mem + len;
num = sp - 0x200 - content; /* FIXME: stack size should be
determined dynamically */
if (num > size - sent)
num = size - sent;
/* Set up stack frame.
* Be careful with the longword writes, they must be longword aligned!
*/
switch (cpu_type) {
case BDM_CPU32:
sp -= 4;
ra = sp;
bdmWriteWord (sp, 0x4afa); /* BGND instruction */
break;
case BDM_COLDFIRE:
sp -= 4;
ra = sp;
bdmWriteWord (sp, 0x4ac8); /* HALT instruction */
break;
default:
return 0;
}
sp -= 4;
bdmWriteLongWord (sp, num); /* amount of data to flash */
sp -= 4;
bdmWriteLongWord (sp, content); /* adr of memory contents */
sp -= 4;
bdmWriteLongWord (sp, adr); /* destination adr */
sp -= 4;
bdmWriteLongWord (sp, mem); /* chip descriptor */
sp -= 4;
bdmWriteLongWord (sp, ra); /* return address to BGND */
/* Download contents. */
bdmWriteMemory (content, data, num);
/* Set stack pointer and program counter. */
bdmWriteRegister(BDM_REG_A7, sp);
bdmWriteSystemRegister(BDM_REG_RPC, entry + area->alg->p_entry);
/* Execute */
bdmGo();
while (!((bdmStatus ()) & (BDM_TARGETSTOPPED | BDM_TARGETHALT))) ;
bdmReadRegister (BDM_REG_D0, &wrote_num);
if (num != (uint32_t) wrote_num) {
printf ("Returned 0x%08x\n", wrote_num);
break; /* write failed */
}
sent += num;
data += num;
adr += num;
}
#else
/* FIXME: to be done */
#endif
return sent;
}
/* Register a new memory region. The new region should always overlap with
the RAM fallback (which is registered by the init function). The overlap
is resolved by shrinking/splitting the RAM fallback area. Returns 1 on
success, 0 otherwise.
*/
int
flash_register(char *description, uint32_t adr, char *hint_driver)
{
int i;
uint32_t size;
area_t *bold, *new, *aold; /* order is _b_efore, new, _a_fter */
void *chip;
init();
if (!(chip = malloc (maxsiz)))
return 0;
/* Search area where the address belongs to. The result should be the RAM
fallback. */
bold = search_area(adr);
for (i = 0; i < NUMOF(algorithm); i++) {
if (hint_driver != NULL) {
if (!STREQ(hint_driver, algorithm[i].driver_magic))
continue;
}
if ((size = algorithm[i].search_chip(chip, description, adr))) {
if (bold->end > adr + (size - 1)) {
/* End of old area is bigger than end of new area -> add new area of
old style behind new area. */
if (!(aold = malloc(sizeof(*aold))))
break;
*aold = *bold;
aold->adr = adr + size;
aold->next = bold->next;
bold->next = aold;
}
if (bold->adr < adr) {
/* start of old area is less than start of new area -> add new area
of old style in front of new area. */
if (!(new = malloc(sizeof(*new))))
return 0;
new->next = bold->next; /* insert new area into chain */
bold->next = new;
bold->end = adr - 1; /* shrink old area */
} else {
new = bold; /* same start address -> just replace old area */
}
/* fill new area with contents */
new->adr = adr;
new->end = adr + (size - 1);
new->alg = &algorithm[i];
new->chip_descriptor = chip;
return 1;
}
}
free(chip);
return 0;
}
/* Search area of address and call its erase algorithm.
*/
int
flash_erase(uint32_t adr, int32_t sector_offset)
{
area_t *a;
alg_t *alg;
if (!(a = search_area(adr)))
return 0;
if (alg = a->alg) {
if (alg->erase) {
alg->erase(a->chip_descriptor, sector_offset);
return 1;
}
}
return 0;
}
/* Search area of address and call its blank check algorithm.
*/
int
flash_blank_chk(uint32_t adr, int32_t sector_offset)
{
area_t *a;
alg_t *alg;
if (!(a = search_area(adr)))
return 0;
if (alg = a->alg) {
if (alg->blank_chk) {
return alg->blank_chk(a->chip_descriptor, sector_offset);
}
}
return 0;
}
/* Search area of address and call its erase_wait algorithm.
*/
int
flash_erase_wait(uint32_t adr)
{
area_t *a;
alg_t *alg;
if (!(a = search_area(adr)))
return 0;
if (alg = a->alg) {
if (alg->erase_wait) {
return alg->erase_wait(a->chip_descriptor);
}
}
return 0;
}
/* Write to memory through registered algorithms.
*/
uint32_t
write_memory(uint32_t adr, unsigned char *data, uint32_t cnt)
{
uint32_t ret;
uint32_t wrote = 0;
init();
while (wrote < cnt) {
area_t *area = search_area(adr + wrote);
/* That much fits into this area. */
uint32_t size = (area->end - (adr + wrote)) + 1;
/* Limit size if it is more than we actually want to write. */
if (size > cnt - wrote)
size = cnt - wrote;
if (area->alg && area->alg->prog) {
ret = prog_clone(area, adr, data, size);
wrote += ret;
if (ret != size)
return wrote;
} else {
/* no programming algorithm defined, assume RAM */
#if HOST_FLASHING
if (bdmWriteMemory(adr, data, size) < 0)
return wrote;
#else
memcpy((unsigned char *) adr, data, size);
#endif
wrote += size;
}
}
return wrote;
}
int
flash_set_var(const char *name, uint32_t value)
{
/* find and update existing var */
variable_t *var = s_variables;
while(var) {
if(strcmp(var->name, name) == 0) {
var->value = value;
return 1;
}
var = var->next;
}
/* add a new var */
var = (variable_t *) malloc(sizeof(variable_t));
if(!var)
return 0;
var->name = strdup(name);
if(!var->name)
return 0;
var->value = value;
var->next = s_variables;
s_variables = var;
return 1;
}
int
flash_get_var(const char *name, uint32_t *value, uint32_t value_default)
{
variable_t *var = s_variables;
while(var) {
if(strcmp(var->name, name) == 0) {
*value = var->value;
return 1;
}
var = var->next;
}
*value = value_default;
return 0;
}
int
flash_spin(int c)
{
#if HOST_FLASHING
const char spin[] = {'|', '/', '-', '\\'};
int n = c / 100;
printf("\b%c", spin[n % 4]);
fflush(stdout);
#endif
return ++c;
}

View File

@@ -0,0 +1,79 @@
/* $Id: flash_filter.h,v 1.4 2008/07/31 01:53:44 cjohns Exp $
*
* Header for the flash filtering layer.
*
* 2003-12-28 Josef Wolf (jw@raven.inka.de)
*
* Portions of this program which I authored may be used for any purpose
* so long as this notice is left intact.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _FLASH_FILTER_H_
# define _FLASH_FILTER_H_
# include <stdint.h>
/* This one should be removed in the long term.
*/
# ifndef HOST_FLASHING
# define HOST_FLASHING 1
# endif
# ifndef STREQ
# define STREQ(a,b) (!strcmp((a),(b)))
# endif
# ifndef NUMOF
# define NUMOF(ary) (sizeof(ary)/sizeof(ary[0]))
# endif
/* A driver need to register itself with this function
*/
void register_algorithm(int num, /* number that was passed to init function */
char *driver_magic,
/* size of the chip description structure */
int struct_size,
/* dnload chip-descr */
int (*download_struct) (void *, uint32_t),
uint32_t (*search_chip) (void *, char *, uint32_t),
void (*erase) (void *, int32_t),
int (*blank_chk) (void *, int32_t),
int (*erase_wait) (void *),
uint32_t (*prog) (void *, uint32_t,
unsigned char *, uint32_t),
/* returns the name of the entry function */
char *(*prog_entry) (void)
);
/* Load target drivers. ADR and LEN define memory region in the target that
can be used for downloading code/data.
*/
int flash_plugin (int (*prfunc) (const char *format, ...),
uint32_t adr, uint32_t len, char *argv[]);
/* Register a flash chip on ADR
*/
int flash_register (char *description, uint32_t adr, char *hint_driver);
int flash_erase (uint32_t adr, int32_t sec_adr);
int flash_blank_chk (uint32_t adr, int32_t sec_adr);
int flash_erase_wait (uint32_t adr);
uint32_t write_memory (uint32_t adr, unsigned char *data, uint32_t cnt);
int flash_set_var (const char *name, uint32_t value);
int flash_get_var (const char *name, uint32_t *value, uint32_t value_default);
int flash_spin (int c);
#endif

364
m68k/flashlib/flashcfm.c Normal file
View File

@@ -0,0 +1,364 @@
/* $Id:
*
* Portions of this program which I authored may be used for any purpose
* so long as this notice is left intact.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "flashcfm.h"
#include "flash_filter.h"
#include <stdint.h>
#if HOST_FLASHING
# include <stdio.h>
# include <BDMlib.h>
# include <string.h>
#endif
#define MCF_CFM_CFMCLKD_DIVLD (0x80)
#define MCF_CFM_CFMUSTAT_BLANK (0x04)
#define MCF_CFM_CFMUSTAT_CCIF (0x40)
#define MCF_CFM_CFMUSTAT_CBEIF (0x80)
#define MCF_CFM_CFMCMD_BLANK_CHECK (0x5)
#define MCF_CFM_CFMCMD_PAGE_ERASE_VERIFY (0x6)
#define MCF_CFM_CFMCMD_WORD_PROGRAM (0x20)
#define MCF_CFM_CFMCMD_PAGE_ERASE (0x40)
#define MCF_CFM_CFMCMD_MASS_ERASE (0x41)
/*
* Warning! do not change this struct without changing the download_struct
* function.
*/
typedef struct
{
uint32_t backdoor_address_start;
uint32_t backdoor_address_end;
uint32_t flash_address;
uint32_t flash_size;
uint32_t ipsbar;
uint32_t cfmclkd;
uint32_t cfmustat;
uint32_t cfmcmd;
} chiptype_t;
#if HOST_FLASHING
static inline uint8_t
read_byte(uint32_t a_addr)
{
unsigned char result;
if (bdmReadByte(a_addr, &result) < 0)
fprintf(stderr, "read_byte(0x%08x): %s\n", a_addr, bdmErrorString());
return (uint8_t) result;
}
static inline uint16_t
read_word(uint32_t a_addr)
{
unsigned short result;
if (bdmReadWord(a_addr, &result) < 0)
fprintf(stderr, "read_word(0x%08x): %s\n", a_addr, bdmErrorString());
return (uint16_t) result;
}
static inline uint32_t
read_longword(uint32_t a_addr)
{
unsigned long result;
if (bdmReadLongWord(a_addr, &result) < 0)
fprintf(stderr, "read_longword(0x%08x): %s\n", a_addr, bdmErrorString());
return (uint32_t) result;
}
static inline void
write_byte(uint32_t a_addr, uint8_t a_x)
{
if (bdmWriteByte(a_addr, a_x) < 0)
fprintf(stderr, "write_byte(0x%08x): %s\n", a_addr, bdmErrorString());
}
static inline void
write_word(uint32_t a_addr, uint16_t a_x)
{
if (bdmWriteWord(a_addr, a_x) < 0)
fprintf(stderr, "write_word(0x%08x): %s\n", a_addr, bdmErrorString());
}
static inline void
write_longword(uint32_t a_addr, uint32_t a_x)
{
if (bdmWriteLongWord(a_addr, a_x) < 0)
fprintf(stderr, "write_longword(0x%08x): %s\n", a_addr, bdmErrorString());
}
#else
# define read_byte(A) (*((volatile uint8_t *) (A)))
# define read_word(A) (*((volatile uint16_t *) (A)))
# define read_longword(A) (*((volatile uint32_t *) (A)))
# define write_byte(A, B) *((volatile uint8_t *)(A)) = (B)
# define write_word(A, B) *((volatile uint16_t *)(A)) = (B)
# define write_longword(A, B) *((volatile uint32_t *)(A)) = (B)
#endif
static inline uint32_t
swap32(uint32_t a_v)
{
return (uint32_t) (((a_v >> 24) & 0x000000ff) | ((a_v << 24) & 0xff000000) |
((a_v >> 8) & 0x0000ff00) | ((a_v << 8) & 0x00ff0000));
}
static inline int
is_little_endian(void)
{
uint32_t i = 1;
return (int) *((uint8_t *) &i);
}
/* We need a unique symbol to associate a (target-based) plugin with its
(host-based) driver.
*/
static char driver_magic[] = "flashcfm";
#if HOST_FLASHING
static char *
prog_entry(void)
{
return "flashcfm_prog";
}
#endif
/* The actual programming function.
* NOTE: pos and cnt need to be 4 byte aligned!
*/
static uint32_t
flashcfm_prog(void *chip_descr,
uint32_t pos, unsigned char *data, uint32_t cnt)
{
chiptype_t *ct = (chiptype_t *) chip_descr;
uint32_t offset = ct->backdoor_address_start + (pos - ct->flash_address);
uint32_t n = 0;
cnt /= 4;
if (read_byte(ct->cfmclkd) & MCF_CFM_CFMCLKD_DIVLD) {
while (!(read_byte(ct->cfmustat) & MCF_CFM_CFMUSTAT_CBEIF)) {
}
for (n = 0; n < cnt; ++n) {
uint32_t d = ((uint32_t *) data)[n];
/* write_longword on host assumes host endianess so will perform a
* byte order swap if host is little endian. we need to swap if little
* endian such that the swap will just swap back to the correct endianess
*/
if(is_little_endian())
d = swap32(d);
write_longword(offset + n * 4, d);
write_byte(ct->cfmcmd, MCF_CFM_CFMCMD_WORD_PROGRAM);
write_byte(ct->cfmustat, MCF_CFM_CFMUSTAT_CBEIF);
if (read_byte(ct->cfmustat) & MCF_CFM_CFMUSTAT_CBEIF) {
continue;
}
while (!(read_byte(ct->cfmustat) & MCF_CFM_CFMUSTAT_CCIF)) {
}
}
}
return n * 4;
}
/* Initiate erase operation. Sector address is relative to chip-base.
With sector address==-1, the whole chip is erased. The erase operation
can be called several times before flash_29_erase_wait() is called for
simultanous erasure of multiple sectors.
*/
static void
flashcfm_erase(void *chip_descr, int32_t sector_address)
{
chiptype_t *ct = (chiptype_t *) chip_descr;
if (read_byte(ct->cfmclkd) & MCF_CFM_CFMCLKD_DIVLD) {
while (!(read_byte(ct->cfmustat) & MCF_CFM_CFMUSTAT_CBEIF)) {
}
if (sector_address == -1) {
write_longword(ct->backdoor_address_start, 0);
write_byte(ct->cfmcmd, MCF_CFM_CFMCMD_MASS_ERASE);
} else {
write_longword(ct->backdoor_address_start +
(sector_address - ct->flash_address), 0);
write_byte(ct->cfmcmd, MCF_CFM_CFMCMD_PAGE_ERASE);
}
write_byte(ct->cfmustat, MCF_CFM_CFMUSTAT_CBEIF);
}
}
/* Blank check operation. Sector address is relative to chip-base.
With sector address==-1, the whole chip is checked.
*/
static int
flashcfm_blank_chk(void *chip_descr, int32_t sector_address)
{
chiptype_t *ct = (chiptype_t *) chip_descr;
int result = 0;
if (read_byte(ct->cfmclkd) & MCF_CFM_CFMCLKD_DIVLD) {
while (!(read_byte(ct->cfmustat) & MCF_CFM_CFMUSTAT_CBEIF)) {
}
if (sector_address == -1) {
write_longword(ct->backdoor_address_start, 0);
write_byte(ct->cfmcmd, MCF_CFM_CFMCMD_BLANK_CHECK);
} else {
write_longword(ct->backdoor_address_start +
(sector_address - ct->flash_address), 0);
write_byte(ct->cfmcmd, MCF_CFM_CFMCMD_PAGE_ERASE_VERIFY);
}
write_byte(ct->cfmustat, MCF_CFM_CFMUSTAT_CBEIF);
while (!(read_byte(ct->cfmustat) & MCF_CFM_CFMUSTAT_CCIF)) {
}
if (read_byte(ct->cfmustat) & MCF_CFM_CFMUSTAT_BLANK) {
result = 1;
write_byte(ct->cfmustat, MCF_CFM_CFMUSTAT_BLANK);
}
}
return result;
}
/* wait for queued erasing operations to finish
*/
static int
flashcfm_erase_wait(void *chip_descr)
{
chiptype_t *ct = (chiptype_t *) chip_descr;
#if HOST_FLASHING
int spin = 0;
#endif
if (read_byte(ct->cfmclkd) & MCF_CFM_CFMCLKD_DIVLD) {
while (!(read_byte(ct->cfmustat) & MCF_CFM_CFMUSTAT_CCIF)) {
#if HOST_FLASHING
spin = flash_spin(spin);
#endif
}
return 1;
}
return 0;
}
#if HOST_FLASHING
/* autodetect
*/
static uint32_t
flashcfm_search_chip(void *chip_descr, char *description, uint32_t pos)
{
chiptype_t *ct = (chiptype_t *) chip_descr;
unsigned long flashbar = 0;
uint32_t fbar_reg;
flash_get_var("%flashbar", &fbar_reg, 0x0c04);
if (bdmReadControlRegister(fbar_reg, &flashbar) >= 0) {
if ((flashbar & 1) && ((flashbar & 0xfff80000) == pos)) {
flash_get_var("IPSBAR", &ct->ipsbar, 0x40000000);
flash_get_var("FLASH_BACKDOOR", &ct->backdoor_address_start, 0x04000000);
flash_get_var("FLASH_SIZE", &ct->flash_size, 256 * 1024);
ct->backdoor_address_start += ct->ipsbar;
ct->backdoor_address_end = ct->backdoor_address_start +
ct->flash_size;
flash_get_var("MCF_CFM_CFMCLKD", &ct->cfmclkd, 0x1D0002);
flash_get_var("MCF_CFM_CFMUSTAT", &ct->cfmustat, 0x1D0020);
flash_get_var("ct->cfmcmd", &ct->cfmcmd, 0x1D0024);
ct->cfmclkd += ct->ipsbar;
ct->cfmustat += ct->ipsbar;
ct->cfmcmd += ct->ipsbar;
ct->flash_address = pos;
if (description) {
sprintf(description, "Coldfire flash module @ 0x%08lx..0x%08lx "
"size:0x%08lx",
pos, pos + ct->flash_size, ct->flash_size);
}
return ct->flash_size;
}
}
return 0;
}
static int
download_struct(void *chip_descr, uint32_t adr)
{
chiptype_t *ct = (chiptype_t *) chip_descr;
bdmWriteLongWord(adr, ct->backdoor_address_start);
adr += 4;
bdmWriteLongWord(adr, ct->backdoor_address_end);
adr += 4;
bdmWriteLongWord(adr, ct->flash_address);
adr += 4;
bdmWriteLongWord(adr, ct->flash_size);
adr += 4;
bdmWriteLongWord(adr, ct->ipsbar);
adr += 4;
bdmWriteLongWord(adr, ct->cfmclkd);
adr += 4;
bdmWriteLongWord(adr, ct->cfmustat);
adr += 4;
bdmWriteLongWord(adr, ct->cfmcmd);
adr += 4;
return adr;
}
void
init_flashcfm(int num)
{
register_algorithm(num, driver_magic, sizeof(chiptype_t),
download_struct,
flashcfm_search_chip,
flashcfm_erase,
flashcfm_blank_chk,
flashcfm_erase_wait, flashcfm_prog, prog_entry);
}
#else
void
init_flashcfm(int num)
{
register_algorithm(num, driver_magic, 0,
0,
0,
flashcfm_erase,
flashcfm_blank_chk,
flashcfm_erase_wait, flashcfm_prog, 0);
}
#endif

44
m68k/flashlib/flashcfm.h Normal file
View File

@@ -0,0 +1,44 @@
/* $Id:
*
* Portions of this program which I authored may be used for any purpose
* so long as this notice is left intact.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/*
* To use the flashcfm algorithm:
*
* set the following flash varialbes (flash_set_var)
*
* varname (default) note
* IPSBAR (0x40000000)
* MCF_CFM_CFMCLKD (0x1D0002) ipsbar offset
* MCF_CFM_CFMUSTAT (0x1D0020) ipsbar offset
* MCF_CFM_CFMCMD (0x1D0024) ipsbar offset
* FLASHBAR_REG (0x0C04)
* FLASH_SIZE (256 * 1024)
* FLASH_BACKDOOR (0x04000000) ipsbar offset
*
* NOTE: The target and flash clock must be setup to the correct flashing
* frequency prior to invoking this flash algorithm
*
* NOTE: Flash detection simply checks flashbar, so flashbar must be configured
* prior to calling flash_register
*
* NOTE: Flash addresses and write memory sizes need to be 4 byte aligned!
*
*/
/* This function will be called by flash_filter and is responsible to register
the driver
*/
void init_flashcfm(int num);

View File

@@ -0,0 +1,416 @@
/* $Id:
*
* Portions of this program which I authored may be used for any purpose
* so long as this notice is left intact.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "flashintelc3.h"
#include "flash_filter.h"
#include <stdint.h>
#if HOST_FLASHING
# include <stdio.h>
# include <BDMlib.h>
# include <string.h>
#endif
typedef struct
{
const char *name;
const uint32_t manufacturer, device_id;
const uint32_t size; /* in bytes */
const uint32_t num_sectors;
const uint32_t top;
} chip_t;
/*
* Warning! do not change this struct without changing the download_struct
* function.
*/
typedef struct
{
uint32_t flash_address;
uint32_t flash_size;
uint32_t num_sectors;
uint32_t top;
} chiptype_t;
static const chip_t chips[] = {
{"28F800C3T", 0x0089, 0x88C0, 0x100000, 23, 1}, /* INTEL */
{"28F800C3B", 0x0089, 0x88C1, 0x100000, 23, 0}, /* INTEL */
{"28F160C3T", 0x0089, 0x88C2, 0x200000, 39, 1}, /* INTEL */
{"28F160C3B", 0x0089, 0x88C3, 0x200000, 39, 0}, /* INTEL */
{"28F320C3T", 0x0089, 0x88C4, 0x400000, 71, 1}, /* INTEL */
{"28F320C3B", 0x0089, 0x88C5, 0x400000, 71, 0}, /* INTEL */
{"28F640C3T", 0x0089, 0x88CC, 0x800000, 135, 1}, /* INTEL */
{"28F640C3B", 0x0089, 0x88CD, 0x800000, 135, 0}, /* INTEL */
};
#if HOST_FLASHING
# define DEFINE_READ_FUNC(funcname,vartype,bdmfunc) \
static uint32_t funcname (uint32_t adr) { \
vartype val; \
if (bdmfunc (adr, &val) < 0) \
fprintf (stderr, #bdmfunc "(0x%08lx,xxx): %s\n", \
adr, bdmErrorString()); \
return (uint32_t) val; \
}
# define DEFINE_WRITE_FUNC(funcname,vartype,bdmfunc) \
static void funcname (uint32_t adr, uint32_t val) { \
if (bdmfunc (adr, val) < 0) \
fprintf (stderr, #bdmfunc "(0x%08lx,0x%08x): %s\n", \
adr, val, bdmErrorString()); \
}
#else
# define DEFINE_READ_FUNC(funcname,vartype,bdmfunc) \
static uint32_t funcname (uint32_t adr) { \
return *(volatile vartype *)adr; \
}
# define DEFINE_WRITE_FUNC(funcname,vartype,bdmfunc) \
static void funcname (uint32_t adr,uint32_t val) { \
*(volatile vartype *)adr = val; \
}
#endif
static inline uint16_t
swap16(uint16_t a_v)
{
return (uint16_t) (((a_v >> 8) & 0x00ff) | ((a_v << 8) & 0xff00));
}
static inline int
is_little_endian(void)
{
uint32_t i = 1;
return (int) *((uint8_t *) &i);
}
DEFINE_READ_FUNC(chip_rd_word, unsigned short, bdmReadWord)
DEFINE_WRITE_FUNC(chip_wr_word, uint16_t, bdmWriteWord)
/* We need a unique symbol to associate a (target-based) plugin with its
(host-based) driver.
*/
static char driver_magic[] = "flashintelc3";
#if HOST_FLASHING
static char *
prog_entry(void)
{
return "flashintelc3_prog";
}
#endif
static uint32_t
flashintelc3_sector_size(chiptype_t* chip, int sector)
{
if(chip->top) {
if(sector < (chip->num_sectors - 8)) {
return 0x10000;
}
else {
return 0x2000;
}
}
else {
if(sector < 8) {
return 0x2000;
}
else {
return 0x10000;
}
}
}
static uint32_t
flashintelc3_sector_offset(chiptype_t* chip, int sector)
{
if(chip->top) {
uint32_t d = chip->num_sectors - 8;
if(sector < d) {
return 0x10000 * sector;
}
else {
return (0x10000 * d) + (0x2000 * (sector - d));
}
}
else {
if(sector < 8) {
return 0x2000 * sector;
}
else {
return 0x10000 + (0x10000 * (sector - 8));
}
}
}
/* 0=unlock, 1=lock */
static void
flashintelc3_lock(void *chip_descr, uint32_t start, uint32_t bytes, int cmd)
{
chiptype_t *ct = (chiptype_t *) chip_descr;
int i, s = 0, e = 0;
int ucmd = (cmd) ? 0x01 : 0xD0;
if(bytes == 0)
return;
/* find start sector */
for(i = 0; i < ct->num_sectors; ++i) {
uint32_t off = flashintelc3_sector_offset(ct, i);
uint32_t size = flashintelc3_sector_size(ct, i);
if((start >= ct->flash_address + off) &&
(start < ct->flash_address + off + size)) {
s = i;
break;
}
}
/* find end */
for(; i < ct->num_sectors; ++i) {
uint32_t off = flashintelc3_sector_offset(ct, i);
uint32_t size = flashintelc3_sector_size(ct, i);
if(start + bytes <= ct->flash_address + off + size) {
e = i;
break;
}
}
/* unlock range */
for(i = s; i <= e; ++i) {
uint32_t off = flashintelc3_sector_offset(ct, i);
chip_wr_word(ct->flash_address + off, 0x60);
chip_wr_word(ct->flash_address + off, ucmd);
}
}
/* The actual programming function.
* NOTE: pos and cnt need to be 2 byte aligned!
*/
static uint32_t
flashintelc3_prog(void *chip_descr,
uint32_t pos, unsigned char *data, uint32_t cnt)
{
chiptype_t *ct = (chiptype_t *) chip_descr;
uint32_t n = 0;
uint16_t status;
flashintelc3_lock(ct, pos, cnt, 0);
cnt /= 2;
for (n = 0; n < cnt; ++n) {
uint16_t d = ((uint16_t *) (void*) data)[n];
chip_wr_word(pos, 0x40);
/* write_word on host assumes host endianess so will perform a
* byte order swap if host is little endian. we need to swap if little
* endian such that the swap will just swap back to the correct endianess
*/
if(is_little_endian())
d = swap16(d);
chip_wr_word(pos, d);
/*
* Wait for program operation to finish
*/
do {
chip_wr_word(pos, 0x70);
status = chip_rd_word(pos);
}
while (!(status & 0x80));
pos += 2;
}
chip_wr_word(ct->flash_address, 0xff);
return n * 2;
}
static void
flashintelc3_erase(void *chip_descr, int32_t sector_address)
{
chiptype_t *ct = (chiptype_t *) chip_descr;
uint16_t status;
int i;
#if HOST_FLASHING
int spin = 0;
#endif
if(sector_address == -1) {
flashintelc3_lock(ct, ct->flash_address, ct->flash_size, 0);
/* erasing all sectors */
for(i = 0; i < ct->num_sectors; ++i) {
uint32_t off = flashintelc3_sector_offset(ct, i);
chip_wr_word(ct->flash_address + off, 0x20);
chip_wr_word(ct->flash_address + off, 0xD0);
/* wait */
do {
chip_wr_word(ct->flash_address + off, 0x70);
status = chip_rd_word(ct->flash_address + off);
#if HOST_FLASHING
spin = flash_spin(spin);
#endif
} while(!(status & 0x80));
}
}
else {
uint32_t off = flashintelc3_sector_offset(ct, sector_address);
flashintelc3_lock(ct, ct->flash_address + off, 1, 0);
/* erasing said sector address */
chip_wr_word(ct->flash_address + off, 0x20);
chip_wr_word(ct->flash_address + off, 0xD0);
/* wait */
do {
chip_wr_word(ct->flash_address + off, 0x70);
status = chip_rd_word(ct->flash_address + off);
#if HOST_FLASHING
spin = flash_spin(spin);
#endif
} while(!(status & 0x80));
}
chip_wr_word(ct->flash_address, 0xff);
}
/* Blank check operation. Sector address is relative to chip-base.
With sector address==-1, the whole chip is checked.
*/
static int
flashintelc3_blank_chk(void *chip_descr, int32_t sector_address)
{
#if HOST_FLASHING
printf("intelc3: blank_chk not implemented!\n");
#endif
return 0;
}
/* wait for queued erasing operations to finish
*/
static int
flashintelc3_erase_wait(void *chip_descr)
{
#if HOST_FLASHING
printf("intelc3: no wait needed!\n");
#endif
return 0;
}
#if HOST_FLASHING
# ifndef NUMOF
# define NUMOF(ary) (sizeof(ary)/sizeof(ary[0]))
# endif
/* autodetect
*/
static uint32_t
flashintelc3_search_chip(void *chip_descr, char *description, uint32_t pos)
{
uint32_t size = 0;
uint32_t m, d;
chiptype_t *ct = (chiptype_t *) chip_descr;
const chip_t *chip;
int i;
/* read the manufacturer id */
chip_wr_word(pos, 0x90);
m = chip_rd_word(pos + 0);
/* read the device id */
chip_wr_word(pos, 0x90);
d = chip_rd_word(pos + 2);
/* find our device */
for (i = 0; i < NUMOF(chips); i++) {
chip = &chips[i];
if(chip->manufacturer == m && chip->device_id == d) {
ct->flash_address = pos;
ct->flash_size = chip->size;
ct->num_sectors = chip->num_sectors;
ct->top = chip->top;
size = chip->size;
if (description) {
sprintf(description, "%10s @ 0x%08lx..0x%08lx "
"manuf:0x%02lx device:0x%04lx size:0x%08lx",
chip->name, pos, pos + chip->size, m, d, chip->size);
}
break;
}
}
/* put the device back into read mode */
chip_wr_word(pos, 0xff);
return size;
}
static int
download_struct(void *chip_descr, uint32_t adr)
{
chiptype_t *ct = (chiptype_t *) chip_descr;
bdmWriteLongWord(adr, ct->flash_address);
adr += 4;
bdmWriteLongWord(adr, ct->flash_size);
adr += 4;
bdmWriteLongWord(adr, ct->num_sectors);
adr += 4;
bdmWriteLongWord(adr, ct->top);
adr += 4;
return adr;
}
void
init_flashintelc3(int num)
{
register_algorithm(num, driver_magic, sizeof(chiptype_t),
download_struct,
flashintelc3_search_chip,
flashintelc3_erase,
flashintelc3_blank_chk,
flashintelc3_erase_wait, flashintelc3_prog, prog_entry);
}
#else
void
init_flashintelc3(int num)
{
register_algorithm(num, driver_magic, 0,
0,
0,
flashintelc3_erase,
flashintelc3_blank_chk,
flashintelc3_erase_wait, flashintelc3_prog, 0);
}
#endif

View File

@@ -0,0 +1,32 @@
/* $Id:
*
* Portions of this program which I authored may be used for any purpose
* so long as this notice is left intact.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/*
* To use the flashintelc3 algorithm:
*
* NOTE: You'll need to setup any chip selects etc.
*
* NOTE: No need to use an erase wait command for batch erases. if doing
* a sector erase you'll need to do an erase followed by an erase wait!
*
* NOTE: Flash addresses and write memory sizes need to be 4 byte aligned!
*
*/
/* This function will be called by flash_filter and is responsible to register
the driver
*/
void init_flashintelc3(int num);

View File

@@ -0,0 +1,21 @@
#! /bin/sh
CC=$1 # The m68k cross compiler.
SRC=$2 # The source file.
OUTPUT=$3 # The output file. Contains the CPU.
CPU=$(echo $OUTPUT | sed -e 's/.*-//g' -e 's/\..*//g')
PWARN="-pedantic -Wall -Wcast-align -Wstrict-prototypes -Wmissing-prototypes"
POPT="-O2 -fomit-frame-pointer"
PREL="-mpcrel"
PDEF="-DHOST_FLASHING=0"
PTGT="-mcpu=$CPU"
OPT="$PWARN $POPT $PREL $PDEF $PTGT"
CMD="$CC $OPT -c -o $OUTPUT $SRC"
echo $CMD
$CMD
exit $?

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