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

12
m68k/utils/.cvsignore Normal file
View File

@@ -0,0 +1,12 @@
.deps
Makefile
Makefile.in
bdmreset
bdmreset.exe
bdmctrl
bdmctrl.exe
bdmflash
bdmflash.exe
bdmmon
bdmmon.exe
bdmmon.c

25
m68k/utils/ChangeLog Normal file
View File

@@ -0,0 +1,25 @@
2001-04-15 Chris Johns <cjohns@cybertec.com.au>
* Makefile: More changes to get the install to work on cygwin.
* Makefile: Cygwin needs the file extension to copy when installing.
* Makefile: Fixed a typo.
* Makefile:
Fixed the typo and will now make the bin directory. Needed on Windows builds.
* Makefile: Added install support.
* Makefile:
Fixed the typo and will now make the bin directory. Needed on Windows builds.
* Makefile: Added install support.
2000-09-03 Chris Johns <ccj@acm.org>
* Makefile: New file.
* bdmreset.c: Removed warning.
* bdmreset.c: New file.

87
m68k/utils/Makefile.am Normal file
View File

@@ -0,0 +1,87 @@
##
## $Id: Makefile.am,v 1.14 2008/07/31 01:53:44 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)/../driver \
-I$(srcdir)/../lib
AM_CFLAGS = -Wall
##
## Only way I know of anding in automake.
##
if WIN32
if BDM_REMOTE
LIBS += -l wsock32
endif
endif
if TBLCF_USB
TBLCF_USB_LIB = $(top_builddir)/tblcf/libtblcf.a
endif
if LIBUSB_PATH
AM_CPPFLAGS += -I@LIBUSB_INCLUDE_DIR@
AM_LDFLAGS = -L@LIBUSB_LIB_DIR@
endif
LIBELF = $(top_builddir)/libelf/lib/libelf.a
bin_PROGRAMS = bdmreset
if BDMCTRL
bin_PROGRAMS += bdmctrl
endif
if BDMFLASH
bin_PROGRAMS += bdmflash
endif
if BDMMON
bin_PROGRAMS += bdmmon
endif
bdmctrl_SOURCES = \
bdmctrl.c
bdmctrl_CPPFLAGS = \
-I$(srcdir)/../flashlib \
-I$(srcdir)/../libelf/lib -I../libelf/lib \
$(AM_CPPFLAGS)
bdmctrl_LDADD = \
$(top_builddir)/lib/libBDM.a \
$(top_builddir)/flashlib/libbdmflash.a \
$(TBLCF_USB_LIB) \
$(LIBELF)
bdmreset_SOURCES = \
bdmreset.c
bdmreset_LDADD = \
$(top_builddir)/lib/libBDM.a \
$(TBLCF_USB_LIB)
bdmflash_SOURCES = \
bdmflash.c
bdmflash_CPPFLAGS = \
-I$(top_srcdir)/bdmabstraction
bdmflash_LDADD = \
$(top_builddir)/bdmabstraction/libbdmabstraction.a \
$(top_builddir)/lib/libBDM.a \
$(TBLCF_USB_LIB)
bdmmon_SOURCES = \
bdmmon.l
bdmmon_CFLAGS = @CFLAGS@ -I$(top_srcdir)/bdmabstraction
bdmmon_LDADD = \
$(top_builddir)/bdmabstraction/libbdmabstraction.a \
$(top_builddir)/lib/libBDM.a \
$(TBLCF_USB_LIB)
EXTRA_DIST = README.bdmctrl m68332.test mcf52235.test mcf5235.test mcf5329.test

570
m68k/utils/Makefile.in Normal file
View File

