#! /bin/sh

# usage: STUBS_config <repository> <platform>
#   where <platform> is one of:
#     edb7211
#     cl7111

if [ "$2"x = "x" ]; then
  EDB7xxx="edb7211"
else
  EDB7xxx=$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=${EDB7xxx} --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 --disable-cygmon

patch <<END_OF_PATCHES -p0

// This patch enables GDB stub support

--- pkgconf/hal.h~      Thu Jul  8 08:26:44 1999
+++ pkgconf/hal.h       Wed Jul 28 10:51:07 1999
@@ -369,10 +369,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:

// This patch selects statis MMU tables, in ROM

--- pkgconf/hal.h~      Mon Nov 22 07:42:33 1999
+++ pkgconf/hal.h       Mon Nov 22 08:33:32 1999
@@ -348,7 +348,7 @@
    }}CFG_DATA */
 
 #define CYGSEM_HAL_INSTALL_MMU_TABLES
-#undef  CYGSEM_HAL_STATIC_MMU_TABLES
+#define CYGSEM_HAL_STATIC_MMU_TABLES
 
 /* ---------------------------------------------------------------------
  * Options related to source-level debugging and diagnostics.

END_OF_PATCHES
