#! /bin/sh
# Configure ARM/AEB-1 eCos to create AEB-1 GDB stubs
# Ensure that PATH include the directory where the ARM tools reside.
#
# Run from an empty temporary directory with two arguments: the path to
# the packages directory (i.e., where pkgconf.tcl lives), and the platform
# name (aeb or aebC).
#
# Output files are in the directory hal/arm/aeb/<version>/misc.
#  gdb_module.img: suitable for programming via GDB stub/Angel
#  gdb_module.img.UU: suitable for programming via ROM menu 
# See Notes for details.

if [ "$2"x = "x" ]; then
  AEB="aeb"
else
  AEB=$2
fi

if ( echo | tclsh ) 2>/dev/null ; then
  TCL=tclsh
elif ( echo | cygtclsh80 ) 2>/dev/null ; then
  TCL=cygtclsh80
else
  echo Could not find TCL interpreter
  exit 1
fi

$TCL $1/pkgconf.tcl                                         \
   --target=arm --platform=${AEB} --startup=stubs                      \
   --disable CYGPKG_KERNEL --disable CYGPKG_UITRON                     \
   --disable CYGPKG_LIBC --disable CYGPKG_LIBM                         \
   --disable CYGPKG_ERROR --disable CYGPKG_IO                          \
   --disable CYGPKG_IO_SERIAL --disable CYGPKG_DEVICES_WALLCLOCK       \
   --disable CYGPKG_DEVICES_WATCHDOG

patch <<END_OF_PATCH -p0
--- pkgconf/hal.h.orig	Fri Oct 22 09:32:14 1999
+++ pkgconf/hal.h	Wed Oct 27 11:15:09 1999
@@ -110,7 +110,7 @@
  }
 
  }}CFG_DATA */
-#define CYGFUN_HAL_COMMON_KERNEL_SUPPORT
+#undef CYGFUN_HAL_COMMON_KERNEL_SUPPORT
 
 /* {{CFG_DATA
    
@@ -382,10 +382,10 @@
 
    }}CFG_DATA */
 
-#undef   CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
+#define  CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
 #undef   CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT
-#define  CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT
-#define  CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT
+#undef   CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT
+#undef   CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT
 
 /*
  * NOTE:
END_OF_PATCH

make
make misc