@@ -0,0 +1,570 @@
# 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@
@BDM_REMOTE_TRUE@@WIN32_TRUE@am__append_1 = -l wsock32
@LIBUSB_PATH_TRUE@am__append_2 = -I@LIBUSB_INCLUDE_DIR@
bin_PROGRAMS = bdmreset$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \
$(am__EXEEXT_3)
@BDMCTRL_TRUE@am__append_3 = bdmctrl
@BDMFLASH_TRUE@am__append_4 = bdmflash
@BDMMON_TRUE@am__append_5 = bdmmon
subdir = utils
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog \
bdmmon.c
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 =
@BDMCTRL_TRUE@am__EXEEXT_1 = bdmctrl$(EXEEXT)
@BDMFLASH_TRUE@am__EXEEXT_2 = bdmflash$(EXEEXT)
@BDMMON_TRUE@am__EXEEXT_3 = bdmmon$(EXEEXT)
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_bdmctrl_OBJECTS = bdmctrl-bdmctrl.$(OBJEXT)
bdmctrl_OBJECTS = $(am_bdmctrl_OBJECTS)
bdmctrl_DEPENDENCIES = $(top_builddir)/lib/libBDM.a \
$(top_builddir)/flashlib/libbdmflash.a $(TBLCF_USB_LIB) \
$(LIBELF)
am_bdmflash_OBJECTS = bdmflash-bdmflash.$(OBJEXT)
bdmflash_OBJECTS = $(am_bdmflash_OBJECTS)
bdmflash_DEPENDENCIES = \
$(top_builddir)/bdmabstraction/libbdmabstraction.a \
$(top_builddir)/lib/libBDM.a $(TBLCF_USB_LIB)
am_bdmmon_OBJECTS = bdmmon-bdmmon.$(OBJEXT)
bdmmon_OBJECTS = $(am_bdmmon_OBJECTS)
bdmmon_DEPENDENCIES = \
$(top_builddir)/bdmabstraction/libbdmabstraction.a \
$(top_builddir)/lib/libBDM.a $(TBLCF_USB_LIB)
bdmmon_LINK = $(CCLD) $(bdmmon_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
am_bdmreset_OBJECTS = bdmreset.$(OBJEXT)
bdmreset_OBJECTS = $(am_bdmreset_OBJECTS)
bdmreset_DEPENDENCIES = $(top_builddir)/lib/libBDM.a $(TBLCF_USB_LIB)
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 $@
LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS)
YLWRAP = $(top_srcdir)/config/ylwrap
SOURCES = $(bdmctrl_SOURCES) $(bdmflash_SOURCES) $(bdmmon_SOURCES) \
$(bdmreset_SOURCES)
DIST_SOURCES = $(bdmctrl_SOURCES) $(bdmflash_SOURCES) \
$(bdmmon_SOURCES) $(bdmreset_SOURCES)
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@ $(am__append_1)
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)/../driver -I$(srcdir)/../lib $(am__append_2)
AM_CFLAGS = -Wall
@TBLCF_USB_TRUE@TBLCF_USB_LIB = $(top_builddir)/tblcf/libtblcf.a
@LIBUSB_PATH_TRUE@AM_LDFLAGS = -L@LIBUSB_LIB_DIR@
LIBELF = $(top_builddir)/libelf/lib/libelf.a
bdmctrl_SOURCES = \
bdmctrl.c
bdmctrl_CPPFLAGS = \
-I$(srcdir)/../flashlib \
-I$(srcdir)/../libelf/lib -I../libelf/lib \
$(AM_CPPFLAGS)
bdmctrl_LDADD = \
$(top_builddir)/lib/libBDM.a \
$(top_builddir)/flashlib/libbdmflash.a \
$(TBLCF_USB_LIB) \
$(LIBELF)
bdmreset_SOURCES = \
bdmreset.c
bdmreset_LDADD = \
$(top_builddir)/lib/libBDM.a \
$(TBLCF_USB_LIB)
bdmflash_SOURCES = \
bdmflash.c
bdmflash_CPPFLAGS = \
-I$(top_srcdir)/bdmabstraction
bdmflash_LDADD = \
$(top_builddir)/bdmabstraction/libbdmabstraction.a \
$(top_builddir)/lib/libBDM.a \
$(TBLCF_USB_LIB)
bdmmon_SOURCES = \
bdmmon.l
bdmmon_CFLAGS = @CFLAGS@ -I$(top_srcdir)/bdmabstraction
bdmmon_LDADD = \
$(top_builddir)/bdmabstraction/libbdmabstraction.a \
$(top_builddir)/lib/libBDM.a \
$(TBLCF_USB_LIB)
EXTRA_DIST = README.bdmctrl m68332.test mcf52235.test mcf5235.test mcf5329.test
all: all-am
.SUFFIXES:
.SUFFIXES: .c .l .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 utils/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign utils/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-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
bdmctrl$(EXEEXT): $(bdmctrl_OBJECTS) $(bdmctrl_DEPENDENCIES)
@rm -f bdmctrl$(EXEEXT)
$(LINK) $(bdmctrl_OBJECTS) $(bdmctrl_LDADD) $(LIBS)
bdmflash$(EXEEXT): $(bdmflash_OBJECTS) $(bdmflash_DEPENDENCIES)
@rm -f bdmflash$(EXEEXT)
$(LINK) $(bdmflash_OBJECTS) $(bdmflash_LDADD) $(LIBS)
bdmmon$(EXEEXT): $(bdmmon_OBJECTS) $(bdmmon_DEPENDENCIES)
@rm -f bdmmon$(EXEEXT)
$(bdmmon_LINK) $(bdmmon_OBJECTS) $(bdmmon_LDADD) $(LIBS)
bdmreset$(EXEEXT): $(bdmreset_OBJECTS) $(bdmreset_DEPENDENCIES)
@rm -f bdmreset$(EXEEXT)
$(LINK) $(bdmreset_OBJECTS) $(bdmreset_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bdmctrl-bdmctrl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bdmflash-bdmflash.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bdmmon-bdmmon.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bdmreset.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) '$<'`
bdmctrl-bdmctrl.o: bdmctrl.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bdmctrl_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bdmctrl-bdmctrl.o -MD -MP -MF $(DEPDIR)/bdmctrl-bdmctrl.Tpo -c -o bdmctrl-bdmctrl.o `test -f 'bdmctrl.c' || echo '$(srcdir)/'`bdmctrl.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/bdmctrl-bdmctrl.Tpo $(DEPDIR)/bdmctrl-bdmctrl.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bdmctrl.c' object='bdmctrl-bdmctrl.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bdmctrl_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bdmctrl-bdmctrl.o `test -f 'bdmctrl.c' || echo '$(srcdir)/'`bdmctrl.c
bdmctrl-bdmctrl.obj: bdmctrl.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bdmctrl_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bdmctrl-bdmctrl.obj -MD -MP -MF $(DEPDIR)/bdmctrl-bdmctrl.Tpo -c -o bdmctrl-bdmctrl.obj `if test -f 'bdmctrl.c'; then $(CYGPATH_W) 'bdmctrl.c'; else $(CYGPATH_W) '$(srcdir)/bdmctrl.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/bdmctrl-bdmctrl.Tpo $(DEPDIR)/bdmctrl-bdmctrl.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bdmctrl.c' object='bdmctrl-bdmctrl.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bdmctrl_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bdmctrl-bdmctrl.obj `if test -f 'bdmctrl.c'; then $(CYGPATH_W) 'bdmctrl.c'; else $(CYGPATH_W) '$(srcdir)/bdmctrl.c'; fi`
bdmflash-bdmflash.o: bdmflash.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bdmflash_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bdmflash-bdmflash.o -MD -MP -MF $(DEPDIR)/bdmflash-bdmflash.Tpo -c -o bdmflash-bdmflash.o `test -f 'bdmflash.c' || echo '$(srcdir)/'`bdmflash.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/bdmflash-bdmflash.Tpo $(DEPDIR)/bdmflash-bdmflash.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bdmflash.c' object='bdmflash-bdmflash.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bdmflash_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bdmflash-bdmflash.o `test -f 'bdmflash.c' || echo '$(srcdir)/'`bdmflash.c
bdmflash-bdmflash.obj: bdmflash.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bdmflash_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bdmflash-bdmflash.obj -MD -MP -MF $(DEPDIR)/bdmflash-bdmflash.Tpo -c -o bdmflash-bdmflash.obj `if test -f 'bdmflash.c'; then $(CYGPATH_W) 'bdmflash.c'; else $(CYGPATH_W) '$(srcdir)/bdmflash.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/bdmflash-bdmflash.Tpo $(DEPDIR)/bdmflash-bdmflash.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bdmflash.c' object='bdmflash-bdmflash.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bdmflash_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bdmflash-bdmflash.obj `if test -f 'bdmflash.c'; then $(CYGPATH_W) 'bdmflash.c'; else $(CYGPATH_W) '$(srcdir)/bdmflash.c'; fi`
bdmmon-bdmmon.o: bdmmon.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bdmmon_CFLAGS) $(CFLAGS) -MT bdmmon-bdmmon.o -MD -MP -MF $(DEPDIR)/bdmmon-bdmmon.Tpo -c -o bdmmon-bdmmon.o `test -f 'bdmmon.c' || echo '$(srcdir)/'`bdmmon.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/bdmmon-bdmmon.Tpo $(DEPDIR)/bdmmon-bdmmon.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bdmmon.c' object='bdmmon-bdmmon.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bdmmon_CFLAGS) $(CFLAGS) -c -o bdmmon-bdmmon.o `test -f 'bdmmon.c' || echo '$(srcdir)/'`bdmmon.c
bdmmon-bdmmon.obj: bdmmon.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bdmmon_CFLAGS) $(CFLAGS) -MT bdmmon-bdmmon.obj -MD -MP -MF $(DEPDIR)/bdmmon-bdmmon.Tpo -c -o bdmmon-bdmmon.obj `if test -f 'bdmmon.c'; then $(CYGPATH_W) 'bdmmon.c'; else $(CYGPATH_W) '$(srcdir)/bdmmon.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/bdmmon-bdmmon.Tpo $(DEPDIR)/bdmmon-bdmmon.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bdmmon.c' object='bdmmon-bdmmon.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bdmmon_CFLAGS) $(CFLAGS) -c -o bdmmon-bdmmon.obj `if test -f 'bdmmon.c'; then $(CYGPATH_W) 'bdmmon.c'; else $(CYGPATH_W) '$(srcdir)/bdmmon.c'; fi`
.l.c:
$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE)
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 $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; 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."
-rm -f bdmmon.c
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic 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-binPROGRAMS
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-binPROGRAMS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-binPROGRAMS \
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 uninstall-binPROGRAMS
# 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:

117
m68k/utils/README.bdmctrl Normal file
View File

@@ -0,0 +1,117 @@
bdmctrl utility
===============
Josef Wolf <jw@raven.inka.de> 2003-10-26
Matthew Riek <matthew.riek@ibiscomputer.com.au> 2008-06-27
The intention of the bdmctrl utility is to do basic control of the target
over the BDM interface. It can be used for various tasks. Examples are
loading code to the target and executing it or do hardware tests. I have
even used it to do rudimentary debugging.
Flashing
===============
Most useful, is for using bdmctrl as a flashing utility! You can load
elf files into flash (and-or ram) and execute them from the bdm interface.
Please see the example *.test scripts for examples on using bdmctrl as
a flash loader. Also see flashlib/README
Invoking
===============
Bdmctrl is invoked like this:
Usage: bdmctrl [options] [<script> [arguments [...]]]
where options are one or more of:
-h <cmd> Get additional description for command <cmd>.
-d <level> Choose driver debug level (default=0).
-v <level> Choose verbosity level (default=1).
-D <delay> Delay count for BDM clock generation (default=0).
-c <cmd> Split <cmd> into args and execute resulting command.
-f Turn warnings into fatal errors.
If a script is specified on the command line, bdmctrl reads and executes
commands from the script file. Otherwise commands are read and executed
from stdin until EOF is encountered. If you have a file /foo/bar/baz then
there are several ways to let bdmctrl execute commands from this file:
bdmctrl /foo/bar/baz /dev/bdmicd0 myfirmware.coff
or like this:
echo source /foo/bar/baz /dev/bdmicd0 myfirmware.coff | bdmctrl
or like this:
bdmctrl -c "source /foo/bar/baz /dev/bdmicd0 myfirmware.coff" -c "echo done"
or even like this (if /foo/bar/baz is executable and uses bdmctrl as its
shebang-shell):
/foo/bar/baz /dev/bdmicd0 myfirmware.coff
The first two examples above are semantically almost identical. Please check
the discussion about stdin in the description to the "source" command for the
exception.
For example, the bundeled test scripts can be executed with
bdmctrl m68332.test /dev/bdmicd0 /path/to/my/executable.coff
bdmctrl mcf52235.test /dev/bdmcf0 /path/to/my/executable.elf
bdmctrl mcf5235.test /dev/tblcf2 /path/to/my/executable.elf
etc.
If you set the executable bit, you can execute it with:
m68332.test /dev/bdmicd0 /path/to/my/executable.coff
This script will do some basic hardware checks, load the named executable
into the target and execute it.
The bdmctrl utility shouldn't contain any target specific code and should
therefore work on coldfire as well as on the variuos cpu32 based CPUs.
Currently, it is tested only on 68332, and a few coldfire targets.
Please test it on your target and report the results so that either the
problem can be fixed or the list of working targets can be extended.
Basic syntax of the commands
============================
A command line is split by whitespace into the command and its arguments in
a similar way like bourne shell does. the '#' character starts a comment.
No quoting is supported. After the split, variable substitution (see the
"source" command) is done.
Register names are prefixed by a '%' (for example %sp) and can be in mixed
case. The '%' can be omitted in most cases, but this is not recommended.
Some commands accept a VAL. If VAL begins with a digit, it will be
parsed as a number. If it begins with "0x" it is parsed as a hex number.
If it begins with "0" it is parsed as an octal number. If it begins
with "%", it will be parsed as a register name and the contents of the named
register will be taken. Otherwise it is assumed to be a symbol and its value
will be looked up in the open symbol files.
Supported commands and their parameters
=======================================
Please use "bdmctrl -h" to get a list of available commands.
Please use "bdmctrl -h COMMAND" to get information on specific command.
Plans for the future
=======================================
- Add srec loading support!
- Add more flash chips (for existing drivers) and more drivers!
Miscelaneus
===========
Bugfixes, bugreports, improvements, suggestions and opinions (in this
order ;-) are welcome.

1647
m68k/utils/bdmctrl.c Normal file

File diff suppressed because it is too large Load Diff

380
m68k/utils/bdmflash.c Normal file
View File

@@ -0,0 +1,380 @@
/* @#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.c
* Purpose: Work with target flash through BDM connector.
* 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.c,v $
* Revision 1.3 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.2 2005/10/24 01:32:21 cjohns
* Removed warnings when built with gcc 4.x
*
* Revision 1.1 2003/12/29 22:19:11 codewiz
* Move bdmmon and bdmflash to m68k/utils.
*
* 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/08/03 06:29:18 wuth
* MultiProject Sync; Support Micron-style flash; Report flash model
*
* Revision 1.5 2000/07/25 13:51:09 wuth
* Working sector erase. Better error reports.
*
* Revision 1.4 2000/07/14 18:38:55 wuth
* Flash error status; Fix sector erase support; Command line sector erase
*
* Revision 1.3 2000/04/20 04:56:23 wuth
* GPL. Abstract flash interface.
*
* Revision 1.2 2000/03/30 03:36:56 wuth
* BDMFlash can now write beyond first 1 KiB.
*
* Revision 1.1 2000/03/28 20:28:50 wuth
* Break out flash code into separate executable. Make run under Chris Johns BDM driver.
*
* @#[BasedOnTemplate: template.c version 2]
*/
#include <BDMFlash.h>
#include <bdmops.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static
void
Usage( char const *ProgName )
{
fprintf( stderr,
"usage: %s DeviceFile FlashBaseAddress NumChips ByteWidth "
"[probe | detect | erase | SectorErase Offset | BlockErase Offset | write BinaryFile Offset | read BinaryFile Offset Length]\n",
ProgName );
exit( EXIT_FAILURE );
}
static
void
Probe( int ArgC, char *ArgV[] )
{
FlashError_t Error;
FlashStyle_t Style;
if (ArgC != 6)
Usage( ArgV[0] );
if ((Error = BDMFlashProbe( &Style )) != FlashErrorOkay_c)
{
fprintf( stderr,
"Problem probing flash (code = %d, '%s').\n",
(int) Error,
FlashErrorDescriptionEnglish[Error] );
exit( EXIT_FAILURE );
}
printf( "Flash style is %s.\n", FlashStyleName[Style] );
}
static
void
Detect( int ArgC, char *ArgV[] )
{
FlashError_t Error;
FlashID_t ID;
FlashInfo_t const *Info;
if (ArgC != 6)
Usage( ArgV[0] );
Error = BDMFlashIDRead( &ID );
if (Error != FlashErrorOkay_c)
{
fprintf( stderr,
"Problem detecting flash (code = %d, '%s').\n",
(int) Error,
FlashErrorDescriptionEnglish[Error] );
}
printf( "Flash ID = 0x%04x\n", ID );
printf( "Manufacturer: %s\n", FlashManufacturerName( ID>>8 ) );
if ((Error = BDMFlashDetect( &Info )) != FlashErrorOkay_c)
{
fprintf( stderr,
"Problem detecting flash (code = %d, '%s').\n",
(int) Error,
FlashErrorDescriptionEnglish[Error] );
exit( EXIT_FAILURE );
}
if (Info == NULL)
{
printf( "Model not described.\n" );
}
else
{
printf( "Model: %s\n", Info->Model );
printf( "Flash size is %lu.\n", Info->Size );
}
}
static
void
Erase( int ArgC, char *ArgV[] )
{
FlashError_t Error;
if (ArgC != 6)
Usage( ArgV[0] );
if ((Error = BDMFlashErase()) != FlashErrorOkay_c)
{
fprintf( stderr,
"Problem erasing flash (code = %d, '%s').\n",
(int) Error,
FlashErrorDescriptionEnglish[Error] );
exit( EXIT_FAILURE );
}
}
static
void
SectorErase( int ArgC, char *ArgV[] )
{
unsigned long Offset;
FlashError_t Error;
if (ArgC != 7)
Usage( ArgV[0] );
Offset = strtoul( ArgV[6], NULL, 0 );
if ((Error = BDMFlashEraseSector( Offset )) != FlashErrorOkay_c)
{
fprintf( stderr,
"Problem erasing flash sector at 0x%08lx; error code = %d, '%s'.\n",
Offset,
(int) Error,
FlashErrorDescriptionEnglish[Error] );
exit( EXIT_FAILURE );
}
}
static
void
BlockErase( int ArgC, char *ArgV[] )
{
unsigned long Offset;
FlashError_t Error;
if (ArgC != 7)
Usage( ArgV[0] );
Offset = strtoul( ArgV[6], NULL, 0 );
if ((Error = BDMFlashEraseBlock( Offset )) != FlashErrorOkay_c)
{
fprintf( stderr,
"Problem erasing flash block at 0x%08lx; error code = %d, '%s'.\n",
Offset,
(int) Error,
FlashErrorDescriptionEnglish[Error] );
exit( EXIT_FAILURE );
}
}
static
void
Write( int ArgC, char *ArgV[] )
{
FILE *InFile;
char Buffer[1024];
unsigned long Offset;
if (ArgC != 8)
Usage( ArgV[0] );
InFile = fopen( ArgV[6], "r" );
if (InFile == NULL)
{
fprintf( stderr, "Can't open %s\n", ArgV[6] );
exit( EXIT_FAILURE );
}
Offset = strtoul( ArgV[7], NULL, 0 );
for (;;)
{
FlashError_t Error;
size_t NumRead;
NumRead = fread( Buffer, 1, sizeof (Buffer), InFile );
if (NumRead == 0)
break;
Error = BDMFlashWrite( Offset, (unsigned char*) Buffer, NumRead );
if (Error != FlashErrorOkay_c)
{
fprintf( stderr,
"Problem writing flash.\n"
"While at offset 0x%08x attempting to write %lu bytes, error code %d, '%s'.\n",
(unsigned int) Offset,
(unsigned long) NumRead,
(int) Error,
FlashErrorDescriptionEnglish[Error] );
exit( EXIT_FAILURE );
}
Offset += NumRead;
}
}
static
void
Read( int BDMHandle, int ArgC, char *ArgV[] )
{
FILE *OutFile;
unsigned long Len;
unsigned long ByteI;
unsigned long Offset;
if (ArgC != 9)
Usage( ArgV[0] );
Offset = strtoul( ArgV[7], NULL, 0 );
Len = strtoul( ArgV[8], NULL, 0 );
OutFile = fopen( ArgV[6], "w" );
if (OutFile == NULL)
{
fprintf( stderr, "Can't open %s\n", ArgV[6] );
exit( EXIT_FAILURE );
}
for (ByteI = 0; ByteI < Len; ByteI++)
{
int Byte;
Byte = BDMTargetByteRead( BDMHandle, Offset+ByteI );
if (Byte < 0)
{
fprintf( stderr,
"Failed reading byte at offset %lu, code = %d\n",
Offset+ByteI,
Byte );
exit( EXIT_FAILURE );
}
fputc( Byte, OutFile );
}
}
int
main( int ArgC, char *ArgV[] )
{
int BDMHandle;
unsigned int Base;
unsigned int Chips;
unsigned int Bytes;
char *Operation;
FlashError_t Error;
if (ArgC < 6)
Usage( ArgV[0] );
if((BDMHandle = bdm_init(ArgV[1]))<0)
{
fprintf( stderr,
"Problem opening bdm device %s, error code %d.\n", ArgV[1], BDMHandle );
return (EXIT_FAILURE);
}
Base = (unsigned int) strtoul( ArgV[2], NULL, 0 );
Chips = (unsigned int) strtoul( ArgV[3], NULL, 0 );
Bytes = (unsigned int) strtoul( ArgV[4], NULL, 0 );
Operation = ArgV[5];
Error = BDMFlashConfigSet( BDMHandle, Base, Chips, Bytes );
if (Error != FlashErrorOkay_c)
{
fprintf( stderr,
"Problem configuring flash; error code = %d '%s'.\n",
(int) Error,
FlashErrorDescriptionEnglish[Error] );
}
if (strcasecmp( Operation, "erase" ) == 0)
{
Erase( ArgC, ArgV );
}
else if (strcasecmp( Operation, "SectorErase" ) == 0)
{
SectorErase( ArgC, ArgV );
}
else if (strcasecmp( Operation, "BlockErase" ) == 0)
{
BlockErase( ArgC, ArgV );
}
else if (strcasecmp( Operation, "write" ) == 0)
{
Write( ArgC, ArgV );
}
else if (strcasecmp( Operation, "read" ) == 0)
{
Read( BDMHandle, ArgC, ArgV );
}
else if (strcasecmp( Operation, "probe" ) == 0)
{
Probe( ArgC, ArgV );
}
else if (strcasecmp( Operation, "detect" ) == 0)
{
Detect( ArgC, ArgV );
}
else
Usage( ArgV[0] );
bdm_release( BDMHandle );
return (EXIT_SUCCESS);
}
/*EOF*/

1164
m68k/utils/bdmmon.l Normal file

File diff suppressed because it is too large Load Diff

224
m68k/utils/bdmreset.c Normal file
View File

@@ -0,0 +1,224 @@
/*
* Reset the target connected to the BDM port.
*
* $ gcc -o bdmreset bdmreset.c -lBDM
*
*/
#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <BDMlib.h>
void
clean_exit (int exit_code)
{
if (bdmIsOpen ())
{
bdmSetDriverDebugFlag (0);
bdmClose ();
}
exit (exit_code);
}
void
show_error (char *msg)
{
printf ("%s failed: %s\n", msg, bdmErrorString ());
clean_exit (1);
}
void
do_reset (int cpu, int verbose)
{
unsigned long csr;
/*
* Reset the target
*/
if (bdmReset () < 0)
show_error ("Reset");
/*
* Get the target status
*/
if (cpu == BDM_COLDFIRE)
{
if (bdmReadSystemRegister (BDM_REG_CSR, &csr) < 0)
show_error ("reading CSR");
if ((csr & 0x01000000) == 0)
{
printf ("CSR break not set, target failed to break, CSR = 0x%08lx\n", csr);
clean_exit (1);
}
if (verbose)
{
printf ("CSR break set, target stopped.\n");
printf ("Debug module version is %d, (%s)\n",
(unsigned char) (csr >> 20) & 0x0f,
((csr >> 20) & 0x0f) == 0 ? "5206(e)" : "5307");
}
}
}
void
usage ()
{
printf ("bdmreset -d [level] -D [delay] -v [device]\n"
" where :\n"
" -d [level] : enable driver debug output\n"
" -D [delay] : delay count for the clock generation\n"
" -v : verbose\n"
" [device] : the bdm device, eg /dev/bdmcf0\n");
exit (1);
}
int
main (int argc, char **argv)
{
char *dev = NULL;
int arg;
int delay_counter = 0;
int debug_level = 0;
int verbose = 0;
unsigned int ver;
int cpu;
int iface;
if (argc <= 1)
usage ();
for (arg = 1; arg < argc; arg++)
{
if (argv[arg][0] != '-')
{
if (dev)
{
printf(" device name specified more then once");
exit (1);
}
dev = argv[arg];
}
else
{
switch (argv[arg][1])
{
case 'd':
arg++;
if (arg == argc)
{
printf (" -d option requires a parameter");
exit (1);
}
debug_level = strtoul (argv[arg], NULL, 0);
break;
case 'D':
arg++;
if (arg == argc)
{
printf (" -D option requires a parameter");
exit (1);
}
delay_counter = strtoul (argv[arg], NULL, 0);
break;
case 'v':
verbose = 1;
break;
default:
printf(" unknown option!");
case '?':
case 'h':
usage ();
break;
}
}
}
if (!dev)
{
printf(" ERROR: no device set, check your options as some require parameters.\n");
exit (1);
}
/*
* Open the BDM interface driver
*/
if (bdmOpen (dev) < 0)
show_error ("open");
if (debug_level)
bdmSetDriverDebugFlag (debug_level);
if (delay_counter)
bdmSetDelay (delay_counter);
/*
* Get the driver version
*/
if (verbose)
{
if (bdmGetDrvVersion (&ver) < 0)
show_error ("GetDrvVersion");
printf ("Driver Ver : %i.%i\n", ver >> 8, ver & 0xff);
/*
* Get the processor
*/
if (bdmGetProcessor (&cpu) < 0)
show_error ("GetProcessor");
switch (cpu)
{
case BDM_CPU32:
printf ("Processor : CPU32\n");
break;
case BDM_COLDFIRE:
printf ("Processor : Coldfire\n");
break;
default:
printf ("unknown processor type!\n");
clean_exit (1);
break;
}
/*
* Get the interface
*/
if (bdmGetInterface (&iface) < 0)
show_error ("GetInterface");
switch (iface) {
case BDM_CPU32_ERIC:
printf ("Interface : Eric's CPU32\n");
break;
case BDM_COLDFIRE_TBLCF:
printf ("Interface: TBLCF USB Coldfire\n");
break;
case BDM_COLDFIRE:
printf ("Interface : P&E Coldfire\n");
break;
case BDM_CPU32_ICD:
printf ("Interface : ICD CPU32\n");
break;
default:
printf ("unknown interface type!\n");
clean_exit (1);
break;
}
}
do_reset (cpu, verbose);
clean_exit (0);
return 0;
}

78
m68k/utils/m68332.test Normal file
View File

@@ -0,0 +1,78 @@
#!/usr/local/bin/bdmctrl
#
# This script is for use with the bdmctrl utility and allows loading
# boot loading the 68332.
#
# NOTE: see other scripts for flash loading examples.
#
# Usage ./bdmctrl m68332.test /dev/bdmicd0 object-file-to-load
#
# see flashlib/README and bdmctrl/README.bdmctrl for more information
#
open $1
reset
# reset sometimes leaves %dfc and %sfc in a broken state. This happens rarely,
# but _when_ it happens, the target will just crash. I have never seen this
# with the m683xx branch of the bdm software, so I assume that the problem is
# related to the m68k branch. More investigation will be needed on this issue.
#
write %dfc 5 b
write %sfc 5 b
check-register %a0 a1 a2 a3 a4 a5 a6 a7
check-register d0 d1 d2 d3 d4 d5 d6 d7
check-register vbr pcc rpc
dump-register vbr rpc dfc sfc
write 0x0fffb04 0x1000 w # set RAMBAR to map internal RAM to 0x100000
check-mem 0x100000 0x0800 # check internal RAM
# From here on, the tests are hardware dependant. You will probably need to
# customize.
reset # reset again, since RAMBAR is writable only once
write %dfc 5 b
write %sfc 5 b
# ROM definition
write 0x00fffa48 0x000066830 l # CSBOOT 512K,asy,both,r,as,0wait,s/u
# RAM definiton
write 0x00fffa4c 0x080076830 l # CS0: 1024KB,$800000,asy,both,r,as,0wait,s/u
write 0x00fffa50 0x080073030 l # CS1: 1024KB,$800000,asy,lower,w,as,0wait,s/u
write 0x00fffa54 0x080075030 l # CS2: 1024KB,$800000,asy,upper,w,as,0wait,s/u
# disable remaining chip selects
write 0x00fffa58 0x0fff80000 l
write 0x00fffa5c 0x0fff80000 l
write 0x00fffa60 0x0fff80000 l
write 0x00fffa64 0x0fff80000 l
write 0x00fffa68 0x0fff80000 l
write 0x00fffa6c 0x0fff80000 l
write 0x00fffa70 0x0fff80000 l
write 0x00fffa74 0x0fff80000 l
write 0x00fffa78 0x0fff80000 l
dump-mem 0x0fffa40 48 l # show the chipselect definitions
check-mem 0x800000 0x0800 # check external RAM
load -v $2 .text .data
write main 0x04afa 2 # BGND instruction should stop target on main()
dump-register a0 a1 a2 a3 a4 a5 a6 a7
dump-register d0 d1 d2 d3 d4 d5 d6 d7
dump-register vbr pcc rpc sfc dfc ssp
execute
wait
dump-register a0 a1 a2 a3 a4 a5 a6 a7
dump-register d0 d1 d2 d3 d4 d5 d6 d7
dump-register vbr pcc rpc sfc dfc ssp

89
m68k/utils/mcf52235.test Normal file
View File

@@ -0,0 +1,89 @@
#!/usr/local/bin/bdmctrl
#
# This script is for use with the bdmctrl utility and allows flashing of
# 5223x family devices from linux.
#
# Usage ./bdmctrl mcf52235.test /dev/tblcf2 elf_file
#
# see flashlib/README and bdmctrl/README.bdmctrl for more information
#
# you will need to run flashlib/compile_plugins with 5200 as a target
# and copy the resulting intelc3 plugin to the working folder
#
open $1
reset
# VBR
write-ctrl 0x0801 0x20000000
# RAMBAR
write-ctrl 0x0C05 0x20000021
# FLASHBAR
write-ctrl 0x0C04 0x00000061
# Enable PST[3:0] signals
write 0x40100074 0x0F 1
# Divide 25.0000 MHz clock to get 5.00 MHz PLL input clock
write 0x40120008 0x04 1
# Set RFD+1 to avoid frequency overshoot and wait for PLL to lock
write 0x40120000 0x4103 2
sleep 400
# Set desired RFD=0 and MFD=4 and wait for PLL to lock
write 0x40120000 0x4003 2
sleep 400
# Switch to using PLL
write 0x40120000 0x4007 2
# Set the flash clock
write 0x401D0002 0x55 1
# Unprotect all sectors
#CFMPROT
write 0x401D0010 0x00000000 4
#CFMSACC
write 0x401D0014 0x00000000 4
#CFMDACC
write 0x401D0018 0x00000000 4
#CFMMCR
write 0x401D0000 0x00000000 2
# Set flash algorithm vars
set IPSBAR 0x40000000
set MCF_CFM_CFMCLKD 0x1D0002
set MCF_CFM_CFMUSTAT 0x1D0020
set MCF_CFM_CFMCMD 0x1D0024
set FLASHBAR_REG 0x0C04
set FLASH_SIZE 0x40000
set FLASH_BACKDOOR 0x04000000
# notify flashlib that we have flash at address 0, plugin is flashcfm
flash 0 flashcfm
# erase the entire flash
erase 0 -1
# wait for the erase operation to complete
erase-wait 0
# perform a blank check
blank-chk 0 -1
# load our flash plugin to SRAM
flash-plugin 0x20000000 0x4000 flashcfm_5200.plugin
# load and verify
load -v $2
# dump some memory at the start of flash for debugging
dump-mem 0 48 l
execute
wait

96
m68k/utils/mcf5235.test Normal file
View File

@@ -0,0 +1,96 @@
#!/usr/local/bin/bdmctrl
#
# This script is for use with the bdmctrl utility and allows flashing of
# 5235 BCC (have not tested with EVB) from linux.
#
# Usage ./bdmctrl mcf5235.test /dev/tblcf2 elf_file
#
# see flashlib/README and bdmctrl/README.bdmctrl for more information
#
# you will need to run flashlib/compile_plugins with 5200 as a target
# and copy the resulting intelc3 plugin to the working folder
#
open $1
reset
# IPSBAR at 0x40000000
# SRAMBAR at 0x20000000
# FLASH at 0xFFE00000 (AM29PL160CB(1x16))
# DRAM at 0x00000000
# RAMBAR
write-ctrl 0x0C05 0x20000001
# Set PAR_SDRAM to allow SDRAM signals to be enabled
write 0x40100046 0x3F 1
# Set PAR_AD to allow 32-bit SDRAM if the external boot device is 16 bits
write 0x40100040 0xE1 1
# Turn off WCR
write 0x40140000 0x0000 2
# set up 2nd RAMBAR to make 2nd port avail to FEC
write 0x40000008 0x20000201 4
# 1MB ASRAM on CS1 at 0x30000000 (not populated)
#write 0x4000008C 0x3000 2
#write 0x40000090 0x000f0001 4
#write 0x40000096 0x3d20 2
# 2 meg flash on CS0 at 0xffe000
write 0x40000080 0xFFE0 2
write 0x40000084 0x001f0001 4
write 0x4000008a 0x1980 2
sleep 100
# crank up PLL
write 0x40120000 0x00000000 4
sleep 100
# 16 meg sdram (page 18.6.4 of ref 5235 ref-manual)
#powerup sequence
write 0x40000040 0x0446 2
write 0x40000048 0x00001300 4
write 0x4000004c 0x00fc0001 4
#precharge
write 0x40000048 0x00001308 4
write 0x00000000 0x00000000 4
sleep 100
#refresh sequence
write 0x40000048 0x00009300 4
#enable IMRS
write 0x40000048 0x00009340 4
#access sd ram to initialize the mode register
write 0x00000400 0x00000000 4
sleep 600
#notify flashlib that we have flash at address 0xFFE00000, plugin is flash29
flash 0xFFE00000 flash29
#erase the entire flash
erase 0xFFE00000 -1
#wait for the erase operation to complete
erase-wait 0xFFE00000
#load our flash plugin
flash-plugin 0x20000000 0x4000 flash29_5200.plugin
#load and verify
load -v $2
# dump some memory at the start of flash for debugging
dump-mem 0xFFE00000 48 l
execute
wait

95
m68k/utils/mcf5329.test Normal file
View File

@@ -0,0 +1,95 @@
#!/usr/local/bin/bdmctrl
#
# This script is for use with the bdmctrl utility and allows flashing of
# 5329 Logic PD + Zoom EVB from linux.
#
# Usage ./bdmctrl mcf5329.test /dev/tblcf2 elf_file
#
# see flashlib/README and bdmctrl/README.bdmctrl for more information
#
# you will need to run flashlib/compile_plugins with 5307 as a target
# and copy the resulting intelc3 plugin to the working folder
#
open $1
reset
# SRAMBAR at 0x80000000
# FLASH at 0x00000000 (28F160C3)
# DRAM at 0x40000000
# Turn on RAMBAR1 at address 80000000
write-ctrl 0x0C05 0x80000221
# Disable watchdog timer
write 0xFC098000 0x0000 2
# Init CS0
write 0xFC008000 0x00000000 4
write 0xFC008008 0x00001FA0 4
write 0xFC008004 0x001F0001 4
sleep 100
# SDRAM Initialization
# SDCS0
write 0xFC0B8110 0x40000018 4
# SDCFG1
write 0xFC0B8008 0x53722730 4
# SDCFG2
write 0xFC0B800C 0x56670000 4
# Issue PALL
# SDCR
write 0xFC0B8004 0xE1092002 4
# Issue LEMR
# SDMR
write 0xFC0B8000 0x40010000 4
# Write mode register
# SDMR
write 0xFC0B8000 0x058D0000 4
# Wait a bit
sleep 1000
# Issue PALL
# SDCR
write 0xFC0B8004 0xE1092002 4
# Perform two refresh cycles
# SDCR
write 0xFC0B8004 0xE1092004 4
# SDCR
write 0xFC0B8004 0xE1092004 4
# SDMR
write 0xFC0B8000 0x018D0000 4
# SDCR
write 0xFC0B8004 0x71092C00 4
# Wait a bit
sleep 100
#notify flashlib that we have flash at address 0x00000000, plugin is flashintelc3
flash 0x00000000 flashintelc3
#erase the entire flash
erase 0x00000000 -1
#load our flash plugin
flash-plugin 0x80000000 0x4000 flashintelc3_5307.plugin
#load and verify
load -v $2
# dump some memory at the start of flash for debugging
dump-mem 0x00000000 48 l
execute
wait