summaryrefslogtreecommitdiff
path: root/ecos/packages/hal/synth
diff options
context:
space:
mode:
authorMichael Gielda <mgielda@antmicro.com>2014-04-03 14:53:04 +0200
committerMichael Gielda <mgielda@antmicro.com>2014-04-03 14:53:04 +0200
commitae1e4e08a1005a0c487f03ba189d7536e7fdcba6 (patch)
treef1c296f8a966a9a39876b0e98e16d9c5da1776dd /ecos/packages/hal/synth
parentf157da5337118d3c5cd464266796de4262ac9dbd (diff)
Added the OS files
Diffstat (limited to 'ecos/packages/hal/synth')
-rw-r--r--ecos/packages/hal/synth/arch/current/ChangeLog636
-rw-r--r--ecos/packages/hal/synth/arch/current/cdl/hal_synth.cdl161
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/filters.pngbin0 -> 13312 bytes
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/hal-synth-arch.html177
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/layout.fig57
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/layout.pngbin0 -> 1439 bytes
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/makefile54
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/menu_edit.pngbin0 -> 5685 bytes
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/menu_file.pngbin0 -> 1959 bytes
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/menu_help.pngbin0 -> 2311 bytes
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/menu_view.pngbin0 -> 1223 bytes
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/preferences.pngbin0 -> 7935 bytes
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/screen_main.pngbin0 -> 17090 bytes
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/synth-console.html373
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/synth-gui.html738
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/synth-install.html404
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/synth-io-overview.fig57
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/synth-io-overview.pngbin0 -> 1187 bytes
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/synth-new-host.html1734
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/synth-new-target.html823
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/synth-porting.html379
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/synth-running.html964
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/synth-syscalls.html333
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/synth.html372
-rw-r--r--ecos/packages/hal/synth/arch/current/doc/synth.sgml2744
-rw-r--r--ecos/packages/hal/synth/arch/current/host/Makefile.am89
-rw-r--r--ecos/packages/hal/synth/arch/current/host/Makefile.in715
-rw-r--r--ecos/packages/hal/synth/arch/current/host/acinclude.m443
-rw-r--r--ecos/packages/hal/synth/arch/current/host/aclocal.m4992
-rwxr-xr-xecos/packages/hal/synth/arch/current/host/configure5981
-rw-r--r--ecos/packages/hal/synth/arch/current/host/configure.in92
-rw-r--r--ecos/packages/hal/synth/arch/current/host/console.tcl195
-rw-r--r--ecos/packages/hal/synth/arch/current/host/copy.xbm6
-rw-r--r--ecos/packages/hal/synth/arch/current/host/cut.xbm6
-rw-r--r--ecos/packages/hal/synth/arch/current/host/default.tdf43
-rw-r--r--ecos/packages/hal/synth/arch/current/host/ecosicon.xbm10
-rw-r--r--ecos/packages/hal/synth/arch/current/host/ecosiconmask.xbm10
-rw-r--r--ecos/packages/hal/synth/arch/current/host/ecosynth.c363
-rw-r--r--ecos/packages/hal/synth/arch/current/host/ecosynth.tcl3312
-rw-r--r--ecos/packages/hal/synth/arch/current/host/help.xbm6
-rw-r--r--ecos/packages/hal/synth/arch/current/host/paste.xbm6
-rw-r--r--ecos/packages/hal/synth/arch/current/host/running1.ppmbin0 -> 1981 bytes
-rw-r--r--ecos/packages/hal/synth/arch/current/host/running2.ppmbin0 -> 1981 bytes
-rw-r--r--ecos/packages/hal/synth/arch/current/host/running3.ppmbin0 -> 1981 bytes
-rw-r--r--ecos/packages/hal/synth/arch/current/host/save.xbm6
-rw-r--r--ecos/packages/hal/synth/arch/current/host/saveall.xbm6
-rw-r--r--ecos/packages/hal/synth/arch/current/host/tick_no.xbm5
-rw-r--r--ecos/packages/hal/synth/arch/current/host/tick_yes.xbm5
-rw-r--r--ecos/packages/hal/synth/arch/current/host/user_initrc.tcl9
-rw-r--r--ecos/packages/hal/synth/arch/current/host/user_mainrc.tcl10
-rw-r--r--ecos/packages/hal/synth/arch/current/include/hal_arch.h89
-rw-r--r--ecos/packages/hal/synth/arch/current/include/hal_cache.h87
-rw-r--r--ecos/packages/hal/synth/arch/current/include/hal_diag.h77
-rw-r--r--ecos/packages/hal/synth/arch/current/include/hal_intr.h262
-rw-r--r--ecos/packages/hal/synth/arch/current/include/hal_io.h620
-rw-r--r--ecos/packages/hal/synth/arch/current/src/synth.ld237
-rw-r--r--ecos/packages/hal/synth/arch/current/src/synth_diag.c156
-rw-r--r--ecos/packages/hal/synth/arch/current/src/synth_entry.c219
-rw-r--r--ecos/packages/hal/synth/arch/current/src/synth_intr.c1400
-rw-r--r--ecos/packages/hal/synth/arch/current/src/synth_protocol.h123
-rw-r--r--ecos/packages/hal/synth/arch/current/src/synth_syscalls.c107
-rw-r--r--ecos/packages/hal/synth/arch/current/tests/ftok.c86
-rw-r--r--ecos/packages/hal/synth/i386linux/current/ChangeLog453
-rw-r--r--ecos/packages/hal/synth/i386linux/current/cdl/hal_synth_i386.cdl174
-rw-r--r--ecos/packages/hal/synth/i386linux/current/include/arch.inc76
-rw-r--r--ecos/packages/hal/synth/i386linux/current/include/basetype.h81
-rw-r--r--ecos/packages/hal/synth/i386linux/current/include/pkgconf/mlt_synth_i386_rom.h20
-rw-r--r--ecos/packages/hal/synth/i386linux/current/include/pkgconf/mlt_synth_i386_rom.ldi31
-rw-r--r--ecos/packages/hal/synth/i386linux/current/include/var_arch.h229
-rw-r--r--ecos/packages/hal/synth/i386linux/current/include/var_intr.h78
-rw-r--r--ecos/packages/hal/synth/i386linux/current/include/var_io.h103
-rw-r--r--ecos/packages/hal/synth/i386linux/current/src/context.S223
-rw-r--r--ecos/packages/hal/synth/i386linux/current/src/profile.c184
-rw-r--r--ecos/packages/hal/synth/i386linux/current/src/syscall-i386-linux-1.0.S458
-rw-r--r--ecos/packages/hal/synth/i386linux/current/src/tls.c128
-rw-r--r--ecos/packages/hal/synth/i386linux/current/src/vectors.S131
76 files changed, 27748 insertions, 0 deletions
diff --git a/ecos/packages/hal/synth/arch/current/ChangeLog b/ecos/packages/hal/synth/arch/current/ChangeLog
new file mode 100644
index 0000000..edd36f6
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/ChangeLog
@@ -0,0 +1,636 @@
+2011-08-13 Sergei Gavrikov <sergei.gavrikov@gmail.com>
+
+ * cdl/hal_synth.cdl (CYGPKG_HAL_SYNTH_TESTS): Fix a typo in make rule.
+
+2009-08-13 Bart Veer <bartv@ecoscentric.com>
+
+ * src/synth.ld (SECTION_eh_frame): allow for a .eh_frame_hdr
+ section.
+
+2009-07-16 Bart Veer <bartv@ecoscentric.com>
+
+ * src/synth_diag.c: add locking to the HAL diag code. Remove an
+ unnecessary fdatasync().
+
+2009-07-14 Bart Veer <bartv@ecoscentric.com>
+
+ * host/configure.in: allow builds on x86_64 machines.
+
+ * host/configure, host/Makefile.in, host/aclocal.m4: regenerate.
+
+2009-07-09 Bart Veer <bartv@ecoscentric.com>
+
+ * host/ecosynth.tcl: fix problems with balloon help when widgets
+ are deleted.
+
+ * include/hal_io.h: add unlink() and rename() prototypes
+
+2009-02-07 John Dallaway <john@dallaway.org.uk>
+
+ * cdl/hal_synth.cdl: Parent under the common HAL package as with
+ other architectural HAL packages.
+
+2008-12-30 John Dallaway <john@dallaway.org.uk>
+
+ * cdl/hal_synth.cdl: Reference per-package documentation.
+
+2008-10-07 Bart Veer <bartv@ecoscentric.com>
+
+ * host/ecosynth.tcl: another attempt to fix the X problems when
+ shutting down.
+
+2008-08-28 Bart Veer <bartv@ecoscentric.com>
+
+ * host/configure: regenerate after update of Tcl macro
+
+2008-08-20 Bart Veer <bartv@ecoscentric.com>
+
+ * host/configure: regenerate after update of Tcl macro
+
+2008-08-18 Bart Veer <bartv@ecoscentric.com>
+
+ * host/Makefile.am, host/configure.in, ecosynth.c: update
+ host-side configury.
+ * host/Makefile.in, host/aclocal.m4, host/configure: regenerate
+
+2008-08-13 Bart Veer <bartv@ecoscentric.com>
+
+ * host/ecosynth.tcl: avoid X problems when shutting down.
+ * src/synth.ld: update for recent gcc versions.
+ * cdl/hal_synth.cdl: use the right compiler flags to avoid a build
+ warning.
+
+2007-06-12 Andrew Lunn <andrew.lunn@ascom.ch>
+
+ * src/synth_entry.c (__stack_chk_fail): another new function
+ needed when building with gcc 4.1.2
+ * current/src/synth.ld: place eh_frame_hdr into eh_frame.
+
+2006-07-10 Bart Veer <bartv@ecoscentric.com>
+
+ * src/synth_entry.c (__stack_chk_fail_local): new function needed
+ when building with gcc 4.1.1
+
+2005-11-19 Bart Veer <bartv@ecoscentric.com>
+
+ * src/synth_entry.c (_linux_entry): brk() is no longer needed to
+ get heap memory.
+
+ * src/synth.ld: add new section to contain the heap memory rather
+ than rely on brk().
+
+2005-11-05 Andrew Lunn <andrew.lunn@ascom.ch>
+
+ * include/hal_io.h (struct cyg_hal_sys_old_stat): Make the
+ structure match the kernel version otherwise the stack gets
+ corrupt and we die 'orribly. Added cyg_hal_sys_new_stat for when
+ using the new?stat() calls.
+ * src/synth_syscall.c (cyg_hal_sys_ftok): use the correct structure
+ member names and use the newstat system call so we get
+ values back which are compatible with glibc ftok() function.
+ * tests/ftok.c (new): Test case for the cyg_hal_sys_ftok()
+ function added in the previous patch.
+
+2005-10-19 Alexander Neundorf <neundorf@kde.org>
+
+ * src/synth_syscall.c: add cyg_hal_sys_ftok().
+
+2005-07-30 Andrew Lunn <andrew.lunn@ascom.ch>
+
+ * src/synth_diag.c (hal_diag_write_char): Compiler warning fix.
+ * src/synth_intr.c (synth_auxiliary_instantiate): Ditto
+
+2005-06-26 Bart Veer <bartv@ecoscentric.com>
+
+ * src/synth_intr.c (synth_hardware_init): extract bogomips rating
+ for use by HAL_DELAY_US()
+
+ * include/hal_intr.h: add #include of <cyg/hal/var_intr.h> for
+ HAL_DELAY_US().
+
+2005-03-11 Bart Veer <bartv@ecoscentric.com>
+
+ * src/synth_intr.c (synth_hardware_init): allow the platform to
+ customize the sigaction structures.
+
+ * include/hal_io.h: add more signal-related definitions
+
+ * cdl/hal_synth.cdl: change the clock calculations, so that users
+ only need to specify RTC_PERIOD
+
+2004-12-14 Alexander Neundorf <neundorf@kde.org>
+ Andrew Lunn <andrew.lunn@ascom.ch>
+
+ * include/hal_io.h: Add cyg_hal_sys_shmget(), cyg_hal_sys_shmat()
+ and cyg_hal_sys_shmdt() system calls
+ * src/synth_syscalls.c: Implementations of cyg_hal_sys_shmget(),
+ cyg_hal_sys_shmat() and cyg_hal_sys_shmdt(). Moved
+ cyg_hal_sys_mmap() from the flash driver to here.
+
+2004-08-09 Andrew Lunn <andrew.lunn@ascom.ch>
+
+ * include/hal_intr.h (HAL_PLATFORM_RESET): Added missing ;
+
+2004-08-04 Alexander Neundorf <alexander.neundorf@jenoptik.com>
+
+ * include/hal_io.h: Add cyg_hal_sys_mkdir() system call
+ * include/hal_intr.h: Add HAL_PLATFORM_RESET() macro
+
+2004-07-04 Andrew Lunn <andrew.lunn@ascom.ch>
+
+ * src/synth.ld: Added the 2ram section needed for flash devices
+
+2004-06-21 Alexander Neundorf <alexander.neundorf@jenoptik.com>
+
+ * include/hal_io.h:
+ Add cyg_hal_sys_readdir(), cyg_hal_sys_lstat(),
+ cyg_hal_sys_fstat() system call toegther with their
+ accompanying data structures and file mode bits
+
+2004-06-18 William Donahue <WDonahue@siriusradio.com>
+
+ * include/hal_io.h (CYG_HAL_SYS_FD_ZERO): Added misisng }
+
+2004-05-27 Alexander Neundorf <alexander.neundorf@jenoptik.com>
+
+ * include/hal_io.h:
+ Fix the open/fcntl flags by prepending a leading 0 so that they
+ are interpreted correctly as octal instead of decimal.
+
+2004-04-22 Jani Monoses <jani@iv.ro>
+
+ * cdl/hal_synth.cdl :
+ Invoke tail with stricter syntax that works in latest coreutils.
+
+2003-07-18 Nick Garnett <nickg@balti.calivar.com>
+
+ * cdl/hal_synth.cdl:
+ Changed values for CYGNUM_HAL_RTC_NUMERATOR,
+ CYGNUM_HAL_RTC_DENOMINATOR and CYGNUM_HAL_RTC_PERIOD to
+ "default_value" from "calculated". This makes it easier
+ to change these values globally.
+
+2003-07-05 Bart Veer <bartv@ecoscentric.com>
+
+ * src/synth_entry.c:
+ Add more dummy functions to cope with dependencies introduced by
+ various versions of g++.
+
+2003-06-27 Jonathan Larmour <jifl@eCosCentric.com>
+
+ * src/synth.ld: Synthetic linux at least needs libgcc_eh.a in the
+ GROUP() to resolve exception handling symbols.
+
+2003-02-25 Iztok Zupet <iz@vsr.si>
+
+ * doc/synth.sgml: Replaced .gif with .png to get PDF
+ output.
+ * doc/*.gif: Delete.
+ * doc/*.png: Replacements for .gifs added.
+
+2003-04-10 Nick Garnett <nickg@balti.calivar.com>
+
+ * src/synth.ld:
+ Added libsupc++.a to GROUP() directive for GCC versions later than
+ 3.0.
+
+2003-03-30 Bart Veer <bartv@ecoscentric.com>
+
+ * src/synth_intr.c (synth_auxiliary_xchgmsg): fix typo reported
+ by Savin Zlobec
+
+2003-03-26 Andrew Lunn <andrew.lunn@ascom.ch>
+
+ * src/synth_intr.c (synth_start_auxiliary): When an empty string
+ is found on the PATH, remember to move onto the next entry
+ otherwise we loop forever.
+
+2003-02-24 Jonathan Larmour <jifl@eCosCentric.com>
+
+ * doc/overview.gif, doc/overview.fig: renamed to
+ synth-io-overview.gif and synth-io-overview.fig.
+ * doc/synth.sgml: Add some missing "&gt;"s to header file names.
+ Comment out DOCTYPE for now to allow building with standard doc build.
+ overview.gif renamed as per above.
+
+2003-02-12 Bart Veer <bartv@ecoscentric.com>
+
+ * host/Makefile.am, host/Makefile.in, configure:
+ Regenerate after acinclude.m4 update
+
+2002-12-03 Bart Veer <bartv@ecoscentric.com>
+
+ * src/synth_entry.c:
+ Provide dummy versions of __cxa_atexit() and __dso_handle, to
+ satisfy requirements of recent versions of the compiler configured
+ for native Linux development.
+
+2002-09-22 Bart Veer <bartv@ecoscentric.com>
+
+ * host/configure.in:
+ If the installed version of Tcl is too old, issue a warning and
+ suppress the build, rather than fail. Other bits of the system,
+ e.g. the generic host-side tools, can still be built.
+
+2002-09-21 Bart Veer <bartv@ecoscentric.com>
+
+ * host/ecosynth.c:
+ Avoid const compatibility problems with Tcl 8.4
+
+2002-09-15 Bart Veer <bartv@ecoscentric.com>
+
+ * include/hal_io.h
+ cdl/hal_synth.cdl
+ src/synth_entry.c, src/synth_intr.c, src/synth_diag.c,
+ src/synth_protocol.h
+ doc/*
+ host/*
+ Add support for I/O via an I/O auxiliary
+
+2002-08-04 Bart Veer <bartv@tymora.demon.co.uk>
+
+ * include/hal_io.h: added argv/argv/environ definitions
+
+2002-05-23 Jesper Skov <jskov@redhat.com>
+
+ * cdl/hal_synth.cdl: Don't run cache tests.
+
+2002-04-10 Jonathan Larmour <jlarmour@redhat.com>
+
+ * src/synth.ld: Add RELOCS "section" and eh_frame section, plus
+ correct use of .gnu.linkonce sections.
+
+2002-02-28 Bart Veer <bartv@redhat.com>
+
+ * doc/synth.sgml, doc/makefile, doc/*.html:
+ Documentation for the synthetic target HAL.
+
+2002-01-25 Bart Veer <bartv@redhat.com>
+
+ * src/synth_intr.c (hal_interrupt_mask/unmask):
+ Add preconditions that interrupts are disabled on entry, rather
+ than disabling and reenabling the interrupts, since the
+ specification requires the former.
+
+2002-01-08 Jonathan Larmour <jlarmour@redhat.com>
+2001-11-01 Andrew Lunn <andrew.lunn@ascom.ch>
+
+ * include/hal_io.h: Support for mmap, lseek and open syscalls.
+ * include/hal_cache.h: Add HAL_ICACHE_IS_ENABLED and
+ HAL_DCACHE_IS_ENABLED.
+
+2001-12-07 Bart Veer <bartv@redhat.com>
+
+ * include/hal_io.h: Added cyg_hal_sys_getcwd()
+
+2001-08-02 Bart Veer <bartv@redhat.com>
+
+ * include/hal_intr.h:
+ Note a subtle interaction between the interrupt handling
+ and the context switch handling, which are in the
+ architectural and variant HAL packages respectively.
+
+2001-04-27 Bart Veer <bartv@redhat.com>
+
+ * All files
+ Major reorganization and clean-up of the synthetic target.
+
+2000-11-02 Jonathan Larmour <jlarmour@redhat.com>
+
+ * src/entry.c (_linux_entry): Extend memory using brk() syscall to
+ match memory layout
+
+ * src/syscall-i386-linux-1.0.S: Add brk syscall
+
+2000-10-20 Jonathan Larmour <jlarmour@redhat.com>
+
+ * include/pkgconf/mlt_i386_linux_ram.mlt:
+ Add heap1 section
+
+ * include/pkgconf/mlt_i386_linux_ram.h:
+ * include/pkgconf/mlt_i386_linux_ram.ldi:
+ Regenerated
+
+2000-10-20 Jonathan Larmour <jlarmour@redhat.com>
+
+ * cdl/hal_i386_linux.cdl: Correct memory layout file name
+
+2000-03-03 John Dallaway <jld@cygnus.co.uk>
+
+ * cdl/hal_i386_linux.cdl (CYGBLD_GLOBAL_COMMAND_PREFIX):
+
+ Revert most recent change for now to avoid breaking the
+ release system.
+
+2000-03-02 Jonathan Larmour <jlarmour@redhat.co.uk>
+
+ * cdl/hal_i386_linux.cdl (CYGBLD_GLOBAL_COMMAND_PREFIX): Use native
+ toolchain by default, and describe versions to be used
+
+2000-02-29 Jesper Skov <jskov@redhat.com>
+
+ * include/plf_intr.h: Don't include kernel headers.
+
+2000-02-16 Jesper Skov <jskov@redhat.com>
+
+ * src/hal_diag.c (hal_diag_write_char): Check that write call is
+ successful.
+
+2000-02-16 Nick Garnett <nickg@cygnus.co.uk>
+
+ * include/variant.inc: Added missed copyright notice.
+
+2000-02-15 Nick Garnett <nickg@cygnus.co.uk>
+
+ * include/variant.inc:
+ * include/var_intr.h:
+ * include/plf_intr.h:
+ These files added to make this HAL consistent with PC
+ version. They also contains some code moved out of the
+ architecture HAL.
+
+2000-01-24 John Dallaway <jld@cygnus.co.uk>
+
+ * cdl/*.cdl:
+
+ Remove obsolete option CYGTST_TESTING_IDENTIFIER.
+
+2000-01-21 Jesper Skov <jskov@cygnus.co.uk>
+ CR 902062-CR
+ * src/hal_diag.c:
+ * src/syscall-i386-linux-1.0.S:
+ Sync after write.
+
+ * src/hal_startup.c: Make signals NODEFER.
+
+2000-01-19 Hugo Tyson <hmt@cygnus.co.uk>
+
+ * cdl/*.cdl: Add descriptions to a number of options &c which were
+ lacking same, also tidied up other typos as noticed en passant.
+
+1999-12-20 Gary Thomas <gthomas@cygnus.co.uk>
+
+ * cdl/hal_i386_linux.cdl: Add -Wl for linker options.
+
+1999-11-25 Gary Thomas <gthomas@cygnus.co.uk>
+
+ * include/pkgconf/mlt_i386_linux_ram.h: New file(s).
+
+1999-11-01 Jesper Skov <jskov@cygnus.co.uk>
+
+ * cdl/hal_i386_linux.cdl: Added.
+ Use define_proc for const header defs.
+1999-10-05 Jonathan Larmour <jlarmour@cygnus.co.uk>
+
+ * src/linux_misc.c: Fix some really minor spelling typos
+
+ * src/hal_diag.c (hal_diag_read_char): Check if we were woken up by
+ the itimer alarm (which is used for rescheduling) - in which case
+ just read again.
+
+
+1999-10-05 Jesper Skov <jskov@cygnus.co.uk>
+
+ * include/pkgconf/hal_i386_linux.h: Changed to use REAL TIME as
+ default.
+
+ From Andrew Lunn (lunn@ma.tech.ascom.ch)
+ * src/PKGconf.mak:
+ * src/linux_misc.c: [added]
+ * src/syscall-i386-linux-1.0.S:
+ Added idle thread action, reducing host load when eCos is idle.
+
+1999-08-16 John Dallaway <jld@cygnus.co.uk>
+
+ * include/pkgconf/hal_i386_linux.h:
+
+ Proper case package display string.
+
+1999-05-20 Gary Thomas <gthomas@cygnus.co.uk>
+
+ * include/pkgconf/hal_i386_linux.h: Move RTC setup here.
+
+1999-05-14 Jesper Skov <jskov@cygnus.co.uk>
+ PR 18956
+ * include/pkgconf/mlt_i386_linux_ram.mlt:
+ * include/pkgconf/mlt_i386_linux_ram.ldi:
+ Fixed problem with rel_got.
+ Encode . in section name as __.
+
+1999-04-08 John Dallaway <jld@cygnus.co.uk>
+
+ * include/pkgconf/mlt_*.*: Use double underscore substitution
+ for period character in SECTION_* macro names (PR 19787)
+
+1999-04-08 John Dallaway <jld@cygnus.co.uk>
+
+ * include/pkgconf/*.ldi: Revised SECTION_* macro arguments to
+ avoid padded output sections (PR 19787)
+
+1999-03-22 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/linux.S: Added comment.
+ Doh! Managed to break compilation with a comment...
+
+1999-03-16 Jesper Skov <jskov@cygnus.co.uk>
+ PR 19483
+ * src/linux.S (cyg_hal_hardware_init): Fiddled some more with the
+ bits to no avail.
+
+ * src/hal_startup.c:
+ Renamed hal_ to cyg_hal_.
+ Added exception handling.
+
+1999-03-12 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/hal_startup.c (cyg_hal_isr_init): Initialize ISR table with
+ pointers to default ISR routine.
+
+1999-03-12 Jesper Skov <jskov@cygnus.co.uk>
+ PR 19486
+ * src/linux.S (cyg_hal_hardware_init): Only enable zero divide
+ exceptions.
+
+1999-03-11 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/hal_startup.c:
+ * src/entry.c:
+ Renamed hal_isr_init to cyg_hal_isr_init.
+
+ * src/hal_startup.c: Also catch SIGFPE.
+
+ * src/entry.c: Call cyg_hal_hardware_init.
+
+ * src/linux.S: [added]
+ * src/PKGconf.mak:
+ Added file to hold startup assembly code.
+
+1999-03-11 John Dallaway <jld@cygnus.co.uk>
+
+ * include/pkgconf/*.ldi: add copyright notices
+
+1999-03-04 John Dallaway <jld@cygnus.co.uk>
+
+ * include/pkgconf/*.ldi: give all LDI files unique names so
+ that they can co-exist in an eCos build tree (PR 19184)
+ * include/pkgconf/*.mlt: give all MLT files unique names so
+ that they can co-exist in an eCos build tree (PR 19184)
+
+1999-02-25 Nick Garnett <nickg@cygnus.co.uk>
+
+ * src/hal_startup.c:
+ Changed label used to access scheduler lock to one that is not
+ mangled by C++. This is intended to make support for interrupt
+ handling in non-kernel configurations easier.
+
+1999-02-22 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/syscall-i386-linux-1.0.S: Added copyright header.
+
+1999-02-20 Jonathan Larmour <jlarmour@cygnus.co.uk>
+
+ * src/hal_startup.c:
+ Rename hal_interrupts_deffered -> hal_interrupts_deferred
+ Rename CYG_ISR/VSR_* -> CYGNUM_HAL_ISR/VSR_* in line with HAL changes
+ Rename CYG_VECTOR_RTC -> CYGNUM_HAL_INTERRUPT_RTC
+
+ * src/syscall-i386-linux-1.0.S:
+ Add a FIX ME
+
+1999-02-08 John Dallaway <jld@cygnus.co.uk>
+
+ * include/pkgconf/ram.mlt: New memory layout save file
+
+1999-02-05 John Dallaway <jld@cygnus.co.uk>
+
+ * include/pkgconf/*.ldi: Remove LMA_EQ_VMA macro definition.
+
+1999-01-29 Jesper Skov <jskov@cygnus.co.uk>
+
+ * include/pkgconf/hal_i386_linux.h: Changed CDL type back to radio
+ to get consistent ConfigTool output.
+
+1999-01-27 Jesper Skov <jskov@cygnus.co.uk>
+
+ * include/pkgconf/ram.ldi: Commented out the rel_got change.
+
+1999-01-25 Jesper Skov <jskov@cygnus.co.uk>
+
+ * include/pkgconf/ram.ldi: Added rel.got section.
+
+1999-01-22 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/hal_startup.c: Moved external declarations into top-level
+ scope to avoid compiler warning.
+
+1999-01-19 Jesper Skov <jskov@cygnus.co.uk>
+
+ * include/pkgconf/hal_i386_linux.h: Removed startup
+ config. Changed linux entry to dummy instead of bool.
+
+1999-01-12 Jesper Skov <jskov@cygnus.co.uk>
+
+ * include/pkgconf/hal_i386_linux.h: Added config for real-time
+ timer.
+
+1999-01-12 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/hal_diag.c: Removed hal_diag_write_line.
+
+ * src/entry.c: Removed main/argv stuff.
+
+1999-01-12 Jesper Skov <jskov@cygnus.co.uk>
+
+ * include/pkgconf/hal_i386_linux.h: Added.
+
+1999-01-11 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/hal_startup.c (hal_default_vsr):
+ * src/linux.ld (cyg_hal_sched_lock):
+ Added C-symbol reference to the scheduler lock.
+
+1999-01-11 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/hal_startup.c (hal_default_vsr): Allow interrupt disable
+ count to be bigger than 1.
+
+1999-01-11 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/linux.ld: Added fix me. Remember to clean up.
+
+ * src/hal_startup.c: Removed bogus include statement.
+ Added CYGPKG_KERNEL config handling.
+
+ * src/hal_diag.c: Removed bogus include statements and functions.
+
+1999-01-07 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/hal_startup.c (hal_isr_init): Use CYG_VECTOR_RTC rather than
+ hardcoded value.
+
+1999-01-07 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/syscall-i386-linux-1.0.S:
+ * src/hal_diag.c:
+ * src/PKGconf.mak:
+ Removed tabs & fixed comment style.
+
+1999-01-07 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/PKGconf.mak: Cleaned up.
+
+ * src/entry.c: Added (from proven's crtbegin.c).
+
+ * src/linux.ld: Added.
+
+ * src/hal_startup.cxx: (Deleted)
+ * src/hal_startup.c: (Added)
+ Changed code to C, cleaned up.
+
+1999-01-06 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/hal_diag.c: Fixed warnings. Output chars in batches to avoid
+ problems with pkgtest - also improves performance.
+
+1999-01-06 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/syscall-i386-linux-1.0.S: Set behavior to match __ELF__.
+
+1998-12-18 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/syscall-i386-linux-1.0.S:
+ * src/hal_startup.cxx:
+ Fixed compiler warnings.
+
+Fri Dec 4 13:49:03 GMT 1998
+
+ * src/syscall-i386-linux-1.0.S: Fix to work with Bart's latest tools.
+ For some reason it doesn't define __ELF__ but, we really don't care.
+
+Mon Nov 9 15:18:11 GMT 1998 Chris Provenzano <proven@cygnus.com>
+
+ Initial i386 linux port.
+
+//===========================================================================
+// ####GPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2009 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.
+// -------------------------------------------
+// ####GPLCOPYRIGHTEND####
+//===========================================================================
diff --git a/ecos/packages/hal/synth/arch/current/cdl/hal_synth.cdl b/ecos/packages/hal/synth/arch/current/cdl/hal_synth.cdl
new file mode 100644
index 0000000..5230163
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/cdl/hal_synth.cdl
@@ -0,0 +1,161 @@
+# ====================================================================
+#
+# hal_synth.cdl
+#
+# Synthetic target architectural configuration data
+#
+# ====================================================================
+## ####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 1998, 1999, 2000, 2001, 2002, 2009 Free Software Foundation, Inc.
+##
+## eCos 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.
+##
+## eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+##
+## As a special exception, if other files instantiate templates or use
+## macros or inline functions from this file, or you compile this file
+## and link it with other works to produce a work based on this file,
+## this file does not by itself cause the resulting work to be covered by
+## the GNU General Public License. However the source code for this file
+## must still be made available in accordance with section (3) of the GNU
+## General Public License v2.
+##
+## This exception does not invalidate any other reasons why a work based
+## on this file might be covered by the GNU General Public License.
+## -------------------------------------------
+## ####ECOSGPLCOPYRIGHTEND####
+# ====================================================================
+######DESCRIPTIONBEGIN####
+#
+# Author(s): jskov
+# Original data: jskov
+# Contributors: bartv
+# Date: 1999-11-01
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+cdl_package CYGPKG_HAL_SYNTH {
+ display "Linux Synthetic target"
+ doc ref/hal-synth-arch.html
+ parent CYGPKG_HAL
+ define_header hal_synth.h
+ include_dir cyg/hal
+ requires !CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT
+
+ description "
+ The Linux Synthetic Target HAL package provides the
+ support needed to run eCos binaries on top of a
+ Linux kernel."
+
+ implements CYGINT_HAL_TESTS_NO_CACHES
+
+ make {
+ <PREFIX>/lib/target.ld: <PACKAGE>/src/synth.ld
+ $(CC) -E -P -Wp,-MD,target.tmp -DEXTRAS=1 -xc $(INCLUDE_PATH) $(ACTUAL_CFLAGS) -o $@ $<
+ @echo $@ ": \\" > $(notdir $@).deps
+ @tail -n +2 target.tmp >> $(notdir $@).deps
+ @echo >> $(notdir $@).deps
+ @rm target.tmp
+ }
+ compile synth_entry.c synth_diag.c synth_intr.c synth_syscalls.c
+
+ define_proc {
+ puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H <pkgconf/hal_synth.h>"
+ }
+
+ # Real-time clock/counter specifics
+ cdl_component CYGNUM_HAL_RTC_CONSTANTS {
+ display "Real-time clock constants."
+ description "
+ In the synthetic target the system clock is implemented using
+ Linux setitimer() and a SIGALRM signal. The PERIOD value is the
+ number of microseconds between signals, the usec field of an
+ itimerval structure. It should be a multiple of 10000 because
+ Linux will not generate signals at a finer grain than that.
+ The NUMERATOR and DENOMINATOR are derived from the period."
+ flavor none
+
+ cdl_option CYGNUM_HAL_RTC_PERIOD {
+ display "Real-time clock period"
+ flavor data
+ default_value 10000
+ requires { 0 == (CYGNUM_HAL_RTC_PERIOD % 10000) }
+ description "
+ This option corresponds to the number of microseconds between
+ clock interrupts."
+ }
+ cdl_option CYGNUM_HAL_RTC_NUMERATOR {
+ display "Real-time clock numerator"
+ flavor data
+ calculated CYGNUM_HAL_RTC_DENOMINATOR * 1000 * CYGNUM_HAL_RTC_PERIOD
+ }
+ cdl_option CYGNUM_HAL_RTC_DENOMINATOR {
+ display "Real-time clock denominator"
+ flavor data
+ default_value 100
+ }
+ }
+ # What to do when idling
+ cdl_option CYGIMP_HAL_IDLE_THREAD_SPIN {
+ display "Spin when idle"
+ default_value CYGIMP_IDLE_THREAD_YIELD
+ description "
+ By default, whenever the eCos application enters the idle thread
+ the synthetic target HAL will make a select() system call. Effectively
+ this causes the application to block until an interrupt occurs,
+ without consuming any cpu resources, as if the hardware supported
+ some sort of IDLE instruction. Usually this behaviour is desirable.
+ However it interferes with the emulation of some hardware. For
+ example the synthetic watchdog timer device can use consumed cpu time
+ rather than wallclock time to determine whether or not the watchdog
+ has triggered, and if the process is spending nearly all its time
+ blocked in select() then the watchdog will not trigger when it should.
+ There are also some kernel configurations which require that the idle
+ thread does not block."
+ }
+ requires { CYGIMP_IDLE_THREAD_YIELD implies CYGIMP_HAL_IDLE_THREAD_SPIN }
+
+ cdl_option CYGBLD_LINKER_SCRIPT {
+ display "Linker script"
+ flavor data
+ no_define
+ calculated { "src/synth.ld" }
+ }
+
+ cdl_option CYGSEM_HAL_SYNTH_TESTS {
+ display "Build the Synth HAL tests"
+ default_value 0
+ description "
+ The only test at the moment is disabled by default
+ because it has to be run manually. It should be run both within
+ eCos and natively on Linux and the results compared"
+ }
+
+ cdl_component CYGPKG_HAL_SYNTH_TESTS {
+ display "Synth HAL tests"
+ active_if CYGSEM_HAL_SYNTH_TESTS
+ flavor data
+ no_define
+ calculated { "tests/ftok.c" }
+
+ make {
+ <PREFIX>/tests/ftok: <PACKAGE>/tests/ftok.c
+ @mkdir -p "$(dir $@)"
+ @$(HOST_CC) -DHOST -g -O2 -o $@ $< || cc -DHOST -g -O2 -o $@ $< || gcc -DHOST -g -O2 -o $@ $<
+ }
+ }
+}
diff --git a/ecos/packages/hal/synth/arch/current/doc/filters.png b/ecos/packages/hal/synth/arch/current/doc/filters.png
new file mode 100644
index 0000000..ed89b28
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/filters.png
Binary files differ
diff --git a/ecos/packages/hal/synth/arch/current/doc/hal-synth-arch.html b/ecos/packages/hal/synth/arch/current/doc/hal-synth-arch.html
new file mode 100644
index 0000000..873d05d
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/hal-synth-arch.html
@@ -0,0 +1,177 @@
+<!-- Copyright (C) 2002 Free Software Foundation, Inc. -->
+<!-- This material may be distributed only subject to the terms -->
+<!-- and conditions set forth in the Open Publication License, v1.0 -->
+<!-- or later (the latest version is presently available at -->
+<!-- http://www.opencontent.org/openpub/). -->
+<!-- Distribution of the work or derivative of the work in any -->
+<!-- standard (paper) book form is prohibited unless prior -->
+<!-- permission is obtained from the copyright holder. -->
+<HTML
+><HEAD
+><TITLE
+>eCos Synthetic Target</TITLE
+><meta name="MSSmartTagsPreventParsing" content="TRUE">
+<META
+NAME="GENERATOR"
+CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
+"><LINK
+REL="NEXT"
+TITLE="Overview"
+HREF="synth.html"></HEAD
+><BODY
+CLASS="PART"
+BGCOLOR="#FFFFFF"
+TEXT="#000000"
+LINK="#0000FF"
+VLINK="#840084"
+ALINK="#0000FF"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
+SUMMARY="Header navigation table"
+WIDTH="100%"
+BORDER="0"
+CELLPADDING="0"
+CELLSPACING="0"
+><TR
+><TD
+WIDTH="10%"
+ALIGN="left"
+VALIGN="bottom"
+>&nbsp;</TD
+><TD
+WIDTH="80%"
+ALIGN="center"
+VALIGN="bottom"
+></TD
+><TD
+WIDTH="10%"
+ALIGN="right"
+VALIGN="bottom"
+><A
+HREF="synth.html"
+ACCESSKEY="N"
+>Next</A
+></TD
+></TR
+></TABLE
+><HR
+ALIGN="LEFT"
+WIDTH="100%"></DIV
+><DIV
+CLASS="PART"
+><A
+NAME="HAL-SYNTH-ARCH"><DIV
+CLASS="TITLEPAGE"
+><H1
+CLASS="TITLE"
+>I. eCos Synthetic Target</H1
+><DIV
+CLASS="TOC"
+><DL
+><DT
+><B
+>Table of Contents</B
+></DT
+><DT
+><A
+HREF="synth.html"
+>Overview</A
+>&nbsp;--&nbsp;Overview</DT
+><DT
+><A
+HREF="synth-install.html"
+>Installation</A
+>&nbsp;--&nbsp;Preparing to use the synthetic target</DT
+><DT
+><A
+HREF="synth-running.html"
+>Running a Synthetic Target Application</A
+>&nbsp;--&nbsp;Arguments and configuration files</DT
+><DT
+><A
+HREF="synth-gui.html"
+>The I/O Auxiliary's User Interface</A
+>&nbsp;--&nbsp;Controlling the I/O Auxiliary</DT
+><DT
+><A
+HREF="synth-console.html"
+>The Console Device</A
+>&nbsp;--&nbsp;Show output from the eCos application</DT
+><DT
+><A
+HREF="synth-syscalls.html"
+>System Calls</A
+>&nbsp;--&nbsp;Access Linux system facilities</DT
+><DT
+><A
+HREF="synth-new-target.html"
+>Writing New Devices - target</A
+>&nbsp;--&nbsp;extending the synthetic target, target-side</DT
+><DT
+><A
+HREF="synth-new-host.html"
+>Writing New Devices - host</A
+>&nbsp;--&nbsp;extending the synthetic target, host-side</DT
+><DT
+><A
+HREF="synth-porting.html"
+>Porting</A
+>&nbsp;--&nbsp;Adding support for other hosts</DT
+></DL
+></DIV
+></DIV
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><HR
+ALIGN="LEFT"
+WIDTH="100%"><TABLE
+SUMMARY="Footer navigation table"
+WIDTH="100%"
+BORDER="0"
+CELLPADDING="0"
+CELLSPACING="0"
+><TR
+><TD
+WIDTH="33%"
+ALIGN="left"
+VALIGN="top"
+>&nbsp;</TD
+><TD
+WIDTH="34%"
+ALIGN="center"
+VALIGN="top"
+>&nbsp;</TD
+><TD
+WIDTH="33%"
+ALIGN="right"
+VALIGN="top"
+><A
+HREF="synth.html"
+ACCESSKEY="N"
+>Next</A
+></TD
+></TR
+><TR
+><TD
+WIDTH="33%"
+ALIGN="left"
+VALIGN="top"
+>&nbsp;</TD
+><TD
+WIDTH="34%"
+ALIGN="center"
+VALIGN="top"
+>&nbsp;</TD
+><TD
+WIDTH="33%"
+ALIGN="right"
+VALIGN="top"
+>Overview</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
diff --git a/ecos/packages/hal/synth/arch/current/doc/layout.fig b/ecos/packages/hal/synth/arch/current/doc/layout.fig
new file mode 100644
index 0000000..cd1113d
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/layout.fig
@@ -0,0 +1,57 @@
+#FIG 3.2
+Landscape
+Center
+Inches
+Letter
+100.00
+Single
+-2
+1200 2
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2
+ 0 600 8100 600
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2
+ 0 900 8100 900
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2
+ 0 1800 8100 1800
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2
+ 0 3900 8100 3900
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2
+ 600 4800 600 5100
+2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5
+ 0 0 8100 0 8100 5100 0 5100 0 0
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2
+ 5400 300 5400 600
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2
+ 3600 300 3600 600
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2
+ 1800 300 1800 600
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2
+ 6300 900 6300 4800
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2
+ 6300 300 6300 600
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2
+ 1800 4800 1800 900
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2
+ 6000 1800 6000 3900
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2
+ 1800 3600 6300 3600
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2
+ 2100 4800 2100 5100
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2
+ 0 4800 8100 4800
+4 0 0 50 0 0 16 0.0000 4 165 810 6825 4425 .main.se\001
+4 0 0 50 0 0 16 0.0000 4 165 720 6825 2700 .main.e\001
+4 0 0 50 0 0 16 0.0000 4 165 840 6825 1425 .main.ne\001
+4 0 0 50 0 0 16 0.0000 4 225 1395 6375 525 .menubar.help\001
+4 0 0 50 0 0 16 0.0000 4 165 915 3450 225 .menubar\001
+4 0 0 50 0 0 16 0.0000 4 165 1455 3600 525 .menubar.view\001
+4 0 0 50 0 0 16 0.0000 4 165 765 3525 825 .toolbar\001
+4 0 0 50 0 0 16 0.0000 4 165 735 3525 1350 .main.n\001
+4 0 0 50 0 0 16 0.0000 4 165 1650 3150 2700 .main.centre.text\001
+4 0 0 50 0 0 16 0.0000 4 165 705 3525 4425 .main.s\001
+4 0 0 50 0 0 16 0.0000 4 150 1050 3300 5025 .status.text\001
+4 0 0 50 0 0 16 0.0000 4 165 885 150 4425 .main.sw\001
+4 0 0 50 0 0 16 0.0000 4 165 795 150 2700 .main.w\001
+4 0 0 50 0 0 16 0.0000 4 165 915 150 1425 .main.nw\001
+4 0 0 50 0 0 16 0.0000 4 165 1320 0 525 .menubar.file\001
+4 0 0 50 0 0 16 0.0000 4 165 1350 1875 525 .menubar.edit\001
diff --git a/ecos/packages/hal/synth/arch/current/doc/layout.png b/ecos/packages/hal/synth/arch/current/doc/layout.png
new file mode 100644
index 0000000..257935a
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/layout.png
Binary files differ
diff --git a/ecos/packages/hal/synth/arch/current/doc/makefile b/ecos/packages/hal/synth/arch/current/doc/makefile
new file mode 100644
index 0000000..2c48a6f
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/makefile
@@ -0,0 +1,54 @@
+#=============================================================================
+#
+# makefile
+#
+# For building the synthetic target documentation.
+#
+#=============================================================================
+## ####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+##
+## eCos 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.
+##
+## eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+##
+## As a special exception, if other files instantiate templates or use
+## macros or inline functions from this file, or you compile this file
+## and link it with other works to produce a work based on this file,
+## this file does not by itself cause the resulting work to be covered by
+## the GNU General Public License. However the source code for this file
+## must still be made available in accordance with section (3) of the GNU
+## General Public License v2.
+##
+## This exception does not invalidate any other reasons why a work based
+## on this file might be covered by the GNU General Public License.
+## -------------------------------------------
+## ####ECOSGPLCOPYRIGHTEND####
+#=============================================================================
+#####DESCRIPTIONBEGIN####
+#
+# Author(s): bartv
+# Date: 2001-01-11
+#####DESCRIPTIONEND####
+#=============================================================================
+
+TOPLEVEL := ../../../../..
+MAIN_SGML := synth.sgml
+MAIN_HTML := hal-synth-arch.html
+MAIN_PDF := hal-synth-arch.pdf
+OTHER_SGML :=
+PICTURES :=
+
+include $(TOPLEVEL)/pkgconf/rules.doc
diff --git a/ecos/packages/hal/synth/arch/current/doc/menu_edit.png b/ecos/packages/hal/synth/arch/current/doc/menu_edit.png
new file mode 100644
index 0000000..7923bf7
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/menu_edit.png
Binary files differ
diff --git a/ecos/packages/hal/synth/arch/current/doc/menu_file.png b/ecos/packages/hal/synth/arch/current/doc/menu_file.png
new file mode 100644
index 0000000..8002deb
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/menu_file.png
Binary files differ
diff --git a/ecos/packages/hal/synth/arch/current/doc/menu_help.png b/ecos/packages/hal/synth/arch/current/doc/menu_help.png
new file mode 100644
index 0000000..ef16dfa
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/menu_help.png
Binary files differ
diff --git a/ecos/packages/hal/synth/arch/current/doc/menu_view.png b/ecos/packages/hal/synth/arch/current/doc/menu_view.png
new file mode 100644
index 0000000..199a80b
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/menu_view.png
Binary files differ
diff --git a/ecos/packages/hal/synth/arch/current/doc/preferences.png b/ecos/packages/hal/synth/arch/current/doc/preferences.png
new file mode 100644
index 0000000..7b2a677
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/preferences.png
Binary files differ
diff --git a/ecos/packages/hal/synth/arch/current/doc/screen_main.png b/ecos/packages/hal/synth/arch/current/doc/screen_main.png
new file mode 100644
index 0000000..7be3651
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/screen_main.png
Binary files differ
diff --git a/ecos/packages/hal/synth/arch/current/doc/synth-console.html b/ecos/packages/hal/synth/arch/current/doc/synth-console.html
new file mode 100644
index 0000000..0e81364
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/synth-console.html
@@ -0,0 +1,373 @@
+<!-- Copyright (C) 2002 Free Software Foundation, Inc. -->
+<!-- This material may be distributed only subject to the terms -->
+<!-- and conditions set forth in the Open Publication License, v1.0 -->
+<!-- or later (the latest version is presently available at -->
+<!-- http://www.opencontent.org/openpub/). -->
+<!-- Distribution of the work or derivative of the work in any -->
+<!-- standard (paper) book form is prohibited unless prior -->
+<!-- permission is obtained from the copyright holder. -->
+<HTML
+><HEAD
+><TITLE
+>The Console Device</TITLE
+><meta name="MSSmartTagsPreventParsing" content="TRUE">
+<META
+NAME="GENERATOR"
+CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
+"><LINK
+REL="HOME"
+TITLE="eCos Synthetic Target"
+HREF="hal-synth-arch.html"><LINK
+REL="PREVIOUS"
+TITLE="The I/O Auxiliary's User Interface"
+HREF="synth-gui.html"><LINK
+REL="NEXT"
+TITLE="System Calls"
+HREF="synth-syscalls.html"></HEAD
+><BODY
+CLASS="REFENTRY"
+BGCOLOR="#FFFFFF"
+TEXT="#000000"
+LINK="#0000FF"
+VLINK="#840084"
+ALINK="#0000FF"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
+SUMMARY="Header navigation table"
+WIDTH="100%"
+BORDER="0"
+CELLPADDING="0"
+CELLSPACING="0"
+><TR
+><TH
+COLSPAN="3"
+ALIGN="center"
+>eCos Synthetic Target</TH
+></TR
+><TR
+><TD
+WIDTH="10%"
+ALIGN="left"
+VALIGN="bottom"
+><A
+HREF="synth-gui.html"
+ACCESSKEY="P"
+>Prev</A
+></TD
+><TD
+WIDTH="80%"
+ALIGN="center"
+VALIGN="bottom"
+></TD
+><TD
+WIDTH="10%"
+ALIGN="right"
+VALIGN="bottom"
+><A
+HREF="synth-syscalls.html"
+ACCESSKEY="N"
+>Next</A
+></TD
+></TR
+></TABLE
+><HR
+ALIGN="LEFT"
+WIDTH="100%"></DIV
+><H1
+><A
+NAME="SYNTH-CONSOLE">The Console Device</H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="AEN435"
+></A
+><H2
+>Name</H2
+>The console device &nbsp;--&nbsp;Show output from the eCos application</DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-CONSOLE-DESCRIPTION"
+></A
+><H2
+>Description</H2
+><P
+>The eCos application can generate text output in a variety of ways,
+including calling <TT
+CLASS="FUNCTION"
+>printf</TT
+> or
+<TT
+CLASS="FUNCTION"
+>diag_printf</TT
+>. When the I/O auxiliary is enabled
+the eCos startup code will instantiate a console device to process all
+such output. If operating in text mode the output will simply go to
+standard output, or to a logfile if the <TT
+CLASS="OPTION"
+>-l</TT
+> command
+line option is specified. If operating in graphical mode the output
+will go to the central text window, and optionally to a logfile as
+well. In addition it is possible to control the appearance of the main
+text via the target definition file, and to install extra filters for
+certain types of text.
+ </P
+><P
+>It should be noted that the console device is line-oriented, not
+character-oriented. This means that outputting partial lines is not
+supported, and some functions such as <TT
+CLASS="FUNCTION"
+>fflush</TT
+> and
+<TT
+CLASS="FUNCTION"
+>setvbuf</TT
+> will not operate as expected. This
+limitation prevents much possible confusion when using filters to
+control the appearance of the text window, and has some performance
+benefits - especially when the eCos application generates a great deal
+of output such as when tracing is enabled. For most applications this
+is not a problem, but it is something that developers should be aware
+of.
+ </P
+><P
+>The console device is output-only, it does not provide any support for
+keyboard input. If the application requires keyboard input then that
+should be handled by a separate eCos device package and matching
+host-side code.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-CONSOLE-INSTALL"
+></A
+><H2
+>Installation</H2
+><P
+>The eCos side of the console device is implemented by the
+architectural HAL itself, in the source file
+<TT
+CLASS="FILENAME"
+>synth_diag.c</TT
+>, rather than in a separate device
+package. Similarly the host-side implementation,
+<TT
+CLASS="FUNCTION"
+>console.tcl</TT
+>, is part of the architectural HAL's
+host-side support. It gets installed automatically alongside the I/O
+auxiliary itself, so no separate installation procedure is required.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-CONSOLE-TDF"
+></A
+><H2
+>Target Definition File</H2
+><P
+>The <A
+HREF="synth-running.html#SYNTH-RUNNING-TDF"
+>target definition file</A
+>
+can contain a number of entries related to the console device. These
+are all optional, they only control the appearance of text output. If
+such control is desired then the relevant options should appear in the
+body of a <B
+CLASS="COMMAND"
+>synth_device</B
+> entry:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>synth_device console {
+ &#8230;
+}</PRE
+></TD
+></TR
+></TABLE
+><P
+>The first option is <B
+CLASS="COMMAND"
+>appearance</B
+>, used to control the
+appearance of any text generated by the eCos application that does not
+match one of the installed filters. This option takes the same
+argument as any other filter, for example:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>synth_device console {
+ appearance -foreground white -background black
+ &#8230;
+}</PRE
+></TD
+></TR
+></TABLE
+><P
+>Any number of additional filters can be created with a
+<B
+CLASS="COMMAND"
+>filter</B
+> option, for example:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>synth_device console {
+ &#8230;
+ filter trace {^TRACE:.*} -foreground HotPink1 -hide 1
+ &#8230;
+}</PRE
+></TD
+></TR
+></TABLE
+><P
+>The first argument gives the new filter a name which will be used in
+the <A
+HREF="synth-gui.html#SYNTH-GUI-TEXT"
+>filters dialog</A
+>. Filter names
+should be unique. The second argument is a Tcl regular expression. The
+console support will match each line of eCos output against this
+regular expression, and if a match is found then the filter will be
+used for this line of text. The above example matches any line of
+output that begins with <TT
+CLASS="LITERAL"
+>TRACE:</TT
+>, which corresponds
+to the eCos infrastructure's tracing facilities. The remaining options
+control the desired appearance for matched text. If some eCos output
+matches the regular expressions for several different filters then
+only the first match will be used.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-CONSOLE-TARGET-CONFIG"
+></A
+><H2
+>Target-side
+ Configuration Options</H2
+><P
+>There are no target-side configuration options related to the console
+device.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-CONSOLE-ARGUMENTS"
+></A
+><H2
+>Command Line Arguments</H2
+><P
+>The console device does not use any command-line arguments.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-CONSOLE-HOOKS"
+></A
+><H2
+>Hooks</H2
+><P
+>The console device does not provide any hooks.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN477"
+></A
+><H2
+>Additional Tcl Procedures</H2
+><P
+>The console device does not provide any additional Tcl procedures that
+can be used by other scripts.
+ </P
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><HR
+ALIGN="LEFT"
+WIDTH="100%"><TABLE
+SUMMARY="Footer navigation table"
+WIDTH="100%"
+BORDER="0"
+CELLPADDING="0"
+CELLSPACING="0"
+><TR
+><TD
+WIDTH="33%"
+ALIGN="left"
+VALIGN="top"
+><A
+HREF="synth-gui.html"
+ACCESSKEY="P"
+>Prev</A
+></TD
+><TD
+WIDTH="34%"
+ALIGN="center"
+VALIGN="top"
+><A
+HREF="hal-synth-arch.html"
+ACCESSKEY="H"
+>Home</A
+></TD
+><TD
+WIDTH="33%"
+ALIGN="right"
+VALIGN="top"
+><A
+HREF="synth-syscalls.html"
+ACCESSKEY="N"
+>Next</A
+></TD
+></TR
+><TR
+><TD
+WIDTH="33%"
+ALIGN="left"
+VALIGN="top"
+>The I/O Auxiliary's User Interface</TD
+><TD
+WIDTH="34%"
+ALIGN="center"
+VALIGN="top"
+>&nbsp;</TD
+><TD
+WIDTH="33%"
+ALIGN="right"
+VALIGN="top"
+>System Calls</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
diff --git a/ecos/packages/hal/synth/arch/current/doc/synth-gui.html b/ecos/packages/hal/synth/arch/current/doc/synth-gui.html
new file mode 100644
index 0000000..916990b
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/synth-gui.html
@@ -0,0 +1,738 @@
+<!-- Copyright (C) 2002 Free Software Foundation, Inc. -->
+<!-- This material may be distributed only subject to the terms -->
+<!-- and conditions set forth in the Open Publication License, v1.0 -->
+<!-- or later (the latest version is presently available at -->
+<!-- http://www.opencontent.org/openpub/). -->
+<!-- Distribution of the work or derivative of the work in any -->
+<!-- standard (paper) book form is prohibited unless prior -->
+<!-- permission is obtained from the copyright holder. -->
+<HTML
+><HEAD
+><TITLE
+>The I/O Auxiliary's User Interface</TITLE
+><meta name="MSSmartTagsPreventParsing" content="TRUE">
+<META
+NAME="GENERATOR"
+CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
+"><LINK
+REL="HOME"
+TITLE="eCos Synthetic Target"
+HREF="hal-synth-arch.html"><LINK
+REL="PREVIOUS"
+TITLE="Running a Synthetic Target Application"
+HREF="synth-running.html"><LINK
+REL="NEXT"
+TITLE="The Console Device"
+HREF="synth-console.html"></HEAD
+><BODY
+CLASS="REFENTRY"
+BGCOLOR="#FFFFFF"
+TEXT="#000000"
+LINK="#0000FF"
+VLINK="#840084"
+ALINK="#0000FF"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
+SUMMARY="Header navigation table"
+WIDTH="100%"
+BORDER="0"
+CELLPADDING="0"
+CELLSPACING="0"
+><TR
+><TH
+COLSPAN="3"
+ALIGN="center"
+>eCos Synthetic Target</TH
+></TR
+><TR
+><TD
+WIDTH="10%"
+ALIGN="left"
+VALIGN="bottom"
+><A
+HREF="synth-running.html"
+ACCESSKEY="P"
+>Prev</A
+></TD
+><TD
+WIDTH="80%"
+ALIGN="center"
+VALIGN="bottom"
+></TD
+><TD
+WIDTH="10%"
+ALIGN="right"
+VALIGN="bottom"
+><A
+HREF="synth-console.html"
+ACCESSKEY="N"
+>Next</A
+></TD
+></TR
+></TABLE
+><HR
+ALIGN="LEFT"
+WIDTH="100%"></DIV
+><H1
+><A
+NAME="SYNTH-GUI">The I/O Auxiliary's User Interface</H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="AEN304"
+></A
+><H2
+>Name</H2
+>User Interface&nbsp;--&nbsp;Controlling the I/O Auxiliary</DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-GUI-DESCRIPTION"
+></A
+><H2
+>Description</H2
+><P
+>The synthetic target auxiliary is designed to support both extensions
+and user customization. Support for the desired devices is dynamically
+loaded, and each device can extend the user interface. For example it
+is possible for a device to add menu options, place new buttons on the
+toolbar, create its own sub-window within the overall layout, or even
+create entire new toplevel windows. These subwindows or toplevels
+could show graphs of activity such as interrupts or packets being
+transferred. They could also allow users to interact with the eCos
+application, for example by showing a number of buttons which will be
+mapped on to digital inputs in the eCos application. Different
+applications will have their own I/O requirements, changing the
+host-side support files that get loaded and that may modify the user
+interface. The I/O auxiliary also reads in user configuration scripts
+which can enhance the interface in the same way. Therefore the exact
+user interface will depend on the user and on the eCos application
+being run. However the overall layout is likely to remain the same.
+ </P
+><DIV
+CLASS="INFORMALFIGURE"
+><A
+NAME="AEN310"><P
+></P
+><DIV
+CLASS="MEDIAOBJECT"
+><P
+><IMG
+SRC="screen_main.gif"
+ALIGN="CENTER"></P
+></DIV
+><P
+></P
+></DIV
+><P
+>The title bar identifies the window as belonging to an eCos synthetic
+target application and lists both the application name and its process
+id. The latter is especially useful if the application was started
+directly from a shell prompt and the user now wants to attach a gdb
+session. The window has a conventional menu bar with the usual
+entries, plus a toolbar with buttons for common operations such as cut
+and paste. Balloon help is supported.
+ </P
+><P
+>There is a central <A
+HREF="synth-gui.html#SYNTH-GUI-TEXT"
+>text window</A
+>,
+possibly surrounded by various sub-windows for various devices. For
+example there could be a row of emulated LED's above the text window,
+and monitors of ethernet traffic and interrupt activity on the right.
+At the bottom of the window is a status line, including a small
+animation that shows whether or not the eCos application is still
+running.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-GUI-MENUS"
+></A
+><H2
+>Menus and the Toolbar</H2
+><P
+>Usually there will be four menus on the menu bar:
+<SPAN
+CLASS="GUIMENU"
+>File</SPAN
+>, <SPAN
+CLASS="GUIMENU"
+>Edit</SPAN
+>,
+<SPAN
+CLASS="GUIMENU"
+>View</SPAN
+> and <SPAN
+CLASS="GUIMENU"
+>Help</SPAN
+>.
+ </P
+><DIV
+CLASS="INFORMALFIGURE"
+><A
+NAME="AEN324"><P
+></P
+><DIV
+CLASS="MEDIAOBJECT"
+><P
+><IMG
+SRC="menu_file.gif"
+ALIGN="CENTER"></P
+></DIV
+><P
+></P
+></DIV
+><P
+>On the <SPAN
+CLASS="GUIMENU"
+>File</SPAN
+> menu there are three entries related to
+saving the current contents of the central text window.
+<SPAN
+CLASS="GUIMENUITEM"
+>Save</SPAN
+> is used to save the currently visible
+contents of the text window. Any text that is hidden because of
+filters will not be written to the savefile. If there has been a
+previous <SPAN
+CLASS="GUIMENUITEM"
+>Save</SPAN
+> or <SPAN
+CLASS="GUIMENUITEM"
+>Save
+As</SPAN
+> operation then the existing savefile will be re-used,
+otherwise the user will be asked to select a suitable file.
+<SPAN
+CLASS="GUIMENUITEM"
+>Save As</SPAN
+> also saves just the currently
+visible contents but will always prompt the user for a filename.
+<SPAN
+CLASS="GUIMENUITEM"
+>Save All</SPAN
+> can be used to save the full
+contents of the text window, including any text that is currently
+hidden. It will always prompt for a new filename, to avoid confusion
+with partial savefiles.
+ </P
+><P
+>Usually the eCos application will be run from inside gdb or from a
+shell prompt. Killing off the application while it is being debugged
+in a gdb session is not a good idea, it would be better to use gdb's
+own <B
+CLASS="COMMAND"
+>kill</B
+> command. Alternatively the eCos
+application itself can use the <TT
+CLASS="FUNCTION"
+>CYG_TEST_EXIT</TT
+> or
+<TT
+CLASS="FILENAME"
+>cyg_hal_sys_exit</TT
+> functionality. However it is
+possible to terminate the application from the I/O auxiliary using
+<SPAN
+CLASS="GUIMENUITEM"
+>Kill eCos</SPAN
+>. A clean shutdown will be
+attempted, but that can fail if the application is currently halted
+inside gdb or if it has crashed completely. As a last resort
+<TT
+CLASS="CONSTANT"
+>SIGKILL</TT
+> will be used.
+ </P
+><P
+>When operating in graphical mode the I/O auxiliary will normally
+continue to run even after the eCos application has exited. This
+allows the user to examine the last few lines of output, and perhaps
+perform actions such as saving the output to a file. The
+<SPAN
+CLASS="GUIMENUITEM"
+>Exit</SPAN
+> menu item can be used to shut down the
+auxiliary. Note that this behaviour can be changed with command line
+arguments <A
+HREF="synth-running.html#SYNTH-RUNNING-ARGUMENTS"
+><TT
+CLASS="OPTION"
+>--exit</TT
+></A
+> and
+<A
+HREF="synth-running.html#SYNTH-RUNNING-ARGUMENTS"
+><TT
+CLASS="OPTION"
+>--no-exit</TT
+></A
+>.
+ </P
+><P
+>If <SPAN
+CLASS="GUIMENUITEM"
+>Exit</SPAN
+> is used while the eCos application
+is still running then the I/O auxiliary will first attempt to
+terminate the application cleanly, and then exit.
+ </P
+><DIV
+CLASS="INFORMALFIGURE"
+><A
+NAME="AEN349"><P
+></P
+><DIV
+CLASS="MEDIAOBJECT"
+><P
+><IMG
+SRC="menu_edit.gif"
+ALIGN="CENTER"></P
+></DIV
+><P
+></P
+></DIV
+><P
+>The <SPAN
+CLASS="GUIMENU"
+>Edit</SPAN
+> menu contains the usual entries for
+text manipulation: <SPAN
+CLASS="GUIMENUITEM"
+>Cut</SPAN
+>,
+<SPAN
+CLASS="GUIMENUITEM"
+>Copy</SPAN
+>, <SPAN
+CLASS="GUIMENUITEM"
+>Paste</SPAN
+>,
+<SPAN
+CLASS="GUIMENUITEM"
+>Clear</SPAN
+> and <SPAN
+CLASS="GUIMENUITEM"
+>Select
+All</SPAN
+>. These all operate on the central text window. By
+default this window cannot be edited so the cut, paste and clear
+operations are disabled. If the user wants to edit the contents of the
+text window then the <SPAN
+CLASS="GUIMENUITEM"
+>Read Only</SPAN
+> checkbutton
+should be toggled.
+ </P
+><P
+>The <SPAN
+CLASS="GUIMENUITEM"
+>Preferences</SPAN
+> menu item brings up a
+miscellaneous preferences dialog. One of the preferences relates to
+online help: the I/O auxiliary does not currently have a built-in html
+viewer; instead it will execute an external browser of some sort. With
+the example settings shown, the I/O auxiliary will first attempt to
+interact with an existing mozilla session. If that fails it will try
+to run a new mozilla instance, or as a last result use the Gnome help
+viewer.
+ </P
+><DIV
+CLASS="INFORMALFIGURE"
+><A
+NAME="AEN363"><P
+></P
+><DIV
+CLASS="MEDIAOBJECT"
+><P
+><IMG
+SRC="preferences.gif"
+ALIGN="CENTER"></P
+></DIV
+><P
+></P
+></DIV
+><P
+>The <SPAN
+CLASS="GUIMENU"
+>View</SPAN
+> menu contains the <SPAN
+CLASS="GUIMENUITEM"
+>System
+Filters</SPAN
+> entry, used to edit the settings for the current
+<A
+HREF="synth-gui.html#SYNTH-GUI-TEXT"
+>filters</A
+>.
+ </P
+><DIV
+CLASS="INFORMALFIGURE"
+><A
+NAME="AEN371"><P
+></P
+><DIV
+CLASS="MEDIAOBJECT"
+><P
+><IMG
+SRC="menu_view.gif"
+ALIGN="CENTER"></P
+></DIV
+><P
+></P
+></DIV
+><P
+>The <SPAN
+CLASS="GUIMENU"
+>Help</SPAN
+> menu can be used to activate online help
+for eCos generally, for the synthetic target as a whole, and for
+specific devices supported by the generic target. The Preferences
+dialog can be used to select the browser that will be used.
+ </P
+><DIV
+CLASS="INFORMALFIGURE"
+><A
+NAME="AEN377"><P
+></P
+><DIV
+CLASS="MEDIAOBJECT"
+><P
+><IMG
+SRC="menu_help.gif"
+ALIGN="CENTER"></P
+></DIV
+><P
+></P
+></DIV
+><DIV
+CLASS="NOTE"
+><BLOCKQUOTE
+CLASS="NOTE"
+><P
+><B
+>Note: </B
+>At the time of writing there is no well-defined toplevel index file
+for all eCos documentation. Hence the relevant menu item is disabled.
+Documentation for the synthetic target and the supported devices
+is stored as part of the package itself so can usually be found fairly
+easily. It may be necessary to set the <TT
+CLASS="ENVAR"
+>ECOS_REPOSITORY</TT
+>
+environment variable.
+ </P
+></BLOCKQUOTE
+></DIV
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-GUI-TEXT"
+></A
+><H2
+>The Main Text Window</H2
+><P
+>The central text window holds the console output from the eCos
+application: the screen shot above shows DHCP initialization data from
+the TCP/IP stack, and some output from the <TT
+CLASS="FUNCTION"
+>main</TT
+>
+thread at the bottom. Some devices can insert text of their own, for
+example the ethernet device support can be configured to show details
+of incoming and outgoing packets. Mixing the output from the eCos
+application and the various devices can make it easier to understand
+the order in which events occur.
+ </P
+><P
+>The appearance of text from different sources can be controlled by
+means of filters, and it is also possible to hide some of the text.
+For example, if tracing is enabled in the eCos configuration then the
+trace output can be given its own colour scheme, making it stand out
+from the rest of the output. In addition the trace output is generally
+voluminous so it can be hidden by default, made visible only to find
+out more about what was happening when a particular problem occurred.
+Similarly the ethernet device support can output details of the
+various packets being transferred, and using a different background
+colour for this output again makes it easier to distinguish from
+console output.
+ </P
+><P
+>The default appearance for most filters is controlled via the
+<A
+HREF="synth-running.html#SYNTH-RUNNING-TDF"
+>target definition file</A
+>. An
+example entry might be:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+> filter trace {^TRACE:.*} -foreground HotPink1 -hide 1</PRE
+></TD
+></TR
+></TABLE
+><P
+>The various colours and the hide flag for each filter can be changed
+at run-time, using the <SPAN
+CLASS="GUIMENUITEM"
+>System Filters</SPAN
+> item
+on the <SPAN
+CLASS="GUIMENU"
+>View</SPAN
+> menu. This will bring up a dialog like
+the following:
+ </P
+><DIV
+CLASS="INFORMALFIGURE"
+><A
+NAME="AEN395"><P
+></P
+><DIV
+CLASS="MEDIAOBJECT"
+><P
+><IMG
+SRC="filters.gif"
+ALIGN="CENTER"></P
+></DIV
+><P
+></P
+></DIV
+><P
+>It should be noted that the text window is line-oriented, not
+character-oriented. If an eCos application sends a partial line of
+text then that will remain buffered until a newline character is
+received, rather than being displayed immediately. This avoids
+confusion when there is concurrent output from several sources.
+ </P
+><P
+>By default the text window is read-only. This means it will not allow
+cut, paste and clear operations, and keyboard input will be ignored.
+The <SPAN
+CLASS="GUIMENU"
+>Edit</SPAN
+> menu has a checkbutton <SPAN
+CLASS="GUIMENUITEM"
+>Read
+Only</SPAN
+> which can be toggled to allow write operations. For
+example, a user could type in a reminder of what was happening at this
+time, or paste in part of a gdb session. Such keyboard input does not
+get forwarded to the eCos application: if the latter requires keyboard
+input then that should happen via a separate keyboard device.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-GUI-LAYOUT"
+></A
+><H2
+>Positioning Optional Windows</H2
+><P
+>Some devices may create their own subwindows, for example to monitor
+ethernet traffic or to provide additional I/O facilities such as
+emulated LED's or buttons. Usually the target definition file can be
+used to control the <A
+HREF="synth-gui.html#SYNTH-GUI-LAYOUT"
+>layout</A
+> of
+these windows. This requires an understanding of the overall layout of
+the display.
+ </P
+><DIV
+CLASS="INFORMALFIGURE"
+><A
+NAME="AEN407"><P
+></P
+><DIV
+CLASS="MEDIAOBJECT"
+><P
+><IMG
+SRC="layout.gif"
+ALIGN="CENTER"></P
+></DIV
+><P
+></P
+></DIV
+><P
+>Subwindows are generally packed in one of eight frames surrounding the
+central text window: <TT
+CLASS="VARNAME"
+>.main.nw</TT
+>,
+<TT
+CLASS="VARNAME"
+>.main.n</TT
+>, <TT
+CLASS="VARNAME"
+>.main.ne</TT
+>,
+<TT
+CLASS="VARNAME"
+>.main.w</TT
+>, <TT
+CLASS="VARNAME"
+>.main.e</TT
+>,
+<TT
+CLASS="VARNAME"
+>.main.sw</TT
+>, <TT
+CLASS="VARNAME"
+>.main.s</TT
+>, and
+<TT
+CLASS="VARNAME"
+>.main.se</TT
+>. To position a row of LED's above the text
+window and towards the left, a target definition file could contain an
+entry such as:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>synth_device led {
+ pack -in .main.n -side left
+ &#8230;
+}</PRE
+></TD
+></TR
+></TABLE
+><P
+>Similarly, to put a traffic monitor window on the right of the text
+window would involve something like:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+> &#8230;
+ monitor_pack -in .main.e -side bottom
+ &#8230;</PRE
+></TD
+></TR
+></TABLE
+><P
+>Often it will be sufficient to specify a container frame and one of
+<TT
+CLASS="CONSTANT"
+>left</TT
+>, <TT
+CLASS="CONSTANT"
+>right</TT
+>,
+<TT
+CLASS="CONSTANT"
+>top</TT
+> or <TT
+CLASS="CONSTANT"
+>bottom</TT
+>. Full control
+over the positioning requires an understanding of Tcl/Tk and in
+particular the packing algorithm, and an appropriate reference work
+should be consulted.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-GUI-GLOBAL-CONFIG"
+></A
+><H2
+>Global Settings</H2
+><DIV
+CLASS="NOTE"
+><BLOCKQUOTE
+CLASS="NOTE"
+><P
+><B
+>Note: </B
+>This section still to be written - it should document the interaction
+between X resources and ecosynth, and how users can control settings
+such as the main foreground and background colours.
+ </P
+></BLOCKQUOTE
+></DIV
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><HR
+ALIGN="LEFT"
+WIDTH="100%"><TABLE
+SUMMARY="Footer navigation table"
+WIDTH="100%"
+BORDER="0"
+CELLPADDING="0"
+CELLSPACING="0"
+><TR
+><TD
+WIDTH="33%"
+ALIGN="left"
+VALIGN="top"
+><A
+HREF="synth-running.html"
+ACCESSKEY="P"
+>Prev</A
+></TD
+><TD
+WIDTH="34%"
+ALIGN="center"
+VALIGN="top"
+><A
+HREF="hal-synth-arch.html"
+ACCESSKEY="H"
+>Home</A
+></TD
+><TD
+WIDTH="33%"
+ALIGN="right"
+VALIGN="top"
+><A
+HREF="synth-console.html"
+ACCESSKEY="N"
+>Next</A
+></TD
+></TR
+><TR
+><TD
+WIDTH="33%"
+ALIGN="left"
+VALIGN="top"
+>Running a Synthetic Target Application</TD
+><TD
+WIDTH="34%"
+ALIGN="center"
+VALIGN="top"
+>&nbsp;</TD
+><TD
+WIDTH="33%"
+ALIGN="right"
+VALIGN="top"
+>The Console Device</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
diff --git a/ecos/packages/hal/synth/arch/current/doc/synth-install.html b/ecos/packages/hal/synth/arch/current/doc/synth-install.html
new file mode 100644
index 0000000..5af1540
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/synth-install.html
@@ -0,0 +1,404 @@
+<!-- Copyright (C) 2002 Free Software Foundation, Inc. -->
+<!-- This material may be distributed only subject to the terms -->
+<!-- and conditions set forth in the Open Publication License, v1.0 -->
+<!-- or later (the latest version is presently available at -->
+<!-- http://www.opencontent.org/openpub/). -->
+<!-- Distribution of the work or derivative of the work in any -->
+<!-- standard (paper) book form is prohibited unless prior -->
+<!-- permission is obtained from the copyright holder. -->
+<HTML
+><HEAD
+><TITLE
+>Installation</TITLE
+><meta name="MSSmartTagsPreventParsing" content="TRUE">
+<META
+NAME="GENERATOR"
+CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
+"><LINK
+REL="HOME"
+TITLE="eCos Synthetic Target"
+HREF="hal-synth-arch.html"><LINK
+REL="PREVIOUS"
+TITLE="Overview"
+HREF="synth.html"><LINK
+REL="NEXT"
+TITLE="Running a Synthetic Target Application"
+HREF="synth-running.html"></HEAD
+><BODY
+CLASS="REFENTRY"
+BGCOLOR="#FFFFFF"
+TEXT="#000000"
+LINK="#0000FF"
+VLINK="#840084"
+ALINK="#0000FF"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
+SUMMARY="Header navigation table"
+WIDTH="100%"
+BORDER="0"
+CELLPADDING="0"
+CELLSPACING="0"
+><TR
+><TH
+COLSPAN="3"
+ALIGN="center"
+>eCos Synthetic Target</TH
+></TR
+><TR
+><TD
+WIDTH="10%"
+ALIGN="left"
+VALIGN="bottom"
+><A
+HREF="synth.html"
+ACCESSKEY="P"
+>Prev</A
+></TD
+><TD
+WIDTH="80%"
+ALIGN="center"
+VALIGN="bottom"
+></TD
+><TD
+WIDTH="10%"
+ALIGN="right"
+VALIGN="bottom"
+><A
+HREF="synth-running.html"
+ACCESSKEY="N"
+>Next</A
+></TD
+></TR
+></TABLE
+><HR
+ALIGN="LEFT"
+WIDTH="100%"></DIV
+><H1
+><A
+NAME="SYNTH-INSTALL">Installation</H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="AEN45"
+></A
+><H2
+>Name</H2
+>Installation&nbsp;--&nbsp;Preparing to use the synthetic target</DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-INSTALL-HOST"
+></A
+><H2
+>Host-side Software</H2
+><P
+>To get the full functionality of the synthetic target, users must
+build and install the I/O auxiliary ecosynth and various support
+files. It is possible to develop applications for the synthetic target
+without the auxiliary, but only limited I/O facilities will be
+available. The relevant code resides in the <TT
+CLASS="FILENAME"
+>host</TT
+> subdirectory of the synthetic target
+architectural HAL package, and building it involves the standard
+<B
+CLASS="COMMAND"
+>configure</B
+>, <B
+CLASS="COMMAND"
+>make</B
+>, and
+<B
+CLASS="COMMAND"
+>make install</B
+> steps.
+ </P
+><P
+>There are two main ways of building the host-side software. It is
+possible to build both the generic host-side software and all
+package-specific host-side software, including the I/O auxiliary. in a
+single build tree. This involves using the
+<B
+CLASS="COMMAND"
+>configure</B
+> script at the toplevel of the eCos
+repository, which will automatically search the <TT
+CLASS="FILENAME"
+>packages</TT
+> hierarchy for host-side
+software. For more information on this, see the
+<TT
+CLASS="FILENAME"
+>README.host</TT
+> file at the top of the repository.
+Note that if you have an existing build tree which does not include
+the synthetic target architectural HAL package then it will be
+necessary to rerun the toplevel configure script: the search for
+appropriate packages happens at configure time.
+ </P
+><P
+>The alternative is to build just the host-side for this package.
+This involves creating a suitable build directory and running the
+<B
+CLASS="COMMAND"
+>configure</B
+> script. Note that building directly in
+the source tree is not allowed.
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="SCREEN"
+>$ cd &lt;somewhere suitable&gt;
+$ mkdir synth_build
+$ cd synth_build
+$ &lt;repo&lt;&gt;/packages/hal/synth/arch/&lt;version&gt;/host/configure &lt;options&gt;
+$ make
+$ make install</PRE
+></TD
+></TR
+></TABLE
+><P
+>The code makes extensive use of Tcl/TK and requires version 8.3 or
+later. This is checked by the <B
+CLASS="COMMAND"
+>configure</B
+> script. By
+default it will use the system's Tcl installation in <TT
+CLASS="FILENAME"
+>/usr</TT
+>. If a different, more recent Tcl
+installation should be used then its location can be specified using
+the options <TT
+CLASS="OPTION"
+>--with-tcl=&lt;path&gt;</TT
+>,
+<TT
+CLASS="OPTION"
+>--with-tcl-header=&lt;path&gt;</TT
+> and
+<TT
+CLASS="OPTION"
+>--with-tcl-lib=&lt;path&gt;</TT
+>. For more information on these options
+see the <TT
+CLASS="FILENAME"
+>README.host</TT
+> file at the toplevel of the
+eCos repository.
+ </P
+><P
+>Some users may also want to specify the install location using a
+<TT
+CLASS="OPTION"
+>--prefix=&lt;path&gt;</TT
+> option. The default install
+location is <TT
+CLASS="FILENAME"
+>/usr/local</TT
+>. It is
+essential that the <TT
+CLASS="FILENAME"
+>bin</TT
+>
+subdirectory of the install location is on the user's search
+<TT
+CLASS="ENVAR"
+>PATH</TT
+>, otherwise the eCos application will be unable to
+locate and execute the I/O auxiliary ecosynth.
+ </P
+><P
+>Because ecosynth is run automatically by an eCos application rather
+than explicitly by the user, it is not installed in the <TT
+CLASS="FILENAME"
+>bin</TT
+> subdirectory itself. Instead it is
+installed below <TT
+CLASS="FILENAME"
+>libexec</TT
+>,
+together with various support files such as images. At configure time
+it is usually possible to specify an alternative location for
+<TT
+CLASS="FILENAME"
+>libexec</TT
+> using
+<TT
+CLASS="OPTION"
+>--exec-prefix=&lt;path&gt;</TT
+> or
+<TT
+CLASS="OPTION"
+>--libexecdir=&lt;path&gt;</TT
+>. These options should not
+be used for this package because the eCos application is built
+completely separately and does not know how the host-side was
+configured.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-TOOLS"
+></A
+><H2
+>Toolchain</H2
+><P
+>When developing eCos applications for a normal embedded target it is
+necessary to use a suitable cross-compiler and related tools such as
+the linker. Developing for the synthetic target is easier because you
+can just use the standard GNU tools (gcc, g++, ld, &#8230;) which
+were provided with your Linux distribution, or which you used to build
+your own Linux setup. Any reasonably recent version of the tools, for
+example gcc 2.96(Red Hat) as shipped with Red Hat Linux 7, should be
+sufficient.
+ </P
+><P
+>There is one important limitation when using these tools: current gdb
+will not support debugging of eCos threads on the synthetic target. As
+far as gdb is concerned a synthetic target application is
+indistinguishable from a normal Linux application, so it assumes that
+any threads will be created by calls to the Linux
+<TT
+CLASS="FUNCTION"
+>pthread_create</TT
+> function provided by the C
+library. Obviously this is not the case since the application is never
+linked with that library. Therefore gdb never notices the eCos thread
+mechanisms and assumes the application is single-threaded. Fixing this
+is possible but would involve non-trivial changes to gdb.
+ </P
+><P
+>Theoretically it is possible to develop synthetic target applications
+on, for example, a PC running Windows and then run the resulting
+executables on another machine that runs Linux. This is rarely useful:
+if a Linux machine is available then usually that machine will also be
+used for building ecos and the application. However, if for some
+reason it is necessary or desirable to build on another machine then
+this requires a suitable cross-compiler and related tools. If the
+application will be running on a typical PC with an x86 processor then
+a suitable configure triplet would be
+<TT
+CLASS="USERINPUT"
+><B
+>i686-pc-linux-gnu</B
+></TT
+>. The installation
+instructions for the various GNU tools should be consulted for further
+information.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-HARDWARE"
+></A
+><H2
+>Hardware Preparation</H2
+><P
+>Preparing a real embedded target for eCos development can be tricky.
+Often the first step is to install suitable firmware, usually RedBoot.
+This means creating and building a special configuration for eCos with
+the RedBoot template, then somehow updating the target's flash chips
+with the resulting RedBoot image. Typically it will also be necessary
+to get a working serial connection, and possibly set up ethernet as
+well. Although usually none of the individual steps are particularly
+complicated, there are plenty of ways in which things can go wrong and
+it can be hard to figure out what is actually happening. Of course
+some board manufacturers make life easier for their developers by
+shipping hardware with RedBoot preinstalled, but even then it is still
+necessary to set up communication between host and target.
+ </P
+><P
+>None of this is applicable to the synthetic target. Instead you can
+just build a normal eCos configuration, link your application with the
+resulting libraries, and you end up with an executable that you can
+run directly on your Linux machine or via gdb. A useful side effect of
+this is that application development can start before any real
+embedded hardware is actually available.
+ </P
+><P
+>Typically the memory map for a synthetic target application will be
+set up such that there is a read-only ROM region containing all the
+code and constant data, and a read-write RAM region for the data. The
+default locations and sizes of these regions depend on the specific
+platform being used for development. Note that the application always
+executes out of ROM: on a real embedded target much of the development
+would involve running RedBoot firmware there, with application code
+and data loaded into RAM; usually this would change for the final
+system; the firmware would be replaced by the eCos application itself,
+configured for ROM bootstrap, and it would perform the appropriate
+hardware initialization. Therefore the synthetic target actually
+emulates the behaviour of a final system, not of a development
+environment. In practice this is rarely significant, although having
+the code in read-only memory can help catch some problems in
+application code.
+ </P
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><HR
+ALIGN="LEFT"
+WIDTH="100%"><TABLE
+SUMMARY="Footer navigation table"
+WIDTH="100%"
+BORDER="0"
+CELLPADDING="0"
+CELLSPACING="0"
+><TR
+><TD
+WIDTH="33%"
+ALIGN="left"
+VALIGN="top"
+><A
+HREF="synth.html"
+ACCESSKEY="P"
+>Prev</A
+></TD
+><TD
+WIDTH="34%"
+ALIGN="center"
+VALIGN="top"
+><A
+HREF="hal-synth-arch.html"
+ACCESSKEY="H"
+>Home</A
+></TD
+><TD
+WIDTH="33%"
+ALIGN="right"
+VALIGN="top"
+><A
+HREF="synth-running.html"
+ACCESSKEY="N"
+>Next</A
+></TD
+></TR
+><TR
+><TD
+WIDTH="33%"
+ALIGN="left"
+VALIGN="top"
+>Overview</TD
+><TD
+WIDTH="34%"
+ALIGN="center"
+VALIGN="top"
+>&nbsp;</TD
+><TD
+WIDTH="33%"
+ALIGN="right"
+VALIGN="top"
+>Running a Synthetic Target Application</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
diff --git a/ecos/packages/hal/synth/arch/current/doc/synth-io-overview.fig b/ecos/packages/hal/synth/arch/current/doc/synth-io-overview.fig
new file mode 100644
index 0000000..59ec99f
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/synth-io-overview.fig
@@ -0,0 +1,57 @@
+#FIG 3.2
+Landscape
+Center
+Inches
+Letter
+100.00
+Single
+-2
+1200 2
+2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5
+ 300 300 3300 300 3300 1800 300 1800 300 300
+2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2
+ 2700 300 2700 1800
+2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2
+ 1800 300 1800 1800
+2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2
+ 1800 750 2700 750
+2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2
+ 1800 1350 2700 1350
+2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2
+ 5400 300 5400 1800
+2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2
+ 5400 750 6900 750
+2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2
+ 5400 1350 6900 1350
+2 2 0 1 0 7 50 0 -1 4.000 0 0 7 0 0 5
+ 4200 300 6900 300 6900 1800 4200 1800 4200 300
+2 1 0 2 0 7 50 0 -1 6.000 0 0 7 1 1 2
+ 1 1 2.00 120.00 240.00
+ 1 1 2.00 120.00 240.00
+ 3300 1050 4200 1050
+2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 1 2
+ 1 1 1.00 60.00 120.00
+ 1 1 1.00 60.00 120.00
+ 6900 600 7500 600
+2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 1 2
+ 1 1 1.00 60.00 120.00
+ 1 1 1.00 60.00 120.00
+ 6900 1125 7500 1125
+2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 1 2
+ 1 1 1.00 60.00 120.00
+ 1 1 1.00 60.00 120.00
+ 6900 1650 7500 1650
+4 0 0 50 0 0 12 0.0000 4 135 375 2850 1200 HAL\001
+4 0 0 50 0 0 12 0.0000 4 135 585 1950 1650 console\001
+4 0 0 50 0 0 12 0.0000 4 135 690 1875 1200 /dev/ser0\001
+4 0 0 50 0 0 12 0.0000 4 135 330 2100 600 eth0\001
+4 0 0 50 0 0 12 0.0000 4 135 390 750 825 eCos\001
+4 0 0 50 0 0 12 0.0000 4 180 825 600 1200 application\001
+4 0 0 50 0 0 12 0.0000 4 180 975 4350 1200 I/O Auxiliary\001
+4 0 0 50 0 0 12 0.0000 4 180 690 4500 825 ecosynth\001
+4 0 0 50 0 0 12 0.0000 4 135 870 5775 675 ethernet.tcl\001
+4 0 0 50 0 0 12 0.0000 4 135 660 5775 1200 serial.tcl\001
+4 0 0 50 0 0 12 0.0000 4 135 825 5775 1725 console.tcl\001
+4 0 0 50 0 0 12 0.0000 4 180 795 7575 675 Linux tap3\001
+4 0 0 50 0 0 12 0.0000 4 180 765 7575 1200 /dev/ttyS1\001
+4 0 0 50 0 0 12 0.0000 4 135 135 7575 1725 X\001
diff --git a/ecos/packages/hal/synth/arch/current/doc/synth-io-overview.png b/ecos/packages/hal/synth/arch/current/doc/synth-io-overview.png
new file mode 100644
index 0000000..342a1a7
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/synth-io-overview.png
Binary files differ
diff --git a/ecos/packages/hal/synth/arch/current/doc/synth-new-host.html b/ecos/packages/hal/synth/arch/current/doc/synth-new-host.html
new file mode 100644
index 0000000..9bb2ecf
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/synth-new-host.html
@@ -0,0 +1,1734 @@
+<!-- Copyright (C) 2002 Free Software Foundation, Inc. -->
+<!-- This material may be distributed only subject to the terms -->
+<!-- and conditions set forth in the Open Publication License, v1.0 -->
+<!-- or later (the latest version is presently available at -->
+<!-- http://www.opencontent.org/openpub/). -->
+<!-- Distribution of the work or derivative of the work in any -->
+<!-- standard (paper) book form is prohibited unless prior -->
+<!-- permission is obtained from the copyright holder. -->
+<HTML
+><HEAD
+><TITLE
+>Writing New Devices - host</TITLE
+><meta name="MSSmartTagsPreventParsing" content="TRUE">
+<META
+NAME="GENERATOR"
+CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
+"><LINK
+REL="HOME"
+TITLE="eCos Synthetic Target"
+HREF="hal-synth-arch.html"><LINK
+REL="PREVIOUS"
+TITLE="Writing New Devices - target"
+HREF="synth-new-target.html"><LINK
+REL="NEXT"
+TITLE="Porting"
+HREF="synth-porting.html"></HEAD
+><BODY
+CLASS="REFENTRY"
+BGCOLOR="#FFFFFF"
+TEXT="#000000"
+LINK="#0000FF"
+VLINK="#840084"
+ALINK="#0000FF"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
+SUMMARY="Header navigation table"
+WIDTH="100%"
+BORDER="0"
+CELLPADDING="0"
+CELLSPACING="0"
+><TR
+><TH
+COLSPAN="3"
+ALIGN="center"
+>eCos Synthetic Target</TH
+></TR
+><TR
+><TD
+WIDTH="10%"
+ALIGN="left"
+VALIGN="bottom"
+><A
+HREF="synth-new-target.html"
+ACCESSKEY="P"
+>Prev</A
+></TD
+><TD
+WIDTH="80%"
+ALIGN="center"
+VALIGN="bottom"
+></TD
+><TD
+WIDTH="10%"
+ALIGN="right"
+VALIGN="bottom"
+><A
+HREF="synth-porting.html"
+ACCESSKEY="N"
+>Next</A
+></TD
+></TR
+></TABLE
+><HR
+ALIGN="LEFT"
+WIDTH="100%"></DIV
+><H1
+><A
+NAME="SYNTH-NEW-HOST">Writing New Devices - host</H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="AEN726"
+></A
+><H2
+>Name</H2
+>Writing New Devices&nbsp;--&nbsp;extending the synthetic target, host-side</DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-NEW-HOST-DESCRIPTION"
+></A
+><H2
+>Description</H2
+><P
+>On the host-side adding a new device means writing a Tcl/Tk script
+that will handle instantiation and subsequent requests from the
+target-side. These scripts all run in the same full interpreter,
+extended with various commands provided by the main I/O auxiliary
+code, and running in an overall GUI framework. Some knowledge of
+programming with Tcl/Tk is required to implement host-side device
+support.
+ </P
+><P
+>Some devices can be implemented entirely using a Tcl/Tk script. For
+example, if the final system will have some buttons then those can be
+emulated in the synthetic target using a few Tk widgets. A simple
+emulation could just have the right number of buttons in a row. A more
+advanced emulation could organize the buttons with the right layout,
+perhaps even matching the colour scheme, the shapes, and the relative
+sizes. With other devices it may be necessary for the Tcl script to
+interact with an external program, because the required functionality
+cannot easily be accessed from a Tcl script. For example interacting
+with a raw ethernet device involves some <TT
+CLASS="FUNCTION"
+>ioctl</TT
+>
+calls, which is easier to do in a C program. Therefore the
+<TT
+CLASS="FILENAME"
+>ethernet.tcl</TT
+> script which implements the
+host-side ethernet support spawns a separate program
+<TT
+CLASS="FILENAME"
+>rawether</TT
+>, written in C, that performs the
+low-level I/O. Raw ethernet access usually also requires root
+privileges, and running a small program <TT
+CLASS="FILENAME"
+>rawether</TT
+>
+with such privileges is somewhat less of a security risk than the
+whole eCos application, the I/O auxiliary, and various dynamically
+loaded Tcl scripts.
+ </P
+><P
+>Because all scripts run in a single interpreter, some care has
+to be taken to avoid accidental sharing of global variables. The best
+way to avoid problems is to have each script create its own Tcl
+namespace, so for example the <TT
+CLASS="FILENAME"
+>ethernet.tcl</TT
+> script
+creates a namespace <TT
+CLASS="VARNAME"
+>ethernet::</TT
+> and all variables
+and procedures reside in this namespace. Similarly the I/O auxiliary
+itself makes use of a <TT
+CLASS="VARNAME"
+>synth::</TT
+> namespace.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-NEW-HOST-BUILD"
+></A
+><H2
+>Building and Installation</H2
+><P
+>When an eCos device driver or application code instantiates a device,
+the I/O auxiliary will attempt to load a matching Tcl script. The
+third argument to <TT
+CLASS="FUNCTION"
+>synth_auxiliary_instantiate</TT
+>
+specifies the type of device, for example <TT
+CLASS="LITERAL"
+>ethernet</TT
+>,
+and the I/O auxiliary will append a <TT
+CLASS="FILENAME"
+>.tcl</TT
+> suffix
+and look for a script <TT
+CLASS="FILENAME"
+>ethernet.tcl</TT
+>.
+ </P
+><P
+>If the device being instantiated is application-specific rather than
+part of an eCos package, the I/O auxiliary will look first in the
+current directory, then in <TT
+CLASS="FILENAME"
+>~/.ecos/synth</TT
+>. If it is part of an eCos
+package then the auxiliary will expect to find the Tcl script and any
+support files below <TT
+CLASS="FILENAME"
+>libexec/ecos</TT
+> in the install tree - note
+that the same install tree must be used for the I/O auxiliary itself
+and for any device driver support. The directory hierarchy below
+<TT
+CLASS="FILENAME"
+>libexec/ecos</TT
+> matches the
+structure of the eCos repository, allowing multiple versions of a
+package to be installed to allow for incompatible protocol changes.
+ </P
+><P
+>The preferred way to build host-side software is to use
+<B
+CLASS="COMMAND"
+>autoconf</B
+> and <B
+CLASS="COMMAND"
+>automake</B
+>. Usually
+this involves little more than copying the
+<TT
+CLASS="FILENAME"
+>acinclude.m4</TT
+>, <TT
+CLASS="FILENAME"
+>configure.in</TT
+>
+and <TT
+CLASS="FILENAME"
+>Makefile.am</TT
+> files from an existing package,
+for example the synthetic target ethernet driver, and then making
+minor edits. In <TT
+CLASS="FILENAME"
+>acinclude.m4</TT
+> it may be necessary
+to adjust the path to the root of the repository.
+<TT
+CLASS="FILENAME"
+>configure.in</TT
+> may require a similar change, and
+the <TT
+CLASS="FUNCTION"
+>AC_INIT</TT
+> macro invocation will have to be
+changed to match one of the files in the new package. A critical macro
+in this file is <TT
+CLASS="FILENAME"
+>ECOS_PACKAGE_DIRS</TT
+> which will set
+up the correct install directory. <TT
+CLASS="FILENAME"
+>Makefile.am</TT
+> may
+require some more changes, for example to specify the data files that
+should be installed (including the Tcl script). These files should
+then be processed using <B
+CLASS="COMMAND"
+>aclocal</B
+>,
+<B
+CLASS="COMMAND"
+>autoconf</B
+> and <B
+CLASS="COMMAND"
+>automake</B
+> in that
+order. Actually building the software then just involves
+<B
+CLASS="COMMAND"
+>configure</B
+>, <B
+CLASS="COMMAND"
+>make</B
+> and
+<B
+CLASS="COMMAND"
+>make install</B
+>, as per the instructions in the
+toplevel <TT
+CLASS="FILENAME"
+>README.host</TT
+> file.
+ </P
+><P
+>To assist developers, if the environment variable
+<TT
+CLASS="ENVAR"
+>ECOSYNTH_DEVEL</TT
+> is set then a slightly different
+algorithm is used for locating device Tcl scripts. Instead of looking
+only in the install tree the I/O auxiliary will also look in the
+source tree, and if the script there is more recent than the installed
+version it will be used in preference. This allows developers to
+modify the master copy without having to run <B
+CLASS="COMMAND"
+>make
+install</B
+> all the time.
+ </P
+><P
+>If a script needs to know where it has been installed it can examine
+the Tcl variable <TT
+CLASS="VARNAME"
+>synth::device_install_dir</TT
+> . This
+variable gets updated whenever a script is loaded, so if the
+value may be needed later it should be saved away in a device-specific
+variable.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-NEW-HOST-INSTANTIATION"
+></A
+><H2
+>Instantiation</H2
+><P
+>The I/O auxiliary will <B
+CLASS="COMMAND"
+>source</B
+> the device-specific
+Tcl script when the eCos application first attempts to instantiate a
+device of that type. The script should return a procedure that will be
+invoked to instantiate a device.
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>namespace eval ethernet {
+ &#8230;
+ proc instantiate { id instance data } {
+ &#8230;
+ return ethernet::handle_request
+ }
+}
+return ethernet::instantiate</PRE
+></TD
+></TR
+></TABLE
+><P
+>The <TT
+CLASS="VARNAME"
+>id</TT
+> argument is a unique identifier for this
+device instance. It will also be supplied on subsequent calls to the
+request handler, and will match the return value of
+<TT
+CLASS="FUNCTION"
+>synth_auxiliary_instantiate</TT
+> on the target side. A
+common use for this value is as an array index to support multiple
+instances of this types of device. The <TT
+CLASS="VARNAME"
+>instance</TT
+> and
+<TT
+CLASS="VARNAME"
+>data</TT
+> arguments match the corresponding arguments to
+<TT
+CLASS="FUNCTION"
+>synth_auxiliary_instantiate</TT
+> on the target side, so
+a typical value for <TT
+CLASS="VARNAME"
+>instance</TT
+> would be
+<TT
+CLASS="LITERAL"
+>eth0</TT
+>, and <TT
+CLASS="VARNAME"
+>data</TT
+> is used to pass
+arbitrary initialization parameters from target to host.
+ </P
+><P
+>The actual work done by the instantiation procedure is obviously
+device-specific. It may involve allocating an <A
+HREF="synth-new-host.html#SYNTH-NEW-HOST-INTERRUPTS"
+>interrupt vector</A
+>, adding a
+device-specific subwindow to the display, opening a real Linux device,
+establishing a socket connection to some server, spawning a separate
+process to handle the actual I/O, or a combination of some or all of
+the above.
+ </P
+><P
+>If the device is successfully instantiated then the return value
+should be a handler for subsequent I/O requests. Otherwise the return
+value should be an empty string, and on the target-side the
+<TT
+CLASS="FUNCTION"
+>synth_auxiliary_instantiate</TT
+> call will return
+<TT
+CLASS="LITERAL"
+>-1</TT
+>. The script is responsible for providing
+<A
+HREF="synth-new-host.html#SYNTH-NEW-HOST-OUTPUT"
+>diagnostics</A
+> explaining
+why the device could not be instantiated.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-NEW-HOST-REQUESTS"
+></A
+><H2
+>Handling Requests</H2
+><P
+>When the target-side calls
+<TT
+CLASS="FUNCTION"
+>synth_auxiliary_xchgmsg</TT
+>, the I/O auxiliary will
+end up calling the request handler for the appropriate device instance
+returned during instantiation:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>namespace eval ethernet {
+ &#8230;
+ proc handle_request { id request arg1 arg2 txdata txlen max_rxlen } {
+ &#8230;
+ if { &lt;some condition&gt; } {
+ synth::send_reply &lt;error code&gt; 0 ""
+ return
+ }
+ &#8230;
+ synth::send_reply &lt;reply code&gt; $packet_len $packet
+ }
+ &#8230;
+}</PRE
+></TD
+></TR
+></TABLE
+><P
+>The <TT
+CLASS="VARNAME"
+>id</TT
+> argument is the same device id that was
+passed to the instantiate function, and is typically used as an array
+index to access per-device data. The <TT
+CLASS="VARNAME"
+>request</TT
+>,
+<TT
+CLASS="VARNAME"
+>arg1</TT
+>, <TT
+CLASS="VARNAME"
+>arg2</TT
+>, and
+<TT
+CLASS="VARNAME"
+>max_rxlen</TT
+> are the same values that were passed to
+<TT
+CLASS="FUNCTION"
+>synth_auxiliary_xchgmsg</TT
+> on the target-side,
+although since this is a Tcl script obviously the numbers have been
+converted to strings. The <TT
+CLASS="VARNAME"
+>txdata</TT
+> buffer is raw data
+as transmitted by the target, or an empty string if the I/O operation
+does not involve any additional data. The Tcl procedures
+<B
+CLASS="COMMAND"
+>binary scan</B
+>, <B
+CLASS="COMMAND"
+>string index</B
+> and
+<B
+CLASS="COMMAND"
+>string range</B
+> may be found especially useful when
+manipulating this buffer. <TT
+CLASS="VARNAME"
+>txlen</TT
+> is provided for
+convenience, although <B
+CLASS="COMMAND"
+>string length $txdata</B
+> would
+give the same information.
+ </P
+><P
+>The code for actually processing the request is of course device
+specific. If the target does not expect a reply then the request
+handler should just return when finished. If a reply is expected then
+there should be a call to <B
+CLASS="COMMAND"
+>synth::send_reply</B
+>. The
+first argument is the reply code, and will be turned into a 32-bit
+integer on the target side. The second argument specifies the length
+of the reply data, and the third argument is the reply data itself.
+For some devices the Tcl procedure <B
+CLASS="COMMAND"
+>binary format</B
+>
+may prove useful. If the reply involves just a code and no additional
+data, the second and third arguments should be <TT
+CLASS="LITERAL"
+>0</TT
+>
+and an empty string respectively.
+ </P
+><P
+>Attempts to send a reply when none is expected, fail to send a reply
+when one is expected, or send a reply that is larger than the
+target-side expects, will all be detected by the I/O auxiliary and
+result in run-time error messages.
+ </P
+><P
+>It is not possible for the host-side code to send unsolicited messages
+to the target. If host-side code needs attention from the target, for
+example because some I/O operation has completed, then an interrupt
+should be raised.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-NEW-HOST-INTERRUPTS"
+></A
+><H2
+>Interrupts</H2
+><P
+>The I/O auxiliary provides a number of procedures for interrupt
+handling.
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>synth::interrupt_allocate &lt;name&gt;
+synth::interrupt_get_max
+synth::interrupt_get_devicename &lt;vector&gt;
+synth::interrupt_raise &lt;vector&gt;</PRE
+></TD
+></TR
+></TABLE
+><P
+><B
+CLASS="COMMAND"
+>synth::interrupt_allocate</B
+> is normally called during
+device instantiation, and returns the next free interrupt vector. This
+can be passed on to the target-side device driver in response to a
+suitable request, and it can then install an interrupt handler on that
+vector. Interrupt vector <TT
+CLASS="LITERAL"
+>0</TT
+> is used within the
+target-side code for the real-time clock, so the allocated vectors
+will start at <TT
+CLASS="LITERAL"
+>1</TT
+>. The argument identifies the
+device, for example <TT
+CLASS="LITERAL"
+>eth0</TT
+>. This is not actually used
+internally, but can be accessed by user-initialization scripts that
+provide some sort of interrupt monitoring facility (typically via the
+<TT
+CLASS="LITERAL"
+>interrupt</TT
+> <A
+HREF="synth-new-host.html#SYNTH-NEW-HOST-HOOKS"
+>hook</A
+>). It is possible for a
+single device to allocate multiple interrupt vectors, but the
+synthetic target supports a maximum of 32 such vectors.
+ </P
+><P
+><B
+CLASS="COMMAND"
+>synth::interrupt_get_max</B
+> returns the highest
+interrupt vector that has been allocated, or <TT
+CLASS="LITERAL"
+>0</TT
+> if
+there have been no calls to
+<B
+CLASS="COMMAND"
+>synth::interrupt_allocate</B
+>.
+<B
+CLASS="COMMAND"
+>synth::interrupt_get_devicename</B
+> returns the string
+that was passed to <B
+CLASS="COMMAND"
+>synth::interrupt_allocate</B
+> when
+the vector was allocated.
+ </P
+><P
+><B
+CLASS="COMMAND"
+>synth::interrupt_raise</B
+> can be called any time after
+initialization. The argument should be the vector returned by
+<B
+CLASS="COMMAND"
+>synth::interrupt_allocate</B
+> for this device. It will
+activate the normal eCos interrupt handling mechanism so, subject to
+interrupts being enabled and this particular interrupt not being
+masked out, the appropriate ISR will run.
+ </P
+><DIV
+CLASS="NOTE"
+><BLOCKQUOTE
+CLASS="NOTE"
+><P
+><B
+>Note: </B
+>At this time it is not possible for a device to allocate a specific
+interrupt vector. The order in which interrupt vectors are assigned to
+devices effectively depends on the order in which the eCos devices get
+initialized, and that may change if the eCos application is rebuilt. A
+future extension may allow devices to allocate specific vectors, thus
+making things more deterministic. However that will introduce new
+problems, in particular the code will have to start worrying about
+requests for vectors that have already been allocated.
+ </P
+></BLOCKQUOTE
+></DIV
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-NEW-HOST-ARGS"
+></A
+><H2
+>Flags and Command Line Arguments</H2
+><P
+>The generic I/O auxiliary code will process the standard command line
+arguments, and will set various flag variables accordingly. Some of
+these should be checked by device-specific scripts.
+ </P
+><P
+></P
+><DIV
+CLASS="VARIABLELIST"
+><DL
+><DT
+><TT
+CLASS="VARNAME"
+>synth::flag_gui</TT
+></DT
+><DD
+><P
+>This is set when the I/O auxiliary is operating in graphical mode
+rather than text mode. Some functionality such as filters and the GUI
+layout are only available in graphical mode.
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+> if { $synth::flag_gui } {
+ &#8230;
+ }</PRE
+></TD
+></TR
+></TABLE
+></DD
+><DT
+><TT
+CLASS="VARNAME"
+>synth::flag_verbose</TT
+></DT
+><DD
+><P
+>The user has requested additional information during startup. Each
+device driver can decide how much additional information, if any,
+should be produced.
+ </P
+></DD
+><DT
+><TT
+CLASS="VARNAME"
+>synth::flag_keep_going</TT
+></DT
+><DD
+><P
+>The user has specified <TT
+CLASS="OPTION"
+>-k</TT
+> or
+<TT
+CLASS="OPTION"
+>--keep-going</TT
+>, so even if an error occurs the I/O
+auxiliary and the various device driver scripts should continue running
+if at all possible. Diagnostics should still be generated.
+ </P
+></DD
+></DL
+></DIV
+><P
+>Some scripts may want to support additional command line arguments.
+This facility should be used with care since there is no way to
+prevent two different scripts from trying to use the same argument.
+The following Tcl procedures are available:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>synth::argv_defined &lt;name&gt;
+synth::argv_get_value &lt;name&gt;</PRE
+></TD
+></TR
+></TABLE
+><P
+><B
+CLASS="COMMAND"
+>synth::argv_defined</B
+> returns a boolean to indicate
+whether or not a particular argument is present. If the argument is
+the name part of a name/value pair, an <TT
+CLASS="LITERAL"
+>=</TT
+> character
+should be appended. Typical uses might be:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+> if { [synth::argv_defined "-o13"] } {
+ &#8230;
+ }
+
+ if { [synth::argv_defined "-mark="] } {
+ &#8230;
+ }</PRE
+></TD
+></TR
+></TABLE
+><P
+>The first call checks for a flag <TT
+CLASS="LITERAL"
+>-o13</TT
+> or
+<TT
+CLASS="LITERAL"
+>--o13</TT
+> - the code treats options with single and
+double hyphens interchangeably. The second call checks for an argument
+of the form <TT
+CLASS="LITERAL"
+>-mark=&lt;value&gt;</TT
+> or a pair of
+arguments <TT
+CLASS="LITERAL"
+>-mark &lt;value&gt;</TT
+>. The value part of a
+name/value pair can be obtained using
+<B
+CLASS="COMMAND"
+>synth::argv_get_value</B
+>;
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+> variable speed 1
+ if { [synth::argv_defined "-mark="] } {
+ set mark [synth::argv_get_value "-mark="]
+ if { ![string is integer $mark] || ($mark &#60; 1) || ($mark &#62; 9) } {
+ &lt;issue diagnostic&gt;
+ } else {
+ set speed $mark
+ }
+ }</PRE
+></TD
+></TR
+></TABLE
+><P
+><B
+CLASS="COMMAND"
+>synth::argv_get_value</B
+> should only be used after a
+successful call to <B
+CLASS="COMMAND"
+>synth::argv_defined</B
+>.
+At present there is no support for some advanced forms of command line
+argument processing. For example it is not possible to repeat a
+certain option such as <TT
+CLASS="OPTION"
+>-v</TT
+> or
+<TT
+CLASS="OPTION"
+>--verbose</TT
+>, with each occurrence increasing the level
+of verbosity.
+ </P
+><P
+>If a script is going to have its own set of command-line arguments
+then it should give appropriate details if the user specifies
+<TT
+CLASS="OPTION"
+>--help</TT
+>. This involves a hook function:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>namespace eval my_device {
+ proc help_hook { } {
+ puts " -o13 : activate the omega 13 device"
+ puts " -mark &lt;speed&gt; : set speed. Valid values are 1 to 9."
+ }
+
+ synth::hook_add "help" my_device::help_hook
+}</PRE
+></TD
+></TR
+></TABLE
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-NEW-HOST-TDF"
+></A
+><H2
+>The Target Definition File</H2
+><P
+>Most device scripts will want to check entries in the target
+definition file for run-time configuration information. The Tcl
+procedures for this are as follows:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>synth::tdf_has_device &lt;name&gt;
+synth::tdf_get_devices
+synth::tdf_has_option &lt;devname&gt; &lt;option&gt;
+synth::tdf_get_option &lt;devname&gt; &lt;option&gt;
+synth::tdf_get_options &lt;devname&gt; &lt;option&gt;
+synth::tdf_get_all_options &lt;devname&gt;</PRE
+></TD
+></TR
+></TABLE
+><P
+><B
+CLASS="COMMAND"
+>synth::tdf_has_device</B
+> can be used to check whether
+or not the target definition file had an entry
+<TT
+CLASS="LITERAL"
+>synth_device&nbsp;&lt;name&gt;</TT
+>. Usually the name
+will match the type of device, so the
+<TT
+CLASS="FILENAME"
+>console.tcl</TT
+> script will look for a target
+definition file entry <TT
+CLASS="LITERAL"
+>console</TT
+>.
+<B
+CLASS="COMMAND"
+>synth::tdf_get_devices</B
+> returns a list of all
+device entries in the target definition file.
+ </P
+><P
+>Once it is known that the target definition file has an entry for a
+certain device, it is possible to check for options within the entry.
+<B
+CLASS="COMMAND"
+>synth::tdf_has_option</B
+> just checks for the presence,
+returning a boolean:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+> if { [synth::tdf_has_option "console" "appearance"] } {
+ &#8230;
+ }</PRE
+></TD
+></TR
+></TABLE
+><P
+><B
+CLASS="COMMAND"
+>synth::tdf_get_option</B
+> returns a list of all the
+arguments for a given option. For example, if the target definition
+file contains an entry:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>synth_device console {
+ appearance -foreground white -background black
+ filter trace {^TRACE:.*} -foreground HotPink1 -hide 1
+ filter xyzzy {.*xyzzy.*} -foreground PapayaWhip
+}</PRE
+></TD
+></TR
+></TABLE
+><P
+>A call
+<B
+CLASS="COMMAND"
+>synth::tdf_get_option&nbsp;console&nbsp;appearance</B
+>
+will return the list <TT
+CLASS="LITERAL"
+>{-foreground white -background
+black}</TT
+>. This list can be manipulated using standard Tcl routines
+such as <B
+CLASS="COMMAND"
+>llength</B
+> and <B
+CLASS="COMMAND"
+>lindex</B
+>. Some
+options can occur multiple times in one entry, for example
+<TT
+CLASS="OPTION"
+>filter</TT
+> in the <TT
+CLASS="LITERAL"
+>console</TT
+> entry.
+<B
+CLASS="COMMAND"
+>synth::tdf_get_options</B
+> returns a list of lists,
+with one entry for each option occurrence.
+<B
+CLASS="COMMAND"
+>synth::tdf_get_all_options</B
+> returns a list of lists
+of all options. This time each entry will include the option name as
+well.
+ </P
+><P
+>The I/O auxiliary will not issue warnings about entries in the target
+definition file for devices which were not loaded, unless the
+<TT
+CLASS="OPTION"
+>-v</TT
+> or <TT
+CLASS="OPTION"
+>--verbose</TT
+> command line
+argument was used. This makes it easier to use a single target
+definition file for different applications. However the auxiliary will
+issue warnings about options within an entry that were ignored,
+because often these indicate a typing mistake of some sort. Hence a
+script should always call <B
+CLASS="COMMAND"
+>synth::tdf_has_option</B
+>,
+<B
+CLASS="COMMAND"
+>synth:;tdf_get_option</B
+> or
+<B
+CLASS="COMMAND"
+>synth::tdf_get_options</B
+> for all valid options, even
+if some of the options preclude the use of others.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-NEW-HOST-HOOKS"
+></A
+><H2
+>Hooks</H2
+><P
+>Some scripts may want to take action when particular events occur, for
+example when the eCos application has exited and there is no need for
+further I/O. This is supported using hooks:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>namespace eval my_device {
+ &#8230;
+ proc handle_ecos_exit { arg_list } {
+ &#8230;
+ }
+ synth::hook_add "ecos_exit" my_device::handle_ecos_exit
+}</PRE
+></TD
+></TR
+></TABLE
+><P
+>It is possible for device scripts to add their own hooks and call all
+functions registered for those hooks. A typical use for this is by
+user initialization scripts that want to monitor some types of I/O.
+The available Tcl procedures for manipulating hooks are:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>synth::hook_define &lt;name&gt;
+synth::hook_defined &lt;name&gt;
+synth::hook_add &lt;name&gt; &lt;function&gt;
+synth::hook_call &lt;name&gt; &lt;args&gt;</PRE
+></TD
+></TR
+></TABLE
+><P
+><B
+CLASS="COMMAND"
+>synth::hook_define</B
+> creates a new hook with the
+specified name. This hook must not already exist.
+<B
+CLASS="COMMAND"
+>synth::hook_defined</B
+> can be used to check for the
+existence of a hook. <B
+CLASS="COMMAND"
+>synth::hook_add</B
+> allows other
+scripts to register a callback function for this hook, and
+<B
+CLASS="COMMAND"
+>synth::hook_call</B
+> allows the owner script to invoke
+all such callback functions. A hook must already be defined before a
+callback can be attached. Therefore typically device scripts will only
+use standard hooks and their own hooks, not hooks created by some
+other device, because the order of device initialization is not
+sufficiently defined. User scripts run from
+<TT
+CLASS="FILENAME"
+>mainrc.tcl</TT
+> can use any hooks that have been
+defined.
+ </P
+><P
+><B
+CLASS="COMMAND"
+>synth::hook_call</B
+> takes an arbitrary list of
+arguments, for example:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+> synth::hook_call "ethernet_rx" "eth0" $packet</PRE
+></TD
+></TR
+></TABLE
+><P
+>The callback function will always be invoked with a single argument,
+a list of the arguments that were passed to
+<B
+CLASS="COMMAND"
+>synth::hook_call</B
+>:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+> proc rx_callback { arg_list } {
+ set device [lindex $arg_list 0]
+ set packet [lindex $arg_list 1]
+ }</PRE
+></TD
+></TR
+></TABLE
+><P
+>Although it might seem more appropriate to use Tcl's
+<B
+CLASS="COMMAND"
+>eval</B
+> procedure and have the callback functions
+invoked with the right number of arguments rather than a single list,
+that would cause serious problems if any of the data contained special
+characters such as <TT
+CLASS="LITERAL"
+>[</TT
+> or <TT
+CLASS="LITERAL"
+>$</TT
+>. The
+current implementation of hooks avoids such problems, at the cost of
+minor inconvenience when writing callbacks.
+ </P
+><P
+>A number of hooks are defined as standard. Some devices will add
+additional hooks, and the device-specific documentation should be
+consulted for those. User scripts can add their own hooks if desired.
+ </P
+><P
+></P
+><DIV
+CLASS="VARIABLELIST"
+><DL
+><DT
+><TT
+CLASS="LITERAL"
+>exit</TT
+></DT
+><DD
+><P
+>This hook is called just before the I/O auxiliary exits. Hence it
+provides much the same functionality as <TT
+CLASS="FUNCTION"
+>atexit</TT
+> in
+C programs. The argument list passed to the callback function will be
+empty.
+ </P
+></DD
+><DT
+><TT
+CLASS="LITERAL"
+>ecos_exit</TT
+></DT
+><DD
+><P
+>This hook is called when the eCos application has exited. It is used
+mainly to shut down I/O operations: if the application is no longer
+running then there is no point in raising interrupts or storing
+incoming packets. The callback argument list will be empty.
+ </P
+></DD
+><DT
+><TT
+CLASS="LITERAL"
+>ecos_initialized</TT
+></DT
+><DD
+><P
+>The synthetic target HAL will send a request to the I/O auxiliary once
+the static constructors have been run. All devices should now have been
+instantiated. A script could now check how many instances there are of
+a given type of device, for example ethernet devices, and create a
+little monitor window showing traffic on all the devices. The
+<TT
+CLASS="LITERAL"
+>ecos_initialized</TT
+> callbacks will be run just before
+the user's <TT
+CLASS="FILENAME"
+>mainrc.tcl</TT
+> script. The callback
+argument list will be empty.
+ </P
+></DD
+><DT
+><TT
+CLASS="LITERAL"
+>help</TT
+></DT
+><DD
+><P
+>This hook is also invoked once static constructors have been run, but
+only if the user specified <TT
+CLASS="OPTION"
+>-h</TT
+> or
+<TT
+CLASS="OPTION"
+>--help</TT
+>. Any scripts that add their own command line
+arguments should add a callback to this hook which outputs details of
+the additional arguments. The callback argument list will be empty.
+ </P
+></DD
+><DT
+><TT
+CLASS="LITERAL"
+>interrupt</TT
+></DT
+><DD
+><P
+>Whenever a device calls <B
+CLASS="COMMAND"
+>synth::interrupt_raise</B
+> the
+<TT
+CLASS="LITERAL"
+>interrupt</TT
+> hook will be called with a single
+argument, the interrupt vector. The main use for this is to allow
+user scripts to monitor interrupt traffic.
+ </P
+></DD
+></DL
+></DIV
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-NEW-HOST-OUTPUT"
+></A
+><H2
+>Output and Filters</H2
+><P
+>Scripts can use conventional facilities for sending text output to the
+user, for example calling <B
+CLASS="COMMAND"
+>puts</B
+> or directly
+manipulating the central text widget
+<TT
+CLASS="VARNAME"
+>.main.centre.text</TT
+>. However in nearly all cases it
+is better to use output facilities provided by the I/O auxiliary
+itself:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>synth::report &lt;msg&gt;
+synth::report_warning &lt;msg&gt;
+synth::report_error &lt;msg&gt;
+synth::internal_error &lt;msg&gt;
+synth::output &lt;msg&gt; &lt;filter&gt;</PRE
+></TD
+></TR
+></TABLE
+><P
+><B
+CLASS="COMMAND"
+>synth::report</B
+> is intended for messages related to
+the operation of the I/O auxiliary itself, especially additional
+output resulting from <TT
+CLASS="OPTION"
+>-v</TT
+> or
+<TT
+CLASS="OPTION"
+>--verbose</TT
+>. If running in text mode the output will go
+to standard output. If running in graphical mode the output will go to
+the central text window. In both modes, use of <TT
+CLASS="OPTION"
+>-l</TT
+> or
+<TT
+CLASS="OPTION"
+>--logfile</TT
+> will modify the behaviour.
+ </P
+><P
+><B
+CLASS="COMMAND"
+>synth::report_warning</B
+>,
+<B
+CLASS="COMMAND"
+>synth::report_error</B
+> and
+<B
+CLASS="COMMAND"
+>synth::internal_error</B
+> have the obvious meaning,
+including prepending strings such as <TT
+CLASS="LITERAL"
+>Warning:</TT
+> and
+<TT
+CLASS="LITERAL"
+>Error:</TT
+>. When the eCos application informs the I/O
+auxiliary that all static constructors have run, if at that point
+there have been any calls to <B
+CLASS="COMMAND"
+>synth::error</B
+> then the
+I/O auxiliary will exit. This can be suppressed with command line
+arguments <TT
+CLASS="OPTION"
+>-k</TT
+> or <TT
+CLASS="OPTION"
+>--keep-going</TT
+>.
+<B
+CLASS="COMMAND"
+>synth::internal_error</B
+> will output some information
+about the current state of the I/O auxiliary and then exit
+immediately. Of course it should never be necessary to call this
+function.
+ </P
+><P
+><B
+CLASS="COMMAND"
+>synth::output</B
+> is the main routine for outputting
+text. The second argument identifies a filter. If running in text mode
+the filter is ignored, but if running in graphical mode the filter can
+be used to control the appearance of this output. A typical use would
+be:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+> synth::output $line "console"</PRE
+></TD
+></TR
+></TABLE
+><P
+>This outputs a single line of text using the
+<TT
+CLASS="LITERAL"
+>console</TT
+> filter. If running in graphical mode the
+default appearance of this text can be modified with the
+<TT
+CLASS="OPTION"
+>appearance</TT
+> option in the
+<B
+CLASS="COMMAND"
+>synth_device&nbsp;console</B
+> entry of the target
+definition file. The <SPAN
+CLASS="GUIMENUITEM"
+>System filters</SPAN
+> menu
+option can be used to change the appearance at run-time.
+ </P
+><P
+>Filters should be created before they are used. The procedures
+available for this are:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>synth::filter_exists &lt;name&gt;
+synth::filter_get_list
+synth::filter_add &lt;name&gt; [options]
+synth::filter_parse_options &lt;options&gt; &lt;parsed_options&gt; &lt;message&gt;
+synth::filter_add_parsed &lt;name&gt; &lt;parsed_options&gt;</PRE
+></TD
+></TR
+></TABLE
+><P
+><B
+CLASS="COMMAND"
+>synth::filter_exists</B
+> can be used to check whether
+or not a particular filter already exists: creating two filters with
+the same name is not allowed.
+<B
+CLASS="COMMAND"
+>synth::filter_get_list</B
+> returns a list of the
+current known filters. <B
+CLASS="COMMAND"
+>synth::filter_add</B
+> can be
+used to create a new filter. The first argument names the new filter,
+and the remaining arguments control the initial appearance. A typical
+use might be:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+> synth::filter_add "my_device_tx" -foreground yellow -hide 1</PRE
+></TD
+></TR
+></TABLE
+><P
+>It is assumed that the supplied arguments are valid, which typically
+means that they are hard-wired in the script. If instead the data
+comes out of a configuration file and hence may be invalid, the
+I/O auxiliary provides a parsing utility. Typical usage would be:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+> array set parsed_options [list]
+ set message ""
+ if { ![synth::filter_parse_options $console_appearance parsed_options message] } {
+ synth::report_error \
+ "Invalid entry in target definition file $synth::target_definition\
+ \n synth_device \"console\", entry \"appearance\"\n$message"
+ } else {
+ synth::filter_add_parsed "console" parsed_options
+ }</PRE
+></TD
+></TR
+></TABLE
+><P
+>On success <TT
+CLASS="VARNAME"
+>parsed_options</TT
+> will be updated with an
+internal representation of the desired appearance, which can then be
+used in a call to <B
+CLASS="COMMAND"
+>synth::filter_add_parsed</B
+>. On
+failure <TT
+CLASS="VARNAME"
+>message</TT
+> will be updated with details of the
+parsing error that occurred.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-NEW-HOST-GUI"
+></A
+><H2
+>The Graphical Interface</H2
+><P
+>When the I/O auxiliary is running in graphical mode, many scripts will
+want to update the user interface in some way. This may be as simple
+as adding another entry to the help menu for the device, or adding a
+new button to the toolbar. It may also involve adding new subwindows,
+or even creating entire new toplevel windows. These may be simple
+monitor windows, displaying additional information about what is going
+on in the system in a graphical format. Alternatively they may emulate
+actual I/O operations, for example button widgets could be used to
+emulate real physical buttons.
+ </P
+><P
+>The I/O auxiliary does not provide many procedures related to the
+graphical interface. Instead it is expected that scripts will just
+update the widget hierarchy directly.
+ </P
+><DIV
+CLASS="INFORMALFIGURE"
+><A
+NAME="AEN1018"><P
+></P
+><DIV
+CLASS="MEDIAOBJECT"
+><P
+><IMG
+SRC="layout.gif"
+ALIGN="CENTER"></P
+></DIV
+><P
+></P
+></DIV
+><P
+>So adding a new item to the <SPAN
+CLASS="GUIMENU"
+>Help</SPAN
+> menu involves a
+<B
+CLASS="COMMAND"
+>.menubar.help&nbsp;add</B
+> operation with suitable
+arguments. Adding a new button to the toolbar involves creating a
+child window in <TT
+CLASS="VARNAME"
+>.toolbar</TT
+> and packing it
+appropriately. Scripts can create their own subwindows and then pack
+it into one of <TT
+CLASS="VARNAME"
+>.main.nw</TT
+>,
+<TT
+CLASS="VARNAME"
+>.main.n</TT
+>, <TT
+CLASS="VARNAME"
+>.main.ne</TT
+>,
+<TT
+CLASS="VARNAME"
+>.main.w</TT
+>, <TT
+CLASS="VARNAME"
+>.main.e</TT
+>,
+<TT
+CLASS="VARNAME"
+>.main.sw</TT
+>, <TT
+CLASS="VARNAME"
+>.main.s</TT
+> or
+<TT
+CLASS="VARNAME"
+>.main.se</TT
+>. Normally the user should be allowed to
+<A
+HREF="synth-gui.html#SYNTH-GUI-LAYOUT"
+>control</A
+> this via the target
+definition file. The central window <TT
+CLASS="VARNAME"
+>.main.centre</TT
+>
+should normally be left alone by other scripts since it gets used for
+text output.
+ </P
+><P
+>The following graphics-related utilities may be found useful:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>synth::load_image &lt;image name&gt; &lt;filename&gt;
+synth::register_ballon_help &lt;widget&gt; &lt;message&gt;
+synth::handle_help &lt;URL&gt;</PRE
+></TD
+></TR
+></TABLE
+><P
+><B
+CLASS="COMMAND"
+>synth::load_image</B
+> can be used to add a new image to
+the current interpreter. If the specified file has a
+<TT
+CLASS="FILENAME"
+>.xbm</TT
+> extension then the image will be a
+monochrome bitmap, otherwise it will be a colour image of some sort.
+A boolean will be returned to indicate success or failure, and
+suitable diagnostics will be generated if necessary.
+ </P
+><P
+><B
+CLASS="COMMAND"
+>synth::register_balloon_help</B
+> provides balloon help
+for a specific widget, usually a button on the toolbar.
+ </P
+><P
+><B
+CLASS="COMMAND"
+>synth::handle_help</B
+> is a utility routine that can be
+installed as the command for displaying online help, for example:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+> .menubar.help add command -label "my device" -command \
+ [list synth::handle_help "file://$path"]</PRE
+></TD
+></TR
+></TABLE
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><HR
+ALIGN="LEFT"
+WIDTH="100%"><TABLE
+SUMMARY="Footer navigation table"
+WIDTH="100%"
+BORDER="0"
+CELLPADDING="0"
+CELLSPACING="0"
+><TR
+><TD
+WIDTH="33%"
+ALIGN="left"
+VALIGN="top"
+><A
+HREF="synth-new-target.html"
+ACCESSKEY="P"
+>Prev</A
+></TD
+><TD
+WIDTH="34%"
+ALIGN="center"
+VALIGN="top"
+><A
+HREF="hal-synth-arch.html"
+ACCESSKEY="H"
+>Home</A
+></TD
+><TD
+WIDTH="33%"
+ALIGN="right"
+VALIGN="top"
+><A
+HREF="synth-porting.html"
+ACCESSKEY="N"
+>Next</A
+></TD
+></TR
+><TR
+><TD
+WIDTH="33%"
+ALIGN="left"
+VALIGN="top"
+>Writing New Devices - target</TD
+><TD
+WIDTH="34%"
+ALIGN="center"
+VALIGN="top"
+>&nbsp;</TD
+><TD
+WIDTH="33%"
+ALIGN="right"
+VALIGN="top"
+>Porting</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
diff --git a/ecos/packages/hal/synth/arch/current/doc/synth-new-target.html b/ecos/packages/hal/synth/arch/current/doc/synth-new-target.html
new file mode 100644
index 0000000..1148269
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/synth-new-target.html
@@ -0,0 +1,823 @@
+<!-- Copyright (C) 2002 Free Software Foundation, Inc. -->
+<!-- This material may be distributed only subject to the terms -->
+<!-- and conditions set forth in the Open Publication License, v1.0 -->
+<!-- or later (the latest version is presently available at -->
+<!-- http://www.opencontent.org/openpub/). -->
+<!-- Distribution of the work or derivative of the work in any -->
+<!-- standard (paper) book form is prohibited unless prior -->
+<!-- permission is obtained from the copyright holder. -->
+<HTML
+><HEAD
+><TITLE
+>Writing New Devices - target</TITLE
+><meta name="MSSmartTagsPreventParsing" content="TRUE">
+<META
+NAME="GENERATOR"
+CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
+"><LINK
+REL="HOME"
+TITLE="eCos Synthetic Target"
+HREF="hal-synth-arch.html"><LINK
+REL="PREVIOUS"
+TITLE="System Calls"
+HREF="synth-syscalls.html"><LINK
+REL="NEXT"
+TITLE="Writing New Devices - host"
+HREF="synth-new-host.html"></HEAD
+><BODY
+CLASS="REFENTRY"
+BGCOLOR="#FFFFFF"
+TEXT="#000000"
+LINK="#0000FF"
+VLINK="#840084"
+ALINK="#0000FF"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
+SUMMARY="Header navigation table"
+WIDTH="100%"
+BORDER="0"
+CELLPADDING="0"
+CELLSPACING="0"
+><TR
+><TH
+COLSPAN="3"
+ALIGN="center"
+>eCos Synthetic Target</TH
+></TR
+><TR
+><TD
+WIDTH="10%"
+ALIGN="left"
+VALIGN="bottom"
+><A
+HREF="synth-syscalls.html"
+ACCESSKEY="P"
+>Prev</A
+></TD
+><TD
+WIDTH="80%"
+ALIGN="center"
+VALIGN="bottom"
+></TD
+><TD
+WIDTH="10%"
+ALIGN="right"
+VALIGN="bottom"
+><A
+HREF="synth-new-host.html"
+ACCESSKEY="N"
+>Next</A
+></TD
+></TR
+></TABLE
+><HR
+ALIGN="LEFT"
+WIDTH="100%"></DIV
+><H1
+><A
+NAME="SYNTH-NEW-TARGET">Writing New Devices - target</H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="AEN524"
+></A
+><H2
+>Name</H2
+>Writing New Devices&nbsp;--&nbsp;extending the synthetic target, target-side</DIV
+><DIV
+CLASS="REFSYNOPSISDIV"
+><A
+NAME="AEN527"><H2
+>Synopsis</H2
+><DIV
+CLASS="FUNCSYNOPSIS"
+><A
+NAME="AEN528"><P
+></P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="FUNCSYNOPSISINFO"
+>#include &lt;cyg/hal/hal_io.h
+ </PRE
+></TD
+></TR
+></TABLE
+><P
+><CODE
+><CODE
+CLASS="FUNCDEF"
+>int synth_auxiliary_instantiate</CODE
+>(const char* package, const char* version, const char* device, const char* instance, const char* data);</CODE
+></P
+><P
+><CODE
+><CODE
+CLASS="FUNCDEF"
+>void synth_auxiliary_xchgmsg</CODE
+>(int device_id, int request, int arg1, int arg2, const unsigned char* txdata, int txlen, int* reply, unsigned char* rxdata, int* rxlen, int max_rxlen);</CODE
+></P
+><P
+></P
+></DIV
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-NEW-TARGET-DESCRIPTION"
+></A
+><H2
+>Description</H2
+><P
+>In some ways writing a device driver for the synthetic target is very
+similar to writing one for a real target. Obviously it has to provide
+the standard interface for that class of device, so for example an
+ethernet device has to provide <TT
+CLASS="FUNCTION"
+>can_send</TT
+>,
+<TT
+CLASS="FUNCTION"
+>send</TT
+>, <TT
+CLASS="FUNCTION"
+>recv</TT
+> and similar
+functions. Many devices will involve interrupts, so the driver
+contains ISR and DSR functions and will call
+<TT
+CLASS="FUNCTION"
+>cyg_drv_interrupt_create</TT
+>,
+<TT
+CLASS="FUNCTION"
+>cyg_drv_interrupt_acknowledge</TT
+>, and related
+functions.
+ </P
+><P
+>In other ways writing a device driver for the synthetic target is very
+different. Usually the driver will not have any direct access to the
+underlying hardware. In fact for some devices the I/O may not involve
+real hardware, instead everything is emulated by widgets on the
+graphical display. Therefore the driver cannot just peek and poke
+device registers, instead it must interact with host-side code by
+exchanging message. The synthetic target HAL provides a function
+<TT
+CLASS="FUNCTION"
+>synth_auxiliary_xchgmsg</TT
+> for this purpose.
+ </P
+><P
+>Initialization of a synthetic target device driver is also very
+different. On real targets the device hardware already exists when the
+driver's initialization routine runs. On the synthetic target it is
+first necessary to instantiate the device inside the I/O auxiliary, by
+a call to <TT
+CLASS="FUNCTION"
+>synth_auxiliary_instantiate</TT
+>. That
+function performs a special message exchange with the I/O auxiliary,
+causing it to load a Tcl script for the desired type of device and run
+an instantiation procedure within that script.
+ </P
+><P
+>Use of the I/O auxiliary is optional: if the user does not specify
+<TT
+CLASS="OPTION"
+>--io</TT
+> on the command line then the auxiliary will not
+be started and hence most I/O operations will not be possible. Device
+drivers should allow for this possibility, for example by just
+discarding any data that gets written. The HAL exports a flag
+<TT
+CLASS="VARNAME"
+>synth_auxiliary_running</TT
+> which should be checked.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-NEW-TARGET-INSTANTIATE"
+></A
+><H2
+>Instantiating a Device</H2
+><P
+>Device instantiation should happen during the C++ prioritized static
+constructor phase of system initialization, before control switches to
+<TT
+CLASS="FUNCTION"
+>cyg_user_start</TT
+> and general application code. This
+ensures that there is a clearly defined point at which the I/O
+auxiliary knows that all required devices have been loaded. It can
+then perform various consistency checks and clean-ups, run the user's
+<TT
+CLASS="FILENAME"
+>mainrc.tcl</TT
+> script, and make the main window
+visible.
+ </P
+><P
+>For standard devices generic eCos I/O code will call the device
+initialization routines at the right time, iterating through the
+<TT
+CLASS="VARNAME"
+>DEVTAB</TT
+> table in a static constructor. The same
+holds for network devices and file systems. For more custom devices
+code like the following can be used:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>#include &lt;cyg/infra/cyg_type.h&gt;
+class mydev_init {
+ public:
+ mydev_init() {
+ &#8230;
+ }
+};
+static mydev_init mydev_init_object CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO);</PRE
+></TD
+></TR
+></TABLE
+><P
+>Some care has to be taken because the object
+<TT
+CLASS="VARNAME"
+>mydev_init_object</TT
+> will typically not be referenced
+by other code, and hence may get eliminated at link-time. If the code
+is part of an eCos package then problems can be avoided by putting the
+relevant file in <TT
+CLASS="FILENAME"
+>libextras.a</TT
+>:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>cdl_package CYGPKG_DEVS_MINE {
+ &#8230;
+ compile -library=libextras.a init.cxx
+}</PRE
+></TD
+></TR
+></TABLE
+><P
+>For devices inside application code the same can be achieved by
+linking the relevant module as a <TT
+CLASS="FILENAME"
+>.o</TT
+> file rather
+than putting it in a <TT
+CLASS="FILENAME"
+>.a</TT
+> library.
+ </P
+><P
+>In the device initialization routine the main operation is a call to
+<TT
+CLASS="FUNCTION"
+>synth_auxiliary_instantiate</TT
+>. This takes five
+arguments, all of which should be strings:
+ </P
+><P
+></P
+><DIV
+CLASS="VARIABLELIST"
+><DL
+><DT
+><TT
+CLASS="VARNAME"
+>package</TT
+></DT
+><DD
+><P
+>For device drivers which are eCos packages this should be a directory
+path relative to the eCos repository, for example
+<TT
+CLASS="LITERAL"
+>devs/eth/synth/ecosynth</TT
+>. This will allow the I/O
+auxiliary to find the various host-side support files for this package
+within the install tree. If the device is application-specific and not
+part of an eCos package then a NULL pointer can be used, causing the
+I/O auxiliary to search for the support files in the current directory
+and then in <TT
+CLASS="FILENAME"
+>~/.ecos/synth</TT
+>
+instead.
+ </P
+></DD
+><DT
+><TT
+CLASS="VARNAME"
+>version</TT
+></DT
+><DD
+><P
+>For eCos packages this argument should be the version of the package
+that is being used, for example <TT
+CLASS="LITERAL"
+>current</TT
+>. A simple
+way to get this version is to use the
+<TT
+CLASS="FUNCTION"
+>SYNTH_MAKESTRING</TT
+> macro on the package name.
+If the device is application-specific then a NULL pointer should be
+used.
+ </P
+></DD
+><DT
+><TT
+CLASS="VARNAME"
+>device</TT
+></DT
+><DD
+><P
+>This argument specifies the type of device being instantiated, for
+example <TT
+CLASS="LITERAL"
+>ethernet</TT
+>. More specifically the I/O
+auxiliary will append a <TT
+CLASS="FILENAME"
+>.tcl</TT
+> suffix, giving
+the name of a Tcl script that will handle all I/O requests for the
+device. If the application requires several instances of a type
+of device then the script will only be loaded once, but the script
+will contain an instantiation procedure that will be called for each
+device instance.
+ </P
+></DD
+><DT
+><TT
+CLASS="VARNAME"
+>instance</TT
+></DT
+><DD
+><P
+>If it is possible to have multiple instances of a device then this
+argument identifies the particular instance, for example
+<TT
+CLASS="LITERAL"
+>eth0</TT
+> or <TT
+CLASS="LITERAL"
+>eth1</TT
+>. Otherwise a NULL
+pointer can be used.
+ </P
+></DD
+><DT
+><TT
+CLASS="VARNAME"
+>data</TT
+></DT
+><DD
+><P
+>This argument can be used to pass additional initialization data from
+eCos to the host-side support. This is useful for devices where eCos
+configury must control certain aspects of the device, rather than
+host-side configury such as the target definition file, because eCos
+has compile-time dependencies on some or all of the relevant options.
+An example might be an emulated frame buffer where eCos has been
+statically configured for a particular screen size, orientation and
+depth. There is no fixed format for this string, it will be
+interpreted only by the device-specific host-side Tcl script. However
+the string length should be limited to a couple of hundred bytes to
+avoid possible buffer overflow problems.
+ </P
+></DD
+></DL
+></DIV
+><P
+>Typical usage would look like:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+> if (!synth_auxiliary_running) {
+ return;
+ }
+ id = synth_auxiliary_instantiate("devs/eth/synth/ecosynth",
+ SYNTH_MAKESTRING(CYGPKG_DEVS_ETH_ECOSYNTH),
+ "ethernet",
+ "eth0",
+ (const char*) 0);</PRE
+></TD
+></TR
+></TABLE
+><P
+>The return value will be a device identifier which can be used for
+subsequent calls to <TT
+CLASS="FUNCTION"
+>synth_auxiliary_xchgmsg</TT
+>. If
+the device could not be instantiated then <TT
+CLASS="LITERAL"
+>-1</TT
+> will
+be returned. It is the responsibility of the host-side software to
+issue suitable diagnostics explaining what went wrong, so normally the
+target-side code should fail silently.
+ </P
+><P
+>Once the desired device has been instantiated, often it will be
+necessary to do some additional initialization by a message exchange.
+For example an ethernet device might need information from the
+host-side about the MAC address, the <A
+HREF="synth-new-target.html#SYNTH-NEW-TARGET-INTERRUPTS"
+>interrupt vector</A
+>, and
+whether or not multicasting is supported.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-NEW-TARGET-XCHGMSG"
+></A
+><H2
+>Communicating with a Device</H2
+><P
+>Once a device has been instantiated it is possible to perform I/O by
+sending messages to the appropriate Tcl script running inside the
+auxiliary, and optionally getting back replies. I/O operations are
+always initiated by the eCos target-side, it is not possible for the
+host-side software to initiate data transfers. However the host-side
+can raise interrupts, and the interrupt handler inside the target can
+then exchange one or more messages with the host.
+ </P
+><P
+>There is a single function to perform I/O operations,
+<TT
+CLASS="FUNCTION"
+>synth_auxiliary_xchgmsg</TT
+>. This takes the following
+arguments:
+ </P
+><P
+></P
+><DIV
+CLASS="VARIABLELIST"
+><DL
+><DT
+><TT
+CLASS="VARNAME"
+>device_id</TT
+></DT
+><DD
+><P
+>This should be one of the identifiers returned by a previous
+call to <TT
+CLASS="FUNCTION"
+>synth_auxiliary_instantiate</TT
+>, specifying the
+particular device which should perform some I/O.
+ </P
+></DD
+><DT
+><TT
+CLASS="VARNAME"
+>request</TT
+></DT
+><DD
+><P
+>Request are just signed 32-bit integers that identify the particular
+I/O operation being requested. There is no fixed set of codes, instead
+each type of device can define its own.
+ </P
+></DD
+><DT
+><TT
+CLASS="VARNAME"
+>arg1</TT
+>, <TT
+CLASS="VARNAME"
+>arg2</TT
+></DT
+><DD
+><P
+>For some requests it is convenient to pass one or two additional
+parameters alongside the request code. For example an ethernet device
+could define a multicast-all request, with <TT
+CLASS="VARNAME"
+>arg1</TT
+>
+controlling whether this mode should be enabled or disabled. Both
+<TT
+CLASS="VARNAME"
+>arg1</TT
+> and <TT
+CLASS="VARNAME"
+>arg2</TT
+> should be signed
+32-bit integers, and their values are interpreted only by the
+device-specific Tcl script.
+ </P
+></DD
+><DT
+><TT
+CLASS="VARNAME"
+>txdata</TT
+>, <TT
+CLASS="VARNAME"
+>txlen</TT
+></DT
+><DD
+><P
+>Some I/O operations may involve sending additional data, for example
+an ethernet packet. Alternatively a control operation may require many
+more parameters than can easily be encoded in <TT
+CLASS="VARNAME"
+>arg1</TT
+>
+and <TT
+CLASS="VARNAME"
+>arg2</TT
+>, so those parameters have to be placed in
+a suitable buffer and extracted at the other end.
+<TT
+CLASS="VARNAME"
+>txdata</TT
+> is an arbitrary buffer of
+<TT
+CLASS="VARNAME"
+>txlen</TT
+> bytes that should be sent to the host-side.
+There is no specific upper bound on the number of bytes that can be
+sent, but usually it is a good idea to allocate the transmit buffer
+statically and keep transfers down to at most several kilobytes.
+ </P
+></DD
+><DT
+><TT
+CLASS="VARNAME"
+>reply</TT
+></DT
+><DD
+><P
+>If the host-side is expected to send a reply message then
+<TT
+CLASS="VARNAME"
+>reply</TT
+> should be a pointer to an integer variable
+and will be updated with a reply code, a simple 32-bit integer. The
+synthetic target HAL code assumes that the host-side and target-side
+agree on the protocol being used: if the host-side will not send a
+reply to this message then the <TT
+CLASS="VARNAME"
+>reply</TT
+> argument
+should be a NULL pointer; otherwise the host-side must always send
+a reply code and the <TT
+CLASS="VARNAME"
+>reply</TT
+> argument must be valid.
+ </P
+></DD
+><DT
+><TT
+CLASS="VARNAME"
+>rxdata</TT
+>, <TT
+CLASS="VARNAME"
+>rxlen</TT
+></DT
+><DD
+><P
+>Some operations may involve additional data coming from the host-side,
+for example an incoming ethernet packet. <TT
+CLASS="VARNAME"
+>rxdata</TT
+>
+should be a suitably-sized buffer, and <TT
+CLASS="VARNAME"
+>rxlen</TT
+> a
+pointer to an integer variable that will end up containing the number
+of bytes that were actually received. These arguments will only be
+used if the host-side is expected to send a reply and hence the
+<TT
+CLASS="VARNAME"
+>reply</TT
+> argument was not NULL.
+ </P
+></DD
+><DT
+><TT
+CLASS="VARNAME"
+>max_rxlen</TT
+></DT
+><DD
+><P
+>If a reply to this message is expected and that reply may involve
+additional data, <TT
+CLASS="VARNAME"
+>max_rxlen</TT
+> limits the size of that
+reply. In other words, it corresponds to the size of the
+<TT
+CLASS="VARNAME"
+>rxdata</TT
+> buffer.
+ </P
+></DD
+></DL
+></DIV
+><P
+>Most I/O operations involve only some of the arguments. For example
+transmitting an ethernet packet would use the
+<TT
+CLASS="VARNAME"
+>request</TT
+>, <TT
+CLASS="VARNAME"
+>txdata</TT
+> and
+<TT
+CLASS="VARNAME"
+>txlen</TT
+> fields (in addition to
+<TT
+CLASS="VARNAME"
+>device_id</TT
+> which is always required), but would not
+involve <TT
+CLASS="VARNAME"
+>arg1</TT
+> or <TT
+CLASS="VARNAME"
+>arg2</TT
+> and no
+reply would be expected. Receiving an ethernet packet would involve
+<TT
+CLASS="VARNAME"
+>request</TT
+>, <TT
+CLASS="VARNAME"
+>rxdata</TT
+>,
+<TT
+CLASS="VARNAME"
+>rxlen</TT
+> and <TT
+CLASS="VARNAME"
+>max_rxlen</TT
+>; in addition
+<TT
+CLASS="VARNAME"
+>reply</TT
+> is needed to get any reply from the host-side
+at all, and could be used to indicate whether or not any more packets
+are buffered up. A control operation such as enabling multicast mode
+would involve <TT
+CLASS="VARNAME"
+>request</TT
+> and <TT
+CLASS="VARNAME"
+>arg1</TT
+>,
+but none of the remaining arguments.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-NEW-TARGET-INTERRUPTS"
+></A
+><H2
+>Interrupt Handling</H2
+><P
+>Interrupt handling in the synthetic target is much the same as on a
+real target. An interrupt object is created using
+<TT
+CLASS="FUNCTION"
+>cyg_drv_interrupt_create</TT
+>, attached, and unmasked.
+The emulated device - in other words the Tcl script running inside the
+I/O auxiliary - can raise an interrupt. Subject to interrupts being
+disabled and the appropriate vector being masked, the system will
+invoke the specified ISR function. The synthetic target HAL
+implementation does have some limitations: there is no support for
+nested interrupts, interrupt priorities, or a separate interrupt
+stack. Supporting those might be appropriate when targetting a
+simulator that attempts to model real hardware accurately, but not for
+the simple emulation provided by the synthetic target.
+ </P
+><P
+>Of course the actual implementation of the ISR and DSR functions will
+be rather different for a synthetic target device driver. For real
+hardware the device driver will interact with the device by reading
+and writing device registers, managing DMA engines, and the like. A
+synthetic target driver will instead call
+<TT
+CLASS="FUNCTION"
+>synth_auxiliary_xchgmsg</TT
+> to perform the I/O
+operations.
+ </P
+><P
+>There is one other significant difference between interrupt handling
+on the synthetic target and on real hardware. Usually the eCos code
+will know which interrupt vectors are used for which devices. That
+information is fixed when the target hardware is designed. With the
+synthetic target interrupt vectors are assigned to devices on the host
+side, either via the target definition file or dynamically when the
+device is instantiated. Therefore the initialization code for a
+target-side device driver will need to request interrupt vector
+information from the host-side, via a message exchange. Such interrupt
+vectors will be in the range 1 to 31 inclusive, with interrupt 0 being
+reserved for the real-time clock.
+ </P
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><HR
+ALIGN="LEFT"
+WIDTH="100%"><TABLE
+SUMMARY="Footer navigation table"
+WIDTH="100%"
+BORDER="0"
+CELLPADDING="0"
+CELLSPACING="0"
+><TR
+><TD
+WIDTH="33%"
+ALIGN="left"
+VALIGN="top"
+><A
+HREF="synth-syscalls.html"
+ACCESSKEY="P"
+>Prev</A
+></TD
+><TD
+WIDTH="34%"
+ALIGN="center"
+VALIGN="top"
+><A
+HREF="hal-synth-arch.html"
+ACCESSKEY="H"
+>Home</A
+></TD
+><TD
+WIDTH="33%"
+ALIGN="right"
+VALIGN="top"
+><A
+HREF="synth-new-host.html"
+ACCESSKEY="N"
+>Next</A
+></TD
+></TR
+><TR
+><TD
+WIDTH="33%"
+ALIGN="left"
+VALIGN="top"
+>System Calls</TD
+><TD
+WIDTH="34%"
+ALIGN="center"
+VALIGN="top"
+>&nbsp;</TD
+><TD
+WIDTH="33%"
+ALIGN="right"
+VALIGN="top"
+>Writing New Devices - host</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
diff --git a/ecos/packages/hal/synth/arch/current/doc/synth-porting.html b/ecos/packages/hal/synth/arch/current/doc/synth-porting.html
new file mode 100644
index 0000000..cffa437
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/synth-porting.html
@@ -0,0 +1,379 @@
+<!-- Copyright (C) 2002 Free Software Foundation, Inc. -->
+<!-- This material may be distributed only subject to the terms -->
+<!-- and conditions set forth in the Open Publication License, v1.0 -->
+<!-- or later (the latest version is presently available at -->
+<!-- http://www.opencontent.org/openpub/). -->
+<!-- Distribution of the work or derivative of the work in any -->
+<!-- standard (paper) book form is prohibited unless prior -->
+<!-- permission is obtained from the copyright holder. -->
+<HTML
+><HEAD
+><TITLE
+>Porting</TITLE
+><meta name="MSSmartTagsPreventParsing" content="TRUE">
+<META
+NAME="GENERATOR"
+CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
+"><LINK
+REL="HOME"
+TITLE="eCos Synthetic Target"
+HREF="hal-synth-arch.html"><LINK
+REL="PREVIOUS"
+TITLE="Writing New Devices - host"
+HREF="synth-new-host.html"></HEAD
+><BODY
+CLASS="REFENTRY"
+BGCOLOR="#FFFFFF"
+TEXT="#000000"
+LINK="#0000FF"
+VLINK="#840084"
+ALINK="#0000FF"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
+SUMMARY="Header navigation table"
+WIDTH="100%"
+BORDER="0"
+CELLPADDING="0"
+CELLSPACING="0"
+><TR
+><TH
+COLSPAN="3"
+ALIGN="center"
+>eCos Synthetic Target</TH
+></TR
+><TR
+><TD
+WIDTH="10%"
+ALIGN="left"
+VALIGN="bottom"
+><A
+HREF="synth-new-host.html"
+ACCESSKEY="P"
+>Prev</A
+></TD
+><TD
+WIDTH="80%"
+ALIGN="center"
+VALIGN="bottom"
+></TD
+><TD
+WIDTH="10%"
+ALIGN="right"
+VALIGN="bottom"
+>&nbsp;</TD
+></TR
+></TABLE
+><HR
+ALIGN="LEFT"
+WIDTH="100%"></DIV
+><H1
+><A
+NAME="SYNTH-PORTING">Porting</H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="AEN1049"
+></A
+><H2
+>Name</H2
+>Porting&nbsp;--&nbsp;Adding support for other hosts</DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-PORTING-DESCRIPTION"
+></A
+><H2
+>Description</H2
+><P
+>The initial development effort of the eCos synthetic target happened
+on x86 Linux machines. Porting to other platforms involves addressing
+a number of different issues. Some ports should be fairly
+straightforward, for example a port to Linux on a processor other than
+an x86. Porting to Unix or Unix-like operating systems other than
+Linux may be possible, but would involve more effort. Porting to a
+completely different operating system such as Windows would be very
+difficult. The text below complements the eCos Porting Guide.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-PORTING-LINUX"
+></A
+><H2
+>Other Linux Platforms</H2
+><P
+>Porting the synthetic target to a Linux platform that uses a processor
+other than x86 should be straightforward. The simplest approach is to
+copy the existing <TT
+CLASS="FILENAME"
+>i386linux</TT
+>
+directory tree in the <TT
+CLASS="FILENAME"
+>hal/synth</TT
+>
+hierarchy, then rename and edit the ten or so files in this package.
+Most of the changes should be pretty obvious, for example on a 64-bit
+processor some new data types will be needed in the
+<TT
+CLASS="FILENAME"
+>basetype.h</TT
+> header file. It will also be necessary
+to update the toplevel <TT
+CLASS="FILENAME"
+>ecos.db</TT
+> database with an
+entry for the new HAL package, and a new target entry will be needed.
+ </P
+><P
+>Obviously a different processor will have different register sets and
+calling conventions, so the code for saving and restoring thread
+contexts and for implementing <TT
+CLASS="FUNCTION"
+>setjmp</TT
+> and
+<TT
+CLASS="FUNCTION"
+>longjmp</TT
+> will need to be updated. The exact way of
+performing Linux system calls will vary: on x86 linux this usually
+involves pushing some registers on the stack and then executing an
+<TT
+CLASS="LITERAL"
+>int&nbsp;0x080</TT
+> trap instruction, but on a different
+processor the arguments might be passed in registers instead and
+certainly a different trap instruction will be used. The startup code
+is written in assembler, but needs to do little more than extract the
+process' argument and environment variables and then jump to the main
+<TT
+CLASS="FUNCTION"
+>linux_entry</TT
+> function provided by the
+architectural synthetic target HAL package.
+ </P
+><P
+>The header file <TT
+CLASS="FILENAME"
+>hal_io.h</TT
+> provided by the
+architectural HAL package provides various structure definitions,
+function prototypes, and macros related to system calls. These are
+correct for x86 linux, but there may be problems on other processors.
+For example a structure field that is currently defined as a 32-bit
+number may in fact may be a 64-bit number instead.
+ </P
+><P
+>The synthetic target's memory map is defined in two files in the
+<TT
+CLASS="FILENAME"
+>include/pkgconf</TT
+> subdirectory.
+For x86 the default memory map involves eight megabytes of read-only
+memory for the code at location 0x1000000 and another eight megabytes
+for data at 0x2000000. These address ranges may be reserved for other
+purposes on the new architecture, so may need changing. There may be
+some additional areas of memory allocated by the system for other
+purposes, for example the startup stack and any environment variables,
+but usually eCos applications can and should ignore those.
+ </P
+><P
+>Other HAL functionality such as interrupt handling, diagnostics, and
+the system clock are provided by the architectural HAL package and
+should work on different processors with few if any changes. There may
+be some problems in the code that interacts with the I/O auxiliary
+because of lurking assumptions about endianness or the sizes of
+various data types.
+ </P
+><P
+>When porting to other processors, a number of sources of information
+are likely to prove useful. Obviously the Linux kernel sources and
+header files constitute the ultimate authority on how things work at
+the system call level. The GNU C library sources may also prove very
+useful: for a normal Linux application it is the C library that
+provides the startup code and the system call interface.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-PORTING-UNIX"
+></A
+><H2
+>Other Unix Platforms</H2
+><P
+>Porting to a Unix or Unix-like operating system other than Linux would
+be somewhat more involved. The first requirement is toolchains: the
+GNU compilers, gcc and g++, must definitely be used; use of other GNU
+tools such as the linker may be needed as well, because eCos depends
+on functionality such as prioritizing C++ static constructors, and
+other linkers may not implement this or may implement it in a
+different and incompatible way. A closely related requirement is the
+use of ELF format for binary executables: if the operating system
+still uses an older format such as COFF then there are likely to be
+problems because they do not provide the flexibility required by eCos.
+ </P
+><P
+>In the architectural HAL there should be very little code that is
+specific to Linux. Instead the code should work on any operating
+system that provides a reasonable implementation of the POSIX
+standard. There may be some problems with program startup, but those
+could be handled at the architectural level. Some changes may also be
+required to the exception handling code. However one file which will
+present a problem is <TT
+CLASS="FILENAME"
+>hal_io.h</TT
+>, which contains
+various structure definitions and macros used with the system call
+interface. It is likely that many of these definitions will need
+changing, and it may well be appropriate to implement variant HAL
+packages for the different operating systems where this information
+can be separated out. Another possible problem is that the generic
+code assumes that system calls such as
+<TT
+CLASS="FUNCTION"
+>cyg_hal_sys_write</TT
+> are available. On an operating
+system other than Linux it is possible that some of these are not
+simple system calls, and instead wrapper functions will need to be
+implemented at the variant HAL level.
+ </P
+><P
+>The generic I/O auxiliary code should be fairly portable to other Unix
+platforms. However some of the device drivers may contain code that is
+specific to Linux, for example the <TT
+CLASS="LITERAL"
+>PF_PACKET</TT
+> socket
+address family and the ethertap virtual tunnelling interface. These
+may prove quite difficult to port.
+ </P
+><P
+>The remaining porting task is to implement one or more platform HAL
+packages, one per processor type that is supported. This should
+involve much the same work as a port to <A
+HREF="synth-porting.html#SYNTH-PORTING-LINUX"
+>another processor running Linux</A
+>.
+ </P
+><P
+>When using other Unix operating systems the kernel source code may not
+be available, which would make any porting effort more challenging.
+However there is still a good chance that the GNU C library will have
+been ported already, so its source code may contain much useful
+information.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-PORTING-OTHER"
+></A
+><H2
+>Windows Platforms</H2
+><P
+>Porting the current synthetic target code to some version of Windows
+or to another non-Unix platform is likely to prove very difficult. The
+first hurdle that needs to be crossed is the file format for binary
+executables: current Windows implementations do not use ELF, instead
+they use their own format PE which is a variant of the rather old and
+limited COFF format. It may well prove easier to first write an ELF
+loader for Windows executables, rather than try to get eCos to work
+within the constraints of PE. Of course that introduces new problems,
+for example existing source-level debuggers will still expect
+executables to be in PE format.
+ </P
+><P
+>Under Linux a synthetic target application is not linked with the
+system's C library or any other standard system library. That would
+cause confusion, for example both eCos and the system's C library
+might try to define the <TT
+CLASS="FUNCTION"
+>printf</TT
+> function, and
+introduce complications such as working with shared libraries. For
+much the same reasons, a synthetic target application under Windows
+should not be linked with any Windows DLL's. If an ELF loader has been
+specially written then this may not be much of a problem.
+ </P
+><P
+>The next big problem is the system call interface. Under Windows
+system calls are generally made via DLL's, and it is not clear that
+the underlying trap mechanism is well-documented or consistent between
+different releases of Windows.
+ </P
+><P
+>The current code depends on the operating system providing an
+implementation of POSIX signal handling. This is used for I/O
+purposes, for example <TT
+CLASS="LITERAL"
+>SIGALRM</TT
+> is used for the
+system clock, and for exceptions. It is not known what equivalent
+functionality is available under Windows.
+ </P
+><P
+>Given the above problems a port of the synthetic target to Windows may
+or may not be technically feasible, but it would certainly require a
+very large amount of effort.
+ </P
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><HR
+ALIGN="LEFT"
+WIDTH="100%"><TABLE
+SUMMARY="Footer navigation table"
+WIDTH="100%"
+BORDER="0"
+CELLPADDING="0"
+CELLSPACING="0"
+><TR
+><TD
+WIDTH="33%"
+ALIGN="left"
+VALIGN="top"
+><A
+HREF="synth-new-host.html"
+ACCESSKEY="P"
+>Prev</A
+></TD
+><TD
+WIDTH="34%"
+ALIGN="center"
+VALIGN="top"
+><A
+HREF="hal-synth-arch.html"
+ACCESSKEY="H"
+>Home</A
+></TD
+><TD
+WIDTH="33%"
+ALIGN="right"
+VALIGN="top"
+>&nbsp;</TD
+></TR
+><TR
+><TD
+WIDTH="33%"
+ALIGN="left"
+VALIGN="top"
+>Writing New Devices - host</TD
+><TD
+WIDTH="34%"
+ALIGN="center"
+VALIGN="top"
+>&nbsp;</TD
+><TD
+WIDTH="33%"
+ALIGN="right"
+VALIGN="top"
+>&nbsp;</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
diff --git a/ecos/packages/hal/synth/arch/current/doc/synth-running.html b/ecos/packages/hal/synth/arch/current/doc/synth-running.html
new file mode 100644
index 0000000..a7292b1
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/synth-running.html
@@ -0,0 +1,964 @@
+<!-- Copyright (C) 2002 Free Software Foundation, Inc. -->
+<!-- This material may be distributed only subject to the terms -->
+<!-- and conditions set forth in the Open Publication License, v1.0 -->
+<!-- or later (the latest version is presently available at -->
+<!-- http://www.opencontent.org/openpub/). -->
+<!-- Distribution of the work or derivative of the work in any -->
+<!-- standard (paper) book form is prohibited unless prior -->
+<!-- permission is obtained from the copyright holder. -->
+<HTML
+><HEAD
+><TITLE
+>Running a Synthetic Target Application</TITLE
+><meta name="MSSmartTagsPreventParsing" content="TRUE">
+<META
+NAME="GENERATOR"
+CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
+"><LINK
+REL="HOME"
+TITLE="eCos Synthetic Target"
+HREF="hal-synth-arch.html"><LINK
+REL="PREVIOUS"
+TITLE="Installation"
+HREF="synth-install.html"><LINK
+REL="NEXT"
+TITLE="The I/O Auxiliary's User Interface"
+HREF="synth-gui.html"></HEAD
+><BODY
+CLASS="REFENTRY"
+BGCOLOR="#FFFFFF"
+TEXT="#000000"
+LINK="#0000FF"
+VLINK="#840084"
+ALINK="#0000FF"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
+SUMMARY="Header navigation table"
+WIDTH="100%"
+BORDER="0"
+CELLPADDING="0"
+CELLSPACING="0"
+><TR
+><TH
+COLSPAN="3"
+ALIGN="center"
+>eCos Synthetic Target</TH
+></TR
+><TR
+><TD
+WIDTH="10%"
+ALIGN="left"
+VALIGN="bottom"
+><A
+HREF="synth-install.html"
+ACCESSKEY="P"
+>Prev</A
+></TD
+><TD
+WIDTH="80%"
+ALIGN="center"
+VALIGN="bottom"
+></TD
+><TD
+WIDTH="10%"
+ALIGN="right"
+VALIGN="bottom"
+><A
+HREF="synth-gui.html"
+ACCESSKEY="N"
+>Next</A
+></TD
+></TR
+></TABLE
+><HR
+ALIGN="LEFT"
+WIDTH="100%"></DIV
+><H1
+><A
+NAME="SYNTH-RUNNING">Running a Synthetic Target Application</H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="AEN95"
+></A
+><H2
+>Name</H2
+>Execution&nbsp;--&nbsp;Arguments and configuration files</DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-RUNNING-DESCRIPTION"
+></A
+><H2
+>Description</H2
+><P
+>The procedure for configuring and building eCos and an application for
+the synthetic target is the same as for any other eCos target. Once an
+executable has been built it can be run like any Linux program, for
+example from a shell prompt,
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="SCREEN"
+>$ ecos_hello &lt;options&gt;</PRE
+></TD
+></TR
+></TABLE
+><P
+>or using gdb:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="SCREEN"
+>$ gdb --nw --quiet --args ecos_hello &lt;options&gt;
+(gdb) run
+Starting program: ecos_hello &lt;options&gt;</PRE
+></TD
+></TR
+></TABLE
+><P
+>By default use of the I/O auxiliary is disabled. If its I/O facilities
+are required then the option <TT
+CLASS="OPTION"
+>--io</TT
+> must be used.
+ </P
+><DIV
+CLASS="NOTE"
+><BLOCKQUOTE
+CLASS="NOTE"
+><P
+><B
+>Note: </B
+>In future the default behaviour may change, with the I/O auxiliary
+being started by default. The option <TT
+CLASS="OPTION"
+>--nio</TT
+> can be
+used to prevent the auxiliary from being run.
+ </P
+></BLOCKQUOTE
+></DIV
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-RUNNING-ARGUMENTS"
+></A
+><H2
+>Command-line Arguments</H2
+><P
+>The syntax for running a synthetic target application is:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="SCREEN"
+>$ &lt;ecos_app&gt; [options] [-- [app_options]]</PRE
+></TD
+></TR
+></TABLE
+><P
+>Command line options up to the <TT
+CLASS="OPTION"
+>--</TT
+> are passed on to
+the I/O auxiliary. Subsequent arguments are not passed on to the
+auxiliary, and hence can be used by the eCos application itself. The
+full set of arguments can be accessed through the variables
+<TT
+CLASS="VARNAME"
+>cyg_hal_sys_argc</TT
+> and
+<TT
+CLASS="VARNAME"
+>cyg_hal_sys_argv</TT
+>.
+ </P
+><P
+>The following options are accepted as standard:
+ </P
+><P
+></P
+><DIV
+CLASS="VARIABLELIST"
+><DL
+><DT
+><TT
+CLASS="OPTION"
+>--io</TT
+></DT
+><DD
+><P
+>This option causes the eCos application to spawn the I/O auxiliary
+during HAL initialization. Without this option only limited I/O will
+be available.
+ </P
+></DD
+><DT
+><TT
+CLASS="OPTION"
+>--nio</TT
+></DT
+><DD
+><P
+>This option prevents the eCos application from spawning the I/O
+auxiliary. In the current version of the software this is the default.
+ </P
+></DD
+><DT
+><TT
+CLASS="OPTION"
+>-nw</TT
+>, <TT
+CLASS="OPTION"
+>--no-windows</TT
+></DT
+><DD
+><P
+>The I/O auxiliary can either provide a graphical user interface, or it
+can run in a text-only mode. The default is to provide the graphical
+interface, but this can be disabled with <TT
+CLASS="OPTION"
+>-nw</TT
+>.
+Emulation of some devices, for example buttons connected to digital
+inputs, requires the graphical interface.
+ </P
+></DD
+><DT
+><TT
+CLASS="OPTION"
+>-w</TT
+>, <TT
+CLASS="OPTION"
+>--windows</TT
+></DT
+><DD
+><P
+>The <TT
+CLASS="OPTION"
+>-w</TT
+> causes the I/O auxiliary to provide a
+graphical user interface. This is the default.
+ </P
+></DD
+><DT
+><TT
+CLASS="OPTION"
+>-v</TT
+>, <TT
+CLASS="OPTION"
+>--version</TT
+></DT
+><DD
+><P
+>The <TT
+CLASS="OPTION"
+>-v</TT
+> option can be used to determine the version of
+the I/O auxiliary being used and where it has been installed. Both the
+auxiliary and the eCos application will exit immediately.
+ </P
+></DD
+><DT
+><TT
+CLASS="OPTION"
+>-h</TT
+>, <TT
+CLASS="OPTION"
+>--help</TT
+></DT
+><DD
+><P
+><TT
+CLASS="OPTION"
+>-h</TT
+> causes the I/O auxiliary to list all accepted
+command-line arguments. This happens after all devices have been
+initialized, since the host-side support for some of the devices may
+extend the list of recognised options. After this both the auxiliary
+and the eCos application will exit immediately. This option implies
+<TT
+CLASS="OPTION"
+>-nw</TT
+>.
+ </P
+></DD
+><DT
+><TT
+CLASS="OPTION"
+>-k</TT
+>, <TT
+CLASS="OPTION"
+>--keep-going</TT
+></DT
+><DD
+><P
+>If an error occurs in the I/O auxiliary while reading in any of the
+configuration files or initializing devices, by default both the
+auxiliary and the eCos application will exit. The <TT
+CLASS="OPTION"
+>-k</TT
+>
+option can be used to make the auxiliary continue in spite of errors,
+although obviously it may not be fully functional.
+ </P
+></DD
+><DT
+><TT
+CLASS="OPTION"
+>-nr</TT
+>, <TT
+CLASS="OPTION"
+>--no-rc</TT
+></DT
+><DD
+><P
+>Normally the auxiliary processes two <A
+HREF="synth-running.html#SYNTH-RUNNING-USER-CONFIG"
+>user configuration files</A
+>
+during startup: <TT
+CLASS="FILENAME"
+>initrc.tcl</TT
+> and
+<TT
+CLASS="FILENAME"
+>mainrc.tcl</TT
+>. This can be suppressed using the
+<TT
+CLASS="OPTION"
+>-nr</TT
+> option.
+ </P
+></DD
+><DT
+><TT
+CLASS="OPTION"
+>-x</TT
+>, <TT
+CLASS="OPTION"
+>--exit</TT
+></DT
+><DD
+><P
+>When providing a graphical user interface the I/O auxiliary will
+normally continue running even after the eCos application has exited.
+This allows the user to take actions such as saving the current
+contents of the main text window. If run with <TT
+CLASS="OPTION"
+>-x</TT
+> then
+the auxiliary will exit as soon the application exits.
+ </P
+></DD
+><DT
+><TT
+CLASS="OPTION"
+>-nx</TT
+>, <TT
+CLASS="OPTION"
+>--no-exit</TT
+></DT
+><DD
+><P
+>When the graphical user interface is disabled with
+<TT
+CLASS="OPTION"
+>-nw</TT
+> the I/O auxiliary will normally exit immediately
+when the eCos application exits. Without the graphical frontend there
+is usually no way for the user to interact directly with the
+auxiliary, so there is no point in continuing to run once the eCos
+application will no longer request any I/O operations. Specifying the
+<TT
+CLASS="OPTION"
+>-nx</TT
+> option causes the auxiliary to continue running
+even after the application has exited.
+ </P
+></DD
+><DT
+><TT
+CLASS="OPTION"
+>-V</TT
+>, <TT
+CLASS="OPTION"
+>--verbose</TT
+></DT
+><DD
+><P
+>This option causes the I/O auxiliary to output some additional
+information, especially during initialization.
+ </P
+></DD
+><DT
+><TT
+CLASS="OPTION"
+>-l &lt;file&gt;</TT
+>, <TT
+CLASS="OPTION"
+>--logfile &lt;file&gt;</TT
+></DT
+><DD
+><P
+>Much of the output of the eCos application and the I/O auxiliary is
+simple text, for example resulting from eCos
+<TT
+CLASS="FUNCTION"
+>printf</TT
+> or <TT
+CLASS="FUNCTION"
+>diag_printf</TT
+> calls.
+When running in graphical mode this output goes to a central text
+window, and can be saved to a file or edited via menus. The
+<TT
+CLASS="OPTION"
+>-l</TT
+> can be used to automatically generate an
+additional logfile containing all the text. If graphical
+mode is disabled then by default all the text just goes to the current
+standard output. Specifying <TT
+CLASS="OPTION"
+>-l</TT
+> causes most of the
+text to go into a logfile instead, although some messages such as
+errors generated by the auxiliary itself will still go to stdout as
+well.
+ </P
+></DD
+><DT
+><TT
+CLASS="OPTION"
+>-t &lt;file&gt;</TT
+>, <TT
+CLASS="OPTION"
+>--target &lt;file&gt;</TT
+></DT
+><DD
+><P
+>During initialization the I/O auxiliary reads in a target definition
+file. This file holds information such as which Linux devices should
+be used to emulate the various eCos devices. The <TT
+CLASS="OPTION"
+>-t</TT
+>
+option can be used to specify which target definition should be used
+for the current run, defaulting to <TT
+CLASS="FILENAME"
+>default.tdf</TT
+>.
+It is not necessary to include the <TT
+CLASS="FILENAME"
+>.tdf</TT
+> suffix,
+this will be appended automatically if necessary.
+ </P
+></DD
+><DT
+><TT
+CLASS="OPTION"
+>-geometry &lt;geometry&gt;</TT
+></DT
+><DD
+><P
+>This option can be used to control the size and position of the main
+window, as per X conventions.
+ </P
+></DD
+></DL
+></DIV
+><P
+>The I/O auxiliary loads support for the various devices dynamically
+and some devices may accept additional command line arguments. Details
+of these can be obtained using the <TT
+CLASS="OPTION"
+>-h</TT
+> option or by
+consulting the device-specific documentation. If an unrecognised
+command line argument is used then a warning will be issued.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-RUNNING-TDF"
+></A
+><H2
+>The Target Definition File</H2
+><P
+>The eCos application will want to access devices such as
+<TT
+CLASS="VARNAME"
+>eth0</TT
+> or <TT
+CLASS="VARNAME"
+>/dev/ser0</TT
+>. These need to
+be mapped on to Linux devices. For example some users may all traffic
+on the eCos <TT
+CLASS="VARNAME"
+>/dev/ser0</TT
+> serial device to go via the
+Linux serial device <TT
+CLASS="VARNAME"
+>/dev/ttyS1</TT
+>, while ethernet I/O
+for the eCos <TT
+CLASS="VARNAME"
+>eth0</TT
+> device should be mapped to the
+Linux ethertap device <TT
+CLASS="VARNAME"
+>tap3</TT
+>. Some devices may need
+additional configuration information, for example to limit the
+number of packets that should be buffered within the I/O auxiliary.
+The target definition file provides all this information.
+ </P
+><P
+>By default the I/O auxiliary will look for a file
+<TT
+CLASS="FILENAME"
+>default.tdf</TT
+>. An alternative target definition can
+be specified on the command line using <TT
+CLASS="OPTION"
+>-t</TT
+>, for
+example:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="SCREEN"
+>$ bridge_app --io -t twineth</PRE
+></TD
+></TR
+></TABLE
+><P
+>A <TT
+CLASS="FILENAME"
+>.tdf</TT
+> suffix will be appended automatically if
+necessary. If a relative pathname is used then the I/O auxiliary will
+search for the target definition file in the current directory, then
+in <TT
+CLASS="FILENAME"
+>~/.ecos/synth/</TT
+>, and finally
+in its install location.
+ </P
+><P
+>A typical target definition file might look like this:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>synth_device console {
+ # appearance -foreground white -background black
+ filter trace {^TRACE:.*} -foreground HotPink1 -hide 1
+}
+
+synth_device ethernet {
+ eth0 real eth1
+ eth1 ethertap tap4 00:01:02:03:FE:06
+
+ ## Maximum number of packets that should be buffered per interface.
+ ## Default 16
+ #max_buffer 32
+
+ ## Filters for the various recognised protocols.
+ ## By default all filters are visible and use standard colours.
+ filter ether -hide 0
+ #filter arp -hide 1
+ #filter ipv4 -hide 1
+ #filter ipv6 -hide 1
+}</PRE
+></TD
+></TR
+></TABLE
+><P
+>A target definition file is actually a Tcl script that gets run in the
+main interpreter of the I/O auxiliary during initialization. This
+provides a lot of flexibility if necessary. For example the script
+could open a socket to a resource management server of some sort to
+determine which hardware facilities are already in use and adapt
+accordingly. Another possibility is to adapt based on <A
+HREF="synth-new-host.html#SYNTH-NEW-HOST-ARGS"
+>command line arguments</A
+>. Users who
+are not familiar with Tcl programming should still be able to edit a
+simple target definition file without too much difficulty, using a
+mixture of cut'n'paste, commenting or uncommenting various lines, and
+making small edits such as changing <TT
+CLASS="LITERAL"
+>tap4</TT
+> to
+<TT
+CLASS="LITERAL"
+>eth2</TT
+>.
+ </P
+><P
+>Each type of device will have its own entry in the target definition
+file, taking the form:
+ </P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>synth_device &lt;device type&gt; {
+ &lt;options&gt;
+}</PRE
+></TD
+></TR
+></TABLE
+><P
+>The documentaton for each synthetic target device should provide
+details of the options available for that device, and often a suitable
+fragment that can be pasted into a target definition file and edited.
+There is no specific set of options that a given device will always
+provide. However in practice many devices will use common code
+exported by the main I/O auxiliary, or their implementation will
+involve some re-use of code for an existing device. Hence certain
+types of option are common to many devices.
+ </P
+><P
+>A good example of this is filters, which control the appearance of
+text output. The above target definition file defines a filter
+<TT
+CLASS="VARNAME"
+>trace</TT
+> for output from the eCos application. The
+regular expression will match output from the infrastructure package's
+tracing facilities when <TT
+CLASS="VARNAME"
+>CYGDBG_USE_TRACING</TT
+> and
+<TT
+CLASS="VARNAME"
+>CYGDBG_INFRA_DEBUG_TRACE_ASSERT_SIMPLE</TT
+> are enabled.
+With the current settings this output will not be visible by default,
+but can be made visible using the menu item <SPAN
+CLASS="GUIMENUITEM"
+>System
+Filters</SPAN
+>. If made visible the trace output will appear in
+an unusual colour, so users can easily distinguish the trace output
+from other text. All filters accept the following options:
+ </P
+><P
+></P
+><DIV
+CLASS="VARIABLELIST"
+><DL
+><DT
+><TT
+CLASS="OPTION"
+>-hide [0|1]</TT
+></DT
+><DD
+><P
+>This controls whether or not text matching this filter should be
+invisible by default or not. At run-time the visibility of each filter
+can be controlled using the <SPAN
+CLASS="GUIMENUITEM"
+>System Filters</SPAN
+>
+menu item.
+ </P
+></DD
+><DT
+><TT
+CLASS="OPTION"
+>-foreground &lt;colour&gt;</TT
+></DT
+><DD
+><P
+>This specifies the foreground colour for all text matching this
+filter. The colour can be specified using an RGB value such as
+<TT
+CLASS="LITERAL"
+>#F08010</TT
+>, or a symbolic name such as
+<TT
+CLASS="LITERAL"
+>"light steel blue"</TT
+>. The X11 utility
+<SPAN
+CLASS="APPLICATION"
+>showrgb</SPAN
+> can be used to find out
+about the available colours.
+ </P
+></DD
+><DT
+><TT
+CLASS="OPTION"
+>-background &lt;colour&gt;</TT
+></DT
+><DD
+><P
+>This specifies the background colour for all text matching the filter.
+As with <TT
+CLASS="OPTION"
+>-foreground</TT
+> the colour can be specified using
+a symbolic name or an RGB value.
+ </P
+></DD
+></DL
+></DIV
+><P
+>Some devices may create their own subwindows, for example to monitor
+ethernet traffic or to provide additional I/O facilities such as
+emulated LED's or buttons. Usually the target definition file can be
+used to control the <A
+HREF="synth-gui.html#SYNTH-GUI-LAYOUT"
+>layout</A
+> of
+these windows.
+ </P
+><P
+>The I/O auxiliary will not normally warn about
+<B
+CLASS="COMMAND"
+>synth_device</B
+> entries in the target definition file
+for devices that are not actually needed by the current eCos
+application. This makes it easier to use a single file for several
+different applications. However it can lead to confusion if an entry
+is spelled incorrectly and hence does not actually get used. The
+<TT
+CLASS="OPTION"
+>-V</TT
+> command line option can be used to get warnings
+about unused device entries in the target definition file.
+ </P
+><P
+>If the body of a <B
+CLASS="COMMAND"
+>synth_device</B
+> command contains an
+unrecognised option and the relevant device is in use, the I/O
+auxiliary will always issue a warning about such options.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-RUNNING-USER-CONFIG"
+></A
+><H2
+>User Configuration Files</H2
+><P
+>During initialization the I/O auxiliary will execute two user
+configuration files, <TT
+CLASS="FILENAME"
+>initrc.tcl</TT
+> and
+<TT
+CLASS="FILENAME"
+>mainrc.tcl</TT
+>. It will look for these files in the
+directory <TT
+CLASS="FILENAME"
+>~/.ecos/synth/</TT
+>. If
+that directory does not yet exist it will be created and populated
+with initial dummy files.
+ </P
+><P
+>Both of these configuration files are Tcl scripts and will be run in
+the main interpreter used by the I/O auxiliary itself. This means that
+they have full access to the internals of the auxiliary including the
+various Tk widgets, and they can perform file or socket I/O if
+desired. The section <A
+HREF="synth-new-host.html"
+>Writing New Devices - host</A
+> contains
+information about the facilities available on the host-side for
+writing new device drivers, and these can also be used in the
+initialization scripts.
+ </P
+><P
+>The <TT
+CLASS="FILENAME"
+>initrc.tcl</TT
+> script is run before the auxiliary
+has processed any requests from the eCos application, and hence before
+any devices have been instantiated. At this point the generic
+command-line arguments has been processed, the target definition file
+has been read in, and the hooks functionality has been initialized. If
+running in graphical mode the main window will have been created, but
+has been withdrawn from the screen to allow new widgets to be added
+without annoying screen flicker. A typical
+<TT
+CLASS="FILENAME"
+>initrc.tcl</TT
+> script could add some menu or toolbar
+options, or install a hook function that will be run when the
+eCos application exits.
+ </P
+><P
+>The <TT
+CLASS="FILENAME"
+>mainrc.tcl</TT
+> script is run after eCos has
+performed all its device initialization and after C++ static
+constructors have run, and just before the call to
+<TT
+CLASS="FUNCTION"
+>cyg_start</TT
+> which will end up transferring control
+to the application itself. A typical <TT
+CLASS="FILENAME"
+>mainrc.tcl</TT
+>
+script could look at what interrupt vectors have been allocated to
+which devices and create a little monitor window that shows interrupt
+activity.
+ </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-RUNNING-SESSION"
+></A
+><H2
+>Session Information</H2
+><P
+>When running in graphical mode, the I/O auxiliary will read in a file
+<TT
+CLASS="FILENAME"
+>~/.ecos/synth/guisession</TT
+> containing session
+information. This file should not normally be edited manually, instead
+it gets updated automatically when the auxiliary exits. The purpose of
+this file is to hold configuration options that are manipulated via
+the graphical interface, for example which browser should be used to
+display online help.
+ </P
+><DIV
+CLASS="WARNING"
+><P
+></P
+><TABLE
+CLASS="WARNING"
+BORDER="1"
+WIDTH="100%"
+><TR
+><TD
+ALIGN="CENTER"
+><B
+>Warning</B
+></TD
+></TR
+><TR
+><TD
+ALIGN="LEFT"
+><P
+>GUI session functionality is not yet available in the current release.
+When that functionality is fully implemented it is possible that some
+target definition file options may be removed, to be replaced by
+graphical editing via a suitable preferences dialog, with the
+current settings saved in the session file.
+ </P
+></TD
+></TR
+></TABLE
+></DIV
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><HR
+ALIGN="LEFT"
+WIDTH="100%"><TABLE
+SUMMARY="Footer navigation table"
+WIDTH="100%"
+BORDER="0"
+CELLPADDING="0"
+CELLSPACING="0"
+><TR
+><TD
+WIDTH="33%"
+ALIGN="left"
+VALIGN="top"
+><A
+HREF="synth-install.html"
+ACCESSKEY="P"
+>Prev</A
+></TD
+><TD
+WIDTH="34%"
+ALIGN="center"
+VALIGN="top"
+><A
+HREF="hal-synth-arch.html"
+ACCESSKEY="H"
+>Home</A
+></TD
+><TD
+WIDTH="33%"
+ALIGN="right"
+VALIGN="top"
+><A
+HREF="synth-gui.html"
+ACCESSKEY="N"
+>Next</A
+></TD
+></TR
+><TR
+><TD
+WIDTH="33%"
+ALIGN="left"
+VALIGN="top"
+>Installation</TD
+><TD
+WIDTH="34%"
+ALIGN="center"
+VALIGN="top"
+>&nbsp;</TD
+><TD
+WIDTH="33%"
+ALIGN="right"
+VALIGN="top"
+>The I/O Auxiliary's User Interface</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
diff --git a/ecos/packages/hal/synth/arch/current/doc/synth-syscalls.html b/ecos/packages/hal/synth/arch/current/doc/synth-syscalls.html
new file mode 100644
index 0000000..e4e45f4
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/synth-syscalls.html
@@ -0,0 +1,333 @@
+<!-- Copyright (C) 2002 Free Software Foundation, Inc. -->
+<!-- This material may be distributed only subject to the terms -->
+<!-- and conditions set forth in the Open Publication License, v1.0 -->
+<!-- or later (the latest version is presently available at -->
+<!-- http://www.opencontent.org/openpub/). -->
+<!-- Distribution of the work or derivative of the work in any -->
+<!-- standard (paper) book form is prohibited unless prior -->
+<!-- permission is obtained from the copyright holder. -->
+<HTML
+><HEAD
+><TITLE
+>System Calls</TITLE
+><meta name="MSSmartTagsPreventParsing" content="TRUE">
+<META
+NAME="GENERATOR"
+CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
+"><LINK
+REL="HOME"
+TITLE="eCos Synthetic Target"
+HREF="hal-synth-arch.html"><LINK
+REL="PREVIOUS"
+TITLE="The Console Device"
+HREF="synth-console.html"><LINK
+REL="NEXT"
+TITLE="Writing New Devices - target"
+HREF="synth-new-target.html"></HEAD
+><BODY
+CLASS="REFENTRY"
+BGCOLOR="#FFFFFF"
+TEXT="#000000"
+LINK="#0000FF"
+VLINK="#840084"
+ALINK="#0000FF"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
+SUMMARY="Header navigation table"
+WIDTH="100%"
+BORDER="0"
+CELLPADDING="0"
+CELLSPACING="0"
+><TR
+><TH
+COLSPAN="3"
+ALIGN="center"
+>eCos Synthetic Target</TH
+></TR
+><TR
+><TD
+WIDTH="10%"
+ALIGN="left"
+VALIGN="bottom"
+><A
+HREF="synth-console.html"
+ACCESSKEY="P"
+>Prev</A
+></TD
+><TD
+WIDTH="80%"
+ALIGN="center"
+VALIGN="bottom"
+></TD
+><TD
+WIDTH="10%"
+ALIGN="right"
+VALIGN="bottom"
+><A
+HREF="synth-new-target.html"
+ACCESSKEY="N"
+>Next</A
+></TD
+></TR
+></TABLE
+><HR
+ALIGN="LEFT"
+WIDTH="100%"></DIV
+><H1
+><A
+NAME="SYNTH-SYSCALLS">System Calls</H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="AEN483"
+></A
+><H2
+>Name</H2
+>cyg_hal_sys_xyz&nbsp;--&nbsp;Access Linux system facilities</DIV
+><DIV
+CLASS="REFSYNOPSISDIV"
+><A
+NAME="AEN486"><H2
+>Synopsis</H2
+><DIV
+CLASS="FUNCSYNOPSIS"
+><A
+NAME="AEN487"><P
+></P
+><TABLE
+BORDER="5"
+BGCOLOR="#E0E0F0"
+WIDTH="70%"
+><TR
+><TD
+><PRE
+CLASS="FUNCSYNOPSISINFO"
+>#include &lt;cyg/hal/hal_io.h
+ </PRE
+></TD
+></TR
+></TABLE
+><P
+><CODE
+><CODE
+CLASS="FUNCDEF"
+>int cyg_hal_sys_xyzzy</CODE
+>(...);</CODE
+></P
+><P
+></P
+></DIV
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-SYSCALLS-DESCRIPTION"
+></A
+><H2
+>Description</H2
+><P
+>On a real embedded target eCos interacts with the hardware by peeking
+and poking various registers, manipulating special regions of memory,
+and so on. The synthetic target does not access hardware directly.
+Instead I/O and other operations are emulated by making appropriate
+Linux system calls. The HAL package exports a number of functions
+which allow other packages, or even application code, to make these
+same system calls. However this facility must be used with care: any
+code which calls, for example, <TT
+CLASS="FUNCTION"
+>cyg_hal_sys_write</TT
+>
+will only ever run on the synthetic target; that functionality is
+obviously not provided on any real hardware because there is no
+underlying Linux kernel to implement it.
+ </P
+><P
+>The synthetic target only provides a subset of the available system
+calls, specifically those calls which have proved useful to implement
+I/O emulation. This subset can be extended fairly easily if necessary.
+All of the available calls, plus associated data structures and
+macros, are defined in the header file <TT
+CLASS="FILENAME"
+>cyg/hal/hal_io.h</TT
+>. There is a simple
+convention: given a Linux system call such as
+<TT
+CLASS="FUNCTION"
+>open</TT
+>, the synthetic target will prefix
+<TT
+CLASS="LITERAL"
+>cyg_hal_sys</TT
+> and provide a function with that name.
+The second argument to the <TT
+CLASS="FUNCTION"
+>open</TT
+> system call is
+a set of flags such as <TT
+CLASS="CONSTANT"
+>O_RDONLY</TT
+>, and the header
+file will define a matching constant
+<TT
+CLASS="CONSTANT"
+>CYG_HAL_SYS_O_RDONLY</TT
+>. There are also data
+structures such as <SPAN
+CLASS="STRUCTNAME"
+>cyg_hal_sys_sigset_t</SPAN
+>,
+matching the Linux data structure <SPAN
+CLASS="STRUCTNAME"
+>sigset_t</SPAN
+>.
+ </P
+><P
+>In most cases the functions provided by the synthetic target behave as
+per the documentation for the Linux system calls, and section 2 of the
+Linux man pages can be consulted for more information. There is one
+important difference: typically the documentation will say that a
+function returns <TT
+CLASS="LITERAL"
+>-1</TT
+> to indicate an error, with the
+actual error code held in <TT
+CLASS="VARNAME"
+>errno</TT
+>; the actual
+underlying system call and hence the
+<TT
+CLASS="FUNCTION"
+>cyg_hal_sys_xyz</TT
+> provided by eCos instead returns
+a negative number to indicate an error, with the absolute value of
+that number corresponding to the error code; usually it is the C
+library which handles this and manipulates errno, but of course
+synthetic target applications are not linked with that Linux library.
+ </P
+><P
+>However, there are some exceptions. The Linux kernel has evolved over
+the years, and some of the original system call interfaces are no
+longer appropriate. For example the original
+<TT
+CLASS="FUNCTION"
+>select</TT
+> system call has been superseded by
+<TT
+CLASS="FUNCTION"
+>_newselect</TT
+>, and that is what the
+<TT
+CLASS="FUNCTION"
+>select</TT
+> function in the C library actually uses.
+The old call is still available to preserve binary compatibility but,
+like the C library, eCos makes use of the new one because it provides
+the appropriate functionality. In an attempt to reduce confusion the
+eCos function is called <TT
+CLASS="FUNCTION"
+>cyg_hal_sys__newselect</TT
+>,
+in other words it matches the official system call naming scheme. The
+authoritive source of information on such matters is the Linux kernel
+sources themselves, and especially its header files.
+ </P
+><P
+>eCos packages and applications should never
+<TT
+CLASS="LITERAL"
+>#include</TT
+> Linux header files directly. For example,
+doing a <TT
+CLASS="LITERAL"
+>#include&nbsp;&lt;/usr/include/fcntl.h&gt;</TT
+>
+to access additional macros or structure definitions, or alternatively
+manipulating the header file search path, will lead to problems
+because the Linux header files are likely to duplicate and clash with
+definitions in the eCos headers. Instead the appropriate functionality
+should be extracted from the Linux headers and moved into either
+<TT
+CLASS="FILENAME"
+>cyg/hal/hal_io.h</TT
+> or into
+application code, with suitable renaming to avoid clashes with eCos
+names. Users should be aware that large-scale copying may involve
+licensing complications.
+ </P
+><P
+>Adding more system calls is usually straightforward and involves
+adding one or more lines to the platform-specific file in the
+appropriate platform HAL, for example
+<TT
+CLASS="FILENAME"
+>syscall-i386-linux-1.0.S</TT
+>. However it is necessary
+to do some research first about the exact interface implemented by the
+system call, because of issues such as old system calls that have been
+superseded. The required information can usually be found fairly
+easily by searching through the Linux kernel sources and possibly the
+GNU C library sources.
+ </P
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><HR
+ALIGN="LEFT"
+WIDTH="100%"><TABLE
+SUMMARY="Footer navigation table"
+WIDTH="100%"
+BORDER="0"
+CELLPADDING="0"
+CELLSPACING="0"
+><TR
+><TD
+WIDTH="33%"
+ALIGN="left"
+VALIGN="top"
+><A
+HREF="synth-console.html"
+ACCESSKEY="P"
+>Prev</A
+></TD
+><TD
+WIDTH="34%"
+ALIGN="center"
+VALIGN="top"
+><A
+HREF="hal-synth-arch.html"
+ACCESSKEY="H"
+>Home</A
+></TD
+><TD
+WIDTH="33%"
+ALIGN="right"
+VALIGN="top"
+><A
+HREF="synth-new-target.html"
+ACCESSKEY="N"
+>Next</A
+></TD
+></TR
+><TR
+><TD
+WIDTH="33%"
+ALIGN="left"
+VALIGN="top"
+>The Console Device</TD
+><TD
+WIDTH="34%"
+ALIGN="center"
+VALIGN="top"
+>&nbsp;</TD
+><TD
+WIDTH="33%"
+ALIGN="right"
+VALIGN="top"
+>Writing New Devices - target</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
diff --git a/ecos/packages/hal/synth/arch/current/doc/synth.html b/ecos/packages/hal/synth/arch/current/doc/synth.html
new file mode 100644
index 0000000..39628fa
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/synth.html
@@ -0,0 +1,372 @@
+<!-- Copyright (C) 2002 Free Software Foundation, Inc. -->
+<!-- This material may be distributed only subject to the terms -->
+<!-- and conditions set forth in the Open Publication License, v1.0 -->
+<!-- or later (the latest version is presently available at -->
+<!-- http://www.opencontent.org/openpub/). -->
+<!-- Distribution of the work or derivative of the work in any -->
+<!-- standard (paper) book form is prohibited unless prior -->
+<!-- permission is obtained from the copyright holder. -->
+<HTML
+><HEAD
+><TITLE
+>Overview</TITLE
+><meta name="MSSmartTagsPreventParsing" content="TRUE">
+<META
+NAME="GENERATOR"
+CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
+"><LINK
+REL="HOME"
+TITLE="eCos Synthetic Target"
+HREF="hal-synth-arch.html"><LINK
+REL="PREVIOUS"
+TITLE="eCos Synthetic Target"
+HREF="hal-synth-arch.html"><LINK
+REL="NEXT"
+TITLE="Installation"
+HREF="synth-install.html"></HEAD
+><BODY
+CLASS="REFENTRY"
+BGCOLOR="#FFFFFF"
+TEXT="#000000"
+LINK="#0000FF"
+VLINK="#840084"
+ALINK="#0000FF"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
+SUMMARY="Header navigation table"
+WIDTH="100%"
+BORDER="0"
+CELLPADDING="0"
+CELLSPACING="0"
+><TR
+><TH
+COLSPAN="3"
+ALIGN="center"
+>eCos Synthetic Target</TH
+></TR
+><TR
+><TD
+WIDTH="10%"
+ALIGN="left"
+VALIGN="bottom"
+><A
+HREF="hal-synth-arch.html"
+ACCESSKEY="P"
+>Prev</A
+></TD
+><TD
+WIDTH="80%"
+ALIGN="center"
+VALIGN="bottom"
+></TD
+><TD
+WIDTH="10%"
+ALIGN="right"
+VALIGN="bottom"
+><A
+HREF="synth-install.html"
+ACCESSKEY="N"
+>Next</A
+></TD
+></TR
+></TABLE
+><HR
+ALIGN="LEFT"
+WIDTH="100%"></DIV
+><H1
+><A
+NAME="SYNTH">Overview</H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="AEN6"
+></A
+><H2
+>Name</H2
+>The eCos synthetic target&nbsp;--&nbsp;Overview</DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="SYNTH-DESCRIPTION"
+></A
+><H2
+>Description</H2
+><P
+>Usually eCos runs on either a custom piece of hardware, specially
+designed to meet the needs of a specific application, or on a
+development board of some sort that is available before the final
+hardware. Such boards have a number of things in common:
+ </P
+><P
+></P
+><OL
+TYPE="1"
+><LI
+><P
+>Obviously there has to be at least one processor to do the work. Often
+this will be a 32-bit processor, but it can be smaller or larger.
+Processor speed will vary widely, depending on the expected needs of
+the application. However the exact processor being used tends not to
+matter very much for most of the development process: the use of
+languages such as C or C++ means that the compiler will handle those
+details.
+ </P
+></LI
+><LI
+><P
+>There needs to be memory for code and for data. A typical system will
+have two different types of memory. There will be some non-volatile
+memory such as flash, EPROM or masked ROM. There will also be some
+volatile memory such as DRAM or SRAM. Often the code for the final
+application will reside in the non-volatile memory and all of the RAM
+will be available for data. However updating non-volatile memory
+requires a non-trivial amount of effort, so for much of the
+development process it is more convenient to burn suitable firmware,
+for example RedBoot, into the non-volatile memory and then use that to
+load the application being debugged into RAM, alongside the
+application data and a small area reserved for use by the firmware.
+ </P
+></LI
+><LI
+><P
+>The platform must provide certain mimimal I/O facilities. Most eCos
+configurations require a clock signal of some sort. There must also be
+some way of outputting diagnostics to the user, often but not always
+via a serial port. Unless special debug hardware is being used, source
+level debugging will require bidirectional communication between a
+host machine and the target hardware, usually via a serial port or an
+ethernet device.
+ </P
+></LI
+><LI
+><P
+>All the above is not actually very useful yet because there is no way
+for the embedded device to interact with the rest of the world, except
+by generating diagnostics. Therefore an embedded device will have
+additional I/O hardware. This may be fairly standard hardware such as
+an ethernet or USB interface, or special hardware designed
+specifically for the intended application, or quite often some
+combination. Standard hardware such as ethernet or USB may be
+supported by eCos device drivers and protocol stacks, whereas the
+special hardware will be driven directly by application code.
+ </P
+></LI
+></OL
+><P
+>Much of the above can be emulated on a typical PC running Linux.
+Instead of running the embedded application being developed on a
+target board of some sort, it can be run as a Linux process. The
+processor will be the PC's own processor, for example an x86, and the
+memory will be the process' address space. Some I/O facilities can be
+emulated directly through system calls. For example clock hardware can
+be emulated by setting up a <TT
+CLASS="LITERAL"
+>SIGALRM</TT
+> signal, which
+will cause the process to be interrupted at regular intervals. This
+emulation of real hardware will not be particularly accurate, the
+number of cpu cycles available to the eCos application between clock
+ticks will vary widely depending on what else is running on the PC,
+but for much development work it will be good enough.
+ </P
+><P
+>Other I/O facilities are provided through an I/O auxiliary process,
+ecosynth, that gets spawned by the eCos application during startup.
+When an eCos device driver wants to perform some I/O operation, for
+example send out an ethernet packet, it sends a request to the I/O
+auxiliary. That is an ordinary Linux application so it has ready
+access to all normal Linux I/O facilities. To emulate a device
+interrupt the I/O auxiliary can raise a <TT
+CLASS="LITERAL"
+>SIGIO</TT
+>
+signal within the eCos application. The HAL's interrupt subsystem
+installs a signal handler for this, which will then invoke the
+standard eCos ISR/DSR mechanisms. The I/O auxiliary is based around
+Tcl scripting, making it easy to extend and customize. It should be
+possible to configure the synthetic target so that its I/O
+functionality is similar to what will be available on the final target
+hardware for the application being developed.
+ </P
+><DIV
+CLASS="INFORMALFIGURE"
+><A
+NAME="AEN25"><P
+></P
+><DIV
+CLASS="MEDIAOBJECT"
+><P
+><IMG
+SRC="overview.gif"
+ALIGN="CENTER"></P
+></DIV
+><P
+></P
+></DIV
+><P
+>A key requirement for synthetic target code is that the embedded
+application must not be linked with any of the standard Linux
+libraries such as the GNU C library: that would lead to a confusing
+situation where both eCos and the Linux libraries attempted to provide
+functions such as <TT
+CLASS="FUNCTION"
+>printf</TT
+>. Instead the synthetic
+target support must be implemented directly on top of the Linux
+kernels' system call interface. For example, the kernel provides a
+system call for write operations. The actual function
+<TT
+CLASS="FUNCTION"
+>write</TT
+> is implemented in the system's C library,
+but all it does is move its arguments on to the stack or into certain
+registers and then execute a special trap instruction such as
+<TT
+CLASS="LITERAL"
+>int&nbsp;0x80</TT
+>. When this instruction is executed
+control transfers into the kernel, which will validate the arguments
+and perform the appropriate operation. Now, a synthetic target
+application cannot be linked with the system's C library. Instead it
+contains a function <TT
+CLASS="FUNCTION"
+>cyg_hal_sys_write</TT
+> which, like
+the C library's <TT
+CLASS="FUNCTION"
+>write</TT
+> function, pushes its
+arguments on to the stack and executes the trap instruction. The Linux
+kernel cannot tell the difference, so it will perform the I/O
+operation requested by the synthetic target. With appropriate
+knowledge of what system calls are available, this makes it possible
+to emulate the required I/O facilities. For example, spawning the
+ecosynth I/O auxiliary involves system calls
+<TT
+CLASS="FUNCTION"
+>cyg_hal_sys_fork</TT
+> and
+<TT
+CLASS="FUNCTION"
+>cyg_hal_sys_execve</TT
+>, and sending a request to the
+auxiliary uses <TT
+CLASS="FUNCTION"
+>cyg_hal_sys_write</TT
+>.
+ </P
+><P
+>In many ways developing for the synthetic target is no different from
+developing for real embedded targets. eCos must be configured
+appropriately: selecting a suitable target such as
+<TT
+CLASS="USERINPUT"
+><B
+>i386linux</B
+></TT
+> will cause the configuration system
+to load the appropriate packages for this hardware; this includes an
+architectural HAL package and a platform-specific package; the
+architectural package contains generic code applicable to all Linux
+platforms, whereas the platform package is for specific Linux
+implementations such as the x86 version and contains any
+processor-specific code. Selecting this target will also bring in some
+device driver packages. Other aspects of the configuration such as
+which API's are supported are determined by the template, by adding
+and removing packages, and by fine-grained configuration.
+ </P
+><P
+>In other ways developing for the synthetic target can be much easier
+than developing for a real embedded target. For example there is no
+need to worry about building and installing suitable firmware on the
+target hardware, and then downloading and debugging the actual
+application over a serial line or a similar connection. Instead an
+eCos application built for the synthetic target is mostly
+indistinguishable from an ordinary Linux program. It can be run simply
+by typing the name of the executable file at a shell prompt.
+Alternatively you can debug the application using whichever version of
+gdb is provided by your Linux distribution. There is no need to build
+or install special toolchains. Essentially using the synthetic target
+means that the various problems associated with real embedded hardware
+can be bypassed for much of the development process.
+ </P
+><P
+>The eCos synthetic target provides emulation, not simulation. It is
+possible to run eCos in suitable architectural simulators but that
+involves a rather different approach to software development. For
+example, when running eCos on the psim PowerPC simulator you need
+appropriate cross-compilation tools that allow you to build PowerPC
+executables. These are then loaded into the simulator which interprets
+every instruction and attempts to simulate what would happen if the
+application were running on real hardware. This involves a lot of
+processing overhead, but depending on the functionality provided by
+the simulator it can give very accurate results. When developing for
+the synthetic target the executable is compiled for the PC's own
+processor and will be executed at full speed, with no need for a
+simulator or special tools. This will be much faster and somewhat
+simpler than using an architectural simulator, but no attempt is made
+to accurately match the behaviour of a real embedded target.
+ </P
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><HR
+ALIGN="LEFT"
+WIDTH="100%"><TABLE
+SUMMARY="Footer navigation table"
+WIDTH="100%"
+BORDER="0"
+CELLPADDING="0"
+CELLSPACING="0"
+><TR
+><TD
+WIDTH="33%"
+ALIGN="left"
+VALIGN="top"
+><A
+HREF="hal-synth-arch.html"
+ACCESSKEY="P"
+>Prev</A
+></TD
+><TD
+WIDTH="34%"
+ALIGN="center"
+VALIGN="top"
+><A
+HREF="hal-synth-arch.html"
+ACCESSKEY="H"
+>Home</A
+></TD
+><TD
+WIDTH="33%"
+ALIGN="right"
+VALIGN="top"
+><A
+HREF="synth-install.html"
+ACCESSKEY="N"
+>Next</A
+></TD
+></TR
+><TR
+><TD
+WIDTH="33%"
+ALIGN="left"
+VALIGN="top"
+>eCos Synthetic Target</TD
+><TD
+WIDTH="34%"
+ALIGN="center"
+VALIGN="top"
+>&nbsp;</TD
+><TD
+WIDTH="33%"
+ALIGN="right"
+VALIGN="top"
+>Installation</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
diff --git a/ecos/packages/hal/synth/arch/current/doc/synth.sgml b/ecos/packages/hal/synth/arch/current/doc/synth.sgml
new file mode 100644
index 0000000..17f1b61
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/doc/synth.sgml
@@ -0,0 +1,2744 @@
+<!-- DOCTYPE part PUBLIC "-//OASIS//DTD DocBook V3.1//EN" -->
+
+<!-- {{{ Banner -->
+
+<!-- =============================================================== -->
+<!-- -->
+<!-- synth.sgml -->
+<!-- -->
+<!-- Synthetic target architectural documentation. -->
+<!-- -->
+<!-- =============================================================== -->
+<!-- ####ECOSDOCCOPYRIGHTBEGIN#### -->
+<!-- =============================================================== -->
+<!-- Copyright (C) 2002 Free Software Foundation, Inc. -->
+<!-- This material may be distributed only subject to the terms -->
+<!-- and conditions set forth in the Open Publication License, v1.0 -->
+<!-- or later (the latest version is presently available at -->
+<!-- http://www.opencontent.org/openpub/) -->
+<!-- Distribution of the work or derivative of the work in any -->
+<!-- standard (paper) book form is prohibited unless prior -->
+<!-- permission obtained from the copyright holder -->
+<!-- =============================================================== -->
+<!-- ####ECOSDOCCOPYRIGHTEND#### -->
+<!-- =============================================================== -->
+<!-- =============================================================== -->
+<!-- #####DESCRIPTIONBEGIN#### -->
+<!-- -->
+<!-- Author(s): bartv -->
+<!-- Contact(s): bartv -->
+<!-- Date: 2002/02/24 -->
+<!-- Version: 0.01 -->
+<!-- -->
+<!-- ####DESCRIPTIONEND#### -->
+<!-- =============================================================== -->
+
+<!-- }}} -->
+
+<part id="hal-synth-arch"><title>eCos Synthetic Target</title>
+
+<!-- {{{ Overview -->
+
+<refentry id="synth">
+ <refmeta>
+ <refentrytitle>Overview</refentrytitle>
+ </refmeta>
+ <refnamediv>
+ <refname>The eCos synthetic target</refname>
+ <refpurpose>Overview</refpurpose>
+ </refnamediv>
+
+ <refsect1 id="synth-description"><title>Description</title>
+ <para>
+Usually eCos runs on either a custom piece of hardware, specially
+designed to meet the needs of a specific application, or on a
+development board of some sort that is available before the final
+hardware. Such boards have a number of things in common:
+ </para>
+ <orderedlist>
+ <listitem><para>
+Obviously there has to be at least one processor to do the work. Often
+this will be a 32-bit processor, but it can be smaller or larger.
+Processor speed will vary widely, depending on the expected needs of
+the application. However the exact processor being used tends not to
+matter very much for most of the development process: the use of
+languages such as C or C++ means that the compiler will handle those
+details.
+ </para></listitem>
+ <listitem><para>
+There needs to be memory for code and for data. A typical system will
+have two different types of memory. There will be some non-volatile
+memory such as flash, EPROM or masked ROM. There will also be some
+volatile memory such as DRAM or SRAM. Often the code for the final
+application will reside in the non-volatile memory and all of the RAM
+will be available for data. However updating non-volatile memory
+requires a non-trivial amount of effort, so for much of the
+development process it is more convenient to burn suitable firmware,
+for example RedBoot, into the non-volatile memory and then use that to
+load the application being debugged into RAM, alongside the
+application data and a small area reserved for use by the firmware.
+ </para></listitem>
+ <listitem><para>
+The platform must provide certain mimimal I/O facilities. Most eCos
+configurations require a clock signal of some sort. There must also be
+some way of outputting diagnostics to the user, often but not always
+via a serial port. Unless special debug hardware is being used, source
+level debugging will require bidirectional communication between a
+host machine and the target hardware, usually via a serial port or an
+ethernet device.
+ </para></listitem>
+ <listitem><para>
+All the above is not actually very useful yet because there is no way
+for the embedded device to interact with the rest of the world, except
+by generating diagnostics. Therefore an embedded device will have
+additional I/O hardware. This may be fairly standard hardware such as
+an ethernet or USB interface, or special hardware designed
+specifically for the intended application, or quite often some
+combination. Standard hardware such as ethernet or USB may be
+supported by eCos device drivers and protocol stacks, whereas the
+special hardware will be driven directly by application code.
+ </para></listitem>
+ </orderedlist>
+ <para>
+Much of the above can be emulated on a typical PC running Linux.
+Instead of running the embedded application being developed on a
+target board of some sort, it can be run as a Linux process. The
+processor will be the PC's own processor, for example an x86, and the
+memory will be the process' address space. Some I/O facilities can be
+emulated directly through system calls. For example clock hardware can
+be emulated by setting up a <literal>SIGALRM</literal> signal, which
+will cause the process to be interrupted at regular intervals. This
+emulation of real hardware will not be particularly accurate, the
+number of cpu cycles available to the eCos application between clock
+ticks will vary widely depending on what else is running on the PC,
+but for much development work it will be good enough.
+ </para>
+ <para>
+Other I/O facilities are provided through an I/O auxiliary process,
+ecosynth, that gets spawned by the eCos application during startup.
+When an eCos device driver wants to perform some I/O operation, for
+example send out an ethernet packet, it sends a request to the I/O
+auxiliary. That is an ordinary Linux application so it has ready
+access to all normal Linux I/O facilities. To emulate a device
+interrupt the I/O auxiliary can raise a <literal>SIGIO</literal>
+signal within the eCos application. The HAL's interrupt subsystem
+installs a signal handler for this, which will then invoke the
+standard eCos ISR/DSR mechanisms. The I/O auxiliary is based around
+Tcl scripting, making it easy to extend and customize. It should be
+possible to configure the synthetic target so that its I/O
+functionality is similar to what will be available on the final target
+hardware for the application being developed.
+ </para>
+ <informalfigure PgWide=1>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="synth-io-overview.png" Scalefit=1 Align="Center">
+ </imageobject>
+ </mediaobject>
+ </informalfigure>
+ <para>
+A key requirement for synthetic target code is that the embedded
+application must not be linked with any of the standard Linux
+libraries such as the GNU C library: that would lead to a confusing
+situation where both eCos and the Linux libraries attempted to provide
+functions such as <function>printf</function>. Instead the synthetic
+target support must be implemented directly on top of the Linux
+kernels' system call interface. For example, the kernel provides a
+system call for write operations. The actual function
+<function>write</function> is implemented in the system's C library,
+but all it does is move its arguments on to the stack or into certain
+registers and then execute a special trap instruction such as
+<literal>int&nbsp;0x80</literal>. When this instruction is executed
+control transfers into the kernel, which will validate the arguments
+and perform the appropriate operation. Now, a synthetic target
+application cannot be linked with the system's C library. Instead it
+contains a function <function>cyg_hal_sys_write</function> which, like
+the C library's <function>write</function> function, pushes its
+arguments on to the stack and executes the trap instruction. The Linux
+kernel cannot tell the difference, so it will perform the I/O
+operation requested by the synthetic target. With appropriate
+knowledge of what system calls are available, this makes it possible
+to emulate the required I/O facilities. For example, spawning the
+ecosynth I/O auxiliary involves system calls
+<function>cyg_hal_sys_fork</function> and
+<function>cyg_hal_sys_execve</function>, and sending a request to the
+auxiliary uses <function>cyg_hal_sys_write</function>.
+ </para>
+ <para>
+In many ways developing for the synthetic target is no different from
+developing for real embedded targets. eCos must be configured
+appropriately: selecting a suitable target such as
+<userinput>i386linux</userinput> will cause the configuration system
+to load the appropriate packages for this hardware; this includes an
+architectural HAL package and a platform-specific package; the
+architectural package contains generic code applicable to all Linux
+platforms, whereas the platform package is for specific Linux
+implementations such as the x86 version and contains any
+processor-specific code. Selecting this target will also bring in some
+device driver packages. Other aspects of the configuration such as
+which API's are supported are determined by the template, by adding
+and removing packages, and by fine-grained configuration.
+ </para>
+ <para>
+In other ways developing for the synthetic target can be much easier
+than developing for a real embedded target. For example there is no
+need to worry about building and installing suitable firmware on the
+target hardware, and then downloading and debugging the actual
+application over a serial line or a similar connection. Instead an
+eCos application built for the synthetic target is mostly
+indistinguishable from an ordinary Linux program. It can be run simply
+by typing the name of the executable file at a shell prompt.
+Alternatively you can debug the application using whichever version of
+gdb is provided by your Linux distribution. There is no need to build
+or install special toolchains. Essentially using the synthetic target
+means that the various problems associated with real embedded hardware
+can be bypassed for much of the development process.
+ </para>
+ <para>
+The eCos synthetic target provides emulation, not simulation. It is
+possible to run eCos in suitable architectural simulators but that
+involves a rather different approach to software development. For
+example, when running eCos on the psim PowerPC simulator you need
+appropriate cross-compilation tools that allow you to build PowerPC
+executables. These are then loaded into the simulator which interprets
+every instruction and attempts to simulate what would happen if the
+application were running on real hardware. This involves a lot of
+processing overhead, but depending on the functionality provided by
+the simulator it can give very accurate results. When developing for
+the synthetic target the executable is compiled for the PC's own
+processor and will be executed at full speed, with no need for a
+simulator or special tools. This will be much faster and somewhat
+simpler than using an architectural simulator, but no attempt is made
+to accurately match the behaviour of a real embedded target.
+ </para>
+ </refsect1>
+</refentry>
+
+<!-- }}} -->
+<!-- {{{ Installation -->
+
+<refentry id="synth-install">
+ <refmeta>
+ <refentrytitle>Installation</refentrytitle>
+ </refmeta>
+ <refnamediv>
+ <refname>Installation</refname>
+ <refpurpose>Preparing to use the synthetic target</refpurpose>
+ </refnamediv>
+
+ <refsect1 id="synth-install-host"><title>Host-side Software</title>
+ <para>
+To get the full functionality of the synthetic target, users must
+build and install the I/O auxiliary ecosynth and various support
+files. It is possible to develop applications for the synthetic target
+without the auxiliary, but only limited I/O facilities will be
+available. The relevant code resides in the <filename
+class="directory">host</filename> subdirectory of the synthetic target
+architectural HAL package, and building it involves the standard
+<command>configure</command>, <command>make</command>, and
+<command>make install</command> steps.
+ </para>
+ <para>
+There are two main ways of building the host-side software. It is
+possible to build both the generic host-side software and all
+package-specific host-side software, including the I/O auxiliary. in a
+single build tree. This involves using the
+<command>configure</command> script at the toplevel of the eCos
+repository, which will automatically search the <filename
+class="directory">packages</filename> hierarchy for host-side
+software. For more information on this, see the
+<filename>README.host</filename> file at the top of the repository.
+Note that if you have an existing build tree which does not include
+the synthetic target architectural HAL package then it will be
+necessary to rerun the toplevel configure script: the search for
+appropriate packages happens at configure time.
+ </para>
+ <para>
+The alternative is to build just the host-side for this package.
+This involves creating a suitable build directory and running the
+<command>configure</command> script. Note that building directly in
+the source tree is not allowed.
+ </para>
+ <screen>
+$ cd &lt;somewhere suitable&gt;
+$ mkdir synth_build
+$ cd synth_build
+$ &lt;repo&lt;&gt;/packages/hal/synth/arch/&lt;version&gt;/host/configure &lt;options&gt;
+$ make
+$ make install
+</screen>
+ <para>
+The code makes extensive use of Tcl/TK and requires version 8.3 or
+later. This is checked by the <command>configure</command> script. By
+default it will use the system's Tcl installation in <filename
+class="directory">/usr</filename>. If a different, more recent Tcl
+installation should be used then its location can be specified using
+the options <option>--with-tcl=&lt;path&gt;</option>,
+<option>--with-tcl-header=&lt;path&gt;</option> and
+<option>--with-tcl-lib=&lt;path&gt;</option>. For more information on these options
+see the <filename>README.host</filename> file at the toplevel of the
+eCos repository.
+ </para>
+ <para>
+Some users may also want to specify the install location using a
+<option>--prefix=&lt;path&gt;</option> option. The default install
+location is <filename class="directory">/usr/local</filename>. It is
+essential that the <filename class="directory">bin</filename>
+subdirectory of the install location is on the user's search
+<envar>PATH</envar>, otherwise the eCos application will be unable to
+locate and execute the I/O auxiliary ecosynth.
+ </para>
+ <para>
+Because ecosynth is run automatically by an eCos application rather
+than explicitly by the user, it is not installed in the <filename
+class="directory">bin</filename> subdirectory itself. Instead it is
+installed below <filename class="directory">libexec</filename>,
+together with various support files such as images. At configure time
+it is usually possible to specify an alternative location for
+<filename class="directory">libexec</filename> using
+<option>--exec-prefix=&lt;path&gt;</option> or
+<option>--libexecdir=&lt;path&gt;</option>. These options should not
+be used for this package because the eCos application is built
+completely separately and does not know how the host-side was
+configured.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-tools"><title>Toolchain</title>
+ <para>
+When developing eCos applications for a normal embedded target it is
+necessary to use a suitable cross-compiler and related tools such as
+the linker. Developing for the synthetic target is easier because you
+can just use the standard GNU tools (gcc, g++, ld, &hellip;) which
+were provided with your Linux distribution, or which you used to build
+your own Linux setup. Any reasonably recent version of the tools, for
+example gcc 2.96(Red Hat) as shipped with Red Hat Linux 7, should be
+sufficient.
+ </para>
+ <para>
+There is one important limitation when using these tools: current gdb
+will not support debugging of eCos threads on the synthetic target. As
+far as gdb is concerned a synthetic target application is
+indistinguishable from a normal Linux application, so it assumes that
+any threads will be created by calls to the Linux
+<function>pthread_create</function> function provided by the C
+library. Obviously this is not the case since the application is never
+linked with that library. Therefore gdb never notices the eCos thread
+mechanisms and assumes the application is single-threaded. Fixing this
+is possible but would involve non-trivial changes to gdb.
+ </para>
+ <para>
+Theoretically it is possible to develop synthetic target applications
+on, for example, a PC running Windows and then run the resulting
+executables on another machine that runs Linux. This is rarely useful:
+if a Linux machine is available then usually that machine will also be
+used for building ecos and the application. However, if for some
+reason it is necessary or desirable to build on another machine then
+this requires a suitable cross-compiler and related tools. If the
+application will be running on a typical PC with an x86 processor then
+a suitable configure triplet would be
+<userinput>i686-pc-linux-gnu</userinput>. The installation
+instructions for the various GNU tools should be consulted for further
+information.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-hardware"><title>Hardware Preparation</title>
+ <para>
+Preparing a real embedded target for eCos development can be tricky.
+Often the first step is to install suitable firmware, usually RedBoot.
+This means creating and building a special configuration for eCos with
+the RedBoot template, then somehow updating the target's flash chips
+with the resulting RedBoot image. Typically it will also be necessary
+to get a working serial connection, and possibly set up ethernet as
+well. Although usually none of the individual steps are particularly
+complicated, there are plenty of ways in which things can go wrong and
+it can be hard to figure out what is actually happening. Of course
+some board manufacturers make life easier for their developers by
+shipping hardware with RedBoot preinstalled, but even then it is still
+necessary to set up communication between host and target.
+ </para>
+ <para>
+None of this is applicable to the synthetic target. Instead you can
+just build a normal eCos configuration, link your application with the
+resulting libraries, and you end up with an executable that you can
+run directly on your Linux machine or via gdb. A useful side effect of
+this is that application development can start before any real
+embedded hardware is actually available.
+ </para>
+ <para>
+Typically the memory map for a synthetic target application will be
+set up such that there is a read-only ROM region containing all the
+code and constant data, and a read-write RAM region for the data. The
+default locations and sizes of these regions depend on the specific
+platform being used for development. Note that the application always
+executes out of ROM: on a real embedded target much of the development
+would involve running RedBoot firmware there, with application code
+and data loaded into RAM; usually this would change for the final
+system; the firmware would be replaced by the eCos application itself,
+configured for ROM bootstrap, and it would perform the appropriate
+hardware initialization. Therefore the synthetic target actually
+emulates the behaviour of a final system, not of a development
+environment. In practice this is rarely significant, although having
+the code in read-only memory can help catch some problems in
+application code.
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- }}} -->
+<!-- {{{ Running the application -->
+
+<refentry id="synth-running">
+ <refmeta>
+ <refentrytitle>Running a Synthetic Target Application</refentrytitle>
+ </refmeta>
+ <refnamediv>
+ <refname>Execution</refname>
+ <refpurpose>Arguments and configuration files</refpurpose>
+ </refnamediv>
+
+ <refsect1 id="synth-running-description"><title>Description</title>
+ <para>
+The procedure for configuring and building eCos and an application for
+the synthetic target is the same as for any other eCos target. Once an
+executable has been built it can be run like any Linux program, for
+example from a shell prompt,
+ </para>
+ <screen>
+$ ecos_hello &lt;options&gt;
+</screen>
+ <para>
+or using gdb:
+ </para>
+ <screen>
+$ gdb --nw --quiet --args ecos_hello &lt;options&gt;
+(gdb) run
+Starting program: ecos_hello &lt;options&gt;
+</screen>
+ <para>
+By default use of the I/O auxiliary is disabled. If its I/O facilities
+are required then the option <option>--io</option> must be used.
+ </para>
+ <note><para>
+In future the default behaviour may change, with the I/O auxiliary
+being started by default. The option <option>--nio</option> can be
+used to prevent the auxiliary from being run.
+ </para></note>
+ </refsect1>
+
+ <refsect1 id="synth-running-arguments"><title>Command-line Arguments</title>
+ <para>
+The syntax for running a synthetic target application is:
+ </para>
+ <screen>
+$ &lt;ecos_app&gt; [options] [-- [app_options]]
+</screen>
+ <para>
+Command line options up to the <option>--</option> are passed on to
+the I/O auxiliary. Subsequent arguments are not passed on to the
+auxiliary, and hence can be used by the eCos application itself. The
+full set of arguments can be accessed through the variables
+<varname>cyg_hal_sys_argc</varname> and
+<varname>cyg_hal_sys_argv</varname>.
+ </para>
+ <para>
+The following options are accepted as standard:
+ </para>
+ <variablelist>
+ <varlistentry>
+ <term><option>--io</option></term>
+ <listitem><para>
+This option causes the eCos application to spawn the I/O auxiliary
+during HAL initialization. Without this option only limited I/O will
+be available.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>--nio</option></term>
+ <listitem><para>
+This option prevents the eCos application from spawning the I/O
+auxiliary. In the current version of the software this is the default.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-nw</option>, <option>--no-windows</option></term>
+ <listitem><para>
+The I/O auxiliary can either provide a graphical user interface, or it
+can run in a text-only mode. The default is to provide the graphical
+interface, but this can be disabled with <option>-nw</option>.
+Emulation of some devices, for example buttons connected to digital
+inputs, requires the graphical interface.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-w</option>, <option>--windows</option></term>
+ <listitem><para>
+The <option>-w</option> causes the I/O auxiliary to provide a
+graphical user interface. This is the default.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-v</option>, <option>--version</option></term>
+ <listitem><para>
+The <option>-v</option> option can be used to determine the version of
+the I/O auxiliary being used and where it has been installed. Both the
+auxiliary and the eCos application will exit immediately.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-h</option>, <option>--help</option></term>
+ <listitem><para>
+<option>-h</option> causes the I/O auxiliary to list all accepted
+command-line arguments. This happens after all devices have been
+initialized, since the host-side support for some of the devices may
+extend the list of recognised options. After this both the auxiliary
+and the eCos application will exit immediately. This option implies
+<option>-nw</option>.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-k</option>, <option>--keep-going</option></term>
+ <listitem><para>
+If an error occurs in the I/O auxiliary while reading in any of the
+configuration files or initializing devices, by default both the
+auxiliary and the eCos application will exit. The <option>-k</option>
+option can be used to make the auxiliary continue in spite of errors,
+although obviously it may not be fully functional.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-nr</option>, <option>--no-rc</option></term>
+ <listitem><para>
+Normally the auxiliary processes two <link
+linkend="synth-running-user-config">user configuration files</link>
+during startup: <filename>initrc.tcl</filename> and
+<filename>mainrc.tcl</filename>. This can be suppressed using the
+<option>-nr</option> option.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-x</option>, <option>--exit</option></term>
+ <listitem><para>
+When providing a graphical user interface the I/O auxiliary will
+normally continue running even after the eCos application has exited.
+This allows the user to take actions such as saving the current
+contents of the main text window. If run with <option>-x</option> then
+the auxiliary will exit as soon the application exits.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-nx</option>, <option>--no-exit</option></term>
+ <listitem><para>
+When the graphical user interface is disabled with
+<option>-nw</option> the I/O auxiliary will normally exit immediately
+when the eCos application exits. Without the graphical frontend there
+is usually no way for the user to interact directly with the
+auxiliary, so there is no point in continuing to run once the eCos
+application will no longer request any I/O operations. Specifying the
+<option>-nx</option> option causes the auxiliary to continue running
+even after the application has exited.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-V</option>, <option>--verbose</option></term>
+ <listitem><para>
+This option causes the I/O auxiliary to output some additional
+information, especially during initialization.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-l &lt;file&gt;</option>, <option>--logfile &lt;file&gt;</option></term>
+ <listitem><para>
+Much of the output of the eCos application and the I/O auxiliary is
+simple text, for example resulting from eCos
+<function>printf</function> or <function>diag_printf</function> calls.
+When running in graphical mode this output goes to a central text
+window, and can be saved to a file or edited via menus. The
+<option>-l</option> can be used to automatically generate an
+additional logfile containing all the text. If graphical
+mode is disabled then by default all the text just goes to the current
+standard output. Specifying <option>-l</option> causes most of the
+text to go into a logfile instead, although some messages such as
+errors generated by the auxiliary itself will still go to stdout as
+well.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-t &lt;file&gt;</option>, <option>--target &lt;file&gt;</option></term>
+ <listitem><para>
+During initialization the I/O auxiliary reads in a target definition
+file. This file holds information such as which Linux devices should
+be used to emulate the various eCos devices. The <option>-t</option>
+option can be used to specify which target definition should be used
+for the current run, defaulting to <filename>default.tdf</filename>.
+It is not necessary to include the <filename>.tdf</filename> suffix,
+this will be appended automatically if necessary.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-geometry &lt;geometry&gt;</option></term>
+ <listitem><para>
+This option can be used to control the size and position of the main
+window, as per X conventions.
+ </para></listitem>
+ </varlistentry>
+ </variablelist>
+ <para>
+The I/O auxiliary loads support for the various devices dynamically
+and some devices may accept additional command line arguments. Details
+of these can be obtained using the <option>-h</option> option or by
+consulting the device-specific documentation. If an unrecognised
+command line argument is used then a warning will be issued.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-running-tdf"><title>The Target Definition File</title>
+ <para>
+The eCos application will want to access devices such as
+<varname>eth0</varname> or <varname>/dev/ser0</varname>. These need to
+be mapped on to Linux devices. For example some users may all traffic
+on the eCos <varname>/dev/ser0</varname> serial device to go via the
+Linux serial device <varname>/dev/ttyS1</varname>, while ethernet I/O
+for the eCos <varname>eth0</varname> device should be mapped to the
+Linux ethertap device <varname>tap3</varname>. Some devices may need
+additional configuration information, for example to limit the
+number of packets that should be buffered within the I/O auxiliary.
+The target definition file provides all this information.
+ </para>
+ <para>
+By default the I/O auxiliary will look for a file
+<filename>default.tdf</filename>. An alternative target definition can
+be specified on the command line using <option>-t</option>, for
+example:
+ </para>
+ <screen>
+$ bridge_app --io -t twineth
+</screen>
+ <para>
+A <filename>.tdf</filename> suffix will be appended automatically if
+necessary. If a relative pathname is used then the I/O auxiliary will
+search for the target definition file in the current directory, then
+in <filename class="directory">~/.ecos/synth/</filename>, and finally
+in its install location.
+ </para>
+ <para>
+A typical target definition file might look like this:
+ </para>
+ <programlisting>
+synth_device console {
+ # appearance -foreground white -background black
+ filter trace {^TRACE:.*} -foreground HotPink1 -hide 1
+}
+
+synth_device ethernet {
+ eth0 real eth1
+ eth1 ethertap tap4 00:01:02:03:FE:06
+
+ ## Maximum number of packets that should be buffered per interface.
+ ## Default 16
+ #max_buffer 32
+
+ ## Filters for the various recognised protocols.
+ ## By default all filters are visible and use standard colours.
+ filter ether -hide 0
+ #filter arp -hide 1
+ #filter ipv4 -hide 1
+ #filter ipv6 -hide 1
+}
+</programlisting>
+ <para>
+A target definition file is actually a Tcl script that gets run in the
+main interpreter of the I/O auxiliary during initialization. This
+provides a lot of flexibility if necessary. For example the script
+could open a socket to a resource management server of some sort to
+determine which hardware facilities are already in use and adapt
+accordingly. Another possibility is to adapt based on <link
+linkend="synth-new-host-args">command line arguments</link>. Users who
+are not familiar with Tcl programming should still be able to edit a
+simple target definition file without too much difficulty, using a
+mixture of cut'n'paste, commenting or uncommenting various lines, and
+making small edits such as changing <literal>tap4</literal> to
+<literal>eth2</literal>.
+ </para>
+ <para>
+Each type of device will have its own entry in the target definition
+file, taking the form:
+ </para>
+ <programlisting>
+synth_device &lt;device type&gt; {
+ &lt;options&gt;
+}
+</programlisting>
+ <para>
+The documentaton for each synthetic target device should provide
+details of the options available for that device, and often a suitable
+fragment that can be pasted into a target definition file and edited.
+There is no specific set of options that a given device will always
+provide. However in practice many devices will use common code
+exported by the main I/O auxiliary, or their implementation will
+involve some re-use of code for an existing device. Hence certain
+types of option are common to many devices.
+ </para>
+ <para>
+A good example of this is filters, which control the appearance of
+text output. The above target definition file defines a filter
+<varname>trace</varname> for output from the eCos application. The
+regular expression will match output from the infrastructure package's
+tracing facilities when <varname>CYGDBG_USE_TRACING</varname> and
+<varname>CYGDBG_INFRA_DEBUG_TRACE_ASSERT_SIMPLE</varname> are enabled.
+With the current settings this output will not be visible by default,
+but can be made visible using the menu item <guimenuitem>System
+Filters</guimenuitem>. If made visible the trace output will appear in
+an unusual colour, so users can easily distinguish the trace output
+from other text. All filters accept the following options:
+ </para>
+ <variablelist>
+ <varlistentry>
+ <term><option>-hide [0|1]</option></term>
+ <listitem><para>
+This controls whether or not text matching this filter should be
+invisible by default or not. At run-time the visibility of each filter
+can be controlled using the <guimenuitem>System Filters</guimenuitem>
+menu item.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-foreground &lt;colour&gt;</option></term>
+ <listitem><para>
+This specifies the foreground colour for all text matching this
+filter. The colour can be specified using an RGB value such as
+<literal>#F08010</literal>, or a symbolic name such as
+<literal>"light steel blue"</literal>. The X11 utility
+<application>showrgb</application> can be used to find out
+about the available colours.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-background &lt;colour&gt;</option></term>
+ <listitem><para>
+This specifies the background colour for all text matching the filter.
+As with <option>-foreground</option> the colour can be specified using
+a symbolic name or an RGB value.
+ </para></listitem>
+ </varlistentry>
+ </variablelist>
+ <para>
+Some devices may create their own subwindows, for example to monitor
+ethernet traffic or to provide additional I/O facilities such as
+emulated LED's or buttons. Usually the target definition file can be
+used to control the <link linkend="synth-gui-layout">layout</link> of
+these windows.
+ </para>
+ <para>
+The I/O auxiliary will not normally warn about
+<command>synth_device</command> entries in the target definition file
+for devices that are not actually needed by the current eCos
+application. This makes it easier to use a single file for several
+different applications. However it can lead to confusion if an entry
+is spelled incorrectly and hence does not actually get used. The
+<option>-V</option> command line option can be used to get warnings
+about unused device entries in the target definition file.
+ </para>
+ <para>
+If the body of a <command>synth_device</command> command contains an
+unrecognised option and the relevant device is in use, the I/O
+auxiliary will always issue a warning about such options.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-running-user-config"><title>User Configuration Files</title>
+ <para>
+During initialization the I/O auxiliary will execute two user
+configuration files, <filename>initrc.tcl</filename> and
+<filename>mainrc.tcl</filename>. It will look for these files in the
+directory <filename class="directory">~/.ecos/synth/</filename>. If
+that directory does not yet exist it will be created and populated
+with initial dummy files.
+ </para>
+ <para>
+Both of these configuration files are Tcl scripts and will be run in
+the main interpreter used by the I/O auxiliary itself. This means that
+they have full access to the internals of the auxiliary including the
+various Tk widgets, and they can perform file or socket I/O if
+desired. The section <xref linkend="synth-new-host"> contains
+information about the facilities available on the host-side for
+writing new device drivers, and these can also be used in the
+initialization scripts.
+ </para>
+ <para>
+The <filename>initrc.tcl</filename> script is run before the auxiliary
+has processed any requests from the eCos application, and hence before
+any devices have been instantiated. At this point the generic
+command-line arguments has been processed, the target definition file
+has been read in, and the hooks functionality has been initialized. If
+running in graphical mode the main window will have been created, but
+has been withdrawn from the screen to allow new widgets to be added
+without annoying screen flicker. A typical
+<filename>initrc.tcl</filename> script could add some menu or toolbar
+options, or install a hook function that will be run when the
+eCos application exits.
+ </para>
+ <para>
+The <filename>mainrc.tcl</filename> script is run after eCos has
+performed all its device initialization and after C++ static
+constructors have run, and just before the call to
+<function>cyg_start</function> which will end up transferring control
+to the application itself. A typical <filename>mainrc.tcl</filename>
+script could look at what interrupt vectors have been allocated to
+which devices and create a little monitor window that shows interrupt
+activity.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-running-session"><title>Session Information</title>
+ <para>
+When running in graphical mode, the I/O auxiliary will read in a file
+<filename>~/.ecos/synth/guisession</filename> containing session
+information. This file should not normally be edited manually, instead
+it gets updated automatically when the auxiliary exits. The purpose of
+this file is to hold configuration options that are manipulated via
+the graphical interface, for example which browser should be used to
+display online help.
+ </para>
+ <warning><para>
+GUI session functionality is not yet available in the current release.
+When that functionality is fully implemented it is possible that some
+target definition file options may be removed, to be replaced by
+graphical editing via a suitable preferences dialog, with the
+current settings saved in the session file.
+ </para></warning>
+ </refsect1>
+
+</refentry>
+
+<!-- }}} -->
+<!-- {{{ ecosynth user interface -->
+
+<refentry id="synth-gui">
+ <refmeta>
+ <refentrytitle>The I/O Auxiliary's User Interface</refentrytitle>
+ </refmeta>
+ <refnamediv>
+ <refname>User Interface</refname>
+ <refpurpose>Controlling the I/O Auxiliary</refpurpose>
+ </refnamediv>
+
+ <refsect1 id="synth-gui-description"><title>Description</title>
+ <para>
+The synthetic target auxiliary is designed to support both extensions
+and user customization. Support for the desired devices is dynamically
+loaded, and each device can extend the user interface. For example it
+is possible for a device to add menu options, place new buttons on the
+toolbar, create its own sub-window within the overall layout, or even
+create entire new toplevel windows. These subwindows or toplevels
+could show graphs of activity such as interrupts or packets being
+transferred. They could also allow users to interact with the eCos
+application, for example by showing a number of buttons which will be
+mapped on to digital inputs in the eCos application. Different
+applications will have their own I/O requirements, changing the
+host-side support files that get loaded and that may modify the user
+interface. The I/O auxiliary also reads in user configuration scripts
+which can enhance the interface in the same way. Therefore the exact
+user interface will depend on the user and on the eCos application
+being run. However the overall layout is likely to remain the same.
+ </para>
+ <informalfigure PgWide=1>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="screen_main.png" Scalefit=1 Align="Center">
+ </imageobject>
+ </mediaobject>
+ </informalfigure>
+ <para>
+The title bar identifies the window as belonging to an eCos synthetic
+target application and lists both the application name and its process
+id. The latter is especially useful if the application was started
+directly from a shell prompt and the user now wants to attach a gdb
+session. The window has a conventional menu bar with the usual
+entries, plus a toolbar with buttons for common operations such as cut
+and paste. Balloon help is supported.
+ </para>
+ <para>
+There is a central <link linkend="synth-gui-text">text window</link>,
+possibly surrounded by various sub-windows for various devices. For
+example there could be a row of emulated LED's above the text window,
+and monitors of ethernet traffic and interrupt activity on the right.
+At the bottom of the window is a status line, including a small
+animation that shows whether or not the eCos application is still
+running.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-gui-menus"><title>Menus and the Toolbar</title>
+ <para>
+Usually there will be four menus on the menu bar:
+<guimenu>File</guimenu>, <guimenu>Edit</guimenu>,
+<guimenu>View</guimenu> and <guimenu>Help</guimenu>.
+ </para>
+ <informalfigure PgWide=1>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="menu_file.png" Scalefit=1 Align="Center">
+ </imageobject>
+ </mediaobject>
+ </informalfigure>
+ <para>
+On the <guimenu>File</guimenu> menu there are three entries related to
+saving the current contents of the central text window.
+<guimenuitem>Save</guimenuitem> is used to save the currently visible
+contents of the text window. Any text that is hidden because of
+filters will not be written to the savefile. If there has been a
+previous <guimenuitem>Save</guimenuitem> or <guimenuitem>Save
+As</guimenuitem> operation then the existing savefile will be re-used,
+otherwise the user will be asked to select a suitable file.
+<guimenuitem>Save As</guimenuitem> also saves just the currently
+visible contents but will always prompt the user for a filename.
+<guimenuitem>Save All</guimenuitem> can be used to save the full
+contents of the text window, including any text that is currently
+hidden. It will always prompt for a new filename, to avoid confusion
+with partial savefiles.
+ </para>
+ <para>
+Usually the eCos application will be run from inside gdb or from a
+shell prompt. Killing off the application while it is being debugged
+in a gdb session is not a good idea, it would be better to use gdb's
+own <command>kill</command> command. Alternatively the eCos
+application itself can use the <function>CYG_TEST_EXIT</function> or
+<filename>cyg_hal_sys_exit</filename> functionality. However it is
+possible to terminate the application from the I/O auxiliary using
+<guimenuitem>Kill eCos</guimenuitem>. A clean shutdown will be
+attempted, but that can fail if the application is currently halted
+inside gdb or if it has crashed completely. As a last resort
+<constant>SIGKILL</constant> will be used.
+ </para>
+ <para>
+When operating in graphical mode the I/O auxiliary will normally
+continue to run even after the eCos application has exited. This
+allows the user to examine the last few lines of output, and perhaps
+perform actions such as saving the output to a file. The
+<guimenuitem>Exit</guimenuitem> menu item can be used to shut down the
+auxiliary. Note that this behaviour can be changed with command line
+arguments <link
+linkend="synth-running-arguments"><option>--exit</option></link> and
+<link
+linkend="synth-running-arguments"><option>--no-exit</option></link>.
+ </para>
+ <para>
+If <guimenuitem>Exit</guimenuitem> is used while the eCos application
+is still running then the I/O auxiliary will first attempt to
+terminate the application cleanly, and then exit.
+ </para>
+ <informalfigure PgWide=1>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="menu_edit.png" Scalefit=1 Align="Center">
+ </imageobject>
+ </mediaobject>
+ </informalfigure>
+ <para>
+The <guimenu>Edit</guimenu> menu contains the usual entries for
+text manipulation: <guimenuitem>Cut</guimenuitem>,
+<guimenuitem>Copy</guimenuitem>, <guimenuitem>Paste</guimenuitem>,
+<guimenuitem>Clear</guimenuitem> and <guimenuitem>Select
+All</guimenuitem>. These all operate on the central text window. By
+default this window cannot be edited so the cut, paste and clear
+operations are disabled. If the user wants to edit the contents of the
+text window then the <guimenuitem>Read Only</guimenuitem> checkbutton
+should be toggled.
+ </para>
+ <para>
+The <guimenuitem>Preferences</guimenuitem> menu item brings up a
+miscellaneous preferences dialog. One of the preferences relates to
+online help: the I/O auxiliary does not currently have a built-in html
+viewer; instead it will execute an external browser of some sort. With
+the example settings shown, the I/O auxiliary will first attempt to
+interact with an existing mozilla session. If that fails it will try
+to run a new mozilla instance, or as a last result use the Gnome help
+viewer.
+ </para>
+ <informalfigure PgWide=1>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="preferences.png" Scalefit=1 Align="Center">
+ </imageobject>
+ </mediaobject>
+ </informalfigure>
+ <para>
+The <guimenu>View</guimenu> menu contains the <guimenuitem>System
+Filters</guimenuitem> entry, used to edit the settings for the current
+<link linkend="synth-gui-text">filters</link>.
+ </para>
+ <informalfigure PgWide=1>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="menu_view.png" Scalefit=1 Align="Center">
+ </imageobject>
+ </mediaobject>
+ </informalfigure>
+ <para>
+The <guimenu>Help</guimenu> menu can be used to activate online help
+for eCos generally, for the synthetic target as a whole, and for
+specific devices supported by the generic target. The Preferences
+dialog can be used to select the browser that will be used.
+ </para>
+ <informalfigure PgWide=1>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="menu_help.png" Scalefit=1 Align="Center">
+ </imageobject>
+ </mediaobject>
+ </informalfigure>
+ <note><para>
+At the time of writing there is no well-defined toplevel index file
+for all eCos documentation. Hence the relevant menu item is disabled.
+Documentation for the synthetic target and the supported devices
+is stored as part of the package itself so can usually be found fairly
+easily. It may be necessary to set the <envar>ECOS_REPOSITORY</envar>
+environment variable.
+ </para></note>
+
+ </refsect1>
+
+ <refsect1 id="synth-gui-text"><title>The Main Text Window</title>
+ <para>
+The central text window holds the console output from the eCos
+application: the screen shot above shows DHCP initialization data from
+the TCP/IP stack, and some output from the <function>main</function>
+thread at the bottom. Some devices can insert text of their own, for
+example the ethernet device support can be configured to show details
+of incoming and outgoing packets. Mixing the output from the eCos
+application and the various devices can make it easier to understand
+the order in which events occur.
+ </para>
+ <para>
+The appearance of text from different sources can be controlled by
+means of filters, and it is also possible to hide some of the text.
+For example, if tracing is enabled in the eCos configuration then the
+trace output can be given its own colour scheme, making it stand out
+from the rest of the output. In addition the trace output is generally
+voluminous so it can be hidden by default, made visible only to find
+out more about what was happening when a particular problem occurred.
+Similarly the ethernet device support can output details of the
+various packets being transferred, and using a different background
+colour for this output again makes it easier to distinguish from
+console output.
+ </para>
+ <para>
+The default appearance for most filters is controlled via the
+<link linkend="synth-running-tdf">target definition file</link>. An
+example entry might be:
+ </para>
+ <programlisting>
+ filter trace {^TRACE:.*} -foreground HotPink1 -hide 1
+</programlisting>
+ <para>
+The various colours and the hide flag for each filter can be changed
+at run-time, using the <guimenuitem>System Filters</guimenuitem> item
+on the <guimenu>View</guimenu> menu. This will bring up a dialog like
+the following:
+ </para>
+ <informalfigure PgWide=1>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="filters.png" Scalefit=1 Align="Center">
+ </imageobject>
+ </mediaobject>
+ </informalfigure>
+ <para>
+It should be noted that the text window is line-oriented, not
+character-oriented. If an eCos application sends a partial line of
+text then that will remain buffered until a newline character is
+received, rather than being displayed immediately. This avoids
+confusion when there is concurrent output from several sources.
+ </para>
+ <para>
+By default the text window is read-only. This means it will not allow
+cut, paste and clear operations, and keyboard input will be ignored.
+The <guimenu>Edit</guimenu> menu has a checkbutton <guimenuitem>Read
+Only</guimenuitem> which can be toggled to allow write operations. For
+example, a user could type in a reminder of what was happening at this
+time, or paste in part of a gdb session. Such keyboard input does not
+get forwarded to the eCos application: if the latter requires keyboard
+input then that should happen via a separate keyboard device.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-gui-layout"><title>Positioning Optional Windows</title>
+ <para>
+Some devices may create their own subwindows, for example to monitor
+ethernet traffic or to provide additional I/O facilities such as
+emulated LED's or buttons. Usually the target definition file can be
+used to control the <link linkend="synth-gui-layout">layout</link> of
+these windows. This requires an understanding of the overall layout of
+the display.
+ </para>
+ <informalfigure PgWide=1>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="layout.png" Scalefit=1 Align="Center">
+ </imageobject>
+ </mediaobject>
+ </informalfigure>
+ <para>
+Subwindows are generally packed in one of eight frames surrounding the
+central text window: <varname>.main.nw</varname>,
+<varname>.main.n</varname>, <varname>.main.ne</varname>,
+<varname>.main.w</varname>, <varname>.main.e</varname>,
+<varname>.main.sw</varname>, <varname>.main.s</varname>, and
+<varname>.main.se</varname>. To position a row of LED's above the text
+window and towards the left, a target definition file could contain an
+entry such as:
+ </para>
+ <programlisting>
+synth_device led {
+ pack -in .main.n -side left
+ &hellip;
+}
+</programlisting>
+ <para>
+Similarly, to put a traffic monitor window on the right of the text
+window would involve something like:
+ </para>
+ <programlisting>
+ &hellip;
+ monitor_pack -in .main.e -side bottom
+ &hellip;
+</programlisting>
+ <para>
+Often it will be sufficient to specify a container frame and one of
+<constant>left</constant>, <constant>right</constant>,
+<constant>top</constant> or <constant>bottom</constant>. Full control
+over the positioning requires an understanding of Tcl/Tk and in
+particular the packing algorithm, and an appropriate reference work
+should be consulted.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-gui-global-config"><title>Global Settings</title>
+ <note><para>
+This section still to be written - it should document the interaction
+between X resources and ecosynth, and how users can control settings
+such as the main foreground and background colours.
+ </para></note>
+ </refsect1>
+
+</refentry>
+
+<!-- }}} -->
+<!-- {{{ The console device -->
+
+<refentry id="synth-console">
+ <refmeta>
+ <refentrytitle>The Console Device</refentrytitle>
+ </refmeta>
+ <refnamediv>
+ <refname>The console device </refname>
+ <refpurpose>Show output from the eCos application</refpurpose>
+ </refnamediv>
+
+ <refsect1 id="synth-console-description"><title>Description</title>
+ <para>
+The eCos application can generate text output in a variety of ways,
+including calling <function>printf</function> or
+<function>diag_printf</function>. When the I/O auxiliary is enabled
+the eCos startup code will instantiate a console device to process all
+such output. If operating in text mode the output will simply go to
+standard output, or to a logfile if the <option>-l</option> command
+line option is specified. If operating in graphical mode the output
+will go to the central text window, and optionally to a logfile as
+well. In addition it is possible to control the appearance of the main
+text via the target definition file, and to install extra filters for
+certain types of text.
+ </para>
+ <para>
+It should be noted that the console device is line-oriented, not
+character-oriented. This means that outputting partial lines is not
+supported, and some functions such as <function>fflush</function> and
+<function>setvbuf</function> will not operate as expected. This
+limitation prevents much possible confusion when using filters to
+control the appearance of the text window, and has some performance
+benefits - especially when the eCos application generates a great deal
+of output such as when tracing is enabled. For most applications this
+is not a problem, but it is something that developers should be aware
+of.
+ </para>
+ <para>
+The console device is output-only, it does not provide any support for
+keyboard input. If the application requires keyboard input then that
+should be handled by a separate eCos device package and matching
+host-side code.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-console-install"><title>Installation</title>
+ <para>
+The eCos side of the console device is implemented by the
+architectural HAL itself, in the source file
+<filename>synth_diag.c</filename>, rather than in a separate device
+package. Similarly the host-side implementation,
+<function>console.tcl</function>, is part of the architectural HAL's
+host-side support. It gets installed automatically alongside the I/O
+auxiliary itself, so no separate installation procedure is required.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-console-tdf"><title>Target Definition File</title>
+ <para>
+The <link linkend="synth-running-tdf">target definition file</link>
+can contain a number of entries related to the console device. These
+are all optional, they only control the appearance of text output. If
+such control is desired then the relevant options should appear in the
+body of a <command>synth_device</command> entry:
+ </para>
+ <programlisting>
+synth_device console {
+ &hellip;
+}
+</programlisting>
+ <para>
+The first option is <command>appearance</command>, used to control the
+appearance of any text generated by the eCos application that does not
+match one of the installed filters. This option takes the same
+argument as any other filter, for example:
+ </para>
+ <programlisting>
+synth_device console {
+ appearance -foreground white -background black
+ &hellip;
+}
+</programlisting>
+ <para>
+Any number of additional filters can be created with a
+<command>filter</command> option, for example:
+ </para>
+ <programlisting>
+synth_device console {
+ &hellip;
+ filter trace {^TRACE:.*} -foreground HotPink1 -hide 1
+ &hellip;
+}
+</programlisting>
+ <para>
+The first argument gives the new filter a name which will be used in
+the <link linkend="synth-gui-text">filters dialog</link>. Filter names
+should be unique. The second argument is a Tcl regular expression. The
+console support will match each line of eCos output against this
+regular expression, and if a match is found then the filter will be
+used for this line of text. The above example matches any line of
+output that begins with <literal>TRACE:</literal>, which corresponds
+to the eCos infrastructure's tracing facilities. The remaining options
+control the desired appearance for matched text. If some eCos output
+matches the regular expressions for several different filters then
+only the first match will be used.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-console-target-config"><title>Target-side
+ Configuration Options</title>
+ <para>
+There are no target-side configuration options related to the console
+device.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-console-arguments"><title>Command Line Arguments</title>
+ <para>
+The console device does not use any command-line arguments.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-console-hooks"><title>Hooks</title>
+ <para>
+The console device does not provide any hooks.
+ </para>
+ </refsect1>
+
+ <refsect1><title>Additional Tcl Procedures</title>
+ <para>
+The console device does not provide any additional Tcl procedures that
+can be used by other scripts.
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- }}} -->
+<!-- {{{ System calls -->
+
+<refentry id="synth-syscalls">
+ <refmeta>
+ <refentrytitle>System Calls</refentrytitle>
+ </refmeta>
+
+ <refnamediv>
+ <refname>cyg_hal_sys_xyz</refname>
+ <refpurpose>Access Linux system facilities</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcsynopsisinfo>
+#include &lt;cyg/hal/hal_io.h&gt;
+ </funcsynopsisinfo>
+ <funcprototype>
+ <funcdef>int <function>cyg_hal_sys_xyzzy</function></funcdef>
+ <varargs>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1 id="synth-syscalls-description"><title>Description</title>
+ <para>
+On a real embedded target eCos interacts with the hardware by peeking
+and poking various registers, manipulating special regions of memory,
+and so on. The synthetic target does not access hardware directly.
+Instead I/O and other operations are emulated by making appropriate
+Linux system calls. The HAL package exports a number of functions
+which allow other packages, or even application code, to make these
+same system calls. However this facility must be used with care: any
+code which calls, for example, <function>cyg_hal_sys_write</function>
+will only ever run on the synthetic target; that functionality is
+obviously not provided on any real hardware because there is no
+underlying Linux kernel to implement it.
+ </para>
+ <para>
+The synthetic target only provides a subset of the available system
+calls, specifically those calls which have proved useful to implement
+I/O emulation. This subset can be extended fairly easily if necessary.
+All of the available calls, plus associated data structures and
+macros, are defined in the header file <filename
+class="headerfile">cyg/hal/hal_io.h</filename>. There is a simple
+convention: given a Linux system call such as
+<function>open</function>, the synthetic target will prefix
+<literal>cyg_hal_sys</literal> and provide a function with that name.
+The second argument to the <function>open</function> system call is
+a set of flags such as <constant>O_RDONLY</constant>, and the header
+file will define a matching constant
+<constant>CYG_HAL_SYS_O_RDONLY</constant>. There are also data
+structures such as <structname>cyg_hal_sys_sigset_t</structname>,
+matching the Linux data structure <structname>sigset_t</structname>.
+ </para>
+ <para>
+In most cases the functions provided by the synthetic target behave as
+per the documentation for the Linux system calls, and section 2 of the
+Linux man pages can be consulted for more information. There is one
+important difference: typically the documentation will say that a
+function returns <literal>-1</literal> to indicate an error, with the
+actual error code held in <varname>errno</varname>; the actual
+underlying system call and hence the
+<function>cyg_hal_sys_xyz</function> provided by eCos instead returns
+a negative number to indicate an error, with the absolute value of
+that number corresponding to the error code; usually it is the C
+library which handles this and manipulates errno, but of course
+synthetic target applications are not linked with that Linux library.
+ </para>
+ <para>
+However, there are some exceptions. The Linux kernel has evolved over
+the years, and some of the original system call interfaces are no
+longer appropriate. For example the original
+<function>select</function> system call has been superseded by
+<function>_newselect</function>, and that is what the
+<function>select</function> function in the C library actually uses.
+The old call is still available to preserve binary compatibility but,
+like the C library, eCos makes use of the new one because it provides
+the appropriate functionality. In an attempt to reduce confusion the
+eCos function is called <function>cyg_hal_sys__newselect</function>,
+in other words it matches the official system call naming scheme. The
+authoritive source of information on such matters is the Linux kernel
+sources themselves, and especially its header files.
+ </para>
+ <para>
+eCos packages and applications should never
+<literal>#include</literal> Linux header files directly. For example,
+doing a <literal>#include&nbsp;&lt;/usr/include/fcntl.h&gt;</literal>
+to access additional macros or structure definitions, or alternatively
+manipulating the header file search path, will lead to problems
+because the Linux header files are likely to duplicate and clash with
+definitions in the eCos headers. Instead the appropriate functionality
+should be extracted from the Linux headers and moved into either
+<filename class="headerfile">cyg/hal/hal_io.h</filename> or into
+application code, with suitable renaming to avoid clashes with eCos
+names. Users should be aware that large-scale copying may involve
+licensing complications.
+ </para>
+ <para>
+Adding more system calls is usually straightforward and involves
+adding one or more lines to the platform-specific file in the
+appropriate platform HAL, for example
+<filename>syscall-i386-linux-1.0.S</filename>. However it is necessary
+to do some research first about the exact interface implemented by the
+system call, because of issues such as old system calls that have been
+superseded. The required information can usually be found fairly
+easily by searching through the Linux kernel sources and possibly the
+GNU C library sources.
+ </para>
+ </refsect1>
+</refentry>
+
+<!-- }}} -->
+<!-- {{{ New devices - target-side -->
+
+<refentry id="synth-new-target">
+ <refmeta>
+ <refentrytitle>Writing New Devices - target</refentrytitle>
+ </refmeta>
+ <refnamediv>
+ <refname>Writing New Devices</refname>
+ <refpurpose>extending the synthetic target, target-side</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcsynopsisinfo>
+#include &lt;cyg/hal/hal_io.h&gt;
+ </funcsynopsisinfo>
+
+ <funcprototype>
+ <funcdef>int <function>synth_auxiliary_instantiate</function></funcdef>
+ <paramdef>const char* <parameter>package</parameter></paramdef>
+ <paramdef>const char* <parameter>version</parameter></paramdef>
+ <paramdef>const char* <parameter>device</parameter></paramdef>
+ <paramdef>const char* <parameter>instance</parameter></paramdef>
+ <paramdef>const char* <parameter>data</parameter></paramdef>
+ </funcprototype>
+ <funcprototype>
+ <funcdef>void <function>synth_auxiliary_xchgmsg</function></funcdef>
+ <paramdef>int <parameter>device_id</parameter></paramdef>
+ <paramdef>int <parameter>request</parameter></paramdef>
+ <paramdef>int <parameter>arg1</parameter></paramdef>
+ <paramdef>int <parameter>arg2</parameter></paramdef>
+ <paramdef>const unsigned char* <parameter>txdata</parameter></paramdef>
+ <paramdef>int <parameter>txlen</parameter></paramdef>
+ <paramdef>int* <parameter>reply</parameter></paramdef>
+ <paramdef>unsigned char* <parameter>rxdata</parameter></paramdef>
+ <paramdef>int* <parameter>rxlen</parameter></paramdef>
+ <paramdef>int <parameter>max_rxlen</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1 id="synth-new-target-description"><title>Description</title>
+ <para>
+In some ways writing a device driver for the synthetic target is very
+similar to writing one for a real target. Obviously it has to provide
+the standard interface for that class of device, so for example an
+ethernet device has to provide <function>can_send</function>,
+<function>send</function>, <function>recv</function> and similar
+functions. Many devices will involve interrupts, so the driver
+contains ISR and DSR functions and will call
+<function>cyg_drv_interrupt_create</function>,
+<function>cyg_drv_interrupt_acknowledge</function>, and related
+functions.
+ </para>
+ <para>
+In other ways writing a device driver for the synthetic target is very
+different. Usually the driver will not have any direct access to the
+underlying hardware. In fact for some devices the I/O may not involve
+real hardware, instead everything is emulated by widgets on the
+graphical display. Therefore the driver cannot just peek and poke
+device registers, instead it must interact with host-side code by
+exchanging message. The synthetic target HAL provides a function
+<function>synth_auxiliary_xchgmsg</function> for this purpose.
+ </para>
+ <para>
+Initialization of a synthetic target device driver is also very
+different. On real targets the device hardware already exists when the
+driver's initialization routine runs. On the synthetic target it is
+first necessary to instantiate the device inside the I/O auxiliary, by
+a call to <function>synth_auxiliary_instantiate</function>. That
+function performs a special message exchange with the I/O auxiliary,
+causing it to load a Tcl script for the desired type of device and run
+an instantiation procedure within that script.
+ </para>
+ <para>
+Use of the I/O auxiliary is optional: if the user does not specify
+<option>--io</option> on the command line then the auxiliary will not
+be started and hence most I/O operations will not be possible. Device
+drivers should allow for this possibility, for example by just
+discarding any data that gets written. The HAL exports a flag
+<varname>synth_auxiliary_running</varname> which should be checked.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-new-target-instantiate"><title>Instantiating a Device</title>
+ <para>
+Device instantiation should happen during the C++ prioritized static
+constructor phase of system initialization, before control switches to
+<function>cyg_user_start</function> and general application code. This
+ensures that there is a clearly defined point at which the I/O
+auxiliary knows that all required devices have been loaded. It can
+then perform various consistency checks and clean-ups, run the user's
+<filename>mainrc.tcl</filename> script, and make the main window
+visible.
+ </para>
+ <para>
+For standard devices generic eCos I/O code will call the device
+initialization routines at the right time, iterating through the
+<varname>DEVTAB</varname> table in a static constructor. The same
+holds for network devices and file systems. For more custom devices
+code like the following can be used:
+ </para>
+ <programlisting>
+#include &lt;cyg/infra/cyg_type.h&gt;
+class mydev_init {
+ public:
+ mydev_init() {
+ &hellip;
+ }
+};
+static mydev_init mydev_init_object CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO);
+</programlisting>
+ <para>
+Some care has to be taken because the object
+<varname>mydev_init_object</varname> will typically not be referenced
+by other code, and hence may get eliminated at link-time. If the code
+is part of an eCos package then problems can be avoided by putting the
+relevant file in <filename>libextras.a</filename>:
+ </para>
+ <programlisting>
+cdl_package CYGPKG_DEVS_MINE {
+ &hellip;
+ compile -library=libextras.a init.cxx
+}
+</programlisting>
+ <para>
+For devices inside application code the same can be achieved by
+linking the relevant module as a <filename>.o</filename> file rather
+than putting it in a <filename>.a</filename> library.
+ </para>
+ <para>
+In the device initialization routine the main operation is a call to
+<function>synth_auxiliary_instantiate</function>. This takes five
+arguments, all of which should be strings:
+ </para>
+ <variablelist>
+ <varlistentry>
+ <term><varname>package</varname></term>
+ <listitem><para>
+For device drivers which are eCos packages this should be a directory
+path relative to the eCos repository, for example
+<literal>devs/eth/synth/ecosynth</literal>. This will allow the I/O
+auxiliary to find the various host-side support files for this package
+within the install tree. If the device is application-specific and not
+part of an eCos package then a NULL pointer can be used, causing the
+I/O auxiliary to search for the support files in the current directory
+and then in <filename class="directory">~/.ecos/synth</filename>
+instead.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><varname>version</varname></term>
+ <listitem><para>
+For eCos packages this argument should be the version of the package
+that is being used, for example <literal>current</literal>. A simple
+way to get this version is to use the
+<function>SYNTH_MAKESTRING</function> macro on the package name.
+If the device is application-specific then a NULL pointer should be
+used.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><varname>device</varname></term>
+ <listitem><para>
+This argument specifies the type of device being instantiated, for
+example <literal>ethernet</literal>. More specifically the I/O
+auxiliary will append a <filename>.tcl</filename> suffix, giving
+the name of a Tcl script that will handle all I/O requests for the
+device. If the application requires several instances of a type
+of device then the script will only be loaded once, but the script
+will contain an instantiation procedure that will be called for each
+device instance.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><varname>instance</varname></term>
+ <listitem><para>
+If it is possible to have multiple instances of a device then this
+argument identifies the particular instance, for example
+<literal>eth0</literal> or <literal>eth1</literal>. Otherwise a NULL
+pointer can be used.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><varname>data</varname></term>
+ <listitem><para>
+This argument can be used to pass additional initialization data from
+eCos to the host-side support. This is useful for devices where eCos
+configury must control certain aspects of the device, rather than
+host-side configury such as the target definition file, because eCos
+has compile-time dependencies on some or all of the relevant options.
+An example might be an emulated frame buffer where eCos has been
+statically configured for a particular screen size, orientation and
+depth. There is no fixed format for this string, it will be
+interpreted only by the device-specific host-side Tcl script. However
+the string length should be limited to a couple of hundred bytes to
+avoid possible buffer overflow problems.
+ </para></listitem>
+ </varlistentry>
+ </variablelist>
+ <para>
+Typical usage would look like:
+ </para>
+ <programlisting>
+ if (!synth_auxiliary_running) {
+ return;
+ }
+ id = synth_auxiliary_instantiate("devs/eth/synth/ecosynth",
+ SYNTH_MAKESTRING(CYGPKG_DEVS_ETH_ECOSYNTH),
+ "ethernet",
+ "eth0",
+ (const char*) 0);
+</programlisting>
+ <para>
+The return value will be a device identifier which can be used for
+subsequent calls to <function>synth_auxiliary_xchgmsg</function>. If
+the device could not be instantiated then <literal>-1</literal> will
+be returned. It is the responsibility of the host-side software to
+issue suitable diagnostics explaining what went wrong, so normally the
+target-side code should fail silently.
+ </para>
+ <para>
+Once the desired device has been instantiated, often it will be
+necessary to do some additional initialization by a message exchange.
+For example an ethernet device might need information from the
+host-side about the MAC address, the <link
+linkend="synth-new-target-interrupts">interrupt vector</link>, and
+whether or not multicasting is supported.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-new-target-xchgmsg"><title>Communicating with a Device</title>
+ <para>
+Once a device has been instantiated it is possible to perform I/O by
+sending messages to the appropriate Tcl script running inside the
+auxiliary, and optionally getting back replies. I/O operations are
+always initiated by the eCos target-side, it is not possible for the
+host-side software to initiate data transfers. However the host-side
+can raise interrupts, and the interrupt handler inside the target can
+then exchange one or more messages with the host.
+ </para>
+ <para>
+There is a single function to perform I/O operations,
+<function>synth_auxiliary_xchgmsg</function>. This takes the following
+arguments:
+ </para>
+ <variablelist>
+ <varlistentry>
+ <term><varname>device_id</varname></term>
+ <listitem><para>
+This should be one of the identifiers returned by a previous
+call to <function>synth_auxiliary_instantiate</function>, specifying the
+particular device which should perform some I/O.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><varname>request</varname></term>
+ <listitem><para>
+Request are just signed 32-bit integers that identify the particular
+I/O operation being requested. There is no fixed set of codes, instead
+each type of device can define its own.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><varname>arg1</varname></term>
+ <term><varname>arg2</varname></term>
+ <listitem><para>
+For some requests it is convenient to pass one or two additional
+parameters alongside the request code. For example an ethernet device
+could define a multicast-all request, with <varname>arg1</varname>
+controlling whether this mode should be enabled or disabled. Both
+<varname>arg1</varname> and <varname>arg2</varname> should be signed
+32-bit integers, and their values are interpreted only by the
+device-specific Tcl script.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><varname>txdata</varname></term>
+ <term><varname>txlen</varname></term>
+ <listitem><para>
+Some I/O operations may involve sending additional data, for example
+an ethernet packet. Alternatively a control operation may require many
+more parameters than can easily be encoded in <varname>arg1</varname>
+and <varname>arg2</varname>, so those parameters have to be placed in
+a suitable buffer and extracted at the other end.
+<varname>txdata</varname> is an arbitrary buffer of
+<varname>txlen</varname> bytes that should be sent to the host-side.
+There is no specific upper bound on the number of bytes that can be
+sent, but usually it is a good idea to allocate the transmit buffer
+statically and keep transfers down to at most several kilobytes.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><varname>reply</varname></term>
+ <listitem><para>
+If the host-side is expected to send a reply message then
+<varname>reply</varname> should be a pointer to an integer variable
+and will be updated with a reply code, a simple 32-bit integer. The
+synthetic target HAL code assumes that the host-side and target-side
+agree on the protocol being used: if the host-side will not send a
+reply to this message then the <varname>reply</varname> argument
+should be a NULL pointer; otherwise the host-side must always send
+a reply code and the <varname>reply</varname> argument must be valid.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><varname>rxdata</varname></term>
+ <term><varname>rxlen</varname></term>
+ <listitem><para>
+Some operations may involve additional data coming from the host-side,
+for example an incoming ethernet packet. <varname>rxdata</varname>
+should be a suitably-sized buffer, and <varname>rxlen</varname> a
+pointer to an integer variable that will end up containing the number
+of bytes that were actually received. These arguments will only be
+used if the host-side is expected to send a reply and hence the
+<varname>reply</varname> argument was not NULL.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><varname>max_rxlen</varname></term>
+ <listitem><para>
+If a reply to this message is expected and that reply may involve
+additional data, <varname>max_rxlen</varname> limits the size of that
+reply. In other words, it corresponds to the size of the
+<varname>rxdata</varname> buffer.
+ </para></listitem>
+ </varlistentry>
+ </variablelist>
+ <para>
+Most I/O operations involve only some of the arguments. For example
+transmitting an ethernet packet would use the
+<varname>request</varname>, <varname>txdata</varname> and
+<varname>txlen</varname> fields (in addition to
+<varname>device_id</varname> which is always required), but would not
+involve <varname>arg1</varname> or <varname>arg2</varname> and no
+reply would be expected. Receiving an ethernet packet would involve
+<varname>request</varname>, <varname>rxdata</varname>,
+<varname>rxlen</varname> and <varname>max_rxlen</varname>; in addition
+<varname>reply</varname> is needed to get any reply from the host-side
+at all, and could be used to indicate whether or not any more packets
+are buffered up. A control operation such as enabling multicast mode
+would involve <varname>request</varname> and <varname>arg1</varname>,
+but none of the remaining arguments.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-new-target-interrupts"><title>Interrupt Handling</title>
+ <para>
+Interrupt handling in the synthetic target is much the same as on a
+real target. An interrupt object is created using
+<function>cyg_drv_interrupt_create</function>, attached, and unmasked.
+The emulated device - in other words the Tcl script running inside the
+I/O auxiliary - can raise an interrupt. Subject to interrupts being
+disabled and the appropriate vector being masked, the system will
+invoke the specified ISR function. The synthetic target HAL
+implementation does have some limitations: there is no support for
+nested interrupts, interrupt priorities, or a separate interrupt
+stack. Supporting those might be appropriate when targetting a
+simulator that attempts to model real hardware accurately, but not for
+the simple emulation provided by the synthetic target.
+ </para>
+ <para>
+Of course the actual implementation of the ISR and DSR functions will
+be rather different for a synthetic target device driver. For real
+hardware the device driver will interact with the device by reading
+and writing device registers, managing DMA engines, and the like. A
+synthetic target driver will instead call
+<function>synth_auxiliary_xchgmsg</function> to perform the I/O
+operations.
+ </para>
+ <para>
+There is one other significant difference between interrupt handling
+on the synthetic target and on real hardware. Usually the eCos code
+will know which interrupt vectors are used for which devices. That
+information is fixed when the target hardware is designed. With the
+synthetic target interrupt vectors are assigned to devices on the host
+side, either via the target definition file or dynamically when the
+device is instantiated. Therefore the initialization code for a
+target-side device driver will need to request interrupt vector
+information from the host-side, via a message exchange. Such interrupt
+vectors will be in the range 1 to 31 inclusive, with interrupt 0 being
+reserved for the real-time clock.
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- }}} -->
+<!-- {{{ New devices - host-side -->
+
+<refentry id="synth-new-host">
+ <refmeta>
+ <refentrytitle>Writing New Devices - host</refentrytitle>
+ </refmeta>
+ <refnamediv>
+ <refname>Writing New Devices</refname>
+ <refpurpose>extending the synthetic target, host-side</refpurpose>
+ </refnamediv>
+
+ <refsect1 id="synth-new-host-description"><title>Description</title>
+ <para>
+On the host-side adding a new device means writing a Tcl/Tk script
+that will handle instantiation and subsequent requests from the
+target-side. These scripts all run in the same full interpreter,
+extended with various commands provided by the main I/O auxiliary
+code, and running in an overall GUI framework. Some knowledge of
+programming with Tcl/Tk is required to implement host-side device
+support.
+ </para>
+ <para>
+Some devices can be implemented entirely using a Tcl/Tk script. For
+example, if the final system will have some buttons then those can be
+emulated in the synthetic target using a few Tk widgets. A simple
+emulation could just have the right number of buttons in a row. A more
+advanced emulation could organize the buttons with the right layout,
+perhaps even matching the colour scheme, the shapes, and the relative
+sizes. With other devices it may be necessary for the Tcl script to
+interact with an external program, because the required functionality
+cannot easily be accessed from a Tcl script. For example interacting
+with a raw ethernet device involves some <function>ioctl</function>
+calls, which is easier to do in a C program. Therefore the
+<filename>ethernet.tcl</filename> script which implements the
+host-side ethernet support spawns a separate program
+<filename>rawether</filename>, written in C, that performs the
+low-level I/O. Raw ethernet access usually also requires root
+privileges, and running a small program <filename>rawether</filename>
+with such privileges is somewhat less of a security risk than the
+whole eCos application, the I/O auxiliary, and various dynamically
+loaded Tcl scripts.
+ </para>
+ <para>
+Because all scripts run in a single interpreter, some care has
+to be taken to avoid accidental sharing of global variables. The best
+way to avoid problems is to have each script create its own Tcl
+namespace, so for example the <filename>ethernet.tcl</filename> script
+creates a namespace <varname>ethernet::</varname> and all variables
+and procedures reside in this namespace. Similarly the I/O auxiliary
+itself makes use of a <varname>synth::</varname> namespace.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-new-host-build"><title>Building and Installation</title>
+ <para>
+When an eCos device driver or application code instantiates a device,
+the I/O auxiliary will attempt to load a matching Tcl script. The
+third argument to <function>synth_auxiliary_instantiate</function>
+specifies the type of device, for example <literal>ethernet</literal>,
+and the I/O auxiliary will append a <filename>.tcl</filename> suffix
+and look for a script <filename>ethernet.tcl</filename>.
+ </para>
+ <para>
+If the device being instantiated is application-specific rather than
+part of an eCos package, the I/O auxiliary will look first in the
+current directory, then in <filename
+class="directory">~/.ecos/synth</filename>. If it is part of an eCos
+package then the auxiliary will expect to find the Tcl script and any
+support files below <filename
+class="directory">libexec/ecos</filename> in the install tree - note
+that the same install tree must be used for the I/O auxiliary itself
+and for any device driver support. The directory hierarchy below
+<filename class="directory">libexec/ecos</filename> matches the
+structure of the eCos repository, allowing multiple versions of a
+package to be installed to allow for incompatible protocol changes.
+ </para>
+ <para>
+The preferred way to build host-side software is to use
+<command>autoconf</command> and <command>automake</command>. Usually
+this involves little more than copying the
+<filename>acinclude.m4</filename>, <filename>configure.in</filename>
+and <filename>Makefile.am</filename> files from an existing package,
+for example the synthetic target ethernet driver, and then making
+minor edits. In <filename>acinclude.m4</filename> it may be necessary
+to adjust the path to the root of the repository.
+<filename>configure.in</filename> may require a similar change, and
+the <function>AC_INIT</function> macro invocation will have to be
+changed to match one of the files in the new package. A critical macro
+in this file is <filename>ECOS_PACKAGE_DIRS</filename> which will set
+up the correct install directory. <filename>Makefile.am</filename> may
+require some more changes, for example to specify the data files that
+should be installed (including the Tcl script). These files should
+then be processed using <command>aclocal</command>,
+<command>autoconf</command> and <command>automake</command> in that
+order. Actually building the software then just involves
+<command>configure</command>, <command>make</command> and
+<command>make install</command>, as per the instructions in the
+toplevel <filename>README.host</filename> file.
+ </para>
+ <para>
+To assist developers, if the environment variable
+<envar>ECOSYNTH_DEVEL</envar> is set then a slightly different
+algorithm is used for locating device Tcl scripts. Instead of looking
+only in the install tree the I/O auxiliary will also look in the
+source tree, and if the script there is more recent than the installed
+version it will be used in preference. This allows developers to
+modify the master copy without having to run <command>make
+install</command> all the time.
+ </para>
+ <para>
+If a script needs to know where it has been installed it can examine
+the Tcl variable <varname>synth::device_install_dir</varname> . This
+variable gets updated whenever a script is loaded, so if the
+value may be needed later it should be saved away in a device-specific
+variable.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-new-host-instantiation"><title>Instantiation</title>
+ <para>
+The I/O auxiliary will <command>source</command> the device-specific
+Tcl script when the eCos application first attempts to instantiate a
+device of that type. The script should return a procedure that will be
+invoked to instantiate a device.
+ </para>
+ <programlisting>
+namespace eval ethernet {
+ &hellip;
+ proc instantiate { id instance data } {
+ &hellip;
+ return ethernet::handle_request
+ }
+}
+return ethernet::instantiate
+</programlisting>
+ <para>
+The <varname>id</varname> argument is a unique identifier for this
+device instance. It will also be supplied on subsequent calls to the
+request handler, and will match the return value of
+<function>synth_auxiliary_instantiate</function> on the target side. A
+common use for this value is as an array index to support multiple
+instances of this types of device. The <varname>instance</varname> and
+<varname>data</varname> arguments match the corresponding arguments to
+<function>synth_auxiliary_instantiate</function> on the target side, so
+a typical value for <varname>instance</varname> would be
+<literal>eth0</literal>, and <varname>data</varname> is used to pass
+arbitrary initialization parameters from target to host.
+ </para>
+ <para>
+The actual work done by the instantiation procedure is obviously
+device-specific. It may involve allocating an <link
+linkend="synth-new-host-interrupts">interrupt vector</link>, adding a
+device-specific subwindow to the display, opening a real Linux device,
+establishing a socket connection to some server, spawning a separate
+process to handle the actual I/O, or a combination of some or all of
+the above.
+ </para>
+ <para>
+If the device is successfully instantiated then the return value
+should be a handler for subsequent I/O requests. Otherwise the return
+value should be an empty string, and on the target-side the
+<function>synth_auxiliary_instantiate</function> call will return
+<literal>-1</literal>. The script is responsible for providing
+<link linkend="synth-new-host-output">diagnostics</link> explaining
+why the device could not be instantiated.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-new-host-requests"><title>Handling Requests</title>
+ <para>
+When the target-side calls
+<function>synth_auxiliary_xchgmsg</function>, the I/O auxiliary will
+end up calling the request handler for the appropriate device instance
+returned during instantiation:
+ </para>
+ <programlisting>
+namespace eval ethernet {
+ &hellip;
+ proc handle_request { id request arg1 arg2 txdata txlen max_rxlen } {
+ &hellip;
+ if { &lt;some condition&gt; } {
+ synth::send_reply &lt;error code&gt; 0 ""
+ return
+ }
+ &hellip;
+ synth::send_reply &lt;reply code&gt; $packet_len $packet
+ }
+ &hellip;
+}
+</programlisting>
+ <para>
+The <varname>id</varname> argument is the same device id that was
+passed to the instantiate function, and is typically used as an array
+index to access per-device data. The <varname>request</varname>,
+<varname>arg1</varname>, <varname>arg2</varname>, and
+<varname>max_rxlen</varname> are the same values that were passed to
+<function>synth_auxiliary_xchgmsg</function> on the target-side,
+although since this is a Tcl script obviously the numbers have been
+converted to strings. The <varname>txdata</varname> buffer is raw data
+as transmitted by the target, or an empty string if the I/O operation
+does not involve any additional data. The Tcl procedures
+<command>binary scan</command>, <command>string index</command> and
+<command>string range</command> may be found especially useful when
+manipulating this buffer. <varname>txlen</varname> is provided for
+convenience, although <command>string length $txdata</command> would
+give the same information.
+ </para>
+ <para>
+The code for actually processing the request is of course device
+specific. If the target does not expect a reply then the request
+handler should just return when finished. If a reply is expected then
+there should be a call to <command>synth::send_reply</command>. The
+first argument is the reply code, and will be turned into a 32-bit
+integer on the target side. The second argument specifies the length
+of the reply data, and the third argument is the reply data itself.
+For some devices the Tcl procedure <command>binary format</command>
+may prove useful. If the reply involves just a code and no additional
+data, the second and third arguments should be <literal>0</literal>
+and an empty string respectively.
+ </para>
+ <para>
+Attempts to send a reply when none is expected, fail to send a reply
+when one is expected, or send a reply that is larger than the
+target-side expects, will all be detected by the I/O auxiliary and
+result in run-time error messages.
+ </para>
+ <para>
+It is not possible for the host-side code to send unsolicited messages
+to the target. If host-side code needs attention from the target, for
+example because some I/O operation has completed, then an interrupt
+should be raised.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-new-host-interrupts"><title>Interrupts</title>
+ <para>
+The I/O auxiliary provides a number of procedures for interrupt
+handling.
+ </para>
+ <programlisting>
+synth::interrupt_allocate &lt;name&gt;
+synth::interrupt_get_max
+synth::interrupt_get_devicename &lt;vector&gt;
+synth::interrupt_raise &lt;vector&gt;
+</programlisting>
+ <para>
+<command>synth::interrupt_allocate</command> is normally called during
+device instantiation, and returns the next free interrupt vector. This
+can be passed on to the target-side device driver in response to a
+suitable request, and it can then install an interrupt handler on that
+vector. Interrupt vector <literal>0</literal> is used within the
+target-side code for the real-time clock, so the allocated vectors
+will start at <literal>1</literal>. The argument identifies the
+device, for example <literal>eth0</literal>. This is not actually used
+internally, but can be accessed by user-initialization scripts that
+provide some sort of interrupt monitoring facility (typically via the
+<literal>interrupt</literal> <link
+linkend="synth-new-host-hooks">hook</link>). It is possible for a
+single device to allocate multiple interrupt vectors, but the
+synthetic target supports a maximum of 32 such vectors.
+ </para>
+ <para>
+<command>synth::interrupt_get_max</command> returns the highest
+interrupt vector that has been allocated, or <literal>0</literal> if
+there have been no calls to
+<command>synth::interrupt_allocate</command>.
+<command>synth::interrupt_get_devicename</command> returns the string
+that was passed to <command>synth::interrupt_allocate</command> when
+the vector was allocated.
+ </para>
+ <para>
+<command>synth::interrupt_raise</command> can be called any time after
+initialization. The argument should be the vector returned by
+<command>synth::interrupt_allocate</command> for this device. It will
+activate the normal eCos interrupt handling mechanism so, subject to
+interrupts being enabled and this particular interrupt not being
+masked out, the appropriate ISR will run.
+ </para>
+ <note><para>
+At this time it is not possible for a device to allocate a specific
+interrupt vector. The order in which interrupt vectors are assigned to
+devices effectively depends on the order in which the eCos devices get
+initialized, and that may change if the eCos application is rebuilt. A
+future extension may allow devices to allocate specific vectors, thus
+making things more deterministic. However that will introduce new
+problems, in particular the code will have to start worrying about
+requests for vectors that have already been allocated.
+ </para></note>
+ </refsect1>
+
+ <refsect1 id="synth-new-host-args"><title>Flags and Command Line Arguments</title>
+ <para>
+The generic I/O auxiliary code will process the standard command line
+arguments, and will set various flag variables accordingly. Some of
+these should be checked by device-specific scripts.
+ </para>
+ <variablelist>
+ <varlistentry>
+ <term><varname>synth::flag_gui</varname></term>
+ <listitem><para>
+This is set when the I/O auxiliary is operating in graphical mode
+rather than text mode. Some functionality such as filters and the GUI
+layout are only available in graphical mode.
+ </para>
+ <programlisting>
+ if { $synth::flag_gui } {
+ &hellip;
+ }
+</programlisting></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><varname>synth::flag_verbose</varname></term>
+ <listitem><para>
+The user has requested additional information during startup. Each
+device driver can decide how much additional information, if any,
+should be produced.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><varname>synth::flag_keep_going</varname></term>
+ <listitem><para>
+The user has specified <option>-k</option> or
+<option>--keep-going</option>, so even if an error occurs the I/O
+auxiliary and the various device driver scripts should continue running
+if at all possible. Diagnostics should still be generated.
+ </para></listitem>
+ </varlistentry>
+ </variablelist>
+ <para>
+Some scripts may want to support additional command line arguments.
+This facility should be used with care since there is no way to
+prevent two different scripts from trying to use the same argument.
+The following Tcl procedures are available:
+ </para>
+ <programlisting>
+synth::argv_defined &lt;name&gt;
+synth::argv_get_value &lt;name&gt;
+</programlisting>
+ <para>
+<command>synth::argv_defined</command> returns a boolean to indicate
+whether or not a particular argument is present. If the argument is
+the name part of a name/value pair, an <literal>=</literal> character
+should be appended. Typical uses might be:
+ </para>
+ <programlisting>
+ if { [synth::argv_defined "-o13"] } {
+ &hellip;
+ }
+
+ if { [synth::argv_defined "-mark="] } {
+ &hellip;
+ }
+</programlisting>
+ <para>
+The first call checks for a flag <literal>-o13</literal> or
+<literal>--o13</literal> - the code treats options with single and
+double hyphens interchangeably. The second call checks for an argument
+of the form <literal>-mark=&lt;value&gt;</literal> or a pair of
+arguments <literal>-mark &lt;value&gt;</literal>. The value part of a
+name/value pair can be obtained using
+<command>synth::argv_get_value</command>;
+ </para>
+ <programlisting>
+ variable speed 1
+ if { [synth::argv_defined "-mark="] } {
+ set mark [synth::argv_get_value "-mark="]
+ if { ![string is integer $mark] || ($mark < 1) || ($mark > 9) } {
+ &lt;issue diagnostic&gt;
+ } else {
+ set speed $mark
+ }
+ }
+</programlisting>
+ <para>
+<command>synth::argv_get_value</command> should only be used after a
+successful call to <command>synth::argv_defined</command>.
+At present there is no support for some advanced forms of command line
+argument processing. For example it is not possible to repeat a
+certain option such as <option>-v</option> or
+<option>--verbose</option>, with each occurrence increasing the level
+of verbosity.
+ </para>
+ <para>
+If a script is going to have its own set of command-line arguments
+then it should give appropriate details if the user specifies
+<option>--help</option>. This involves a hook function:
+ </para>
+ <programlisting>
+namespace eval my_device {
+ proc help_hook { } {
+ puts " -o13 : activate the omega 13 device"
+ puts " -mark &lt;speed&gt; : set speed. Valid values are 1 to 9."
+ }
+
+ synth::hook_add "help" my_device::help_hook
+}
+</programlisting>
+ </refsect1>
+
+ <refsect1 id="synth-new-host-tdf"><title>The Target Definition File</title>
+ <para>
+Most device scripts will want to check entries in the target
+definition file for run-time configuration information. The Tcl
+procedures for this are as follows:
+ </para>
+ <programlisting>
+synth::tdf_has_device &lt;name&gt;
+synth::tdf_get_devices
+synth::tdf_has_option &lt;devname&gt; &lt;option&gt;
+synth::tdf_get_option &lt;devname&gt; &lt;option&gt;
+synth::tdf_get_options &lt;devname&gt; &lt;option&gt;
+synth::tdf_get_all_options &lt;devname&gt;
+</programlisting>
+ <para>
+<command>synth::tdf_has_device</command> can be used to check whether
+or not the target definition file had an entry
+<literal>synth_device&nbsp;&lt;name&gt;</literal>. Usually the name
+will match the type of device, so the
+<filename>console.tcl</filename> script will look for a target
+definition file entry <literal>console</literal>.
+<command>synth::tdf_get_devices</command> returns a list of all
+device entries in the target definition file.
+ </para>
+ <para>
+Once it is known that the target definition file has an entry for a
+certain device, it is possible to check for options within the entry.
+<command>synth::tdf_has_option</command> just checks for the presence,
+returning a boolean:
+ </para>
+ <programlisting>
+ if { [synth::tdf_has_option "console" "appearance"] } {
+ &hellip;
+ }
+</programlisting>
+ <para>
+<command>synth::tdf_get_option</command> returns a list of all the
+arguments for a given option. For example, if the target definition
+file contains an entry:
+ </para>
+ <programlisting>
+synth_device console {
+ appearance -foreground white -background black
+ filter trace {^TRACE:.*} -foreground HotPink1 -hide 1
+ filter xyzzy {.*xyzzy.*} -foreground PapayaWhip
+}
+</programlisting>
+ <para>
+A call
+<command>synth::tdf_get_option&nbsp;console&nbsp;appearance</command>
+will return the list <literal>{-foreground white -background
+black}</literal>. This list can be manipulated using standard Tcl routines
+such as <command>llength</command> and <command>lindex</command>. Some
+options can occur multiple times in one entry, for example
+<option>filter</option> in the <literal>console</literal> entry.
+<command>synth::tdf_get_options</command> returns a list of lists,
+with one entry for each option occurrence.
+<command>synth::tdf_get_all_options</command> returns a list of lists
+of all options. This time each entry will include the option name as
+well.
+ </para>
+ <para>
+The I/O auxiliary will not issue warnings about entries in the target
+definition file for devices which were not loaded, unless the
+<option>-v</option> or <option>--verbose</option> command line
+argument was used. This makes it easier to use a single target
+definition file for different applications. However the auxiliary will
+issue warnings about options within an entry that were ignored,
+because often these indicate a typing mistake of some sort. Hence a
+script should always call <command>synth::tdf_has_option</command>,
+<command>synth:;tdf_get_option</command> or
+<command>synth::tdf_get_options</command> for all valid options, even
+if some of the options preclude the use of others.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-new-host-hooks"><title>Hooks</title>
+ <para>
+Some scripts may want to take action when particular events occur, for
+example when the eCos application has exited and there is no need for
+further I/O. This is supported using hooks:
+ </para>
+ <programlisting>
+namespace eval my_device {
+ &hellip;
+ proc handle_ecos_exit { arg_list } {
+ &hellip;
+ }
+ synth::hook_add "ecos_exit" my_device::handle_ecos_exit
+}
+</programlisting>
+ <para>
+It is possible for device scripts to add their own hooks and call all
+functions registered for those hooks. A typical use for this is by
+user initialization scripts that want to monitor some types of I/O.
+The available Tcl procedures for manipulating hooks are:
+ </para>
+ <programlisting>
+synth::hook_define &lt;name&gt;
+synth::hook_defined &lt;name&gt;
+synth::hook_add &lt;name&gt; &lt;function&gt;
+synth::hook_call &lt;name&gt; &lt;args&gt;
+</programlisting>
+ <para>
+<command>synth::hook_define</command> creates a new hook with the
+specified name. This hook must not already exist.
+<command>synth::hook_defined</command> can be used to check for the
+existence of a hook. <command>synth::hook_add</command> allows other
+scripts to register a callback function for this hook, and
+<command>synth::hook_call</command> allows the owner script to invoke
+all such callback functions. A hook must already be defined before a
+callback can be attached. Therefore typically device scripts will only
+use standard hooks and their own hooks, not hooks created by some
+other device, because the order of device initialization is not
+sufficiently defined. User scripts run from
+<filename>mainrc.tcl</filename> can use any hooks that have been
+defined.
+ </para>
+ <para>
+<command>synth::hook_call</command> takes an arbitrary list of
+arguments, for example:
+ </para>
+ <programlisting>
+ synth::hook_call "ethernet_rx" "eth0" $packet
+</programlisting>
+ <para>
+The callback function will always be invoked with a single argument,
+a list of the arguments that were passed to
+<command>synth::hook_call</command>:
+ </para>
+ <programlisting>
+ proc rx_callback { arg_list } {
+ set device [lindex $arg_list 0]
+ set packet [lindex $arg_list 1]
+ }
+</programlisting>
+ <para>
+Although it might seem more appropriate to use Tcl's
+<command>eval</command> procedure and have the callback functions
+invoked with the right number of arguments rather than a single list,
+that would cause serious problems if any of the data contained special
+characters such as <literal>[</literal> or <literal>$</literal>. The
+current implementation of hooks avoids such problems, at the cost of
+minor inconvenience when writing callbacks.
+ </para>
+ <para>
+A number of hooks are defined as standard. Some devices will add
+additional hooks, and the device-specific documentation should be
+consulted for those. User scripts can add their own hooks if desired.
+ </para>
+ <variablelist>
+ <varlistentry>
+ <term><literal>exit</literal></term>
+ <listitem><para>
+This hook is called just before the I/O auxiliary exits. Hence it
+provides much the same functionality as <function>atexit</function> in
+C programs. The argument list passed to the callback function will be
+empty.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><literal>ecos_exit</literal></term>
+ <listitem><para>
+This hook is called when the eCos application has exited. It is used
+mainly to shut down I/O operations: if the application is no longer
+running then there is no point in raising interrupts or storing
+incoming packets. The callback argument list will be empty.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><literal>ecos_initialized</literal></term>
+ <listitem><para>
+The synthetic target HAL will send a request to the I/O auxiliary once
+the static constructors have been run. All devices should now have been
+instantiated. A script could now check how many instances there are of
+a given type of device, for example ethernet devices, and create a
+little monitor window showing traffic on all the devices. The
+<literal>ecos_initialized</literal> callbacks will be run just before
+the user's <filename>mainrc.tcl</filename> script. The callback
+argument list will be empty.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><literal>help</literal></term>
+ <listitem><para>
+This hook is also invoked once static constructors have been run, but
+only if the user specified <option>-h</option> or
+<option>--help</option>. Any scripts that add their own command line
+arguments should add a callback to this hook which outputs details of
+the additional arguments. The callback argument list will be empty.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><literal>interrupt</literal></term>
+ <listitem><para>
+Whenever a device calls <command>synth::interrupt_raise</command> the
+<literal>interrupt</literal> hook will be called with a single
+argument, the interrupt vector. The main use for this is to allow
+user scripts to monitor interrupt traffic.
+ </para></listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
+ <refsect1 id="synth-new-host-output"><title>Output and Filters</title>
+ <para>
+Scripts can use conventional facilities for sending text output to the
+user, for example calling <command>puts</command> or directly
+manipulating the central text widget
+<varname>.main.centre.text</varname>. However in nearly all cases it
+is better to use output facilities provided by the I/O auxiliary
+itself:
+ </para>
+ <programlisting>
+synth::report &lt;msg&gt;
+synth::report_warning &lt;msg&gt;
+synth::report_error &lt;msg&gt;
+synth::internal_error &lt;msg&gt;
+synth::output &lt;msg&gt; &lt;filter&gt;
+</programlisting>
+ <para>
+<command>synth::report</command> is intended for messages related to
+the operation of the I/O auxiliary itself, especially additional
+output resulting from <option>-v</option> or
+<option>--verbose</option>. If running in text mode the output will go
+to standard output. If running in graphical mode the output will go to
+the central text window. In both modes, use of <option>-l</option> or
+<option>--logfile</option> will modify the behaviour.
+ </para>
+ <para>
+<command>synth::report_warning</command>,
+<command>synth::report_error</command> and
+<command>synth::internal_error</command> have the obvious meaning,
+including prepending strings such as <literal>Warning:</literal> and
+<literal>Error:</literal>. When the eCos application informs the I/O
+auxiliary that all static constructors have run, if at that point
+there have been any calls to <command>synth::error</command> then the
+I/O auxiliary will exit. This can be suppressed with command line
+arguments <option>-k</option> or <option>--keep-going</option>.
+<command>synth::internal_error</command> will output some information
+about the current state of the I/O auxiliary and then exit
+immediately. Of course it should never be necessary to call this
+function.
+ </para>
+ <para>
+<command>synth::output</command> is the main routine for outputting
+text. The second argument identifies a filter. If running in text mode
+the filter is ignored, but if running in graphical mode the filter can
+be used to control the appearance of this output. A typical use would
+be:
+ </para>
+ <programlisting>
+ synth::output $line "console"
+</programlisting>
+ <para>
+This outputs a single line of text using the
+<literal>console</literal> filter. If running in graphical mode the
+default appearance of this text can be modified with the
+<option>appearance</option> option in the
+<command>synth_device&nbsp;console</command> entry of the target
+definition file. The <guimenuitem>System filters</guimenuitem> menu
+option can be used to change the appearance at run-time.
+ </para>
+ <para>
+Filters should be created before they are used. The procedures
+available for this are:
+ </para>
+ <programlisting>
+synth::filter_exists &lt;name&gt;
+synth::filter_get_list
+synth::filter_add &lt;name&gt; [options]
+synth::filter_parse_options &lt;options&gt; &lt;parsed_options&gt; &lt;message&gt;
+synth::filter_add_parsed &lt;name&gt; &lt;parsed_options&gt;
+</programlisting>
+ <para>
+<command>synth::filter_exists</command> can be used to check whether
+or not a particular filter already exists: creating two filters with
+the same name is not allowed.
+<command>synth::filter_get_list</command> returns a list of the
+current known filters. <command>synth::filter_add</command> can be
+used to create a new filter. The first argument names the new filter,
+and the remaining arguments control the initial appearance. A typical
+use might be:
+ </para>
+ <programlisting>
+ synth::filter_add "my_device_tx" -foreground yellow -hide 1
+</programlisting>
+ <para>
+It is assumed that the supplied arguments are valid, which typically
+means that they are hard-wired in the script. If instead the data
+comes out of a configuration file and hence may be invalid, the
+I/O auxiliary provides a parsing utility. Typical usage would be:
+ </para>
+ <programlisting>
+ array set parsed_options [list]
+ set message ""
+ if { ![synth::filter_parse_options $console_appearance parsed_options message] } {
+ synth::report_error \
+ "Invalid entry in target definition file $synth::target_definition\
+ \n synth_device \"console\", entry \"appearance\"\n$message"
+ } else {
+ synth::filter_add_parsed "console" parsed_options
+ }
+</programlisting>
+ <para>
+On success <varname>parsed_options</varname> will be updated with an
+internal representation of the desired appearance, which can then be
+used in a call to <command>synth::filter_add_parsed</command>. On
+failure <varname>message</varname> will be updated with details of the
+parsing error that occurred.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-new-host-gui"><title>The Graphical Interface</title>
+ <para>
+When the I/O auxiliary is running in graphical mode, many scripts will
+want to update the user interface in some way. This may be as simple
+as adding another entry to the help menu for the device, or adding a
+new button to the toolbar. It may also involve adding new subwindows,
+or even creating entire new toplevel windows. These may be simple
+monitor windows, displaying additional information about what is going
+on in the system in a graphical format. Alternatively they may emulate
+actual I/O operations, for example button widgets could be used to
+emulate real physical buttons.
+ </para>
+ <para>
+The I/O auxiliary does not provide many procedures related to the
+graphical interface. Instead it is expected that scripts will just
+update the widget hierarchy directly.
+ </para>
+ <informalfigure PgWide=1>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="layout.png" Scalefit=1 Align="Center">
+ </imageobject>
+ </mediaobject>
+ </informalfigure>
+ <para>
+So adding a new item to the <guimenu>Help</guimenu> menu involves a
+<command>.menubar.help&nbsp;add</command> operation with suitable
+arguments. Adding a new button to the toolbar involves creating a
+child window in <varname>.toolbar</varname> and packing it
+appropriately. Scripts can create their own subwindows and then pack
+it into one of <varname>.main.nw</varname>,
+<varname>.main.n</varname>, <varname>.main.ne</varname>,
+<varname>.main.w</varname>, <varname>.main.e</varname>,
+<varname>.main.sw</varname>, <varname>.main.s</varname> or
+<varname>.main.se</varname>. Normally the user should be allowed to
+<link linkend="synth-gui-layout">control</link> this via the target
+definition file. The central window <varname>.main.centre</varname>
+should normally be left alone by other scripts since it gets used for
+text output.
+ </para>
+ <para>
+The following graphics-related utilities may be found useful:
+ </para>
+ <programlisting>
+synth::load_image &lt;image name&gt; &lt;filename&gt;
+synth::register_ballon_help &lt;widget&gt; &lt;message&gt;
+synth::handle_help &lt;URL&gt;
+</programlisting>
+ <para>
+<command>synth::load_image</command> can be used to add a new image to
+the current interpreter. If the specified file has a
+<filename>.xbm</filename> extension then the image will be a
+monochrome bitmap, otherwise it will be a colour image of some sort.
+A boolean will be returned to indicate success or failure, and
+suitable diagnostics will be generated if necessary.
+ </para>
+ <para>
+<command>synth::register_balloon_help</command> provides balloon help
+for a specific widget, usually a button on the toolbar.
+ </para>
+ <para>
+<command>synth::handle_help</command> is a utility routine that can be
+installed as the command for displaying online help, for example:
+ </para>
+ <programlisting>
+ .menubar.help add command -label "my device" -command \
+ [list synth::handle_help "file://$path"]
+</programlisting>
+ </refsect1>
+
+</refentry>
+
+<!-- }}} -->
+<!-- {{{ Porting -->
+
+<refentry id="synth-porting">
+ <refmeta>
+ <refentrytitle>Porting</refentrytitle>
+ </refmeta>
+ <refnamediv>
+ <refname>Porting</refname>
+ <refpurpose>Adding support for other hosts</refpurpose>
+ </refnamediv>
+
+ <refsect1 id="synth-porting-description"><title>Description</title>
+ <para>
+The initial development effort of the eCos synthetic target happened
+on x86 Linux machines. Porting to other platforms involves addressing
+a number of different issues. Some ports should be fairly
+straightforward, for example a port to Linux on a processor other than
+an x86. Porting to Unix or Unix-like operating systems other than
+Linux may be possible, but would involve more effort. Porting to a
+completely different operating system such as Windows would be very
+difficult. The text below complements the eCos Porting Guide.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-porting-linux"><title>Other Linux Platforms</title>
+ <para>
+Porting the synthetic target to a Linux platform that uses a processor
+other than x86 should be straightforward. The simplest approach is to
+copy the existing <filename class="directory">i386linux</filename>
+directory tree in the <filename class="directory">hal/synth</filename>
+hierarchy, then rename and edit the ten or so files in this package.
+Most of the changes should be pretty obvious, for example on a 64-bit
+processor some new data types will be needed in the
+<filename>basetype.h</filename> header file. It will also be necessary
+to update the toplevel <filename>ecos.db</filename> database with an
+entry for the new HAL package, and a new target entry will be needed.
+ </para>
+ <para>
+Obviously a different processor will have different register sets and
+calling conventions, so the code for saving and restoring thread
+contexts and for implementing <function>setjmp</function> and
+<function>longjmp</function> will need to be updated. The exact way of
+performing Linux system calls will vary: on x86 linux this usually
+involves pushing some registers on the stack and then executing an
+<literal>int&nbsp;0x080</literal> trap instruction, but on a different
+processor the arguments might be passed in registers instead and
+certainly a different trap instruction will be used. The startup code
+is written in assembler, but needs to do little more than extract the
+process' argument and environment variables and then jump to the main
+<function>linux_entry</function> function provided by the
+architectural synthetic target HAL package.
+ </para>
+ <para>
+The header file <filename>hal_io.h</filename> provided by the
+architectural HAL package provides various structure definitions,
+function prototypes, and macros related to system calls. These are
+correct for x86 linux, but there may be problems on other processors.
+For example a structure field that is currently defined as a 32-bit
+number may in fact may be a 64-bit number instead.
+ </para>
+ <para>
+The synthetic target's memory map is defined in two files in the
+<filename class="directory">include/pkgconf</filename> subdirectory.
+For x86 the default memory map involves eight megabytes of read-only
+memory for the code at location 0x1000000 and another eight megabytes
+for data at 0x2000000. These address ranges may be reserved for other
+purposes on the new architecture, so may need changing. There may be
+some additional areas of memory allocated by the system for other
+purposes, for example the startup stack and any environment variables,
+but usually eCos applications can and should ignore those.
+ </para>
+ <para>
+Other HAL functionality such as interrupt handling, diagnostics, and
+the system clock are provided by the architectural HAL package and
+should work on different processors with few if any changes. There may
+be some problems in the code that interacts with the I/O auxiliary
+because of lurking assumptions about endianness or the sizes of
+various data types.
+ </para>
+ <para>
+When porting to other processors, a number of sources of information
+are likely to prove useful. Obviously the Linux kernel sources and
+header files constitute the ultimate authority on how things work at
+the system call level. The GNU C library sources may also prove very
+useful: for a normal Linux application it is the C library that
+provides the startup code and the system call interface.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-porting-unix"><title>Other Unix Platforms</title>
+ <para>
+Porting to a Unix or Unix-like operating system other than Linux would
+be somewhat more involved. The first requirement is toolchains: the
+GNU compilers, gcc and g++, must definitely be used; use of other GNU
+tools such as the linker may be needed as well, because eCos depends
+on functionality such as prioritizing C++ static constructors, and
+other linkers may not implement this or may implement it in a
+different and incompatible way. A closely related requirement is the
+use of ELF format for binary executables: if the operating system
+still uses an older format such as COFF then there are likely to be
+problems because they do not provide the flexibility required by eCos.
+ </para>
+ <para>
+In the architectural HAL there should be very little code that is
+specific to Linux. Instead the code should work on any operating
+system that provides a reasonable implementation of the POSIX
+standard. There may be some problems with program startup, but those
+could be handled at the architectural level. Some changes may also be
+required to the exception handling code. However one file which will
+present a problem is <filename>hal_io.h</filename>, which contains
+various structure definitions and macros used with the system call
+interface. It is likely that many of these definitions will need
+changing, and it may well be appropriate to implement variant HAL
+packages for the different operating systems where this information
+can be separated out. Another possible problem is that the generic
+code assumes that system calls such as
+<function>cyg_hal_sys_write</function> are available. On an operating
+system other than Linux it is possible that some of these are not
+simple system calls, and instead wrapper functions will need to be
+implemented at the variant HAL level.
+ </para>
+ <para>
+The generic I/O auxiliary code should be fairly portable to other Unix
+platforms. However some of the device drivers may contain code that is
+specific to Linux, for example the <literal>PF_PACKET</literal> socket
+address family and the ethertap virtual tunnelling interface. These
+may prove quite difficult to port.
+ </para>
+ <para>
+The remaining porting task is to implement one or more platform HAL
+packages, one per processor type that is supported. This should
+involve much the same work as a port to <link
+linkend="synth-porting-linux">another processor running Linux</link>.
+ </para>
+ <para>
+When using other Unix operating systems the kernel source code may not
+be available, which would make any porting effort more challenging.
+However there is still a good chance that the GNU C library will have
+been ported already, so its source code may contain much useful
+information.
+ </para>
+ </refsect1>
+
+ <refsect1 id="synth-porting-other"><title>Windows Platforms</title>
+ <para>
+Porting the current synthetic target code to some version of Windows
+or to another non-Unix platform is likely to prove very difficult. The
+first hurdle that needs to be crossed is the file format for binary
+executables: current Windows implementations do not use ELF, instead
+they use their own format PE which is a variant of the rather old and
+limited COFF format. It may well prove easier to first write an ELF
+loader for Windows executables, rather than try to get eCos to work
+within the constraints of PE. Of course that introduces new problems,
+for example existing source-level debuggers will still expect
+executables to be in PE format.
+ </para>
+ <para>
+Under Linux a synthetic target application is not linked with the
+system's C library or any other standard system library. That would
+cause confusion, for example both eCos and the system's C library
+might try to define the <function>printf</function> function, and
+introduce complications such as working with shared libraries. For
+much the same reasons, a synthetic target application under Windows
+should not be linked with any Windows DLL's. If an ELF loader has been
+specially written then this may not be much of a problem.
+ </para>
+ <para>
+The next big problem is the system call interface. Under Windows
+system calls are generally made via DLL's, and it is not clear that
+the underlying trap mechanism is well-documented or consistent between
+different releases of Windows.
+ </para>
+ <para>
+The current code depends on the operating system providing an
+implementation of POSIX signal handling. This is used for I/O
+purposes, for example <literal>SIGALRM</literal> is used for the
+system clock, and for exceptions. It is not known what equivalent
+functionality is available under Windows.
+ </para>
+ <para>
+Given the above problems a port of the synthetic target to Windows may
+or may not be technically feasible, but it would certainly require a
+very large amount of effort.
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- }}} -->
+
+</part>
diff --git a/ecos/packages/hal/synth/arch/current/host/Makefile.am b/ecos/packages/hal/synth/arch/current/host/Makefile.am
new file mode 100644
index 0000000..f74978e
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/Makefile.am
@@ -0,0 +1,89 @@
+## Process this file with automake to produce Makefile.in
+## =====================================================================
+##
+## Makefile.am
+##
+## Build support for the host-side synthetic target support,
+## the arch package.
+##
+##
+## =====================================================================
+# ####ECOSHOSTGPLCOPYRIGHTBEGIN####
+# -------------------------------------------
+# This file is part of the eCos host tools.
+# Copyright (C) 2002, 2003 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.
+# -------------------------------------------
+# ####ECOSHOSTGPLCOPYRIGHTEND####
+## =====================================================================
+#######DESCRIPTIONBEGIN####
+##
+## Author(s): bartv
+## Contact(s): bartv
+## Date: 2002/08/06
+## Version: 0.01
+##
+######DESCRIPTIONEND####
+## =====================================================================
+
+AUTOMAKE_OPTIONS = 1.10 foreign
+
+## Only some platforms are supported. Having the configure script throw
+## an error when attempting to configure on an unsupported platform
+## would be a mistake, since that would prevent any configury from
+## the toplevel on unsupported platforms. Instead an automake conditional
+## is used, leading to null makefiles on unsupported platforms.
+
+
+AM_CFLAGS = @ecos_CFLAGS@ -DECOSYNTH_VERSION=\"@VERSION@\" \
+ -DECOS_REPOSITORY=\"@ECOS_REPOSITORY@\" \
+ -DLIBEXECDIR=\"$(libexecdir)\" \
+ -DPKG_DIR=\"@PACKAGE_DIR@\" \
+ -DPKG_VERSION=\"@PACKAGE_VERSION@\" \
+ -DPKG_INSTALL=\"@PACKAGE_INSTALL@\"
+AM_CXXFLAGS = @ecos_CXXFLAGS@
+INCLUDES = @ecos_INCLUDES@ @ecos_tk_includes@
+LIBS = @ecos_LIBS@ @ecos_LDADD@
+
+if SUPPORTED
+## The synthetic target support consists of a single program ecosynth,
+## a number of Tcl scripts, and some additional data files. These are
+## all installed in a single directory $(libexec)/ecos/<package>_<version>/
+## Neither the ecosynth executable nor any of the scripts are directly
+## executable, instead ecosynth gets fork()'d/execve()'d by the eCos
+## application so $(libexec) is appropriate. Strictly speaking the
+## Tcl scripts and data files are architecture-independent so should
+## probably be installed in an analogous directory below $(datadir),
+## but that would add more directories for little real gain. The scripts
+## are treated as data files since they should not be executed directly,
+## i.e. they should not be installed with the execute bit set.
+
+synthdir = $(libexecdir)/ecos/@PACKAGE_INSTALL@
+synth_PROGRAMS = ecosynth
+synth_DATA = ecosynth.tcl default.tdf user_initrc.tcl user_mainrc.tcl \
+ console.tcl \
+ ecosicon.xbm ecosiconmask.xbm tick_yes.xbm tick_no.xbm \
+ save.xbm cut.xbm copy.xbm paste.xbm help.xbm running1.ppm \
+ saveall.xbm
+
+ecosynth_SOURCES = ecosynth.c
+ecosynth_LDADD = @ecos_tk_libs@
+
+## Manual dependencies
+ecosynth.$(OBJEXT) : Makefile ../src/synth_protocol.h
+
+endif
diff --git a/ecos/packages/hal/synth/arch/current/host/Makefile.in b/ecos/packages/hal/synth/arch/current/host/Makefile.in
new file mode 100644
index 0000000..a6bbf25
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/Makefile.in
@@ -0,0 +1,715 @@
+# Makefile.in generated by automake 1.11 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@
+
+# ####ECOSHOSTGPLCOPYRIGHTBEGIN####
+# -------------------------------------------
+# This file is part of the eCos host tools.
+# Copyright (C) 2002, 2003 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.
+# -------------------------------------------
+# ####ECOSHOSTGPLCOPYRIGHTEND####
+#######DESCRIPTIONBEGIN####
+######DESCRIPTIONEND####
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@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@
+@SUPPORTED_TRUE@synth_PROGRAMS = ecosynth$(EXEEXT)
+subdir = .
+DIST_COMMON = $(am__configure_deps) \
+ $(srcdir)/../../../../../../acsupport/config.guess \
+ $(srcdir)/../../../../../../acsupport/config.sub \
+ $(srcdir)/../../../../../../acsupport/depcomp \
+ $(srcdir)/../../../../../../acsupport/install-sh \
+ $(srcdir)/../../../../../../acsupport/missing \
+ $(srcdir)/../../../../../../acsupport/mkinstalldirs \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/configure ../../../../../../acsupport/ChangeLog \
+ ../../../../../../acsupport/config.guess \
+ ../../../../../../acsupport/config.sub \
+ ../../../../../../acsupport/depcomp \
+ ../../../../../../acsupport/install-sh \
+ ../../../../../../acsupport/ltconfig \
+ ../../../../../../acsupport/ltmain.sh \
+ ../../../../../../acsupport/missing \
+ ../../../../../../acsupport/mkinstalldirs
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/../../../../../../acsupport/acinclude.m4 \
+ $(top_srcdir)/configure.in
+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)/../../../../../../acsupport/mkinstalldirs
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(synthdir)" "$(DESTDIR)$(synthdir)"
+PROGRAMS = $(synth_PROGRAMS)
+am__ecosynth_SOURCES_DIST = ecosynth.c
+@SUPPORTED_TRUE@am_ecosynth_OBJECTS = ecosynth.$(OBJEXT)
+ecosynth_OBJECTS = $(am_ecosynth_OBJECTS)
+ecosynth_DEPENDENCIES =
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/../../../../../../acsupport/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(ecosynth_SOURCES)
+DIST_SOURCES = $(am__ecosynth_SOURCES_DIST)
+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 = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+DATA = $(synth_DATA)
+ETAGS = etags
+CTAGS = ctags
+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
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECOS_REPOSITORY = @ECOS_REPOSITORY@
+EXEEXT = @EXEEXT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @ecos_LIBS@ @ecos_LDADD@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MSVC_SRCDIR = @MSVC_SRCDIR@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_DIR = @PACKAGE_DIR@
+PACKAGE_INSTALL = @PACKAGE_INSTALL@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+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@
+ac_ct_CXX = @ac_ct_CXX@
+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@
+ecos_CFLAGS = @ecos_CFLAGS@
+ecos_CXXFLAGS = @ecos_CXXFLAGS@
+ecos_INCLUDES = @ecos_INCLUDES@
+ecos_LDADD = @ecos_LDADD@
+ecos_LIBS = @ecos_LIBS@
+ecos_tk_includes = @ecos_tk_includes@
+ecos_tk_libs = @ecos_tk_libs@
+exec_prefix = @exec_prefix@
+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@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.10 foreign
+AM_CFLAGS = @ecos_CFLAGS@ -DECOSYNTH_VERSION=\"@VERSION@\" \
+ -DECOS_REPOSITORY=\"@ECOS_REPOSITORY@\" \
+ -DLIBEXECDIR=\"$(libexecdir)\" \
+ -DPKG_DIR=\"@PACKAGE_DIR@\" \
+ -DPKG_VERSION=\"@PACKAGE_VERSION@\" \
+ -DPKG_INSTALL=\"@PACKAGE_INSTALL@\"
+
+AM_CXXFLAGS = @ecos_CXXFLAGS@
+INCLUDES = @ecos_INCLUDES@ @ecos_tk_includes@
+@SUPPORTED_TRUE@synthdir = $(libexecdir)/ecos/@PACKAGE_INSTALL@
+@SUPPORTED_TRUE@synth_DATA = ecosynth.tcl default.tdf user_initrc.tcl user_mainrc.tcl \
+@SUPPORTED_TRUE@ console.tcl \
+@SUPPORTED_TRUE@ ecosicon.xbm ecosiconmask.xbm tick_yes.xbm tick_no.xbm \
+@SUPPORTED_TRUE@ save.xbm cut.xbm copy.xbm paste.xbm help.xbm running1.ppm \
+@SUPPORTED_TRUE@ saveall.xbm
+
+@SUPPORTED_TRUE@ecosynth_SOURCES = ecosynth.c
+@SUPPORTED_TRUE@ecosynth_LDADD = @ecos_tk_libs@
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
+ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ $(am__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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ $(am__cd) $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
+install-synthPROGRAMS: $(synth_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(synthdir)" || $(MKDIR_P) "$(DESTDIR)$(synthdir)"
+ @list='$(synth_PROGRAMS)'; test -n "$(synthdir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(synthdir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(synthdir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-synthPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(synth_PROGRAMS)'; test -n "$(synthdir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(synthdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(synthdir)" && rm -f $$files
+
+clean-synthPROGRAMS:
+ -test -z "$(synth_PROGRAMS)" || rm -f $(synth_PROGRAMS)
+ecosynth$(EXEEXT): $(ecosynth_OBJECTS) $(ecosynth_DEPENDENCIES)
+ @rm -f ecosynth$(EXEEXT)
+ $(LINK) $(ecosynth_OBJECTS) $(ecosynth_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecosynth.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(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@ $(am__mv) $(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-synthDATA: $(synth_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(synthdir)" || $(MKDIR_P) "$(DESTDIR)$(synthdir)"
+ @list='$(synth_DATA)'; test -n "$(synthdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(synthdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(synthdir)" || exit $$?; \
+ done
+
+uninstall-synthDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(synth_DATA)'; test -n "$(synthdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(synthdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(synthdir)" && rm -f $$files
+
+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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ 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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ 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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__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 "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ -test -n "$(am__skip_mode_fix)" \
+ || 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-lzma: distdir
+ tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+ $(am__remove_distdir)
+
+dist-xz: distdir
+ tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
+ $(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
+ $(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.lzma*) \
+ unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
+ *.tar.xz*) \
+ xz -dc $(distdir).tar.xz | $(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)
+ test -d $(distdir)/_build || exit 0; \
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && am__cwd=`pwd` \
+ && $(am__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 \
+ && cd "$$am__cwd" \
+ || exit 1
+ $(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:
+ @$(am__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-am
+all-am: Makefile $(PROGRAMS) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(synthdir)" "$(DESTDIR)$(synthdir)"; 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)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-synthPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-synthDATA install-synthPROGRAMS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -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-synthDATA uninstall-synthPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
+ clean-generic clean-synthPROGRAMS ctags dist dist-all \
+ dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ dist-xz \
+ dist-zip distcheck distclean distclean-compile \
+ distclean-generic 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 install-synthDATA install-synthPROGRAMS \
+ 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-synthDATA uninstall-synthPROGRAMS
+
+
+@SUPPORTED_TRUE@ecosynth.$(OBJEXT) : Makefile ../src/synth_protocol.h
+
+# 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:
diff --git a/ecos/packages/hal/synth/arch/current/host/acinclude.m4 b/ecos/packages/hal/synth/arch/current/host/acinclude.m4
new file mode 100644
index 0000000..38b48f5
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/acinclude.m4
@@ -0,0 +1,43 @@
+dnl Process this file with aclocal to get an aclocal.m4 file. Then
+dnl process that with autoconf.
+dnl ====================================================================
+dnl
+dnl acinclude.m4
+dnl
+dnl ====================================================================
+dnl ####ECOSHOSTGPLCOPYRIGHTBEGIN####
+dnl -------------------------------------------
+dnl This file is part of the eCos host tools.
+dnl Copyright (C) 2002 Free Software Foundation, Inc.
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 or (at your option) any
+dnl later version.
+dnl
+dnl This program is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the
+dnl Free Software Foundation, Inc., 51 Franklin Street,
+dnl Fifth Floor, Boston, MA 02110-1301, USA.
+dnl -------------------------------------------
+dnl ####ECOSHOSTGPLCOPYRIGHTEND####
+dnl ====================================================================
+dnl#####DESCRIPTIONBEGIN####
+dnl
+dnl Author(s): bartv
+dnl Contact(s): bartv
+dnl Date: 2002/08/06
+dnl Version: 0.01
+dnl
+dnl####DESCRIPTIONEND####
+dnl ====================================================================
+
+dnl Access shared macros.
+dnl AM_CONDITIONAL needs to be mentioned here or else aclocal does not
+dnl incorporate the macro into aclocal.m4
+sinclude(../../../../../../acsupport/acinclude.m4)
diff --git a/ecos/packages/hal/synth/arch/current/host/aclocal.m4 b/ecos/packages/hal/synth/arch/current/host/aclocal.m4
new file mode 100644
index 0000000..4cbba05
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/aclocal.m4
@@ -0,0 +1,992 @@
+# generated automatically by aclocal 1.11 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008, 2009 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_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.63],,
+[m4_warning([this file was generated for autoconf 2.63.
+You have another version of autoconf. It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically `autoreconf'.])])
+
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 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.11'
+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.11], [],
+ [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 AM_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.11])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_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, 2008
+# 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
+
+# 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
+m4_define([_AM_COND_VALUE_$1], [$2])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, 2009
+# 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 10
+
+# 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
+ am__universal=false
+ m4_case([$1], [CC],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac],
+ [CXX],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac])
+
+ 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
+
+ # 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. Also, some Intel
+ # versions had trouble with output in subdirs
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ 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
+ ;;
+ msvisualcpp | msvcmsys)
+ # This compiler won't grok `-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj 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 $am__obj 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, 2008
+# 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_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[{
+ # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ 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 -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/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, 2008, 2009 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 16
+
+# 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.62])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)
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
+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
+])
+_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
+dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
+dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
+dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+ [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+])
+
+dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
+
+# 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_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005, 2008 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
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+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])])
+
+# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
+# From Jim Meyering
+
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
+# 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_MAINTAINER_MODE([DEFAULT-MODE])
+# ----------------------------------
+# Control maintainer-specific portions of Makefiles.
+# Default is to disable them, unless `enable' is passed literally.
+# For symmetry, `disable' may be passed as well. Anyway, the user
+# can override the default with the --enable/--disable switch.
+AC_DEFUN([AM_MAINTAINER_MODE],
+[m4_case(m4_default([$1], [disable]),
+ [enable], [m4_define([am_maintainer_other], [disable])],
+ [disable], [m4_define([am_maintainer_other], [enable])],
+ [m4_define([am_maintainer_other], [enable])
+ m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
+AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
+ dnl maintainer-mode's default is 'disable' unless 'enable' is passed
+ AC_ARG_ENABLE([maintainer-mode],
+[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer],
+ [USE_MAINTAINER_MODE=$enableval],
+ [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
+ AC_MSG_RESULT([$USE_MAINTAINER_MODE])
+ AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
+ MAINT=$MAINTAINER_MODE_TRUE
+ AC_SUBST([MAINT])dnl
+]
+)
+
+AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005, 2009 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_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.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
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
+# 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 6
+
+# 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
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# 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, 2008 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_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],
+[m4_foreach_w([_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, 2008
+# 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_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[[\\\"\#\$\&\'\`$am_lf]]*)
+ AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+ *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
+ AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+esac
+
+# 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, 2008 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_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_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
+
+m4_include([acinclude.m4])
diff --git a/ecos/packages/hal/synth/arch/current/host/configure b/ecos/packages/hal/synth/arch/current/host/configure
new file mode 100755
index 0000000..4ee6978
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/configure
@@ -0,0 +1,5981 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.63.
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+if test "x$CONFIG_SHELL" = x; then
+ if (eval ":") 2>/dev/null; then
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+
+ if test $as_have_required = yes && (eval ":
+(as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=\$LINENO
+ as_lineno_2=\$LINENO
+ test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+ test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+ :
+else
+ as_candidate_shells=
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ case $as_dir in
+ /*)
+ for as_base in sh bash ksh sh5; do
+ as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+ done;;
+ esac
+done
+IFS=$as_save_IFS
+
+
+ for as_shell in $as_candidate_shells $SHELL; do
+ # Try only shells that exist, to save several forks.
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { ("$as_shell") 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+_ASEOF
+}; then
+ CONFIG_SHELL=$as_shell
+ as_have_required=yes
+ if { "$as_shell" 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+(as_func_return () {
+ (exit $1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+ break
+fi
+
+fi
+
+ done
+
+ if test "x$CONFIG_SHELL" != x; then
+ for as_var in BASH_ENV ENV
+ do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ done
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+ if test $as_have_required = no; then
+ echo This script requires a shell more modern than all the
+ echo shells that I found on your system. Please install a
+ echo modern shell, or manually run the script under such a
+ echo shell if you do have one.
+ { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+ echo No shell found that supports shell functions.
+ echo Please tell bug-autoconf@gnu.org about your system,
+ echo including any error possibly output before this message.
+ echo This can help us improve future autoconf versions.
+ echo Configuration will now proceed without shell functions.
+}
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -p'
+ fi
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+
+exec 7<&0 </dev/null 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="ecosynth.c"
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+LIBOBJS
+SUPPORTED_FALSE
+SUPPORTED_TRUE
+PACKAGE_INSTALL
+PACKAGE_DIR
+ECOS_REPOSITORY
+ecos_tk_libs
+ecos_tk_includes
+MSVC_FALSE
+MSVC_TRUE
+MSVC_SRCDIR
+ecos_LIBS
+ecos_INCLUDES
+ecos_LDADD
+ecos_CXXFLAGS
+ecos_CFLAGS
+am__fastdepCXX_FALSE
+am__fastdepCXX_TRUE
+CXXDEPMODE
+ac_ct_CXX
+CXXFLAGS
+CXX
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+MAINT
+MAINTAINER_MODE_FALSE
+MAINTAINER_MODE_TRUE
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_maintainer_mode
+enable_dependency_tracking
+enable_debug
+enable_ansi
+with_tcl
+with_tcl_version
+with_tcl_header
+with_tcl_lib
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CXX
+CXXFLAGS
+CCC'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
+ { (exit 1); exit 1; }; }
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
+ { (exit 1); exit 1; }; }
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
+ { (exit 1); exit 1; }; }
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
+ { (exit 1); exit 1; }; }
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) { $as_echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { $as_echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2
+ { (exit 1); exit 1; }; } ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; }
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ { $as_echo "$as_me: error: working directory cannot be determined" >&2
+ { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ { $as_echo "$as_me: error: pwd does not report name of working directory" >&2
+ { (exit 1); exit 1; }; }
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2
+ { (exit 1); exit 1; }; }
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
+ --enable-debug do a debug rather than a release build
+ --enable-ansi do an ANSI rather than a unicode build
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-tcl=<path> location of Tcl header and libraries
+ --with-tk=<path> location of Tk header and libraries
+ --with-tcl-version=<vsn> version of Tcl/Tk to be used
+ --with-tcl-header=<path> location of Tcl header
+ --with-tcl-lib=<path> location of Tcl libraries
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CXX C++ compiler command
+ CXXFLAGS C++ compiler flags
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+configure
+generated by GNU Autoconf 2.63
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.63. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $as_echo "PATH: $as_dir"
+done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args '$ac_arg'"
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+ ac_site_file1=$CONFIG_SITE
+elif test "x$prefix" != xNONE; then
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
+else
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+ test "x$ac_site_file" = xNONE && continue
+ if test -r "$ac_site_file"; then
+ { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+ac_aux_dir=
+for ac_dir in ../../../../../../acsupport "$srcdir"/../../../../../../acsupport; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in ../../../../../../acsupport \"$srcdir\"/../../../../../../acsupport" >&5
+$as_echo "$as_me: error: cannot find install-sh or install.sh in ../../../../../../acsupport \"$srcdir\"/../../../../../../acsupport" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+
+
+ { $as_echo "$as_me:$LINENO: checking that a separate build tree is being used" >&5
+$as_echo_n "checking that a separate build tree is being used... " >&6; }
+ ecos_cwd=`/bin/pwd`
+ if test "${srcdir}" = "." ; then
+ srcdir=${ecos_cwd}
+ fi
+ if test "${ecos_cwd}" = "${srcdir}" ; then
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+ { { $as_echo "$as_me:$LINENO: error: This configure script should not be run inside the source tree. Instead please use a separate build tree" >&5
+$as_echo "$as_me: error: This configure script should not be run inside the source tree. Instead please use a separate build tree" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ fi
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+ { (exit 1); exit 1; }; }
+
+{ $as_echo "$as_me:$LINENO: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if test "${ac_cv_build+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+ { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+ { (exit 1); exit 1; }; }
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+$as_echo "$as_me: error: invalid value of canonical build" >&2;}
+ { (exit 1); exit 1; }; };;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:$LINENO: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if test "${ac_cv_host+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$host_alias" = x; then
+ ac_cv_host=$ac_cv_build
+else
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+$as_echo "$as_me: error: invalid value of canonical host" >&2;}
+ { (exit 1); exit 1; }; };;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+am__api_version='1.11'
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+
+done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[\\\"\#\$\&\'\`$am_lf]*)
+ { { $as_echo "$as_me:$LINENO: error: unsafe absolute working directory name" >&5
+$as_echo "$as_me: error: unsafe absolute working directory name" >&2;}
+ { (exit 1); exit 1; }; };;
+esac
+case $srcdir in
+ *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
+ { { $as_echo "$as_me:$LINENO: error: unsafe srcdir value: \`$srcdir'" >&5
+$as_echo "$as_me: error: unsafe srcdir value: \`$srcdir'" >&2;}
+ { (exit 1); exit 1; }; };;
+esac
+
+# 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".
+ { { $as_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&5
+$as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+$as_echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+{ $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+test "$program_prefix" != NONE &&
+ program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+
+# 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.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:$LINENO: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+ if test "${ac_cv_path_mkdir+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in mkdir gmkdir; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+ case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+ 'mkdir (GNU coreutils) '* | \
+ 'mkdir (coreutils) '* | \
+ 'mkdir (fileutils) '4.1*)
+ ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+ break 3;;
+ esac
+ done
+ done
+done
+IFS=$as_save_IFS
+
+fi
+
+ if test "${ac_cv_path_mkdir+set}" = set; then
+ MKDIR_P="$ac_cv_path_mkdir -p"
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for MKDIR_P within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ test -d ./--version && rmdir ./--version
+ MKDIR_P="$ac_install_sh -d"
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+ [\\/$]* | ?:[\\/]*) ;;
+ */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AWK="$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:$LINENO: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+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
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ am__isrc=' -I$(srcdir)'
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+ { (exit 1); exit 1; }; }
+ 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
+
+
+# Define the identity of the package.
+ PACKAGE=eCos_synthetic_target_arch
+ VERSION=0.1
+
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+
+{ $as_echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
+$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
+ # Check whether --enable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+ enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
+else
+ USE_MAINTAINER_MODE=no
+fi
+
+ { $as_echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
+$as_echo "$USE_MAINTAINER_MODE" >&6; }
+ if test $USE_MAINTAINER_MODE = yes; then
+ MAINTAINER_MODE_TRUE=
+ MAINTAINER_MODE_FALSE='#'
+else
+ MAINTAINER_MODE_TRUE='#'
+ MAINTAINER_MODE_FALSE=
+fi
+
+ MAINT=$MAINTAINER_MODE_TRUE
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:$LINENO: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { (ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+
+{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+if test -z "$ac_file"; then
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if test "${ac_cv_objext+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_compiler_gnu=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cc_g=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ CFLAGS=""
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cc_g=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cc_c89=$ac_arg
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:$LINENO: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:$LINENO: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+
+
+{ $as_echo "$as_me:$LINENO: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
+depcc="$CC" am_compiler_list=
+
+{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ 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_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ am__universal=false
+ case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac
+
+ 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
+
+ # 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. Also, some Intel
+ # versions had trouble with output in subdirs
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ 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
+ ;;
+ msvisualcpp | msvcmsys)
+ # This compiler won't grok `-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj 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 $am__obj 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_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+ if test -n "$CCC"; then
+ CXX=$CCC
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CXX+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CXX"; then
+ ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+ { $as_echo "$as_me:$LINENO: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CXX" && break
+ done
+fi
+if test -z "$CXX"; then
+ ac_ct_CXX=$CXX
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CXX"; then
+ ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CXX="$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CXX" && break
+done
+
+ if test "x$ac_ct_CXX" = x; then
+ CXX="g++"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CXX=$ac_ct_CXX
+ fi
+fi
+
+ fi
+fi
+# Provide some information about the compiler.
+$as_echo "$as_me:$LINENO: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_compiler_gnu=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GXX=yes
+else
+ GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+ ac_cxx_werror_flag=yes
+ ac_cv_prog_cxx_g=no
+ CXXFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cxx_g=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ CXXFLAGS=""
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+ CXXFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cxx_g=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+ if test "$GXX" = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-g"
+ fi
+else
+ if test "$GXX" = yes; then
+ CXXFLAGS="-O2"
+ else
+ CXXFLAGS=
+ fi
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CXX" am_compiler_list=
+
+{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ 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_CXX_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ am__universal=false
+ case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac
+
+ 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
+
+ # 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. Also, some Intel
+ # versions had trouble with output in subdirs
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ 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
+ ;;
+ msvisualcpp | msvcmsys)
+ # This compiler won't grok `-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj 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 $am__obj 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_CXX_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+ am__fastdepCXX_TRUE=
+ am__fastdepCXX_FALSE='#'
+else
+ am__fastdepCXX_TRUE='#'
+ am__fastdepCXX_FALSE=
+fi
+
+
+
+
+
+ ecos_CFLAGS=""
+ ecos_CXXFLAGS=""
+ ecos_LDADD=""
+ ecos_INCLUDES=""
+ ecos_LIBS=""
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:$LINENO: checking \"for Visual C++\"" >&5
+$as_echo_n "checking \"for Visual C++\"... " >&6; }
+ MSVC="no";
+ if test "${CC}" = "cl" ; then
+ MSVC="yes"
+ CXX="cl"
+ MSVC_SRCDIR=${srcdir}
+
+
+ if test "${MSVC}" = "yes" ; then
+ MSVC_SRCDIR=`cygpath -w ${MSVC_SRCDIR} | tr \\\\\\\\ /`
+ fi
+
+
+ ecos_INCLUDES="${ecos_INCLUDES} \"-I${MSVC_SRCDIR}\""
+ ecos_LDADD="-link"
+ ecos_LIBS="advapi32.lib"
+ fi
+ if test "${MSVC}" = "yes"; then
+ MSVC_TRUE=
+ MSVC_FALSE='#'
+else
+ MSVC_TRUE='#'
+ MSVC_FALSE=
+fi
+
+ if test "${MSVC}" = "yes" ; then
+ { $as_echo "$as_me:$LINENO: result: unfortunately yes" >&5
+$as_echo "unfortunately yes" >&6; }
+ else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+
+
+
+
+
+
+
+ { $as_echo "$as_me:$LINENO: checking \"the default compiler flags\"" >&5
+$as_echo_n "checking \"the default compiler flags\"... " >&6; }
+
+ ecosflags_enable_debug="no"
+ # Check whether --enable-debug was given.
+if test "${enable_debug+set}" = set; then
+ enableval=$enable_debug; case "${enableval}" in
+ yes) ecosflags_enable_debug="yes" ;;
+ *) ecosflags_enable_debug="no" ;;
+ esac
+fi
+
+
+ ecosflags_enable_ansi="no"
+ if test "${MSVC}" = "yes" ; then
+ # Check whether --enable-ansi was given.
+if test "${enable_ansi+set}" = set; then
+ enableval=$enable_ansi; case "${enableval}" in
+ yes) ecosflags_enable_ansi="yes" ;;
+ *) ecosflags_enable_ansi="no" ;;
+ esac
+fi
+
+ fi
+
+ if test "${GCC}" = "yes" ; then
+ ecos_CFLAGS="${ecos_CFLAGS} -pipe -Wall -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs"
+ ecos_CXXFLAGS="${ecos_CXXFLAGS} -pipe -Wall -Wpointer-arith -Wcast-qual -Woverloaded-virtual"
+ elif test "${MSVC}" = "yes" ; then
+ ecos_CFLAGS="${ecos_CFLAGS} -nologo -W3"
+ ecos_CXXFLAGS="${ecos_CXXFLAGS} -nologo -W3 -GR -GX"
+ else
+ { { $as_echo "$as_me:$LINENO: error: \"default flags for ${CC} are not known\"" >&5
+$as_echo "$as_me: error: \"default flags for ${CC} are not known\"" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+ if test "${ecosflags_enable_debug}" = "yes" ; then
+ if test "${GCC}" = "yes" ; then
+ ecos_CFLAGS="${ecos_CFLAGS} -g -O0"
+ ecos_CXXFLAGS="${ecos_CXXFLAGS} -g -O0"
+ elif test "${MSVC}" = "yes" ; then
+ ecos_CFLAGS="${ecos_CFLAGS} -MDd -Zi"
+ ecos_CXXFLAGS="${ecos_CXXFLAGS} -MDd -Zi"
+ fi
+ else
+ if test "${GCC}" = "yes" ; then
+ ecos_CFLAGS="${ecos_CFLAGS} -O2"
+ ecos_CXXFLAGS="${ecos_CXXFLAGS} -O2"
+ elif test "${MSVC}" = "yes" ; then
+ ecos_CFLAGS="${ecos_CFLAGS} -MD -O2"
+ ecos_CXXFLAGS="${ecos_CXXFLAGS} -MD -O2"
+ fi
+ fi
+
+ CFLAGS="${ac_save_CFLAGS}"
+ CXXFLAGS="${ac_save_CXXFLAGS}"
+
+ { $as_echo "$as_me:$LINENO: result: done" >&5
+$as_echo "done" >&6; }
+
+
+
+
+
+
+ { $as_echo "$as_me:$LINENO: checking for Tcl/Tk installation" >&5
+$as_echo_n "checking for Tcl/Tk installation... " >&6; }
+ { $as_echo "$as_me:$LINENO: result: " >&5
+$as_echo "" >&6; }
+
+
+# Check whether --with-tcl was given.
+if test "${with_tcl+set}" = set; then
+ withval=$with_tcl;
+fi
+
+
+# Check whether --with-tcl was given.
+if test "${with_tcl+set}" = set; then
+ withval=$with_tcl;
+fi
+
+
+# Check whether --with-tcl-version was given.
+if test "${with_tcl_version+set}" = set; then
+ withval=$with_tcl_version;
+fi
+
+
+ if test "${MSVC}" = "yes" ; then
+
+# Check whether --with-tcl-header was given.
+if test "${with_tcl_header+set}" = set; then
+ withval=$with_tcl_header;
+fi
+
+
+# Check whether --with-tcl-lib was given.
+if test "${with_tcl_lib+set}" = set; then
+ withval=$with_tcl_lib;
+fi
+
+ ecos_tcl_incdir=""
+ ecos_tcl_libdir=""
+ if test "${with_tcl_version+set}" != set ; then
+ { { $as_echo "$as_me:$LINENO: error: You must specify a Tcl version using --with-tcl-version=<vsn>" >&5
+$as_echo "$as_me: error: You must specify a Tcl version using --with-tcl-version=<vsn>" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ if test "${with_tcl_header+set}" = set ; then
+ ecos_tcl_incdir=${with_tcl_header}
+ elif test "${with_tcl+set}" = set ; then
+ ecos_tcl_incdir="${with_tcl}/include"
+ else
+ { { $as_echo "$as_me:$LINENO: error: You must specify a Tcl installation with either --with-tcl=<path> or --with-tcl-header=<path>" >&5
+$as_echo "$as_me: error: You must specify a Tcl installation with either --with-tcl=<path> or --with-tcl-header=<path>" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ if test "${with_tcl_lib+set}" = set; then
+ ecos_tcl_libdir=${with_tcl_lib}
+ elif test "${with_tcl+set}" = set; then
+ ecos_tcl_libdir="${with_tcl}/lib"
+ else
+ { { $as_echo "$as_me:$LINENO: error: You must specify a Tcl installation with either --with-tcl=<path> or --with-tcl-lib=<path>" >&5
+$as_echo "$as_me: error: You must specify a Tcl installation with either --with-tcl=<path> or --with-tcl-lib=<path>" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+ if test \! -r "${ecos_tcl_incdir}/tcl.h" ; then
+ { { $as_echo "$as_me:$LINENO: error: unable to locate Tcl header file tcl.h" >&5
+$as_echo "$as_me: error: unable to locate Tcl header file tcl.h" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+
+
+ if test "${MSVC}" = "yes" ; then
+ ecos_tcl_incdir=`cygpath -w ${ecos_tcl_incdir} | tr \\\\\\\\ /`
+ fi
+
+
+
+ if test "${MSVC}" = "yes" ; then
+ ecos_tcl_libdir=`cygpath -w ${ecos_tcl_libdir} | tr \\\\\\\\ /`
+ fi
+
+ ecos_INCLUDES="${ecos_INCLUDES} \"-I${ecos_tcl_incdir}\""
+ ecos_LIBS="${ecos_LIBS} tcl${with_tcl_version}.lib"
+ ecos_LDADD="${ecos_LDADD} \"-libpath=${ecos_tcl_libdir}\""
+
+ ecos_tk_libs=""
+
+ else
+ possibles=""
+ if test "${with_tcl+set}" = set ; then
+ possibles="${with_tcl}/lib"
+ if test "${with_tcl_version+set}" = set ; then
+ possibles="${possibles} ${with_tcl}/lib/tcl${with_tcl_version}"
+ fi
+ fi
+ possibles="${possibles} ${prefix}/lib"
+ if test "${with_tcl_version+set}" = set ; then
+ possibles="${possibles} ${prefix}/lib/tcl${with_tcl_version}"
+ fi
+ possibles="${possibles} /usr/lib"
+ if test "${with_tcl_version+set}" = set ; then
+ possibles="${possibles} /usr/lib/tcl${with_tcl_version}"
+ fi
+ { $as_echo "$as_me:$LINENO: looking for tclConfig.sh in ${possibles}" >&5
+$as_echo "$as_me: looking for tclConfig.sh in ${possibles}" >&6;}
+
+ tclconfig=""
+ for i in ${possibles}; do
+ if test -r "$i/"tclConfig.sh""; then
+ tclconfig=$i
+ break
+ fi
+ done
+
+ if test \! -r "${tclconfig}/tclConfig.sh" ; then
+ { { $as_echo "$as_me:$LINENO: error: unable to locate Tcl configuration file tclConfig.sh" >&5
+$as_echo "$as_me: error: unable to locate Tcl configuration file tclConfig.sh" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ { $as_echo "$as_me:$LINENO: found ${tclconfig}/tclConfig.sh" >&5
+$as_echo "$as_me: found ${tclconfig}/tclConfig.sh" >&6;}
+ . ${tclconfig}/tclConfig.sh
+
+ if test -n "${TCL_INCLUDE_SPEC}" ; then
+ ecos_tcl_incdir="${TCL_INCLUDE_SPEC}"
+ { $as_echo "$as_me:$LINENO: trying TCL_INCLUDE_SPEC - looking for tcl.h in ${ecos_tcl_incdir}" >&5
+$as_echo "$as_me: trying TCL_INCLUDE_SPEC - looking for tcl.h in ${ecos_tcl_incdir}" >&6;}
+ elif test -n "${TCL_INC_DIR}" ; then
+ ecos_tcl_incdir="${TCL_INC_DIR}"
+ { $as_echo "$as_me:$LINENO: trying TCL_INC_DIR - looking for tcl.h in ${ecos_tcl_incdir}" >&5
+$as_echo "$as_me: trying TCL_INC_DIR - looking for tcl.h in ${ecos_tcl_incdir}" >&6;}
+ else
+ ecos_tcl_incdir="-I${TCL_PREFIX}/include"
+ { $as_echo "$as_me:$LINENO: WARNING: no TCL_INCLUDE_SPEC or TCL_INC_DIR in tclConfig.sh" >&5
+$as_echo "$as_me: WARNING: no TCL_INCLUDE_SPEC or TCL_INC_DIR in tclConfig.sh" >&2;}
+ { $as_echo "$as_me:$LINENO: fallback - looking for tcl.h in ${ecos_tcl_incdir}" >&5
+$as_echo "$as_me: fallback - looking for tcl.h in ${ecos_tcl_incdir}" >&6;}
+ fi
+ ecos_tcl_tmpdir=`echo ${ecos_tcl_incdir} | sed -e "s:-I::g"`
+ if test \! -r "${ecos_tcl_tmpdir}/tcl.h" ; then
+ { { $as_echo "$as_me:$LINENO: error: unable to locate Tcl header file tcl.h" >&5
+$as_echo "$as_me: error: unable to locate Tcl header file tcl.h" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ { $as_echo "$as_me:$LINENO: using ${ecos_tcl_incdir}" >&5
+$as_echo "$as_me: using ${ecos_tcl_incdir}" >&6;}
+ if test "${ecos_tcl_incdir}" != "-I/usr/include" ; then
+ ecos_INCLUDES="${ecos_INCLUDES} ${ecos_tcl_incdir}"
+ fi
+ fi
+
+ ecos_tcl_libs=""
+ if test -n "${TCL_LIB_SPEC}" ; then
+ ecos_tcl_libs="${ecos_LIBS} ${TCL_LIB_SPEC}"
+ { $as_echo "$as_me:$LINENO: using TCL_LIB_SPEC ${TCL_LIB_SPEC}" >&5
+$as_echo "$as_me: using TCL_LIB_SPEC ${TCL_LIB_SPEC}" >&6;}
+ else
+ { $as_echo "$as_me:$LINENO: WARNING: no TCL_LIB_SPEC in tclConfig.sh" >&5
+$as_echo "$as_me: WARNING: no TCL_LIB_SPEC in tclConfig.sh" >&2;}
+ if test "${with_tcl_version+set}" = set ; then
+ { $as_echo "$as_me:$LINENO: fallback - looking for libtcl${with_tcl_version}.a in ${possibles}" >&5
+$as_echo "$as_me: fallback - looking for libtcl${with_tcl_version}.a in ${possibles}" >&6;}
+
+ libtcl=""
+ for i in ${possibles}; do
+ if test -r "$i/"libtcl${with_tcl_version}.a""; then
+ libtcl=$i
+ break
+ fi
+ done
+
+ if test -r "${libtcl}/libtcl${with_tcl_version}.a" ; then
+ ecos_tcl_libs="-L${libtcl} -ltcl${with_tcl_version}"
+ { $as_echo "$as_me:$LINENO: using ${ecos_tcl_libs}" >&5
+$as_echo "$as_me: using ${ecos_tcl_libs}" >&6;}
+ fi
+ fi
+ if test -z "${ecos_tcl_libs}" ; then
+ { $as_echo "$as_me:$LINENO: fallback - looking for libtcl.a in ${possibles}" >&5
+$as_echo "$as_me: fallback - looking for libtcl.a in ${possibles}" >&6;}
+
+ libtcl=""
+ for i in ${possibles}; do
+ if test -r "$i/"libtcl.a""; then
+ libtcl=$i
+ break
+ fi
+ done
+
+ if test -r "${libtcl}/libtcl.a" ; then
+ ecos_tcl_libs="-L${libtcl} -ltcl"
+ { $as_echo "$as_me:$LINENO: using ${ecos_tcl_libs}" >&5
+$as_echo "$as_me: using ${ecos_tcl_libs}" >&6;}
+ fi
+ fi
+ fi
+
+ if test -z "${ecos_tcl_libs}" ; then
+ { { $as_echo "$as_me:$LINENO: error: ${tclconfig}/tclConfig.sh does not define TCL_LIB_SPEC" >&5
+$as_echo "$as_me: error: ${tclconfig}/tclConfig.sh does not define TCL_LIB_SPEC" >&2;}
+ { (exit and unable to find libtcl.a); exit and unable to find libtcl.a; }; }
+ fi
+
+ if test -n "${TCL_LIBS}" ; then
+ ecos_tcl_libs="${ecos_tcl_libs} ${TCL_LIBS}"
+ { $as_echo "$as_me:$LINENO: using additional libraries for Tcl ${TCL_LIBS}" >&5
+$as_echo "$as_me: using additional libraries for Tcl ${TCL_LIBS}" >&6;}
+ fi
+ if test -n "${TCL_LD_FLAGS}" ; then
+ ecos_tcl_libs="${ecos_tcl_libs} ${TCL_LD_FLAGS}"
+ { $as_echo "$as_me:$LINENO: using additional linker flags for Tcl ${TCL_LD_FLAGS}" >&5
+$as_echo "$as_me: using additional linker flags for Tcl ${TCL_LD_FLAGS}" >&6;}
+ fi
+ ecos_LIBS="${ecos_LIBS} ${ecos_tcl_libs}"
+
+ if test "${TCL_SHARED_BUILD}" = "0" ; then
+ ecos_CFLAGS="${ecos_CFLAGS} -DSTATIC_BUILD"
+ ecos_CXXFLAGS="${ecos_CXXFLAGS} -DSTATIC_BUILD"
+ fi
+ fi
+
+
+ possibles=""
+ if test "${with_tk+set}" = set ; then
+ possibles="${possibles} ${with_tk}/lib"
+ if test "${with_tcl_version+set}" = set ; then
+ possibles="${possibles} ${with_tk}/lib/tcl${with_tcl_version}"
+ possibles="${possibles} ${with_tk}/lib/tk${with_tcl_version}"
+ fi
+ fi
+ if test "${with_tcl+set}" = set ; then
+ possibles="${possibles} ${with_tcl}/lib"
+ if test "${with_tcl_version+set}" = set ; then
+ possibles="${possibles} ${with_tcl}/lib/tcl${with_tcl_version}"
+ possibles="${possibles} ${with_tcl}/lib/tk${with_tcl_version}"
+ fi
+ fi
+ possibles="${possibles} ${prefix}/lib"
+ if test "${with_tcl_version+set}" = set ; then
+ possibles="${possibles} ${prefix}/lib/tcl${with_tcl_version}"
+ possibles="${possibles} ${prefix}/lib/tk${with_tcl_version}"
+ fi
+ possibles="${possibles} /usr/lib"
+ if test "${with_tcl_version+set}" = set ; then
+ possibles="${possibles} /usr/lib/tcl${with_tcl_version}"
+ possibles="${possibles} /usr/lib/tk${with_tcl_version}"
+ fi
+
+ { $as_echo "$as_me:$LINENO: looking for tkConfig.sh in ${possibles}" >&5
+$as_echo "$as_me: looking for tkConfig.sh in ${possibles}" >&6;}
+
+ tkconfig=""
+ for i in ${possibles}; do
+ if test -r "$i/"tkConfig.sh""; then
+ tkconfig=$i
+ break
+ fi
+ done
+
+ if test \! -r "${tkconfig}/tkConfig.sh" ; then
+ { { $as_echo "$as_me:$LINENO: error: unable to locate Tk config file tkConfig.sh" >&5
+$as_echo "$as_me: error: unable to locate Tk config file tkConfig.sh" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ { $as_echo "$as_me:$LINENO: found ${tkconfig}/tkConfig.sh" >&5
+$as_echo "$as_me: found ${tkconfig}/tkConfig.sh" >&6;}
+ . ${tkconfig}/tkConfig.sh
+
+ if test -n "${TK_INCLUDE_SPEC}" ; then
+ ecos_tk_includes="${TK_INCLUDE_SPEC}"
+ { $as_echo "$as_me:$LINENO: trying TK_INCLUDE_SPEC - looking for tk.h in ${ecos_tk_includes}" >&5
+$as_echo "$as_me: trying TK_INCLUDE_SPEC - looking for tk.h in ${ecos_tk_includes}" >&6;}
+ elif test -n "${TK_INC_DIR}" ; then
+ ecos_tk_includes="${TK_INC_DIR}"
+ { $as_echo "$as_me:$LINENO: trying TK_INC_DIR - looking for tk.h in ${ecos_tk_includes}" >&5
+$as_echo "$as_me: trying TK_INC_DIR - looking for tk.h in ${ecos_tk_includes}" >&6;}
+ else
+ ecos_tk_includes="-I${TCL_PREFIX}/include"
+ { $as_echo "$as_me:$LINENO: WARNING: no TK_INCLUDE_SPEC or TK_INC_DIR in tkConfig.sh" >&5
+$as_echo "$as_me: WARNING: no TK_INCLUDE_SPEC or TK_INC_DIR in tkConfig.sh" >&2;}
+ { $as_echo "$as_me:$LINENO: fallback - looking for tk.h in ${ecos_tk_includes}" >&5
+$as_echo "$as_me: fallback - looking for tk.h in ${ecos_tk_includes}" >&6;}
+ fi
+ ecos_tk_tmpdir=`echo ${ecos_tk_includes} | sed -e "s:-I::g"`
+ if test \! -r "${ecos_tk_tmpdir}/tk.h" ; then
+ { { $as_echo "$as_me:$LINENO: error: unable to locate Tk header file tk.h" >&5
+$as_echo "$as_me: error: unable to locate Tk header file tk.h" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ { $as_echo "$as_me:$LINENO: using ${ecos_tk_includes}" >&5
+$as_echo "$as_me: using ${ecos_tk_includes}" >&6;}
+ if test "${ecos_tk_includes}" = "-I/usr/include" ; then
+ ecos_tk_includes=""
+ fi
+ fi
+ if test -n "${TK_XINCLUDES}" ; then
+ { $as_echo "$as_me:$LINENO: adding TK_XINCLUDES ${TK_XINCLUDES}" >&5
+$as_echo "$as_me: adding TK_XINCLUDES ${TK_XINCLUDES}" >&6;}
+ ecos_tk_includes="${ecos_tk_includes} ${TK_XINCLUDES}"
+ fi
+
+ ecos_tk_libs=""
+ if test -n "${TK_LIB_SPEC}" ; then
+ ecos_tk_libs="${TK_LIB_SPEC}"
+ { $as_echo "$as_me:$LINENO: trying TK_LIB_SPEC ${TK_LIB_SPEC}" >&5
+$as_echo "$as_me: trying TK_LIB_SPEC ${TK_LIB_SPEC}" >&6;}
+ else
+ { $as_echo "$as_me:$LINENO: WARNING: no TK_LIB_SPEC in tkConfig.sh" >&5
+$as_echo "$as_me: WARNING: no TK_LIB_SPEC in tkConfig.sh" >&2;}
+ if test "${with_tcl_version+set}" = set ; then
+ { $as_echo "$as_me:$LINENO: fallback - looking for libtk${with_tcl_version}.a in ${possibles}" >&5
+$as_echo "$as_me: fallback - looking for libtk${with_tcl_version}.a in ${possibles}" >&6;}
+
+ libtk=""
+ for i in ${possibles}; do
+ if test -r "$i/"libtk${with_tcl_version}.a""; then
+ libtk=$i
+ break
+ fi
+ done
+
+ if test -r "${libtk}/libtk${with_tcl_version}.a" ; then
+ ecos_tk_libs="-L${libtk} -ltk${with_tcl_version}"
+ fi
+ fi
+ if test -z "${ecos_tk_libs}" ; then
+ { $as_echo "$as_me:$LINENO: fallback - looking for libtk.a in ${possibles}" >&5
+$as_echo "$as_me: fallback - looking for libtk.a in ${possibles}" >&6;}
+
+ libtk=""
+ for i in ${possibles}; do
+ if test -r "$i/"libtk.a""; then
+ libtk=$i
+ break
+ fi
+ done
+
+ if test -r "${libtk}/libtk.a" ; then
+ ecos_tk_libs="-L${libtk} -ltk"
+ fi
+ fi
+ fi
+ if test -z "${ecos_tk_libs}" ; then
+ { { $as_echo "$as_me:$LINENO: error: ${tkconfig}/tkConfig.sh does not define TK_LIB_SPEC" >&5
+$as_echo "$as_me: error: ${tkconfig}/tkConfig.sh does not define TK_LIB_SPEC" >&2;}
+ { (exit and unable to find libtk.a); exit and unable to find libtk.a; }; }
+ else
+ { $as_echo "$as_me:$LINENO: using ${ecos_tk_libs}" >&5
+$as_echo "$as_me: using ${ecos_tk_libs}" >&6;}
+ fi
+
+ if test -n "${TK_LIBS}" ; then
+ if test -n "${TCL_LIBS}" ; then
+ ecos_tk_tmp="${TK_LIBS}"
+ for i in ${TCL_LIBS} ; do
+ ecos_tk_tmp=`echo ${ecos_tk_tmp} | sed -e "s:${i}::g"`
+ done
+ ecos_tk_libs="${ecos_tk_libs} ${ecos_tk_tmp}"
+ { $as_echo "$as_me:$LINENO: using additional libraries for Tk ${ecos_tk_tmp}" >&5
+$as_echo "$as_me: using additional libraries for Tk ${ecos_tk_tmp}" >&6;}
+ else
+ ecos_tk_libs="${ecos_tk_libs} ${TK_LIBS}"
+ { $as_echo "$as_me:$LINENO: using additional libraries for Tk ${TK_LIBS}" >&5
+$as_echo "$as_me: using additional libraries for Tk ${TK_LIBS}" >&6;}
+ fi
+ fi
+ fi
+ fi
+
+ { $as_echo "$as_me:$LINENO: checking for Tcl/Tk installation" >&5
+$as_echo_n "checking for Tcl/Tk installation... " >&6; }
+ { $as_echo "$as_me:$LINENO: result: done" >&5
+$as_echo "done" >&6; }
+
+
+
+
+case "${host}" in
+ i[34567]86-*-linux-gnu* ) SUPPORTED="yes";;
+ x86_64-*-linux-gnu* ) SUPPORTED="yes";;
+ * ) SUPPORTED="no"
+esac
+
+if test "${TK_MAJOR_VERSION}" = "8" ; then
+ if test ${TK_MINOR_VERSION} -lt 3 ; then
+ { $as_echo "$as_me:$LINENO: WARNING: The synthetic target support requires at least version 8.3 of Tcl/Tk" >&5
+$as_echo "$as_me: WARNING: The synthetic target support requires at least version 8.3 of Tcl/Tk" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: Synthetic target host-side support will not be built" >&5
+$as_echo "$as_me: WARNING: Synthetic target host-side support will not be built" >&2;}
+ SUPPORTED="no"
+ fi
+fi
+
+
+ package_dir=`cd ${srcdir} && /bin/pwd`
+ PACKAGE_VERSION=`dirname ${package_dir}`
+ PACKAGE_VERSION=`basename ${PACKAGE_VERSION}`
+
+ package_dir=`dirname ${package_dir}`
+ package_dir=`dirname ${package_dir}`
+
+ possibles="${package_dir}/.. ${package_dir}/../.. ${package_dir}/../../.. ${package_dir}/../../../.."
+ possibles="${possibles} ${package_dir}/../../../../.. ${package_dir}/../../../../../.."
+
+ repository_root=""
+ for i in ${possibles}; do
+ if test -d "$i/"acsupport""; then
+ repository_root=$i
+ break
+ fi
+ done
+
+ if test "${repository_root}" = "" ; then
+ { { $as_echo "$as_me:$LINENO: error: Failed to identify this package's position within the eCos repository" >&5
+$as_echo "$as_me: error: Failed to identify this package's position within the eCos repository" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ ECOS_REPOSITORY=`cd "${repository_root}/packages/pkgconf/.." && /bin/pwd`
+
+ PACKAGE_DIR=`echo ${package_dir} | sed -e "s:${ECOS_REPOSITORY}/::"`
+
+ PACKAGE_INSTALL="${PACKAGE_DIR}/${PACKAGE_VERSION}"
+
+
+
+
+
+
+
+ if test "${SUPPORTED}" = "yes"; then
+ SUPPORTED_TRUE=
+ SUPPORTED_FALSE='#'
+else
+ SUPPORTED_TRUE='#'
+ SUPPORTED_FALSE=
+fi
+
+
+
+ac_config_files="$ac_config_files Makefile:Makefile.in"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ test "x$cache_file" != "x/dev/null" &&
+ { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ cat confcache >$cache_file
+ else
+ { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then branch to the quote section. Otherwise,
+# look for a macro that doesn't take arguments.
+ac_script='
+:mline
+/\\$/{
+ N
+ s,\\\n,,
+ b mline
+}
+t clear
+:clear
+s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
+t quote
+s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
+t quote
+b any
+:quote
+s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
+s/\[/\\&/g
+s/\]/\\&/g
+s/\$/$$/g
+H
+:any
+${
+ g
+ s/^\n//
+ s/\n/ /g
+ p
+}
+'
+DEFS=`sed -n "$ac_script" confdefs.h`
+
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+ if test -n "$EXEEXT"; then
+ am__EXEEXT_TRUE=
+ am__EXEEXT_FALSE='#'
+else
+ am__EXEEXT_TRUE='#'
+ am__EXEEXT_FALSE=
+fi
+
+if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${MSVC_TRUE}" && test -z "${MSVC_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"MSVC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"MSVC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${SUPPORTED_TRUE}" && test -z "${SUPPORTED_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"SUPPORTED\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"SUPPORTED\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -p'
+ fi
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+
+# Save the log message, to keep $[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.63. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTION]... [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.63,
+ with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2008 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ CONFIG_FILES="$CONFIG_FILES '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h | --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { $as_echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile:Makefile.in" ;;
+
+ *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp=
+ trap 'exit_status=$?
+ { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} ||
+{
+ $as_echo "$as_me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=' '
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\).*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\).*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+ || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5
+$as_echo "$as_me: error: could not setup config files machinery" >&2;}
+ { (exit 1); exit 1; }; }
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[ ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+
+eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5
+$as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
+ { (exit 1); exit 1; }; };;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ ac_file_inputs="$ac_file_inputs '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:$LINENO: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$tmp/stdin" \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ { as_dir="$ac_dir"
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ { (exit 1); exit 1; }; }; }
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+ ac_MKDIR_P=$MKDIR_P
+ case $MKDIR_P in
+ [\\/$]* | ?:[\\/]* ) ;;
+ */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; }
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&2;}
+
+ rm -f "$tmp/stdin"
+ case $ac_file in
+ -) cat "$tmp/out" && rm -f "$tmp/out";;
+ *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+ esac \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+
+
+ :C) { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
+
+
+ case $ac_file$ac_mode in
+ "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+ # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ 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 -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ 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_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ { as_dir=$dirpart/$fdir
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ { (exit 1); exit 1; }; }; }
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+ ;;
+
+ esac
+done # for ac_tag
+
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
diff --git a/ecos/packages/hal/synth/arch/current/host/configure.in b/ecos/packages/hal/synth/arch/current/host/configure.in
new file mode 100644
index 0000000..6b9341c
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/configure.in
@@ -0,0 +1,92 @@
+dnl Process this file with autoconf to produce a configure script.
+dnl ====================================================================
+dnl
+dnl configure.in
+dnl
+dnl configure script for eCos synthetic target architectural
+dnl host-side support
+dnl
+dnl ====================================================================
+dnl ####ECOSHOSTGPLCOPYRIGHTBEGIN####
+dnl -------------------------------------------
+dnl This file is part of the eCos host tools.
+dnl Copyright (C) 2002 Free Software Foundation, Inc.
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 or (at your option) any
+dnl later version.
+dnl
+dnl This program is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the
+dnl Free Software Foundation, Inc., 51 Franklin Street,
+dnl Fifth Floor, Boston, MA 02110-1301, USA.
+dnl -------------------------------------------
+dnl ####ECOSHOSTGPLCOPYRIGHTEND####
+dnl ====================================================================
+dnl#####DESCRIPTIONBEGIN####
+dnl
+dnl Author(s): bartv
+dnl Contact(s): bartv
+dnl Date: 2002/08/06
+dnl Version: 0.01
+dnl
+dnl####DESCRIPTIONEND####
+dnl ====================================================================
+
+
+AC_INIT(ecosynth.c)
+
+dnl Pick up the support files from the top-level acsupport directory.
+AC_CONFIG_AUX_DIR(../../../../../../acsupport)
+
+ECOS_CHECK_BUILD_ne_SRC
+AC_CANONICAL_HOST
+AM_INIT_AUTOMAKE(eCos_synthetic_target_arch,0.1,0)
+AM_MAINTAINER_MODE
+AC_PROG_CC
+AC_PROG_CXX
+AC_OBJEXT
+AC_EXEEXT
+ECOS_PROG_MSVC
+ECOS_PROG_STANDARD_COMPILER_FLAGS
+
+ECOS_PATH_TCL
+
+dnl The current version of the synthetic target is implemented only for
+dnl x86 Linux platforms, so a test is appropriate here. However
+dnl it is not a good idea for the configure script to report an error:
+dnl that would prevent any top-level configury working for other
+dnl platforms. Instead an automake conditional is used to suppress adding
+dnl targets to the build.
+case "${host}" in
+ i[[34567]]86-*-linux-gnu* ) SUPPORTED="yes";;
+ x86_64-*-linux-gnu* ) SUPPORTED="yes";;
+ * ) SUPPORTED="no"
+esac
+
+dnl Check that the version of tk is sufficiently recent.
+dnl For example the text widget's tag -elide facility was
+dnl added between 8.2 and 8.3. Initial development of
+dnl the synthetic target used 8.3.1
+if test "${TK_MAJOR_VERSION}" = "8" ; then
+ if test ${TK_MINOR_VERSION} -lt 3 ; then
+ AC_MSG_WARN([The synthetic target support requires at least version 8.3 of Tcl/Tk])
+ AC_MSG_WARN([Synthetic target host-side support will not be built])
+ SUPPORTED="no"
+ fi
+fi
+ECOS_PACKAGE_DIRS
+
+AM_CONDITIONAL(SUPPORTED, test "${SUPPORTED}" = "yes")
+
+dnl There is no real need for a config.h file at this time, since the code
+dnl is specific to x86 Linux. This may change in future.
+dnl AM_CONFIG_HEADER(config.h:config.h.in)
+
+AC_OUTPUT(Makefile:Makefile.in)
diff --git a/ecos/packages/hal/synth/arch/current/host/console.tcl b/ecos/packages/hal/synth/arch/current/host/console.tcl
new file mode 100644
index 0000000..ef90ab6
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/console.tcl
@@ -0,0 +1,195 @@
+# {{{ Banner
+
+# ============================================================================
+#
+# console.tcl
+#
+# Console output support for the eCos synthetic target I/O auxiliary
+#
+# ============================================================================
+# ####ECOSHOSTGPLCOPYRIGHTBEGIN####
+# -------------------------------------------
+# This file is part of the eCos host tools.
+# Copyright (C) 2002 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.
+# -------------------------------------------
+# ####ECOSHOSTGPLCOPYRIGHTEND####
+# ============================================================================
+# #####DESCRIPTIONBEGIN####
+#
+# Author(s): bartv
+# Contact(s): bartv
+# Date: 2002/08/07
+# Version: 0.01
+# Description:
+# Implementation of the console device. This script should only ever
+# be run from inside the ecosynth auxiliary.
+#
+# ####DESCRIPTIONEND####
+# ============================================================================
+
+# }}}
+
+# The console device is pretty simple. There can only ever be one
+# instance of the console, and it does not take any initialization
+# data from the target or from command-line arguments. It does
+# look for entries in the target definition file, to set up
+# colours for console output, and to install additional regexp-based
+# filters. The only type of request that can go to the console device
+# is to write some text.
+
+namespace eval ::console {
+
+ variable _pending_output ""
+ variable filter_count 0
+ array set filters [list]
+
+ proc instantiate { id name data } {
+ # There is only console so no name is expected, and the target
+ # cannot provide any initialization data.
+ if { ("" != $name) || ("" != $data) } {
+ synth::report_error "The target has passed invalid data when instantiating the console device.\n"
+ return ""
+ }
+
+ # There are no command line arguments to be processed and consumed.
+
+ # Look for and consume target definition entries related to the console.
+ # These are only actually applicable when running in GUI mode, but
+ # should always be consumed.
+ set console_appearance ""
+
+ if { [synth::tdf_has_device "console"] } {
+ if { [synth::tdf_has_option "console" "appearance"] } {
+ set console_appearance [synth::tdf_get_option "console" "appearance"]
+ }
+
+ if { [synth::tdf_has_option "console" "filter"] } {
+ set tdf_filters [synth::tdf_get_options "console" "filter"]
+ foreach filter $tdf_filters {
+ if { 2 > [llength $filter] } {
+ set msg "Invalid entry in target definition file $synth::target_definition\n"
+ append msg " Device console, option filter takes at least two arguments, a name and a regular expression.\n"
+ synth::report_error $msg
+ } else {
+ # Attempt some minimal validation of the regexp
+ set name [lindex $filter 0]
+ set regexp [lindex $filter 1]
+ set error ""
+ if { [catch { regexp -- $regexp "Hello world\n" } error] } {
+ set msg "Invalid entry in target definition file $synth::target_definition\n"
+ append msg " Device console, filter $name, invalid regular expression\n $error\n"
+ synth::report_error $msg
+ } else {
+ set ::console::filters($::console::filter_count,name) $name
+ set ::console::filters($::console::filter_count,regexp) $regexp
+ set ::console::filters($::console::filter_count,appearance) [lrange $filter 2 end]
+ incr ::console::filter_count
+ }
+ }
+ }
+ }
+ }
+
+ # If the GUI is enabled then set up a filter for the console, and
+ # any additional filters specified in the target definition file
+ # for e.g. trace output.
+ if { $synth::flag_gui } {
+ if { [synth::filter_exists "console" ] } {
+ synth::report_warning "The console device script [info script] cannot create a filter for \"console\".\nThis filter already exists.\n"
+ } elseif { "" == $console_appearance } {
+ synth::filter_add "console"
+ } else {
+ array set parsed_options [list]
+ set message ""
+ if { ![synth::filter_parse_options $console_appearance parsed_options message] } {
+ synth::report_error \
+ "Invalid entry in target definition file $synth::target_definition\
+ \n synth_device \"console\", entry \"appearance\"\n$message"
+ } else {
+ synth::filter_add_parsed "console" parsed_options
+ }
+ }
+
+ for { set i 0 } { $i < $::console::filter_count } { incr i } {
+ set name $::console::filters($i,name)
+ set appearance $::console::filters($i,appearance)
+ array unset parsed_options
+ array set parsed_options [list]
+
+ if { [synth::filter_exists $name] } {
+ synth::report_warning "The console device script [info script] cannot create a filter for \"$name\".\nThis filter already exists.\n"
+ } else {
+ set message ""
+ if { ![synth::filter_parse_options $appearance parsed_options message] } {
+ synth::report_error \
+ "Invalid entry in target definition file $synth::target_definition\
+ \n synth_device \"console\", entry filter $name\n$message"
+ } else {
+ synth::filter_add_parsed $name parsed_options
+ }
+ }
+ }
+ }
+
+ # An instantiation function should return a handler for further requests
+ # to this device instance.
+ return console::handle_request
+ }
+
+ proc handle_request { id reqcode arg1 arg2 reqdata reqlen reply_len } {
+ # Unfortunately the main eCos diagnostic code assumes it is
+ # talking to a tty in raw mode, since typically the output
+ # will go via the gdb output window. Hence it will have inserted
+ # carriage returns which are best filtered out here.
+ set reqdata [string map {"\r" " "} $reqdata]
+
+ # The output should be processed one line at a time, to make it
+ # easier to write the regexp filters.
+ append console::_pending_output $reqdata
+ while { -1 != [string first "\n" $console::_pending_output] } {
+ set regexp_matched 0
+ set index [string first "\n" $console::_pending_output]
+ set line [string range $console::_pending_output 0 $index]
+ set ::console::_pending_output [string range $console::_pending_output [expr $index + 1] end]
+
+ for { set i 0 } { !$regexp_matched && ($i < $console::filter_count) } { incr i } {
+ if { [regexp -- $console::filters($i,regexp) $line] } {
+ synth::output $line $console::filters($i,name)
+ set regexp_matched 1
+ }
+ }
+ if { ! $regexp_matched } {
+ synth::output $line "console"
+ }
+ }
+ }
+
+ # Deal with the case where eCos has exited after sending only part
+ # of a line, which is still pending. In practice this has no
+ # effect at present because the data is still buffered inside
+ # eCos.
+ proc _flush { arg_list } {
+ if { "" != $console::_pending_output } {
+ synth::output "$console::_pending_output\n" "console"
+ }
+ }
+ synth::hook_add "ecos_exit" console::_flush
+
+}
+
+return console::instantiate
diff --git a/ecos/packages/hal/synth/arch/current/host/copy.xbm b/ecos/packages/hal/synth/arch/current/host/copy.xbm
new file mode 100644
index 0000000..92df79f
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/copy.xbm
@@ -0,0 +1,6 @@
+#define copy_width 16
+#define copy_height 15
+static unsigned char copy_bits[] = {
+ 0x00, 0x00, 0x7e, 0x00, 0xc2, 0x00, 0x42, 0x01, 0xda, 0x0f, 0x82, 0x30,
+ 0xfa, 0xd0, 0x82, 0xf6, 0xfa, 0x80, 0x82, 0xbe, 0xfe, 0x80, 0x80, 0xbe,
+ 0x80, 0x80, 0x80, 0xff, 0x00, 0x00};
diff --git a/ecos/packages/hal/synth/arch/current/host/cut.xbm b/ecos/packages/hal/synth/arch/current/host/cut.xbm
new file mode 100644
index 0000000..93a0fcf
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/cut.xbm
@@ -0,0 +1,6 @@
+#define cut_width 16
+#define cut_height 15
+static unsigned char cut_bits[] = {
+ 0x00, 0x00, 0x20, 0x02, 0x20, 0x02, 0x20, 0x02, 0x60, 0x03, 0x40, 0x01,
+ 0xc0, 0x01, 0x80, 0x00, 0xc0, 0x00, 0x40, 0x07, 0x70, 0x09, 0x48, 0x09,
+ 0x48, 0x09, 0x48, 0x06, 0x30, 0x00};
diff --git a/ecos/packages/hal/synth/arch/current/host/default.tdf b/ecos/packages/hal/synth/arch/current/host/default.tdf
new file mode 100644
index 0000000..485b680
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/default.tdf
@@ -0,0 +1,43 @@
+# Default synthetic target hardware definition file. This file gets
+# installed alongside ecosynth.tcl and other support files in the
+# directory $(libexecdir)/ecos/hal_synth_arch_<version>.
+#
+# The synthetic target support will look for the target definition
+# file in various places: first the current directory, then
+# ~/.ecos/synth, finally the install location as above. It assumes the
+# file is called "default.tdf", unless this is overwritten on the
+# command line using the -t or --target option. Typically users will
+# make a copy of the default target definition in an appropriate
+# location and then modify this copy as required.
+#
+# This file only contains support for those devices supported by the
+# core package: the console, ... Additional devices such as the
+# ethernet support which live in separate eCos packages may have their
+# own example fragments which can be inserted in the user's own target
+# definition file, directly or via e.g. a Tcl "source" command.
+#
+# This file is executed in a Tcl interpreter with an additional
+# command "synth_device", so Tcl syntax applies and the full
+# functionality provided by Tcl interpreters is available if desired.
+
+# ----------------------------------------------------------------------------
+# The console device. This serves as the destination for low-level
+# eCos text output, for example from the diag_printf() function,
+# and is intended primarily for diagnostics and debugging.
+#
+# The appearance of normal console output can be controlled by
+# the "appearance" option. This takes the standard arguments for
+# text filters, for example -foreground and -background.
+#
+# It is also possible to install new filters for specific types
+# of output, for example eCos tracing output. Each such filter
+# is defined by a name, a regular expression, and details of
+# the desired appearance. Every line of console output generated
+# by eCos is matched against the various regular expressions,
+# and the first match found controls the appearance of the
+# output.
+
+synth_device console {
+ # appearance -foreground white -background black
+ filter trace {^TRACE:.*} -foreground HotPink1 -hide 1
+} \ No newline at end of file
diff --git a/ecos/packages/hal/synth/arch/current/host/ecosicon.xbm b/ecos/packages/hal/synth/arch/current/host/ecosicon.xbm
new file mode 100644
index 0000000..cc7f563
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/ecosicon.xbm
@@ -0,0 +1,10 @@
+#define ecosicon_width 40
+#define ecosicon_height 16
+static unsigned char ecosicon_bits[] = {
+ 0xfc, 0xff, 0xab, 0xaa, 0x2a, 0xfe, 0xff, 0x53, 0x55, 0x55, 0xff, 0xff,
+ 0xab, 0xaa, 0xaa, 0x87, 0x1f, 0x52, 0x50, 0x40, 0x03, 0x0f, 0x28, 0x20,
+ 0x80, 0x71, 0xc6, 0x11, 0x41, 0x14, 0x79, 0xe6, 0x8b, 0x22, 0xaa, 0x01,
+ 0xe6, 0x17, 0x45, 0x40, 0x01, 0xe6, 0x8f, 0xa2, 0x80, 0xf9, 0xe7, 0x13,
+ 0x45, 0x15, 0x79, 0xc6, 0x09, 0x22, 0x8a, 0x03, 0x0e, 0x10, 0x50, 0x00,
+ 0x07, 0x1f, 0x2a, 0xa8, 0x80, 0xff, 0xff, 0x53, 0x55, 0x55, 0xfe, 0xff,
+ 0xab, 0xaa, 0x2a, 0xfc, 0xff, 0x53, 0x55, 0x15};
diff --git a/ecos/packages/hal/synth/arch/current/host/ecosiconmask.xbm b/ecos/packages/hal/synth/arch/current/host/ecosiconmask.xbm
new file mode 100644
index 0000000..4c143a2
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/ecosiconmask.xbm
@@ -0,0 +1,10 @@
+#define ecosiconmask_width 40
+#define ecosiconmask_height 16
+static unsigned char ecosiconmask_bits[] = {
+ 0xfc, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff,
+ 0xff, 0xff, 0x7f, 0xfc, 0xff, 0xff, 0xff, 0x3f};
diff --git a/ecos/packages/hal/synth/arch/current/host/ecosynth.c b/ecos/packages/hal/synth/arch/current/host/ecosynth.c
new file mode 100644
index 0000000..047a10a
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/ecosynth.c
@@ -0,0 +1,363 @@
+//============================================================================
+//
+// ecosynth.c
+//
+// The eCos synthetic target I/O auxiliary
+//
+//============================================================================
+// ####ECOSHOSTGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of the eCos host tools.
+// Copyright (C) 2002 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.
+// -------------------------------------------
+// ####ECOSHOSTGPLCOPYRIGHTEND####
+//============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): bartv
+// Contact(s): bartv
+// Date: 2002-08-05
+// Version: 0.01
+// Description:
+//
+// The main module for the eCos synthetic target auxiliary. This
+// program is fork'ed and execve'd during the initialization phase of
+// any synthetic target application, and is primarily responsible for
+// I/O operations. This program should never be run directly by a
+// user.
+//
+//####DESCRIPTIONEND####
+//============================================================================
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+#include <limits.h>
+#include <unistd.h>
+#include <assert.h>
+#include <fcntl.h>
+#include <sys/param.h>
+#include <sys/types.h>
+// Avoid compatibility problems with Tcl 8.4 vs. earlier
+#define USE_NON_CONST
+#include <tcl.h>
+#include <tk.h>
+
+// The protocol between host and target is defined by a private
+// target-side header.
+#include "../src/synth_protocol.h"
+
+// ----------------------------------------------------------------------------
+// Statics etc.
+#define PROGNAME "Synthetic target auxiliary"
+
+static int no_windows = 0; // -nw arg
+
+static pid_t parent_pid;
+
+// ----------------------------------------------------------------------------
+// Overview.
+//
+// When a synthetic target application is executed, whether directly
+// or from inside gdb, it can fork() and execve() the synthetic
+// target auxiliary: this program, ecosynth. For now this is disabled
+// by default but can be enabled using a --io option on the command line.
+// In future it may be enabled by default, but can be suppressed using
+// --nio.
+//
+// stdin, stdout, and stderr will be inherited from the eCos application, so
+// that attempts to use printf() or fprintf(stderr, ) from inside the
+// auxiliary or its helper applications work as expected. In addition file
+// descriptor 3 will be a pipe from the eCos application, and file descriptor
+// 4 will be a pipe to the application. The protocol defined in
+// ../src/synth_protocol.h runs over these pip
+//
+// argv[] and environ are also as per the application, with the exception
+// of argv[0] which is the full path to this application.
+//
+// The bulk of the hard work is done inside Tcl. The C++ code is
+// responsible only for initialization and for implementing some
+// additional commands, for example to send a SIGIO signal to the
+// parent when there is a new pending interrupt. The primary script is
+// ecosynth.tcl which should be installed alongside the executable.
+//
+// This code makes use of the standard Tcl initialization facilities:
+//
+// 1) main() calls Tcl_Main() with the command-line arguments and an
+// application-specific initialization routine ecosynth_appinit().
+//
+// 2) Tcl_Main() goes through the initialization sequence in generic/tclMain.c.
+// There is one slight complication: Tcl_main() interprets arguments in
+// a way that makes sense for tclsh, but not for ecosynth. Specially if
+// argv[1] exists and does not begin with a - then it will be interpreted
+// as a script to be executed. Hence argv[] is re-allocated and the name
+// of a suitable script is inserted.
+//
+// 3) ecosynth_appinit() initializes the Tcl interpreter, and optionally
+// the Tk interpreter as well. This is controlled by the presence of
+// a -nw argument on the command line. This initialization routine
+// also takes care of adding some commands to the Tcl interpreter.
+//
+// 4) Tcl_Main() will now proceed to execute the startup script, which
+// is eccentric.tcl installed in the libexec directory.
+
+static int ecosynth_appinit(Tcl_Interp*);
+
+int
+main(int argc, char** argv)
+{
+ char ecosynth_tcl_path[_POSIX_PATH_MAX];
+ char** new_argv;
+ int i;
+
+ parent_pid = getppid();
+
+ // The various core Tcl scripts are installed in the same
+ // directory as ecosynth. The Tcl script itself will check whether
+ // there is a newer version of itself in the source tree and
+ // switch to that instead.
+ assert((strlen(LIBEXECDIR) + strlen(PKG_INSTALL) + 20) < _POSIX_PATH_MAX);
+ strcpy(ecosynth_tcl_path, LIBEXECDIR);
+ strcat(ecosynth_tcl_path, "/ecos/");
+ strcat(ecosynth_tcl_path, PKG_INSTALL);
+ strcat(ecosynth_tcl_path, "/ecosynth.tcl");
+
+ // Installation sanity checks.
+ if (0 != access(ecosynth_tcl_path, F_OK)) {
+ fprintf(stderr, PROGNAME ": error, a required Tcl script has not been installed.\n");
+ fprintf(stderr, " The script is \"%s\"\n", ecosynth_tcl_path);
+ exit(EXIT_FAILURE);
+ }
+ if (0 != access(ecosynth_tcl_path, R_OK)) {
+ fprintf(stderr, PROGNAME ": error, no read access to a required Tcl script.\n");
+ fprintf(stderr, " The script is \"%s\"\n", ecosynth_tcl_path);
+ exit(EXIT_FAILURE);
+ }
+
+ // Look for options -nw and -w. This information is needed by the appinit() routine.
+ no_windows = 0;
+ for (i = 1; i < argc; i++) {
+ if ((0 == strcmp("-nw", argv[i])) || (0 == strcmp("--nw", argv[i])) ||
+ (0 == strcmp("-no-windows", argv[i])) || (0 == strcmp("--no-windows", argv[i]))) {
+ no_windows = 1;
+ } else if ((0 == strcmp("-w", argv[i])) || (0 == strcmp("--w", argv[i])) ||
+ (0 == strcmp("-windows", argv[i])) || (0 == strcmp("--windows", argv[i]))) {
+ no_windows = 0;
+ }
+ }
+
+ new_argv = malloc((argc+2) * sizeof(char*));
+ if (NULL == new_argv) {
+ fprintf(stderr, PROGNAME ": internal error, out of memory.\n");
+ exit(EXIT_FAILURE);
+ }
+ new_argv[0] = argv[0];
+ new_argv[1] = ecosynth_tcl_path;
+ for (i = 1; i < argc; i++) {
+ new_argv[i+1] = argv[i];
+ }
+ new_argv[i+1] = NULL;
+
+ // Ignore SIGINT requests. Those can happen if e.g. the application is
+ // ctrl-C'd or if a gdb session is interrupted because this process is
+ // a child of the eCos application. Instead the normal code for handling
+ // application termination needs to run.
+ signal(SIGINT, SIG_IGN);
+
+ // Similarly ignore SIGTSTP if running in graphical mode, it would
+ // be inappropriate for the GUI to freeze if the eCos application is
+ // suspended. If running in text mode then it is better for both
+ // the application and the I/O auxiliary to freeze, halting any further
+ // output.
+ if (!no_windows) {
+ signal(SIGTSTP, SIG_IGN);
+ }
+
+ Tcl_Main(argc+1, new_argv, &ecosynth_appinit);
+ return EXIT_SUCCESS;
+}
+
+
+// ----------------------------------------------------------------------------
+// Commands for the Tcl interpreter. These are few and far between because
+// as much work as possible is done in Tcl.
+
+// Send a SIGIO signal to the parent process. This is done whenever a new
+// interrupt is pending. There is a possibility of strange behaviour if
+// the synthetic target application is exiting at just the wrong moment
+// and this process has become a zombie. An alternative approach would
+// involve loading the Extended Tcl extension.
+static int
+ecosynth_send_SIGIO(ClientData clientData __attribute__ ((unused)),
+ Tcl_Interp* interp,
+ int argc,
+ char** argv __attribute__ ((unused)))
+{
+ if (1 != argc) {
+ Tcl_SetResult(interp, "wrong # args: should be \"usbtest::_send_SIGIO\"" , TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ (void) kill(parent_pid, SIGIO);
+ return TCL_OK;
+}
+
+// Similarly send a SIGKILL (-9) to the parent process. This allows the GUI
+// code to kill of the eCos application
+static int
+ecosynth_send_SIGKILL(ClientData clientData __attribute__ ((unused)),
+ Tcl_Interp* interp,
+ int argc,
+ char** argv __attribute__ ((unused)))
+{
+ if (1 != argc) {
+ Tcl_SetResult(interp, "wrong # args: should be \"usbtest::_send_SIGIO\"" , TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ (void) kill(parent_pid, SIGKILL);
+ return TCL_OK;
+}
+
+
+// ----------------------------------------------------------------------------
+// Application-specific initialization.
+
+static int
+ecosynth_appinit(Tcl_Interp* interp)
+{
+ Tcl_Channel from_app;
+ Tcl_Channel to_app;
+
+ // Tcl library initialization. This has the effect of executing init.tcl,
+ // thus setting up package load paths etc. Not all of that initialization
+ // is necessarily appropriate for ecosynth, but some devices may well want
+ // to load in additional packages or whatever.
+ if (Tcl_Init(interp) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ // Optionally initialize Tk as well. This can be suppressed by an
+ // argument -nw. Possibly this could be done by the Tcl script
+ // instead using dynamic loading.
+ //
+ // There is a problem with the way that Tk does its argument processing.
+ // By default it will accept abbreviations for the standard wish arguments,
+ // so if the user specifies e.g. -v then the Tk code will interpret this
+ // as an abbreviation for -visual, and will probably complain because
+ // -visual takes an argument whereas ecosynth's -v is just a flag.
+ //
+ // The Tk argument processing can be suppressed simply by temporarily
+ // getting rid of the argv variable. The disadvantage is that some
+ // standard arguments now have to be processed explicitly:
+ //
+ // -colormap map ignored, of little interest these days
+ // -display display currently ignored. This would have to be
+ // implemented at the C level, not the Tcl level,
+ // since Tk_Init() will start interacting with the
+ // X server. Its implementation would involve a
+ // setenv() call.
+ // -geometry geom implemented in the Tcl code using "wm geometry"
+ // -name name ignored for now.
+ // -sync ignored, of little interest to typical users
+ // -use id ignored, probably of little interest for now
+ // -visual visual ignored, of little interest these days
+ //
+ // so actually the only extra work that is required is for the Tcl code
+ // to process -geometry.
+ if (!no_windows) {
+ Tcl_Obj* argv = Tcl_GetVar2Ex(interp, "argv", NULL, TCL_GLOBAL_ONLY);
+ Tcl_IncrRefCount(argv);
+ Tcl_UnsetVar(interp, "argv", TCL_GLOBAL_ONLY);
+ if (Tk_Init(interp) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ Tcl_SetVar2Ex(interp, "argv", NULL, argv, TCL_GLOBAL_ONLY);
+ Tcl_DecrRefCount(argv);
+ }
+
+ // Create the synth:: namespace. Currently this does not seem to be possible from
+ // inside C.
+ if (TCL_OK != Tcl_Eval(interp,
+ "namespace eval synth {\n"
+ " variable channel_from_app 0\n"
+ " variable channel_to_app 0\n"
+ "}\n")) {
+ fprintf(stderr, PROGNAME ": internal error, failed to create Tcl synth:: namespace\n");
+ fprintf(stderr, " Please check Tcl version (8.3 or later required).\n");
+ exit(EXIT_FAILURE);
+ }
+
+ // The pipe to/from the application is exposed to Tcl, allowing
+ // the main communication to be handled at the Tcl level and
+ // specifically via the event loop. This requires two additional
+ // Tcl channels to be created for file descriptors 3 and 4.
+ from_app = Tcl_MakeFileChannel((ClientData) 3, TCL_READABLE);
+ if (NULL == from_app) {
+ fprintf(stderr, PROGNAME ": internal error, failed to create Tcl channel for pipe from application.\n");
+ exit(EXIT_FAILURE);
+ }
+ Tcl_RegisterChannel(interp, from_app);
+
+ // The channel name will be something like file0. Add a variable to the
+ // interpreter to store this name.
+ if (NULL == Tcl_SetVar(interp, "synth::_channel_from_app", Tcl_GetChannelName(from_app), TCL_GLOBAL_ONLY)) {
+ fprintf(stderr, PROGNAME ": internal error, failed to create Tcl variable from application channel 0\n");
+ exit(EXIT_FAILURE);
+ }
+
+ // Repeat for the channel to the application.
+ to_app = Tcl_MakeFileChannel((ClientData) 4, TCL_WRITABLE);
+ if (NULL == to_app) {
+ fprintf(stderr, PROGNAME ": internal error, failed to create Tcl channel for pipe to application.\n");
+ exit(EXIT_FAILURE);
+ }
+ Tcl_RegisterChannel(interp, to_app);
+ if (NULL == Tcl_SetVar(interp, "synth::_channel_to_app", Tcl_GetChannelName(to_app), TCL_GLOBAL_ONLY)) {
+ fprintf(stderr, PROGNAME ": internal error, failed to create Tcl variable from application channel 1\n");
+ exit(EXIT_FAILURE);
+ }
+
+ // The auxiliary may spawn additional programs, via
+ // device-specific scripts. Those programs should not have
+ // direct access to the pipe - that would just lead to
+ // confusion.
+ fcntl(3, F_SETFD, FD_CLOEXEC);
+ fcntl(4, F_SETFD, FD_CLOEXEC);
+
+ // Add synthetic target-specific commands to the Tcl interpreter.
+ Tcl_CreateCommand(interp, "synth::_send_SIGIO", &ecosynth_send_SIGIO, (ClientData)NULL, (Tcl_CmdDeleteProc*) NULL);
+ Tcl_CreateCommand(interp, "synth::_send_SIGKILL", &ecosynth_send_SIGKILL, (ClientData)NULL, (Tcl_CmdDeleteProc*) NULL);
+
+ // Define additional variables.
+
+ // The version, from the AM_INIT_AUTOMAKE() macro in configure.in
+ Tcl_SetVar(interp, "synth::_ecosynth_version", ECOSYNTH_VERSION, TCL_GLOBAL_ONLY);
+
+ // The parent process id, i.e. that for the eCos application itself.
+ Tcl_SetVar2Ex(interp, "synth::_ppid", NULL, Tcl_NewIntObj(getppid()), TCL_GLOBAL_ONLY);
+
+ // The various directories
+ Tcl_SetVar(interp, "synth::_ecosynth_repository", ECOS_REPOSITORY, TCL_GLOBAL_ONLY);
+ Tcl_SetVar(interp, "synth::_ecosynth_libexecdir", LIBEXECDIR, TCL_GLOBAL_ONLY);
+ Tcl_SetVar(interp, "synth::_ecosynth_package_dir", PKG_DIR, TCL_GLOBAL_ONLY);
+ Tcl_SetVar(interp, "synth::_ecosynth_package_version", PKG_VERSION, TCL_GLOBAL_ONLY);
+ Tcl_SetVar(interp, "synth::_ecosynth_package_install", PKG_INSTALL, TCL_GLOBAL_ONLY);
+
+ return TCL_OK;
+}
diff --git a/ecos/packages/hal/synth/arch/current/host/ecosynth.tcl b/ecos/packages/hal/synth/arch/current/host/ecosynth.tcl
new file mode 100644
index 0000000..f85fca2
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/ecosynth.tcl
@@ -0,0 +1,3312 @@
+# {{{ Banner
+
+# ============================================================================
+#
+# ecosynth.tcl
+#
+# The eCos synthetic target I/O auxiliary
+#
+# ============================================================================
+# ####ECOSHOSTGPLCOPYRIGHTBEGIN####
+# -------------------------------------------
+# This file is part of the eCos host tools.
+# Copyright (C) 2002, 2009 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.
+# -------------------------------------------
+# ####ECOSHOSTGPLCOPYRIGHTEND####
+# ============================================================================
+# #####DESCRIPTIONBEGIN####
+#
+# Author(s): bartv
+# Contact(s): bartv
+# Date: 2002/08/05
+# Version: 0.01
+# Description:
+# The main script for the eCos synthetic target auxiliary. This should
+# only ever be invoked from inside ecosynth.
+#
+# ####DESCRIPTIONEND####
+# ============================================================================
+
+# }}}
+
+# {{{ Overview
+
+# When an eCos synthetic target application runs it will usually
+# fork/execve an auxiliary program, ecosynth, to provide certain
+# I/O functionality. This happens as part of hardware initialization.
+#
+# The ecosynth executable in turn runs this ecosynth.tcl script which
+# either does most of the real work or delegates it to other scripts.
+# Those other scripts may in turn exec other programs to perform any
+# I/O operations that cannot easily be done at the Tcl level. For
+# example performing low-level ethernet operations generally requires
+# working at the C level or equivalent, so a separate executable would
+# be appropriate. The ecosynth executable will transfer control to
+# this script after the appinit() call, which should have performed
+# certain initialization steps.
+#
+# 1) the Tcl interpreter will be fully initialized.
+#
+# 2) usually Tk will have been loaded and initialized as well. This
+# can be suppressed using a command-line option -nw.
+#
+# 3) there will be a namespace synth:: for use by ecosynth.tcl
+# Auxiliary scripts are expected to use their own namespace
+# where possible.
+#
+# 4) there will be two channels synth::_channel_from_app and
+# synth::_channel_to_app. These correspond to a pipe between
+# the eCos application and the auxiliary. The application will
+# send requests using this pipe and expect replies. I/O
+# operations are always initiated by a request from the
+# application, but the auxiliary can raise an interrupt via
+# the SIGIO signal.
+#
+# Other standard channels stdin, stdout and stderr will have
+# been inherited from the eCos application.
+#
+# 5) some Tcl commands implemented in C will have been added to the
+# interpreter. The most notable is synth::_send_SIGIO, used to
+# raise an interrupt within the application.
+#
+# 6) similarly some variables will have been added to the interpreter.
+#
+#
+# Configuring everything can get somewhat complicated. It is the eCos
+# application that knows what I/O facilities within the auxiliary it
+# wants to access, but it may not know all the details. The eCos
+# component architecture makes things a bit more complicated still,
+# generic code such as this ecosynth.tcl script has no way of knowing
+# what I/O facilities might be provided by some package or other.
+#
+# For example, a target-side ethernet driver may want to send outgoing
+# ethernet packets to some script or program on the host and receive
+# incoming ethernet packets. However it does not necessarily know what
+# the host-side should do with those ethernet packets, e.g. use a
+# spare Linux ethernet device, use the Linux kernel's ethertap
+# facility, ... Although that kind of information could be handled by
+# target-side configury, host-side configuration files will often be
+# more appropriate. Specifically it would allow a single eCos
+# synthetic target application to run in a variety of environments,
+# using different ways to provide the I/O, with no need to do any
+# reconfiguring or rebuilding of the target side.
+#
+#
+# The basic approach that is taken is:
+#
+# 1) the eCos application tells the auxiliary what I/O facilities
+# it is interested in. This should happen as a result
+# of static constructors or of device driver initialization
+# routines. The application has no control over the implementation
+# of the I/O facilities, it just expects something on the other
+# end to respond sensibly to requests.
+#
+# For example, a synthetic target ethernet driver will supply
+# an initialization routine via its NETDEVTAB_ENTRY. This
+# routine will send a request to the auxiliary asking for a
+# device of type ethernet, id "eth0", provided by
+# CYGPKG_DEVS_ETH_ECOSYNTH, version current. The auxiliary will
+# now attempt to load a suitable Tcl script ethernet.tcl from a
+# location determined using the package name and version.
+#
+# 2) there is a primary target definition file which can be
+# specified as the final argument on the command line, with
+# "default" being the default value. The code will look for
+# this file with or without a .tdf extension, first in the
+# current directory, then in ~/.ecos/synth/. This file is
+# actually a Tcl script that gets executed in the current
+# interpreter. However typically it will only contain
+# entries such as:
+#
+# synth_device eth0 {
+ # ...
+ # }
+#
+# 3) There are additional optional configuration files
+# ~/.ecos/synth/initrc.tcl and ~/.ecos/synth/mainrc.tcl which can
+# be used for further customization. initrc.tcl will get run
+# early on, mainrc.tcl will get run once initialization is
+# complete. Specifically the target-side code will send an
+# appropriate request after invoking all the static constructors.
+# At this time the auxiliary will run mainrc.tcl, and in addition
+# it may issue warnings about unused arguments etc.
+#
+# 4) there may also be separate configuration files for GUI
+# preferences etc. These are distinct from the initrc and
+# mainrc files in that they are generated rather than
+# hand-written.
+
+# }}}
+# {{{ Basic initialization
+
+# ----------------------------------------------------------------------------
+# There should be two channels corresponding to the pipe between the
+# eCos application and the auxiliary. These should be configured
+# appropriately. If either channel does not exist then that is a
+# very good indication that the system is not properly initialized,
+# i.e. that this script is not being run by the ecosynth executable
+# and by implication that no eCos application is involved.
+
+if {([info exists synth::_channel_to_app] == 0) ||
+ ([info exists synth::_channel_from_app] == 0) ||
+ ([info exists synth::_ecosynth_version] == 0) ||
+ ([info exists synth::_ppid] == 0) ||
+ ([info exists synth::_ecosynth_repository] == 0) ||
+ ([info exists synth::_ecosynth_libexecdir] == 0) ||
+ ([info exists synth::_ecosynth_package_dir] == 0) ||
+ ([info exists synth::_ecosynth_package_version] == 0) ||
+ ([info exists synth::_ecosynth_package_install] == 0) ||
+ ([info commands synth::_send_SIGIO] == "") ||
+ ([info commands synth::_send_SIGKILL] == "") } {
+
+ puts stderr "ecosynth.tcl: the current interpreter has not been properly initialized."
+ puts stderr " This script should only be invoked by the ecosynth executable when"
+ puts stderr " an eCos synthetic target application is run."
+ exit 1
+}
+
+# Is the script currently being executed the most recent version?
+# This check should only happen if an environment variable
+# ECOSYNTH_DEVEL is set, because the installed tools may have come
+# from somewhere other than the current repository.
+if { [info exists ::env(ECOSYNTH_DEVEL)] } {
+ set _orig_name [file join $synth::_ecosynth_repository $synth::_ecosynth_package_dir $synth::_ecosynth_package_version \
+ "host" [file tail [info script]]]
+ if { [file exists $_orig_name] && [file readable $_orig_name] && ($_orig_name != [info script]) } {
+ if { [file mtime $_orig_name] >= [file mtime [info script]] } {
+ puts "$_orig_name is more recent than install: executing that."
+ source $_orig_name
+ return
+ }
+ }
+ unset _orig_name
+}
+
+fconfigure $synth::_channel_to_app -buffering none
+fconfigure $synth::_channel_from_app -encoding binary
+fconfigure $synth::_channel_to_app -encoding binary
+fconfigure $synth::_channel_from_app -translation binary
+fconfigure $synth::_channel_to_app -translation binary
+
+# Define additional globals and procedures inside the synth:: namespace.
+# Variables and functions that begin with an _ are considered internal
+# and should not be used directly.
+namespace eval synth {
+
+ # Unfortunately the name of the eCos executable is lost at this stage.
+ # Within the eCos application it was held in argv[0], but that has been
+ # overridden with the name of the auxiliary. However we have access to the
+ # parent process id so we can use /proc to get the required information.
+ variable ecos_appname ""
+ catch {
+ set synth::ecos_appname [file readlink "/proc/[set synth::_ppid]/exe"]
+ set synth::ecos_appname [file tail $synth::ecos_appname]
+ }
+
+ # The install location can be determined from the script name.
+ # This is used for e.g. loading bitmaps, even if ECOSYNTH_DEVEL
+ # is set, because some of the files may be generated.
+ # ECOSYNTH_DEVEL only affects Tcl scripts.
+ variable install_dir [file join $synth::_ecosynth_libexecdir "ecos" $synth::_ecosynth_package_install]
+
+ # Is the eCos application still running? This is worth keeping
+ # track of so that send_reply and raise_interrupt do not try to
+ # interact with a program that is no longer running.
+ variable ecos_running 1
+
+ # This variable is used to enter the event loop
+ variable _ecosynth_exit 0
+
+ # Is GUI mode enabled?
+ variable flag_gui [expr { "" != [info commands "tk"] } ]
+
+ # When running in GUI mode the GUI should stay up even after the application
+ # has exited, so that the user can take a good look around. When running in
+ # non-GUI mode this program should exit as soon it has finished cleaning up.
+ variable flag_immediate_exit [expr { 0 == $synth::flag_gui} ]
+
+ # Is the GUI ready to accept output?
+ variable flag_gui_ready 0
+
+ # Flags and variables related to command-line arguments
+ variable flag_help 0
+ variable flag_keep_going 0
+ variable flag_no_rc 0
+ variable flag_verbose 0
+ variable flag_debug 0
+ variable logfile ""
+ variable target_definition ""
+ variable geometry "<none>"
+}
+
+# }}}
+# {{{ Hooks & atexit support
+
+# ----------------------------------------------------------------------------
+# A lot of the flexibility of ecosynth is provided by hooks. Device scripts
+# and, more importantly, the per-user initrc and mainrc scripts can install
+# hooks that get called when an event occurs, for example when the eCos
+# applications attempts to transmit an ethernet packet.
+#
+# A special hook is used to implement atexit handling. This involves redefining
+# the "exit" command so that it will invoke the appropriate hooks first.
+
+namespace eval synth {
+ # All hooks are held in an array, indexed by the hook name, with each
+ # array entry being a list of functions to be invoked.
+ array set _hooks [list]
+
+ proc hook_define { name } {
+ if { [info exists synth::_hooks($name)] } {
+ synth::report_error "Attempt to create hook $name which already exists.\n"
+ } else {
+ set synth::_hooks($name) [list]
+ }
+ }
+
+ proc hook_defined { name } {
+ return [info exists synth::_hooks($name)]
+ }
+
+ proc hook_add { name function } {
+ if { ! [info exists synth::_hooks($name)] } {
+ synth::report_error "Attempt to attach a function to an unknown hook $name\n"
+ set synth::_hooks($name) [list]
+ }
+ lappend synth::_hooks($name) $function
+ }
+
+ proc hook_call { name args } {
+ if { ! [info exists synth::_hooks($name) ] } {
+ synth::report_error "Attempt to invoke unknown hook $name\n"
+ } else {
+ foreach function $synth::_hooks($name) {
+ $function $args
+ }
+ }
+ }
+
+ # Define an initial set of hooks
+ synth::hook_define "exit" ;# The auxiliary is exiting
+ synth::hook_define "ecos_exit" ;# The eCos application has exited
+ synth::hook_define "ecos_initialized" ;# eCos static constructors have run
+ synth::hook_define "help" ;# --help
+}
+
+# Rename the builtin exit command so that it can still be accessed.
+rename exit _hook_real_exit
+
+# And define a replacement for exit which will invoke the appropriate
+# hook. Care has to be taken in case of recursive exit calls, each
+# hook function is only called once.
+
+proc exit { { code 0 } } {
+ while { [llength $synth::_hooks(exit)] > 0 } {
+ set handler [lindex $synth::_hooks(exit) end]
+ set synth::_hooks(exit) [lrange $synth::_hooks(exit) 0 end-1]
+
+ # For now assume no errors - it is not clear what could be done
+ # about them anyway.
+ catch { eval $handler [list]}
+ }
+ # When running in GUI mode, some versions of Tk on top of some versions
+ # of X have problems shutting down cleanly and may report an X error.
+ # It is not understood exactly what is going on. This close causes the
+ # error to be ignored silently. Since we are exiting anyway, that is
+ # good enough.
+ close stderr
+ _hook_real_exit $code
+}
+
+# }}}
+# {{{ Output
+
+# ----------------------------------------------------------------------------
+# The usual set of utilities for issuing warnings, errors, ...
+#
+# There are three possibilities to consider:
+#
+# 1) running in text-only mode. The output should just go to stdout
+#
+# 2) running in GUI mode and the text window exists. Just update the
+# window
+#
+# 3) running in GUI mode but the text window is not yet ready. The
+# output needs to be buffered for now, and will be flushed
+# later.
+#
+# Also, if for some reason this program exits while there is output still
+# buffered that output should also go to stdout.
+#
+# If any errors occur during initialization, e.g. an invalid device script
+# or user initialization scripts, those get reported and an error count
+# is maintained. When the eCos application reports that initialization is
+# complete it will be sent back a status for the auxiliary, and will
+# exit if things have not started up correctly. This tries to ensure that
+# if there are multiple errors the user sees all of them.
+
+namespace eval synth {
+
+ variable _pending_output [list]
+ variable _logfd ""
+ variable _error_count 0
+
+ proc logfile_open { } {
+ synth::report "Opening logfile $synth::logfile"
+ set msg ""
+ if { [catch { set synth::_logfd [open $synth::logfile "w"] } msg ] } {
+ synth::report_error "Unable to open logfile \"$synth::logfile\"\n $msg\n"
+ }
+ }
+
+ # A default implementation of output. This gets overwritten later when running
+ # in GUI mode, so if GUI mode is enabled then this proc must be called before
+ # the GUI is ready and the data must be queued.
+ proc output { msg filter } {
+ if { ! $synth::flag_gui } {
+ # If a logfile exists, output normally goes there rather than
+ # to standard output. The exception is for errors which
+ # always go to stderr, in addition to the logfile.
+ if { "" != $synth::_logfd } {
+ puts -nonewline $synth::_logfd $msg
+ if { "error" == $filter } {
+ puts -nonewline stderr $msg
+ }
+ } else {
+ if { "error" == $filter } {
+ puts -nonewline stderr $msg
+ } else {
+ puts -nonewline $msg
+ }
+ }
+ } else {
+ lappend synth::_pending_output [list $msg $filter]
+ }
+ }
+
+ # Invoked by the text window code once everything is ready
+ # and synth::output has been redefined.
+ proc _flush_output { } {
+ foreach msg $synth::_pending_output {
+ synth::output [lindex $msg 0] [lindex $msg 1]
+ }
+ set synth::_pending_output [list]
+ }
+
+ # Cope with early exits. This will only have an effect if
+ # _flush_output has not been called yet, and by implication
+ # if synth::output has not yet been redefined.
+ proc _exit_flush_output { arg_list } {
+ if { 0 != [llength $synth::_pending_output] } {
+ set synth::flag_gui 0
+ synth::_flush_output
+ }
+ }
+ synth::hook_add "exit" synth::_exit_flush_output
+
+ proc report { msg } {
+ synth::output $msg "report"
+ }
+
+ proc report_warning { msg } {
+ synth::output "Warning: $msg" "warning"
+ }
+
+ proc report_error { msg } {
+ incr synth::_error_count
+ synth::output "Error: $msg" "error"
+ }
+
+ # Internal errors indicate a serious problem within ecosynth or
+ # a device-specific script. For now this results in output to
+ # stderr, a backtrace, and termination of the auxiliary, which
+ # should also cause the eCos application to shut down.
+ #
+ # An alternative approach would involve calling ::error and
+ # benefitting from its backtrace generation, but there are various
+ # places where it makes to sense to catch problems and call
+ # synth::error rather than internal_error
+ proc internal_error { msg } {
+ puts stderr "ecosynth, an internal error has occurred:"
+ puts stderr " $msg"
+ puts stderr "---------- backtrace -------------------------------------------------"
+ for { set level [info level] } { $level > 0 } { incr level -1 } {
+ puts stderr [info level $level]
+ }
+ puts stderr "----------------------------------------------------------------------"
+ puts stderr "ecosynth, exiting."
+ exit 1
+ }
+
+ # Dummy implementations of the exported filter routines, in case a script
+ # tries to create a filter even when not running in graphical mode
+ variable _dummy_filters [list]
+
+ proc filter_exists { name } {
+ set result 0
+ if { -1 != [lsearch -exact $synth::_dummy_filters $name] } {
+ set result 1
+ }
+ return $result
+ }
+
+ proc filter_get_list { } {
+ return $synth::_dummy_filters
+ }
+
+ proc filter_add { name args } {
+ if { [synth::filter_exists $name] } {
+ synth::internal_error "attempt to install filter $name twice.\n"
+ }
+ lappend synth::_dummy_filters $name
+ }
+}
+
+# }}}
+# {{{ Argument processing and global options
+
+# ----------------------------------------------------------------------------
+# Argument processing. The eCos application will usually just pass its
+# command line arguments to the auxiliary. Four special arguments will
+# have been examined already:
+#
+# -io, --io
+# I/O facilities, i.e. the auxiliary should run
+# -ni, -nio, --ni, --nio
+# No I/O facilities, i.e. the auxiliary should not be run.
+# -nw, --nw, --no-windows
+# No windows, i.e. disable the GUI
+# -w, --w, --windows
+# Enable the GUI
+#
+# There are a number of additional flags available as standard:
+#
+# -v, --version
+# The usual
+# -h, --help
+# Ditto
+# -k, --k, --keep-going
+# Ignore errors as much as possible
+# -nr, --no-rc
+# Skip the initrc and mainrc files
+# -x, --exit
+# The auxiliary should exit at the same time as the eCos application.
+# -nx, --no-exit
+# Inverse of the above
+# -V, --verbose
+# The usual
+# --debug
+# Not intended for end users
+# -l <file>, -l=<file>, --logfile <file>, --logfile=<file>
+# Send all output to the specified file. In GUI mode this is in addition
+# to the main text window. In non-GUI mode this is instead of stdout.
+# -t <file>, -t=<file>, --target <file>, --target=<file>
+# Specify the target definition file.
+#
+# Many X applications accept a common set of options, e.g. -display,
+# -geometry, etc. Although usually Tk will process these, there are
+# some problems - see ecosynth.c, ecosynth_appinit() for details.
+# Hence -geometry has to be processed here.
+#
+# -geometry <geom>
+#
+#
+# Some device-specific scripts may want to support additional
+# command line arguments. This is somewhat messy, since the core
+# code has no way of knowing what devices might be available and
+# hence what the actual valid arguments are. It would be possible
+# to just ignore any arguments that are not used by any device,
+# but that could really confuse a user who has made a typo. Instead
+# the code below keeps track of which arguments have been "consumed",
+# allowing it to issue a warning about unconsumed arguments after
+# initialization.
+#
+# Arguments can take the following forms:
+#
+# 1) -flag or --flag.
+# 2) -name=value or --name=value
+# 3) -name value or --name value
+#
+# There is a possibility of confusion if any of the values begin with a hyphen.
+# It is hard to do anything about this without advance knowledge of what all
+# the valid arguments are. Instead the user can avoid problems by using
+# the -name=value variant on the command line.
+#
+# There is also possible confusion if a single argument can occur multiple
+# times. If that is permitted then things can get rather messy, and
+# the current API does not really handle it.
+
+namespace eval synth {
+
+ # Keep track of all arguments which have not yet been consumed.
+ array set _argv_unconsumed [list]
+ for { set i 0 } { $i < $::argc } { incr i } {
+ set synth::_argv_unconsumed($i) [lindex $::argv $i]
+ }
+
+ # Provide a list of just those arguments that have not yet
+ # been consumed.
+ proc argv_get_unconsumed { } {
+ set result [list]
+ for { set i 0 } { $i < $::argc } {incr i } {
+ if { [info exists synth::_argv_unconsumed($i)] } {
+ lappend result $synth::_argv_unconsumed($i)
+ }
+ }
+ return $result
+ }
+
+ proc _argv_consume { index } {
+ if { [info exists synth::_argv_unconsumed($index)] } {
+ unset synth::_argv_unconsumed($index)
+ }
+ }
+
+ # Internal routine. Given a string of the form "-flag" or "-name=",
+ # return an index within argv or -1 if not found. As a side effect
+ # this "consumes" the argument.
+ proc _argv_lookup { name } {
+ set result -1
+ if { "=" != [string index $name end] } {
+ for { set i 0 } { $i < $::argc } { incr i } {
+ set arg [lindex $::argv $i]
+ if { [string equal $arg $name] || [string equal $arg "-[set name]"] } {
+ set result $i
+ synth::_argv_consume $i
+ break
+ }
+ }
+ } else {
+ set name [string range $name 0 end-1]
+ set len [string length $name]
+ for { set i 0 } { $i < $::argc } { incr i } {
+ set arg [lindex $::argv $i]
+ if { [string equal -length $len $arg $name] } {
+ if { "=" == [string index $arg $len] } {
+ set result $i
+ synth::_argv_consume $i
+ break;
+ } elseif { ([string length $arg] == $len) && ($i < ($::argc - 1)) } {
+ set result $i
+ synth::_argv_consume $i
+ synth::_argv_consume [expr $i + 1]
+ break
+ }
+ } elseif { [string equal -length [expr $len + 1] $arg "-[set name]"] } {
+ if { "=" == [string index $arg [expr $len + 1]] } {
+ set result $i
+ synth::_argv_consume $i
+ break
+ } elseif { ([string length $arg] == [expr $len + 1]) && ($i < ($::argc - 1)) } {
+ set result $i
+ synth::_argv_consume $i
+ synth::_argv_consume [expr $i + 1]
+ break
+ }
+ }
+ }
+ }
+ return $result
+ }
+
+ # Look for a given argument on the command line.
+ proc argv_defined { name } {
+ set result 0
+ set index [synth::_argv_lookup $name]
+ if { -1 != $index } {
+ set result 1
+ }
+ return $result
+ }
+
+ # Return the value associated with a given argument, which must be present.
+ proc argv_get_value { name } {
+ if { "=" != [string index $name end] } {
+ synth::internal_error "attempt to get a value for a simple flag argument \"$name\".\n"
+ }
+ set result ""
+ set index [synth::_argv_lookup $name]
+ if { -1 == $index } {
+ synth::internal_error "attempt to get the value associated with a non-existent argument \"$name\".\n"
+ }
+ set arg [lindex $::argv $index]
+ set len [string length $name]
+ if { [string equal -length $len $arg $name] } {
+ set result [string range $arg $len end]
+ } elseif { [string equal -length [expr $len + 1] $arg "-[set name]"] } {
+ set result [string range $arg [expr $len + 1] end]
+ } else {
+ set result [lindex $::argv [expr $index + 1]]
+ }
+ return $result
+ }
+
+ # -ni/-nio are not relevant. If present then they would have been handled
+ # within the eCos application, the auxiliary would not have been spawned,
+ # and this script would not be running.
+
+ # -io will have been processed by the eCos application.
+ # -nw, -w, and related options have been processed by the C code.
+ # Look them up anyway to consume them.
+ synth::_argv_lookup "-io"
+ synth::_argv_lookup "-nw"
+ synth::_argv_lookup "-no-windows"
+ synth::_argv_lookup "-w"
+ synth::_argv_lookup "-windows"
+
+ # Now cope with the other standard flags
+ if { [synth::argv_defined "-v"] || [synth::argv_defined "--version"] } {
+ # Just output the version message and exit. The eCos application
+ # will do the same. The version is obtained from configure.in,
+ # and also from the install directory. The synthetic target
+ # startup code will exit quietly if the auxiliary exits at this
+ # stage. This output should go via puts rather than the
+ # synth:: output routines, since the GUI will never appear if
+ # --version is specified.
+ puts "ecosynth: version $synth::_ecosynth_version"
+ puts " : install location [file dirname [info script]]"
+ exit 0
+ }
+
+ if { [synth::argv_defined "-l="] } {
+ set synth::logfile [synth::argv_get_value "-l="]
+ } elseif { [synth::argv_defined "-logfile="] } {
+ set synth::logfile [synth::argv_get_value "-logfile="]
+ }
+ if { "" != $synth::logfile } {
+ synth::logfile_open
+ }
+
+ # -h/--help would normally also result in an immediate exit. However,
+ # the device-specific scripts have not yet been loaded so there
+ # is no way of reporting their options. Hence the usage information
+ # is delayed until later. Suppressing GUI mode as a side effect is
+ # probably a good idea as well, that way the output appears in the
+ # current console window.
+ if { [synth::argv_defined "-h"] || [synth::argv_defined "-help"] } {
+ set synth::flag_help 1
+ set synth::flag_gui 0
+ }
+
+ if { [synth::argv_defined "-debug"] } {
+ set synth::flag_debug 1
+ }
+
+ if { [synth::argv_defined "-k"] || [synth::argv_defined "-keep-going"] } {
+ set synth::flag_keep_going 1
+ }
+
+ if { [synth::argv_defined "-nr"] || [synth::argv_defined "-no-rc"]} {
+ set synth::flag_no_rc 1
+ }
+
+ if { [synth::argv_defined "-x"] || [synth::argv_defined "-exit"] } {
+ set synth::flag_immediate_exit 1
+ } elseif { [synth::argv_defined "-nx"] || [synth::argv_defined "-no-exit"] } {
+ set synth::flag_immediate_exit 0
+ }
+
+ if { [synth::argv_defined "-V"] || [synth::argv_defined "-verbose"] } {
+ set synth::flag_verbose 1
+ }
+
+ if { [synth::argv_defined "-t="] } {
+ set synth::target_definition [synth::argv_get_value "-t="]
+ } elseif { [synth::argv_defined "-target="] } {
+ set synth::target_definition [synth::argv_get_value "-target="]
+ }
+
+ # Arguably -geometry should only be checked when the GUI is enabled,
+ # but doing so at all times is harmless.
+ # Note that '-geometry ""' means that any value held in the
+ # preferences file should be ignored. Hence the regexp below
+ # accepts the empty string, and treats it separately from
+ # uninitialized.
+ if { [synth::argv_defined "-geometry="] } {
+ set synth::geometry [synth::argv_get_value "-geometry="]
+
+ if { ![regexp -- {^([0-9]+x[0-9]+)?([+-][0-9]+[+-][0-9]+)?$} $synth::geometry] } {
+ synth::report_warning "Invalid geometry string $synth::geometry\n"
+ set synth::geometry "<none>"
+ }
+ }
+
+ if { $synth::flag_debug } {
+ synth::report \
+ "Results of initial command-line parsing:\n \
+ --help $synth::flag_help\n \
+ --keep-going $synth::flag_keep_going\n \
+ --no-rc $synth::flag_no_rc\n \
+ --exit $synth::flag_immediate_exit\n \
+ --verbose $synth::flag_verbose\n \
+ logfile $synth::logfile\n \
+ target definition $synth::target_definition\n \
+ geometry $synth::geometry\n \
+ unconsumed [synth::get_unconsumed_args]\n"
+ }
+}
+
+# }}}
+# {{{ Create and populate ~/.ecos/synth
+
+# ----------------------------------------------------------------------------
+# If the per-user configuration directories do not exist yet, create them.
+# Also install default initrc.tcl and mainrc.tcl files which do nothing, but
+# which can be edited. If problems occur then the user gets a warning
+# but execution proceeds.
+#
+# Some people may object to this automatic creation of directories and
+# configuration files. However there is plenty of precedent, and the
+# files involved are small. Messages are generated so that the user
+# knows what has happened.
+#
+# Currently the default target definition file is not copied from
+# the install tree into the per-user tree. Although some users will
+# be happy having this file in ~/.ecos/synth, others may prefer it
+# to be more visible in the current directory.
+
+if { ![file exists "~/.ecos"] } {
+ synth::report "Creating new directory ~/.ecos for eCos configuration files.\n"
+ if { 0 != [catch { file mkdir "~/.ecos" }] } {
+ synth::report_warning "failed to create directory ~/.ecos\n"
+ }
+}
+if { [file exists "~/.ecos"] && [file isdirectory "~/.ecos"] && ![file exists "~/.ecos/synth"] } {
+ synth::report "Creating new directory ~/.ecos/synth for synthetic target configuration files.\n"
+ if { 0 != [catch { file mkdir "~/.ecos/synth" } ] } {
+ synth::report_warning "failed to create directory ~/.ecos/synth\n"
+ } else {
+ # initrc and mainrc are only copied when the directory is first created,
+ # so that users can delete them if unwanted - even though the
+ # default versions do nothing.
+ synth::report "Installing default configuration files ~/.ecos/synth/initrc.tcl and ~/.ecos/synth/mainrc.tcl\n"
+ catch { file copy -- [file join $synth::install_dir "user_initrc.tcl"] "~/.ecos/synth/initrc.tcl"}
+ catch { file copy -- [file join $synth::install_dir "user_mainrc.tcl"] "~/.ecos/synth/mainrc.tcl"}
+ }
+}
+
+# }}}
+# {{{ Read target definition file
+
+# ----------------------------------------------------------------------------
+# Once the GUI is up and running it is possible to start reading in some
+# configuration files. The first of these is the target definition file.
+# Typically this would be ~/.ecos/synth/default.tdf. An alternative
+# definition file can be specified on the command line with the
+# -t argument, and the code will look in the current directory,
+# in ~/.ecos/synth, and in the install tree.
+#
+# The purpose of the target definition file is to specify exactly
+# how I/O gets implemented. For example the eCos application may
+# want to access a network device eth0, but that device could be
+# implemented in a variety of ways (e.g. a real ethernet device
+ # on the Linux host, or a fake device provided by the ethertap
+ # facility). It is the target definition file that provides
+# this information.
+#
+# The file is of course just another Tcl script, running in the
+# current interpreter. There seems little point in using a safe
+# interpreter given the considerable number of other Tcl scripts
+# that are being used, some of which need the ability to e.g.
+# run other programs. The main command is synth_device which
+# takes two arguments, a device name and some options for that
+# device, e.g.:
+#
+# synth_device eth0 {
+ # use eth1
+ # }
+#
+# synth_device eth1 {
+ # use tap0
+ # }
+#
+# When the eCos device driver looks up eth0 this will cause a
+# device-specific Tcl script to be loaded, which can examine
+# this data.
+#
+# This code has no way of knowing what constitutes valid or invalid
+# contents for an eth0 device, especially since the Tcl script that
+# could provide such knowledge has not been loaded. Instead it is
+# assumed that the contents is another set of Tcl commands such as
+# "physical", which will of course not be defined so the Tcl interpreter
+# will invoke "unknown" which is temporarily redefined here. This makes
+# it possible for the device-specific commands to have arbitrary number
+# of arguments, or to define Tcl fragments for hooks, or whatever.
+#
+# As with argument processing, the code attempts to keep track of
+# which devices and options have been "consumed" and can issue
+# warnings about any unused devices or options. This helps to track
+# down typos and similar problems. These warnings are only output
+# when running at verbose mode, since it is fairly normal practice
+# to have a single target definition file which supports
+# a number of different eCos applications with different I/O
+# requirements.
+
+namespace eval synth {
+ # A list of all devices specified in the target definition file.
+ # For now assume that a given device will only be specified once.
+ variable _tdf_devices [list]
+
+ # An array with additional details of each device. This will have
+ # entries such as _tdf_device_options(eth0,4), where the second
+ # argument is a per-device index. The value of each entry is
+ # a list of the actual command and its arguments. This use of
+ # an index allows for multiple instances of a per-device
+ # option.
+ array set _tdf_device_options [list]
+
+ # While reading in the device details it is necessary to keep track
+ # of the current device, if any. Otherwise the implementation of
+ # "unknown" will not be able to update _tdf_device_options. An index
+ # is needed as well.
+ variable _tdf_current_device ""
+ variable _tdf_current_index 0
+
+ # Keep track of which devices and options have been consumed
+ variable _tdf_consumed_devices [list]
+ variable _tdf_consumed_options [list]
+
+ proc tdf_has_device { name } {
+ return [expr -1 != [lsearch -exact $synth::_tdf_devices $name]]
+ }
+
+ proc tdf_get_devices { } {
+ return $synth::_tdf_devices
+ }
+
+ proc _tdf_get_option_index { devname option } {
+ synth::_tdf_consume_device $devname
+ for { set i 0 } { [info exists synth::_tdf_device_options($devname,$i)] } { incr i } {
+ if { $option == [lindex $synth::_tdf_device_options($devname,$i) 0] } {
+ synth::_tdf_consume_option $devname $i
+ return $i
+ }
+ }
+ return -1
+ }
+
+ proc _tdf_get_option_indices { devname option } {
+ synth::_tdf_consume_device $devname
+ set result [list]
+ for { set i 0 } { [info exists synth::_tdf_device_options($devname,$i)] } { incr i } {
+ if { $option == [lindex $synth::_tdf_device_options($devname,$i) 0] } {
+ synth::_tdf_consume_option $devname $i
+ lappend result $i
+ }
+ }
+ return $result
+ }
+
+ proc tdf_has_option { devname option } {
+ return [expr -1 != [synth::_tdf_get_option_index $devname $option]]
+ }
+
+ proc tdf_get_option { devname option } {
+ set index [synth::_tdf_get_option_index $devname $option]
+ if { -1 != $index } {
+ lappend synth::_tdf_consumed_options "$devname,$index"
+ return [lrange $synth::_tdf_device_options($devname,$index) 1 end]
+ } else {
+ return [list]
+ }
+ }
+
+ proc tdf_get_options { devname option } {
+ set result [list]
+ set indices [synth::_tdf_get_option_indices $devname $option]
+ foreach index $indices {
+ lappend result [lrange $synth::_tdf_device_options($devname,$index) 1 end]
+ }
+ return $result
+ }
+
+ proc tdf_get_all_options { devname } {
+ set result [list]
+ for { set i 0 } { [info exists synth::_tdf_device_options($devname,$i)] } { incr i } {
+ lappend synth::_tdf_consumed_options "$devname,$i"
+ lappend result $synth::_tdf_device_options($devname,$i)
+ }
+ return $result
+ }
+
+ proc _tdf_consume_device { name } {
+ if { -1 == [lsearch -exact $synth::_tdf_consumed_devices $name] } {
+ lappend synth::_tdf_consumed_devices $name
+ }
+ }
+
+ proc _tdf_consume_option { devname index } {
+ if { -1 == [lsearch -exact $synth::_tdf_consumed_options "$devname,$index"] } {
+ lappend synth::_tdf_consumed_options "$devname,$index"
+ }
+ }
+
+ proc tdf_get_unconsumed_devices { } {
+ set result [list]
+ foreach devname $synth::_tdf_devices {
+ if { -1 == [lsearch -exact $synth::_tdf_consumed_devices $devname] } {
+ lappend result $devname
+ }
+ }
+ return $result
+ }
+
+ proc tdf_get_unconsumed_options { } {
+ set result [list]
+ foreach devname $synth::_tdf_devices {
+ if { -1 == [lsearch -exact $synth::_tdf_consumed_devices $devname] } {
+ # Do not report all the options for a device that has not been consumed at all
+ continue
+ }
+ for { set i 0 } { [info exists synth::_tdf_device_options($devname,$i)] } { incr i } {
+ if { -1 == [lsearch -exact $synth::_tdf_consumed_options "$devname,$i"] } {
+ lappend result [list $devname $synth::_tdf_device_options($devname,$i)]
+ }
+ }
+ }
+ return $result
+ }
+}
+
+# Look for the target definition file.
+set _tdf $synth::target_definition
+if { "" == $_tdf } {
+ set _tdf "default"
+}
+set _config_file ""
+
+set _dirlist [list [pwd] "~/.ecos/synth" $synth::install_dir]
+foreach _dir $_dirlist {
+ set _candidate "[file join $_dir $_tdf].tdf" ; # file join does the right thing for absolute paths
+ if { [file isfile $_candidate] } {
+ set _config_file $_candidate
+ break
+ } else {
+ set _candidate [file join $_dir $_tdf]
+ if { [file isfile $_candidate] } {
+ set _config_file $_candidate
+ break
+ }
+ }
+}
+if { "" == $_config_file } {
+ if { "" != $synth::target_definition } {
+ # The user explicitly specified a file, so it must be read in.
+ # If it cannot be found then that should be treated as an error.
+ set msg "Unable to find target definition file $synth::target_definition\n"
+ if { "absolute" != [file pathtype $synth::target_definition] } {
+ append msg " Searched $_dirlist\n"
+ }
+ synth::report_error $msg
+ exit 1
+ } else {
+ # This is a mild error, because default.tdf should be installed
+ # below libexec. However the default file does not actually
+ # define anything, it is just a set of comments, so there is
+ # nothing to be gained by issuing a warning.
+ }
+} else {
+
+ set synth::target_definition $_config_file
+
+ proc synth_device { name data } {
+ if { "" != $synth::_tdf_current_device } {
+ error "synth_device $name is nested inside $synth::_tdf_current_device\nNesting of synth_device entries is not allowed."
+ }
+ if { -1 != [lsearch -exact $synth::_tdf_devices $name] } {
+ error "Duplicate entry for synth_device $name"
+ }
+ set synth::_tdf_current_device $name
+ set synth::_tdf_current_index 0
+ lappend synth::_tdf_devices $name
+ eval $data
+ # If the eval resulted in an error, propagate it immediately rather than attempt
+ # any form of recovery. The downside is that only error per run will be
+ # reported.
+ set synth::_tdf_current_device ""
+ }
+ rename unknown _synth_unknown
+ proc unknown { args } {
+ if { "" == $synth::_tdf_current_device } {
+ # An unknown command at the toplevel. Pass this to the
+ # original "unknown" command, in the unlikely event that
+ # the user really did want to autoload a library or do
+ # something similar.
+ eval _synth_unknown $arg
+ return
+ }
+
+ # Anything else is treated as an option within the synth_device
+ set synth::_tdf_device_options($synth::_tdf_current_device,$synth::_tdf_current_index) $args
+ incr synth::_tdf_current_index
+ }
+
+ set _config_file_msg ""
+ set _result [catch { source $_config_file } _config_file_msg ]
+
+ rename unknown ""
+ rename synth_device ""
+ rename _synth_unknown unknown
+
+ if { $_result } {
+ # Any problems reading in the target definition file should be
+ # treated as an error: I/O is unlikely to behave in the way
+ # that the user expects.
+ set msg "An error occurred while reading in the target definition file\n $_config_file\n $_config_file_msg\n"
+ synth::report_error $msg
+ exit 1
+ }
+ unset _result _config_file_msg
+}
+
+unset _dirlist _tdf _config_file _candidate
+
+# }}}
+
+if { $synth::flag_gui } {
+# {{{ Main GUI code
+
+# {{{ Session file
+
+ # ----------------------------------------------------------------------------
+ # The tool manages a file ~/.ecos/synth/guisession, holding information
+ # such as the size and position of the main window. The aim is to give
+ # the user a fairly consistent interface between sessions. The information
+ # is saved during exit handling, and also in response to the window
+ # manager WM_SAVE_YOURSELF request. However note that the latter does
+ # not extend to user session information - restarting the eCos application
+ # the next time a user logs in is inappropriate for eCos, plus if
+ # the application is being run inside gdb (a likely scenario) it is gdb
+ # that should handle restarting the application.
+ #
+ # Using a single file has limitations. Specifically the user may be
+ # switching between a number of different target definition files,
+ # each resulting in a subtly different layout, and arguably there
+ # should be separate session information for each one. However
+ # distinguishing between per-target and global settings would be
+ # very complicated.
+ #
+ # The most obvious implementation involves the options database.
+ #
+ # FIXME: implement properly
+
+ namespace eval synth {
+ # Make sure we are using the right options from .Xdefaults etc.
+ tk appname "ecosynth"
+
+ if { $synth::flag_debug } {
+ # synth::report "Reading in session file ~/.ecos/synth/guisession\n"
+ }
+
+ # synth::report_warning "Support for reading session file ~/.ecos/synth/guisession not yet implemented.\n"
+
+ if { [file exists "~/.ecos/synth/guisession"] } {
+ if {0 != [catch { option readfile "~/.ecos/synth/guisession" userDefault} msg]} {
+ # synth::report_error "Failed to read GUI session information from file ~/.ecos/synth/guisession\n $msg\n"
+ }
+ }
+
+ proc _update_session_file { arg_list } {
+ # synth::report_warning "Support for updating session file ~/.ecos/synth/guisession not yet implemented.\n"
+ }
+ proc _handle_wm_save_yourself { } {
+ # synth::report_warning "Support for WM_SAVE_YOURSELF not yet implemented\n"
+ }
+
+ synth::hook_add "exit" synth::_update_session_file
+ }
+
+ # }}}
+# {{{ Load images
+
+# ----------------------------------------------------------------------------
+# Load various useful bitmaps etc. into memory, so that they can be accessed
+# by any code that needs them.
+#
+# Running1 is a coloured version of the eCos logo. running2 and running3 are
+# used by alternative implementations of the heartbeat: running2 has the
+# red and black reversed, and running3 is mostly a mirror image of the normal
+# logo.
+namespace eval synth {
+
+ proc load_image { image_name filename } {
+ set result 0
+ set type [file extension $filename]
+ if { ! [file exists $filename] } {
+ synth::report_error "Image $filename has not been installed.\n"
+ } elseif { ! [file readable $filename] } {
+ synth::report_error "Image $filename is not readable.\n"
+ } elseif { (".xbm" == $type) } {
+ if { 0 == [catch { set $image_name [image create bitmap -file $filename] }] } {
+ set result 1
+ } else {
+ synth::report_error "Bitmap image $filename is invalid.\n"
+ }
+ } else {
+ if { 0 == [catch { set $image_name [image create photo -file $filename] }] } {
+ set result 1
+ } else {
+ synth::report_error "Image $filename is invalid.\n"
+ }
+ }
+ return $result
+ }
+
+ set _images [list "tick_yes.xbm" "tick_no.xbm" "save.xbm" "cut.xbm" "copy.xbm" "paste.xbm" \
+ "help.xbm" "running1.ppm" "saveall.xbm" ]
+ foreach _image $_images {
+ variable image_[file rootname $_image]
+ synth::load_image "synth::image_[file rootname $_image]" [file join $synth::install_dir $_image]
+ }
+ unset _images _image
+}
+
+# }}}
+# {{{ Balloon help
+
+namespace eval synth {
+
+ variable _balloon_current ""
+ array set _balloon_messages [list]
+ variable _balloon_pending ""
+
+ toplevel .balloon
+ label .balloon.info -borderwidth 2 -relief groove -background "light yellow" -anchor w
+ pack .balloon.info -side left -fill both -expand 1
+ wm overrideredirect .balloon 1
+ wm withdraw .balloon
+
+ proc register_balloon_help { widget message } {
+ set synth::_balloon_messages($widget) $message
+ bind $widget <Enter> { synth::_balloonhelp_pending %W }
+ bind $widget <Leave> { synth::_balloonhelp_cancel }
+ bind $widget <Destroy> {+synth::_balloonhelp_destroy %W }
+ }
+
+ proc _balloonhelp_pending { widget } {
+ synth::_balloonhelp_cancel
+ set synth::_balloon_pending [after 1200 [list synth::_balloonhelp_show $widget]]
+ }
+
+ proc _balloonhelp_cancel { } {
+ if { "" != $synth::_balloon_pending } {
+ after cancel $synth::_balloon_pending
+ set synth::_balloon_pending ""
+ } else {
+ wm withdraw .balloon
+ set synth::_balloon_current ""
+ }
+ }
+
+ proc _balloonhelp_destroy { widget } {
+ if { $synth::_balloon_current == $widget } {
+ wm withdraw .balloon
+ set synth::_balloon_current ""
+ }
+ unset synth::_balloon_messages($widget)
+ }
+
+ proc _balloonhelp_show { widget } {
+ if { [winfo exists $widget] } {
+ set synth::_balloon_current $widget
+ .balloon.info configure -text $synth::_balloon_messages($widget)
+ set x [expr [winfo rootx $widget] + 2]
+ set y [expr [winfo rooty $widget] + [winfo height $widget] + 2]
+ wm geometry .balloon +$x+$y
+ wm deiconify .balloon
+ raise .balloon
+ }
+ set synth::_balloon_pending ""
+ }
+}
+
+# }}}
+# {{{ Window manager settings
+
+# ----------------------------------------------------------------------------
+# Set up the current program name in the title bar etc.
+
+namespace eval synth {
+
+ if { $synth::flag_debug } {
+ synth::report "Performing required interactions with window manager\n"
+ }
+
+ # The toplevel is withdrawn during startup. It is possible that
+ # some of the windows and other objects created initially will end
+ # up being deleted again before the system is fully up and running,
+ # and the event loop is entered before then to accept requests from
+ # the eCos application. This could cause confusing changes. The
+ # toplevel is displayed in response to the constructors-done request.
+ wm withdraw .
+
+ # For now disable all attempts to use the "send" command. Leaving it
+ # enabled would introduce security problems.
+ rename "::send" {}
+
+ variable title "eCos synthetic target"
+ if { "" != $synth::ecos_appname} {
+ append synth::title ": $synth::ecos_appname ($synth::_ppid)"
+ }
+ wm title . $synth::title
+
+ # Use the specified geometry, or that from the last session.
+ # Obviously how well this works depends very much on the
+ # window manager being used.
+ set _geometry ""
+ if { "" == $synth::geometry} {
+ # Command line request to suppress the preferences. Revert
+ # to a default size.
+ set _geometry "640x480"
+ } elseif { "<none>" == $synth::geometry } {
+ # No command line option, use the value from the preferences file
+ # FIXME: implement
+ set _geometry "640x480"
+ } else {
+ # There was an explicit -geometry option on the command line. Use it.
+ set synth::_geometry $synth::geometry
+ if { [regexp -- {^([0-9]+x[0-9]+).*$} $synth::_geometry] } {
+ wm sizefrom . "user"
+ }
+ if { [regexp -- {^.*([+-][0-9]+[+-][0-9]+)$} $synth::_geometry] } {
+ wm positionfrom . "user"
+ }
+ }
+ wm geometry . $synth::_geometry
+ unset synth::_geometry
+
+ set _file [file join $synth::install_dir "ecosicon.xbm"]
+ if { [file readable $synth::_file] } {
+ wm iconbitmap . "@$synth::_file"
+ }
+ set _file [file join $synth::install_dir "ecosiconmask.xbm"]
+ if { [file readable $synth::_file] } {
+ wm iconmask . "@$synth::_file"
+ }
+ unset synth::_file
+
+ if { "" != $synth::ecos_appname } {
+ wm iconname . "ecosynth: $synth::ecos_appname"
+ } else {
+ wm iconname . "ecosynth"
+ }
+
+ wm protocol . "WM_DELETE_WINDOW" synth::_handle_exit_request
+ wm protocol . "WM_SAVE_YOURSELF" synth::_handle_wm_save_yourself
+}
+
+# }}}
+# {{{ Exit and kill handling
+
+# ----------------------------------------------------------------------------
+# Exit handling. The user may request program termination using various
+# different ways:
+# 1) File->Exit
+# 2) ctrl-Q, the shortcut for the above
+# 3) the Window Manager's delete-window request
+#
+# If eCos has already exited then the request can be handled straightaway.
+# The invocation of exit will go via the exit hooks so appropriate
+# clean-ups will take place.
+#
+# If eCos has not already exited then it is assumed that the user wants
+# the eCos application to terminate as well as the GUI. This can be achieved
+# via the interrupt subsystem. However, there is a risk that the application
+# has crashed, or is blocked in gdb, or has interrupts permanently disabled,
+# in which case it is not going to respond to the SIGIO. To allow for this
+# a number of retries are attempted, and after five seconds of this the
+# application is killed off forcibly.
+
+namespace eval synth {
+
+ variable _handle_exit_retries 0
+ variable _handle_exit_after ""
+
+ proc _handle_exit_request { } {
+ if { !$synth::ecos_running } {
+ exit 0
+ }
+ # Setting this flag causes ecosynth to exit immediately once
+ # the application terminates.
+ set synth::flag_immediate_exit 1
+
+ # Now ask the application to exit
+ synth::request_application_exit
+
+ # Set up a timer to retry this
+ if { "" == $synth::_handle_exit_after } {
+ set synth::_handle_exit_after [after 1000 synth::_handle_exit_timer]
+
+ # And output something so the user knows the request has been received
+ synth::report "Waiting for the eCos application to exit.\n"
+ }
+ }
+
+ # This routine requests termination of eCos, but not of
+ # ecosynth
+ proc _handle_kill_request { } {
+ if { $synth::ecos_running } {
+ synth::request_application_exit
+ if { "" == $synth::_handle_exit_after } {
+ set synth::_handle_exit_after [after 1000 synth::_handle_exit_timer]
+ }
+ }
+ }
+
+ proc _handle_exit_timer { } {
+ if { $synth::ecos_running } {
+ incr synth::_handle_exit_retries
+ if { $synth::_handle_exit_retries < 5 } {
+ synth::request_application_exit
+ synth::report "Still waiting for the eCos application to exit.\n"
+ } else {
+ synth::_send_SIGKILL
+ }
+ set synth::_handle_exit_after [after 1000 synth::_handle_exit_timer]
+ }
+ }
+}
+
+# }}}
+# {{{ Main window layout
+
+# ----------------------------------------------------------------------------
+# The window layout is as follows:
+# 1) a menu bar at the top (surprise surprise). Many of the menus will be
+# empty or nearly so, but device-specific scripts may want to extend
+# the menus.
+# 2) a toolbar. This is primarily for use by device-specific scripts
+# 3) a central grid.
+# 4) a status line at the bottom.
+#
+# The central grid is organised as a 3x3 set of frames. The centre frame holds
+# the main text display, plus associated scrollbars, and is the frame that
+# will expand or shrink as the toplevel is resized. The remaining eight frames
+# (nw, n, ne, e, se, s, sw, w) are available for use by device-specific
+# scripts, typically under control of settings in the target definition file.
+# It is very possible that some or all of these eight frames will be empty,
+# and if an entire row or column is empty then Tk will make them invisible.
+#
+# Possible enhancements:
+# 1) implement some sort of paning/resizing around the central text window.
+# That would provide some way of letting the user control the space
+# taken by device-specific subwindows. This would be implemented
+# by modifying the weights assigned to different rows/columns.
+# 2) it would be very useful if the main text window could be split,
+# like emacs. This would require multiple text widgets, with output
+# being pasted in each one.
+# 3) possibly the text window should not be hard-wired to the centre frame,
+# instead its frame could be selected by preferences somehow.
+
+if { $synth::flag_debug } {
+ synth::report "Creating main window layout\n"
+}
+
+# The various frames are generally accessed via variables
+
+menu .menubar -borderwidth 1
+menu .menubar.file
+menu .menubar.edit
+menu .menubar.view
+menu .menubar.windows
+menu .menubar.help
+
+. configure -menu .menubar
+.menubar add cascade -label "File" -underline 0 -menu .menubar.file
+.menubar add cascade -label "Edit" -underline 0 -menu .menubar.edit
+.menubar add cascade -label "View" -underline 0 -menu .menubar.view
+.menubar add cascade -label "Windows" -underline 0 -menu .menubar.windows
+.menubar add cascade -label "Help" -underline 0 -menu .menubar.help
+
+.menubar.file add command -label "Save" -underline 0 -accelerator "Ctrl-S" -command [list synth::_handle_file_save]
+.menubar.file add command -label "Save As..." -underline 5 -command [list synth::_handle_file_save_as]
+.menubar.file add command -label "Save All..." -underline 6 -command [list synth::_handle_file_save_all]
+.menubar.file add command -label "Kill eCos" -underline 0 -command [list synth::_handle_kill_request]
+.menubar.file add command -label "Exit" -underline 1 -accelerator "Ctrl-Q" -command [list synth::_handle_exit_request]
+bind . <Control-KeyPress-q> [list synth::_handle_exit_request]
+bind . <Control-KeyPress-s> [list synth::_handle_file_save]
+
+# Once eCos has exited, the kill option should be disabled
+namespace eval synth {
+ proc _menubar_ecos_exit_clean { arg_list } {
+ .menubar.file entryconfigure "Kill eCos" -state disabled
+ }
+ synth::hook_add "ecos_exit" synth::_menubar_ecos_exit_clean
+}
+
+frame .toolbar -borderwidth 1 -relief groove
+if { "" != $synth::image_save } {
+ button .toolbar.save -image $synth::image_save -borderwidth 0 -command [list synth::_handle_file_save]
+ pack .toolbar.save -side left -padx 2
+ synth::register_balloon_help .toolbar.save "Save visible output"
+}
+if { "" != $synth::image_saveall } {
+ button .toolbar.saveall -image $synth::image_saveall -borderwidth 0 -command [list synth::_handle_file_save_all]
+ pack .toolbar.saveall -side left -padx 2
+ synth::register_balloon_help .toolbar.saveall "Save all output"
+}
+if { "" != $synth::image_cut } {
+ button .toolbar.cut -image $synth::image_cut -borderwidth 0 -state disabled -command [list synth::_handle_edit_cut]
+ pack .toolbar.cut -side left -padx 2
+ synth::register_balloon_help .toolbar.cut "Cut"
+}
+if { "" != $synth::image_copy } {
+
+ button .toolbar.copy -image $synth::image_copy -borderwidth 0 -command [list synth::_handle_edit_copy]
+ pack .toolbar.copy -side left -padx 2
+ synth::register_balloon_help .toolbar.copy "Copy"
+}
+if { "" != $synth::image_paste } {
+ button .toolbar.paste -image $synth::image_paste -borderwidth 0 -state disabled -command [list synth::_handle_edit_paste]
+ pack .toolbar.paste -side left -padx 2
+ synth::register_balloon_help .toolbar.paste "Paste"
+}
+pack .toolbar -side top -fill x
+
+frame .main
+frame .main.nw -borderwidth 0
+frame .main.n -borderwidth 0
+frame .main.ne -borderwidth 0
+frame .main.e -borderwidth 0
+frame .main.se -borderwidth 0
+frame .main.s -borderwidth 0
+frame .main.sw -borderwidth 0
+frame .main.w -borderwidth 0
+
+frame .main.centre
+
+frame .main.border_nw_n -width 2 -background black -borderwidth 0
+frame .main.border_n_ne -width 2 -background black -borderwidth 0
+frame .main.border_w_centre -width 2 -background black -borderwidth 0
+frame .main.border_centre_e -width 2 -background black -borderwidth 0
+frame .main.border_sw_s -width 2 -background black -borderwidth 0
+frame .main.border_s_se -width 2 -background black -borderwidth 0
+frame .main.border_nw_w -height 2 -background black -borderwidth 0
+frame .main.border_n_centre -height 2 -background black -borderwidth 0
+frame .main.border_ne_e -height 2 -background black -borderwidth 0
+frame .main.border_w_sw -height 2 -background black -borderwidth 0
+frame .main.border_centre_s -height 2 -background black -borderwidth 0
+frame .main.border_e_se -height 2 -background black -borderwidth 0
+
+text .main.centre.text -xscrollcommand [list .main.centre.horizontal set] -yscrollcommand [list .main.centre.vertical set]
+scrollbar .main.centre.horizontal -orient horizontal -command [list .main.centre.text xview]
+scrollbar .main.centre.vertical -orient vertical -command [list .main.centre.text yview]
+grid configure .main.centre.text -row 0 -column 0 -sticky news
+grid configure .main.centre.vertical -row 0 -column 1 -sticky ns
+grid configure .main.centre.horizontal -row 1 -column 0 -sticky ew
+# Is there anything useful to be done in 1,1? e.g. a >> button to
+# go directly to perform ".main.centre.text see end"
+
+# Make sure that row 0 column 0, i.e. the text widget rather than the
+# scrollbars, grows to fit all available space.
+grid rowconfigure .main.centre 0 -weight 1
+grid rowconfigure .main.centre 1 -weight 0
+grid columnconfigure .main.centre 0 -weight 1
+grid columnconfigure .main.centre 1 -weight 0
+
+grid configure .main.nw -row 0 -column 0 -sticky news
+grid configure .main.border_nw_n -row 0 -column 1 -sticky ns
+grid configure .main.n -row 0 -column 2 -sticky news
+grid configure .main.border_n_ne -row 0 -column 3 -sticky ns
+grid configure .main.ne -row 0 -column 4 -sticky news
+grid configure .main.border_nw_w -row 1 -column 0 -sticky ew
+grid configure .main.border_n_centre -row 1 -column 1 -columnspan 3 -sticky ew
+grid configure .main.border_ne_e -row 1 -column 4 -sticky ew
+grid configure .main.w -row 2 -column 0 -sticky news
+grid configure .main.border_w_centre -row 2 -column 1 -sticky ns
+grid configure .main.centre -row 2 -column 2 -sticky news
+grid configure .main.border_centre_e -row 2 -column 3 -sticky ns
+grid configure .main.e -row 2 -column 4 -sticky news
+grid configure .main.border_w_sw -row 3 -column 0 -sticky ew
+grid configure .main.border_centre_s -row 3 -column 1 -columnspan 3 -sticky ew
+grid configure .main.border_e_se -row 3 -column 4 -sticky ew
+grid configure .main.sw -row 4 -column 0 -sticky news
+grid configure .main.border_sw_s -row 4 -column 1 -sticky ns
+grid configure .main.s -row 4 -column 2 -sticky news
+grid configure .main.border_s_se -row 4 -column 3 -sticky ns
+grid configure .main.se -row 4 -column 4 -sticky news
+grid columnconfigure .main 0 -weight 0
+grid columnconfigure .main 1 -weight 0
+grid columnconfigure .main 2 -weight 1
+grid columnconfigure .main 3 -weight 0
+grid columnconfigure .main 4 -weight 0
+grid rowconfigure .main 0 -weight 0
+grid rowconfigure .main 1 -weight 0
+grid rowconfigure .main 2 -weight 1
+grid rowconfigure .main 3 -weight 0
+grid rowconfigure .main 4 -weight 0
+
+# The .main frame should not be packed into the main window yet.
+# Until all devices have been instantiated the various subwindows
+# are not yet known, so the desired size of .main is not known
+# either. Packing it too early and then adding more windows
+# causes confusion.
+
+# }}}
+# {{{ Help
+
+# ----------------------------------------------------------------------------
+# Two main sources of documentation are of interest to the synthetic
+# target. The first is the toplevel eCos documentation. The second
+# is the documentation specific to the generic target. Device-specific
+# scripts may want to add menu entries for their own documentation.
+#
+# The problems are:
+# 1) where to find the documentation
+# 2) how to view it?
+#
+# The documentation should be in the component repository. If there is
+# a variable ECOS_REPOSITORY then that gives the appropriate information.
+# Otherwise things get messy because the repository being used for
+# eCos may not match the repository used when building the host-side
+# support - the versions should match but the repository may have
+# moved. Never the less that is the best we can do.
+# NOTE: sources.redhat.com might provide another alternative, but the
+# documentation is not organized in the same way as the repository.
+#
+# As for how to view the documentation, this is up to user preferences
+# but ecosynth has built-in knowledge of three different viewers.
+
+namespace eval synth {
+
+ if { $synth::flag_debug } {
+ synth::report "Setting up help menu\n"
+ }
+
+ variable _browser1 "mozilla -remote openURL(%s)"
+ variable _browser2 "mozilla %s"
+ variable _browser3 "gnome-help-browser %s"
+ variable _main_help ""
+ variable _synth_help ""
+ set _repo ""
+
+ if { [info exists env(ECOS_REPOSITORY)] } {
+ set _repo $env(ECOS_REPOSITORY)
+ } else {
+ set _repo $synth::_ecos_repository
+ }
+ # FIXME: cope with multiple repositories.
+
+ if { ![file exists [file join $_repo "ecos.db"]] } {
+ synth::report_warning "Failed to locate eCos component repository.\n \
+ Please define an environment variable ECOS_REPOSITORY.\n"
+ } else {
+ # FIXME: this needs attention once the documentation is more sorted
+ set synth::_main_help [file join $_repo "index.html"]
+ if { ![file exists $synth::_main_help] } {
+ if { 0 } {
+ synth::report_warning "Failed to locate toplevel documentation file $synth::_main_help\n \
+ Help->eCos menu option disabled.\n"
+ }
+ set synth::_main_help ""
+ } else {
+ set synth::_main_help "file://$_main_help"
+ }
+
+ set synth::_synth_help [file join $_repo $synth::_ecosynth_package_dir $synth::_ecosynth_package_version "doc/hal-synth-arch.html"]
+ if { ![file exists $synth::_synth_help] } {
+ synth::report_warning "Failed to locate synthetic target documentation $synth::_synth_help\n \
+ Help->Synthetic target menu option disabled.\n"
+ set synth::_synth_help ""
+ } else {
+ set synth::_synth_help "file://$_synth_help"
+ }
+ }
+
+ if { "" != $_main_help } {
+ .menubar.help add command -label "eCos" -command [list synth::_menu_help $synth::handle_help]
+ } else {
+ .menubar.help add command -label "eCos" -state disabled
+ }
+ if { "" != $_synth_help } {
+ .menubar.help add command -label "Synthetic target" -command [list synth::handle_help "$synth::_synth_help"]
+ } else {
+ .menubar.help add command -label "Synthetic target" -state disabled
+ }
+
+ unset _repo
+
+ proc handle_help { which } {
+ set command [format $synth::_browser1 $which]
+ if { 0 != [catch { eval exec -- "$command > /dev/null" } & ] } {
+ set command [format $synth::_browser2 $which]
+ if { 0 != [catch { eval exec -- "$command > /dev/null &" } ] } {
+ set command [format $synth::_browser3 $which]
+ if { 0 != [catch { eval exec -- "$command > /dev/null &"} ] } {
+ synth::report_warning "Unable to start a help browser.\n Please check the settings in Edit->Preferences.\n"
+ }
+ }
+ }
+ }
+
+ # FIXME: add an about box as well.
+}
+
+# }}}
+# {{{ Filters
+
+# ----------------------------------------------------------------------------
+# The central text window is expected to provide the bulk of the information
+# to the user. This information can be voluminous, so filtering is desirable.
+#
+# There are two types of filters. System filters are provided by ecosynth
+# itself and by device-specific scripts. For example ecosynth has a filter
+# for warnings, and the console device has a filter for eCos trace messages.
+# In addition users can specify their own filters using regular expressions,
+# and those filters take priority. Note that there is an assumption that
+# output is predominantly line-based: if partial lines get output then
+# some confusion is possible.
+#
+# With tk the implementation is relatively straightforward: the text widget's
+# tag facility does all the hard work of controlling how text gets displayed.
+# It is possible to show or hide text using -elide, colours can be controlled
+# using -background and -foreground, ... Not all of this functionality
+# is made available to the user just yet.
+
+namespace eval synth {
+ # The bulk of the information is held in arrays, indexed by the name of
+ # the filter. Lists are used to keep track of all valid names.
+ variable _system_filter_list [list]
+ variable _system_filter_settings
+ variable _user_filter_list [list]
+ variable _user_filter_settings
+
+ # Does a given system filter already exist?
+ proc filter_exists { name } {
+ set result 0
+ if { -1 != [lsearch -exact $synth::_system_filter_list $name] } {
+ set result 1
+ }
+ return $result
+ }
+
+ proc filter_get_list { } {
+ return $synth::_system_filter_list
+ }
+
+ # Parsing support. All filters take a number of standard options:
+ #
+ # -text "message" - how to identify this filter to the user
+ # -hide [0|1] - whether or not this text should be hidden by default
+ # -foreground <colour>
+ # -background <colour>
+ #
+ # The details of the currently supported options are known only to
+ # filter_parse_options and filter_add, allowing new options such
+ # as font manipulation to be added in future.
+ #
+ # There are two ways of adding a filter. filter_add is typically used
+ # inside ecosynth.tcl with known good data. filter_add_parsed is
+ # used with user-provided data, e.g. from the target definition file,
+ # after a call to filter_validate.
+ proc filter_parse_options { arg_list result_ref message_ref } {
+ upvar 1 $result_ref result
+ upvar 1 $message_ref message
+ set message ""
+
+ set text_set 0
+ set hide_set 0
+ set foreground_set 0
+ set background_set 0
+
+ set len [llength $arg_list]
+ for { set i 0 } { $i < $len } { incr i } {
+ set arg [lindex $arg_list $i]
+ if { ( "-text" == $arg) ||
+ ( "-hide" == $arg) ||
+ ( "-foreground" == $arg) || ( "-fg" == $arg) ||
+ ( "-background" == $arg) || ( "-bg" == $arg) } {
+
+ incr i
+ if { $i >= $len } {
+ append message " Missing data after argument $arg\n"
+ } else {
+ set data [lindex $arg_list $i]
+ if { "-text" == $arg } {
+ if { $text_set } {
+ append message " Attempt to set -text option twice.\n"
+ } else {
+ set text_set 1
+ set result("-text") $data
+ }
+ } elseif { "-hide" == $arg } {
+ if { $hide_set } {
+ append message " Attempt to set -hide option twice.\n"
+ } else {
+ set hide_set 1
+ if { ! [string is boolean -strict $data] } {
+ append message " -hide should be given a boolean value, not \"$data\"\n"
+ } else {
+ set result("-hide") [expr $data ? 1 : 0]
+ }
+ }
+ } elseif { ( "-foreground" == $arg) || ( "-fg" == $arg ) } {
+ if { $foreground_set } {
+ append message " Attempt to set -foreground twice.\n"
+ } else {
+ set foreground_set 1
+ # FIXME: is there some way of validating this color?
+ set result("-foreground") $data
+ }
+ } elseif { ( "-background" == $arg) || ( "-bg" == $arg ) } {
+ if { $background_set } {
+ append message " Attempt to set -background twice.\n"
+ } else {
+ set background_set 1
+ # FIXME: is there some way of validating this color?
+ set result("-background") $data
+ }
+ }
+ }
+ } else {
+ append message " Unknown option \"$arg\".\n"
+ }
+ }
+
+ if { "" == $message } {
+ return 1
+ } else {
+ return 0
+ }
+ }
+
+ # Add a new system filter, after the options have been parsed
+ proc filter_add_parsed { name data_ref } {
+ upvar 1 $data_ref data
+
+ set text $name
+ set hide 0
+ set foreground "<default>"
+ set background "<default>"
+ if { [info exists data("-text")] } {
+ set text $data("-text")
+ }
+ if { [info exists data("-hide")] } {
+ set hide $data("-hide")
+ }
+ if { [info exists data("-foreground")] } {
+ set foreground $data("-foreground")
+ }
+ if { [info exists data("-background")] } {
+ set background $data("-background")
+ }
+
+ if { $hide } {
+ .main.centre.text tag configure $name -elide 1
+ } else {
+ .main.centre.text tag configure $name -elide 0
+ }
+ if { "<default>" == $foreground } {
+ .main.centre.text tag configure $name -foreground [.main.centre.text cget -foreground]
+ } else {
+ set msg ""
+ if [catch { .main.centre.text tag configure $name -foreground $foreground } msg ] {
+ synth::report_warning "Unable to configure color \"$foreground\"\n $msg\n"
+ set foreground "<default>"
+ .main.centre.text tag configure $name -foreground [.main.centre.text cget -foreground]
+ }
+ }
+ if { "<default>" == $background } {
+ .main.centre.text tag configure $name -background [.main.centre.text cget -background]
+ } else {
+ set msg ""
+ if [catch { .main.centre.text tag configure $name -background $background } msg ] {
+ synth::report_warning "Unable to configure color \"$background\"\n $msg\n"
+ set background "<default>"
+ .main.centre.text tag configure $name -background [.main.centre.text cget -background]
+ }
+ }
+
+ lappend synth::_system_filter_list $name
+ set synth::_system_filter_settings($name,text) $text
+ set synth::_system_filter_settings($name,hide) $hide
+ set synth::_system_filter_settings($name,foreground) $foreground
+ set synth::_system_filter_settings($name,background) $background
+
+ # System tags should only get added during initialization. Hence the
+ # first time the system filters window is brought up all filters
+ # should be defined. However, just in case a new filter is added
+ # in the middle of a run...
+ if { [winfo exists .system_filters] } {
+ destroy .system_filters
+ }
+ }
+
+ # Add a new system filter, performing the appropriate parsing.
+ proc filter_add { name args } {
+
+ if { [synth::filter_exists $name] } {
+ synth::internal_error "attempt to install filter $name twice.\n"
+ }
+ array set data [list]
+ set msg ""
+
+ if { ![synth::filter_parse_options $args data msg] } {
+ # Any dubious arguments to the internal filter_add are treated as fatal.
+ synth::internal_error "unable to create new filter $name.\n$msg"
+ } else {
+ filter_add_parsed $name data
+ }
+ }
+
+ filter_add "report" -text "ecosynth messages"
+ filter_add "error" -text "ecosynth errors" -foreground red
+ # amber is not a standard colour. Amber leds emit light in the range
+ # 595-605 nm, corresponding to rgb values of approx. FF4200.
+ # OrangeRed is close enough at FF4500
+ filter_add "warning" -text "ecosynth warnings" -foreground OrangeRed
+
+ # Bring up the system filters window, creating it if necessary.
+ # Keeping the toplevel around but iconified/withdrawn when
+ # unwanted means that properties such as size and position will
+ # tend to be preserved.
+ variable _system_filter_new_settings
+ variable _system_filter_widgets
+
+ proc _menu_view_system_filters { } {
+ if { [winfo exists .system_filters] } {
+ if { "normal" == [wm state .system_filters] } {
+ raise .system_filters
+ } else {
+ wm deiconify .system_filters
+ }
+ return
+ }
+ toplevel .system_filters
+ wm title .system_filters "ecosynth system filters"
+ wm protocol .system_filters "WM_DELETE_WINDOW" [list synth::_menu_view_system_filters_cancel]
+ wm group .system_filters .
+
+ frame .system_filters.main
+ label .system_filters.main.header1 -text "Filter"
+ label .system_filters.main.header2 -text "Hide"
+ label .system_filters.main.header3 -text "Foreground"
+ label .system_filters.main.header4 -text "Background"
+ set text_fg [.system_filters.main.header1 cget -foreground]
+ frame .system_filters.main.row0 -height 1 -background $text_fg
+ frame .system_filters.main.row2 -height 1 -background $text_fg
+ frame .system_filters.main.col0 -width 1 -background $text_fg
+ frame .system_filters.main.col2 -width 1 -background $text_fg
+ frame .system_filters.main.col4 -width 1 -background $text_fg
+ frame .system_filters.main.col6 -width 1 -background $text_fg
+ frame .system_filters.main.col8 -width 1 -background $text_fg
+ grid .system_filters.main.row0 -row 0 -column 0 -columnspan 9 -sticky ew
+ grid .system_filters.main.header1 -row 1 -column 1 -sticky news
+ grid .system_filters.main.header2 -row 1 -column 3 -sticky news
+ grid .system_filters.main.header3 -row 1 -column 5 -sticky news
+ grid .system_filters.main.header4 -row 1 -column 7 -sticky news
+ grid .system_filters.main.row2 -row 2 -column 0 -columnspan 9 -sticky ew
+
+ set row 3
+ foreach filter $synth::_system_filter_list {
+ set synth::_system_filter_new_settings($filter,hide) $synth::_system_filter_settings($filter,hide)
+ set synth::_system_filter_new_settings($filter,foreground) $synth::_system_filter_settings($filter,foreground)
+ set synth::_system_filter_new_settings($filter,background) $synth::_system_filter_settings($filter,background)
+
+ set synth::_system_filter_widgets($filter,label) \
+ [label .system_filters.main.filter_name_$row -text $synth::_system_filter_settings($filter,text)]
+ set synth::_system_filter_widgets($filter,hide) \
+ [checkbutton .system_filters.main.filter_hide_$row -borderwidth 2 -indicatoron false -selectcolor "" \
+ -image $synth::image_tick_no -selectimage $synth::image_tick_yes -variable synth::_system_filter_new_settings($filter,hide)]
+ set synth::_system_filter_widgets($filter,foreground) [button .system_filters.main.filter_foreground_$row -borderwidth 2 \
+ -command [list synth::_menu_view_system_filters_choose_foreground $filter]]
+ set synth::_system_filter_widgets($filter,background) [button .system_filters.main.filter_background_$row -borderwidth 2 \
+ -command [list synth::_menu_view_system_filters_choose_background $filter]]
+
+ grid .system_filters.main.filter_name_$row -row $row -column 1 -sticky news
+ grid .system_filters.main.filter_hide_$row -row $row -column 3 -sticky news
+ grid .system_filters.main.filter_foreground_$row -row $row -column 5 -sticky news
+ grid .system_filters.main.filter_background_$row -row $row -column 7 -sticky news
+
+ incr row
+ frame .system_filters.main.row$row -height 1 -background $text_fg
+ grid .system_filters.main.row$row -row $row -column 0 -columnspan 9 -sticky ew
+ incr row
+ }
+ grid .system_filters.main.col0 -row 0 -column 0 -rowspan $row -sticky ns
+ grid .system_filters.main.col2 -row 0 -column 2 -rowspan $row -sticky ns
+ grid .system_filters.main.col4 -row 0 -column 4 -rowspan $row -sticky ns
+ grid .system_filters.main.col6 -row 0 -column 6 -rowspan $row -sticky ns
+ grid .system_filters.main.col8 -row 0 -column 8 -rowspan $row -sticky ns
+
+ for { set i 0 } { $i < $row } { incr i 2 } {
+ grid rowconfigure .system_filters.main $i -weight 0
+ }
+ for { set i 1 } { $i < $row } { incr i 2 } {
+ grid rowconfigure .system_filters.main $i -weight 1
+ }
+ for { set i 0 } { $i < 9 } { incr i 2 } {
+ grid columnconfigure .system_filters.main $i -weight 0
+ }
+ for { set i 1 } { $i < 9 } { incr i 2 } {
+ grid columnconfigure .system_filters.main $i -weight 1
+ }
+
+ pack .system_filters.main -side top -fill both -expand 1 -pady 4 -padx 4
+
+ # FIXME: add try and revert buttons
+ frame .system_filters.buttons
+ button .system_filters.buttons.ok -text "OK" -command [list synth::_menu_view_system_filters_ok]
+ button .system_filters.buttons.cancel -text "Cancel" -command [list synth::_menu_view_system_filters_cancel]
+ pack .system_filters.buttons.ok .system_filters.buttons.cancel -side left -expand 1
+ pack .system_filters.buttons -side bottom -fill x -pady 4
+
+ frame .system_filters.separator -height 2 -borderwidth 1 -relief sunken
+ pack .system_filters.separator -side bottom -fill x -pady 4
+
+ bind .system_filters <KeyPress-Return> [list synth::_menu_view_system_filters_ok]
+ bind .system_filters <KeyPress-Escape> [list synth::_menu_view_system_filters_cancel]
+
+ synth::_menu_view_system_filters_reset
+ }
+
+ proc _menu_view_system_filters_reset { } {
+ foreach filter $synth::_system_filter_list {
+ set synth::_system_filter_new_settings($filter,hide) $synth::_system_filter_settings($filter,hide)
+ set synth::_system_filter_new_settings($filter,foreground) $synth::_system_filter_settings($filter,foreground)
+ set synth::_system_filter_new_settings($filter,background) $synth::_system_filter_settings($filter,background)
+
+ set colour $synth::_system_filter_new_settings($filter,foreground)
+ if { "<default>" == $colour } {
+ set colour [.system_filters.main.header1 cget -foreground]
+ }
+ $synth::_system_filter_widgets($filter,label) configure -foreground $colour
+ $synth::_system_filter_widgets($filter,foreground) configure -background $colour -activebackground $colour
+
+ set colour $synth::_system_filter_new_settings($filter,background)
+ if { "<default>" == $colour } {
+ set colour [.system_filters.main.header1 cget -background]
+ }
+ $synth::_system_filter_widgets($filter,label) configure -background $colour
+ $synth::_system_filter_widgets($filter,background) configure -background $colour -activebackground $colour
+ }
+ }
+
+ # Change a colour. For now this involves calling Tk's chooseColor utility.
+ # This is simple but not quite right: it would be much better to allow
+ # the foreground and background to be modified in the same dialog, providing
+ # immediate feedback on how the text will actually appear; it should also
+ # provide some simple way of reverting to the default.
+ proc _menu_view_system_filters_choose_foreground { filter } {
+ set current_colour $synth::_system_filter_new_settings($filter,foreground)
+ if { "<default>" == $current_colour } {
+ set current_colour [.system_filters.main.header1 cget -foreground]
+ }
+ set new_colour [tk_chooseColor -parent .system_filters -title "$synth::_system_filter_settings($filter,text) foreground" \
+ -initialcolor $current_colour]
+ if { "" != $new_colour } {
+ set synth::_system_filter_new_settings($filter,foreground) $new_colour
+ $synth::_system_filter_widgets($filter,label) configure -foreground $new_colour
+ $synth::_system_filter_widgets($filter,foreground) configure -background $new_colour -activebackground $new_colour
+ }
+ }
+
+ proc _menu_view_system_filters_choose_background { filter } {
+ set current_colour $synth::_system_filter_new_settings($filter,background)
+ if { "<default>" == $current_colour } {
+ set current_colour [.system_filters.main.header1 cget -background]
+ }
+ set new_colour [tk_chooseColor -parent .system_filters -title "$synth::_system_filter_settings($filter,text) background" \
+ -initialcolor $current_colour]
+ if { "" != $new_colour } {
+ set synth::_system_filter_new_settings($filter,background) $new_colour
+ $synth::_system_filter_widgets($filter,label) configure -background $new_colour
+ $synth::_system_filter_widgets($filter,background) configure -background $new_colour -activebackground $new_colour
+ }
+ }
+
+ proc _menu_view_system_filters_ok { } {
+ wm withdraw .system_filters
+ foreach filter $synth::_system_filter_list {
+ if { $synth::_system_filter_settings($filter,hide) != $synth::_system_filter_new_settings($filter,hide) } {
+ set hide $synth::_system_filter_new_settings($filter,hide)
+ set synth::_system_filter_settings($filter,hide) $hide
+ if { $hide } {
+ .main.centre.text tag configure $filter -elide 1
+ } else {
+ .main.centre.text tag configure $filter -elide 0
+ }
+ }
+ if { $synth::_system_filter_settings($filter,foreground) != $synth::_system_filter_new_settings($filter,foreground) } {
+ set foreground $synth::_system_filter_new_settings($filter,foreground)
+ set synth::_system_filter_settings($filter,foreground) $foreground
+ .main.centre.text tag configure $filter -foreground $foreground
+ }
+ if { $synth::_system_filter_settings($filter,background) != $synth::_system_filter_new_settings($filter,background) } {
+ set background $synth::_system_filter_new_settings($filter,background)
+ set synth::_system_filter_settings($filter,background) $background
+ .main.centre.text tag configure $filter -background $background
+ }
+ }
+ }
+
+ proc _menu_view_system_filters_cancel { } {
+ wm withdraw .system_filters
+ synth::_menu_view_system_filters_reset
+ }
+
+ # Now add a suitable entry to the View menu.
+ .menubar.view add command -label "System filters..." -command [list synth::_menu_view_system_filters]
+
+ # User filters.
+ # FIXME: implement
+ # .menubar.view add command -label "User filters..." -command [list synth::_menu_view_filters] -state disabled
+}
+
+# }}}
+# {{{ Text window
+
+# ----------------------------------------------------------------------------
+# The central text window is expected to provide the bulk of the information
+# to the user. Various filtering mechanisms are desirable. For example the
+# user should be able to control whether or not eCos trace messages are
+# currently visible, not to mention other characteristics such as font
+# and colours. The text widget's tag mechanism makes this relatively simple.
+
+namespace eval synth {
+
+ # Should the user be able to edit the text window, e.g. to add annotations?
+ # This is disabled by default but can be enabled.
+ variable flag_read_only 1
+
+ # By default disable wrapping. Possibly it should be possible to
+ # enable this on a per-tag basis.
+ .main.centre.text configure -wrap "none"
+
+ # Give the text widget the focus by default. That way operations
+ # like page-up work immediately.
+ focus .main.centre.text
+
+ # If editing is currently disallowed, do not accept any input.
+ # The code below is probably not quite sufficient, it is
+ # ASCII-centric. A separate binding for Alt- sequences ensures
+ # that the top-level menu processing continues to work.
+ # Similarly a separate binding for Control- sequences ensures
+ # that the shortcuts continue to work.
+ bind .main.centre.text <Alt-KeyPress> {
+ continue
+ }
+ bind .main.centre.text <Control-KeyPress> {
+ continue
+ }
+ bind .main.centre.text <KeyPress> {
+ if { !$synth::flag_read_only } {
+ continue
+ } elseif { 0 != [llength %A] } {
+ break
+ } elseif { ("Return" == "%K") || ("Tab" == "%K") || ("space" == "%K") } {
+ break
+ } else {
+ continue
+ }
+ }
+ # There are a few special control- bindings built in to the Tk text
+ # widget which perform editing operations
+ bind .main.centre.text <Control-KeyPress-h> {
+ if { !$synth::flag_read_only } {
+ continue
+ } else {
+ break
+ }
+ }
+ bind .main.centre.text <Control-KeyPress-d> {
+ if { !$synth::flag_read_only } {
+ continue
+ } else {
+ break
+ }
+ }
+ bind .main.centre.text <Control-KeyPress-k> {
+ if { !$synth::flag_read_only } {
+ continue
+ } else {
+ break
+ }
+ }
+ bind .main.centre.text <Control-KeyPress-o> {
+ if { !$synth::flag_read_only } {
+ continue
+ } else {
+ break
+ }
+ }
+ bind .main.centre.text <Control-KeyPress-t> {
+ if { !$synth::flag_read_only } {
+ continue
+ } else {
+ break
+ }
+ }
+
+ # Implement support for the normal edit menu operations.
+ # FIXME: add a search facility
+ .menubar.edit insert end command -label "Cut" -command [list synth::_handle_edit_cut] -underline 2 -accelerator "Ctrl-X" -state disabled
+ .menubar.edit insert end command -label "Copy" -command [list synth::_handle_edit_copy] -underline 0 -accelerator "Ctrl-C"
+ .menubar.edit insert end command -label "Paste" -command [list synth::_handle_edit_paste] -underline 0 -accelerator "Ctrl-V" -state disabled
+ .menubar.edit insert end command -label "Clear" -command [list synth::_handle_edit_clear] -underline 3 -accelerator "Del" -state disabled
+ .menubar.edit insert end command -label "Select All" -command [list synth::_handle_edit_select_all] -underline 9 -accelerator "Ctrl-A"
+ .menubar.edit insert end checkbutton -label "Read Only" -variable synth::flag_read_only
+ .menubar.edit insert end separator
+ proc _trace_read_only { name1 name2 op } {
+ if { !$synth::flag_read_only } {
+ .menubar.edit entryconfigure "Cut" -state normal
+ .menubar.edit entryconfigure "Paste" -state normal
+ .menubar.edit entryconfigure "Clear" -state normal
+ .toolbar.cut configure -state normal
+ .toolbar.paste configure -state normal
+ } else {
+ .menubar.edit entryconfigure "Cut" -state disabled
+ .menubar.edit entryconfigure "Paste" -state disabled
+ .menubar.edit entryconfigure "Clear" -state disabled
+ .toolbar.cut configure -state disabled
+ .toolbar.paste configure -state disabled
+ }
+ }
+ trace variable synth::flag_read_only "w" synth::_trace_read_only
+
+ # Support for cut'n'paste etc. The widget does most of the hard
+ # work, but this code has to distinguish between read-only and
+ # read-write windows.
+ #
+ # Some operations such as clear may operate on everything in the
+ # selection, including hidden text that happens to be in the
+ # range. That may or may not be the right thing to do. It is right
+ # if the intent is to get rid of all events during a period of
+ # time, but wrong if the user wants to get rid of specific text.
+ bind . <Control-KeyPress-x> [list synth::_handle_edit_cut]
+ bind . <Control-KeyPress-c> [list synth::_handle_edit_copy]
+ bind . <Control-KeyPress-v> [list synth::_handle_edit_paste]
+ bind . <KeyPress-Delete> [list synth::_handle_edit_clear]
+ bind . <Control-KeyPress-a> [list synth::_handle_edit_select_all]
+
+ bind .main.centre.text <<Paste>> {
+ if { !$synth::flag_read_only } {
+ continue
+ } else {
+ break
+ }
+ }
+ bind .main.centre.text <<Cut>> {
+ if { !$synth::flag_read_only } {
+ continue
+ } else {
+ break
+ }
+ }
+ bind .main.centre.text <<Clear>> {
+ if { !$synth::flag_read_only } {
+ continue
+ } else {
+ break
+ }
+ }
+
+ proc _handle_edit_cut { } {
+ event generate .main.centre.text "<<Cut>>"
+ }
+
+ proc _handle_edit_copy { } {
+ event generate .main.centre.text "<<Copy>>"
+ }
+
+ proc _handle_edit_paste { } {
+ event generate .main.centre.text "<<Paste>>"
+ }
+
+ proc _handle_edit_clear { } {
+ event generate .main.centre.text "<<Clear>>"
+ }
+
+ proc _handle_edit_select_all { } {
+ .main.centre.text tag add sel 1.0 "end - 1 chars"
+ }
+
+ # Most output to the text window goes through this routine. It inserts
+ # some text with an appropriate tag. In addition it will ensure that
+ # the new text is visible if appropriate, and if a logfile has been
+ # specified then that will be updated as well.
+ proc output { msg tag } {
+ set ytail [lindex [.main.centre.text yview] 1]
+ set xhead [lindex [.main.centre.text xview] 0]
+ .main.centre.text insert end $msg $tag
+ if { (1.0 == $ytail) && (0.0 == $xhead) } {
+ .main.centre.text see end
+ }
+ if { "" != $synth::_logfd } {
+ puts -nonewline $synth::_logfd $msg
+ }
+ }
+
+ # Text output is now possible, so flush anything that is still buffered.
+ # xview and yview may not give the right results until the window
+ # is mapped, so always make the last text visible.
+ set synth::flag_gui_ready 1
+ synth::_flush_output
+ .main.centre.text see end
+
+
+ # Support for saving the current document. Save applies only to
+ # the currently visible text. SaveAll gives the hidden text as
+ # well.
+ variable _savefile ""
+ proc _handle_file_save { } {
+ if { "" == $synth::_savefile } {
+ set synth::_savefile [tk_getSaveFile -parent .]
+ if { "" == $synth::_savefile } {
+ return
+ }
+ }
+ set msg ""
+ if { 0 != [catch { set fd [open $synth::_savefile "w"] } msg] } {
+ synth::report_error "$msg\n"
+ if { $synth::_system_filter_settings(error,hide) } {
+ tk_messageBox -type "ok" -icon "error" -parent . -message "$msg\n"
+ }
+ return
+ }
+ set number_lines [expr int([.main.centre.text index end])]
+ for { set i 1 } { $i < $number_lines } { incr i } {
+ set tags [.main.centre.text tag names "[set i].0"]
+ if {[llength $tags] > 0 } {
+ set tag [lindex $tags 0]
+ if { [info exists synth::_system_filter_settings($tag,hide)] &&
+ $synth::_system_filter_settings($tag,hide) } {
+ continue
+ }
+ }
+ puts $fd [.main.centre.text get "[set i].0" "[set i].end"]
+ }
+ close $fd
+ }
+
+ proc _handle_file_save_as { } {
+ set new_savefile [tk_getSaveFile -parent .]
+ if { "" == $new_savefile } {
+ return
+ }
+ set synth::_savefile $new_savefile
+ synth::_handle_file_save
+ }
+
+ proc _handle_file_save_all { } {
+ set new_savefile [tk_getSaveFile -parent .]
+ if { "" == $new_savefile } {
+ return
+ }
+ set msg ""
+ if { 0 != [catch { set fd [open $new_savefile "w"] } msg] } {
+ synth::report_error "$msg\n"
+ if { $synth::_system_filter_settings(error,hide) } {
+ tk_messageBox -type "ok" -icon "error" -parent . -message "$msg\n"
+ }
+ return
+ }
+ puts -nonewline $fd [.main.centre.text get 1.0 end]
+ close $fd
+ }
+}
+
+# }}}
+# {{{ Heartbeat and status
+
+# ----------------------------------------------------------------------------
+# This code manages a status line at the bottom of the main window.
+# This involves a little heartbeat window, a label with the
+# text Running or Exited, some padding, and an additional status
+# line for use by other code.
+#
+# A variety of heartbeats have been attempted. The current one is
+# still not very good, but will do for now. Others are if 0'd out.
+# Note that these others may require additional images to be
+# preloaded.
+
+namespace eval synth {
+ frame .status -borderwidth 1 -relief groove
+
+ if { 1 } {
+ # The eCos logo, bouncing horizontally
+ variable _heartbeat_image_width [image width $synth::image_running1]
+ variable _heartbeat_offset 0
+ variable _heartbeat_ltor 1
+
+ frame .status.heartbeat -width $synth::_heartbeat_image_width -height [image height $synth::image_running1]
+ pack .status.heartbeat -side left
+ label .status.heartbeat.image -image $synth::image_running1 -anchor w -borderwidth 0
+ place .status.heartbeat.image -x $synth::_heartbeat_offset -y 0
+
+ proc _heartbeat_update { } {
+ catch {
+ if { ! $synth::ecos_running } {
+ place configure .status.heartbeat.image -x 0 -y 0
+ } else {
+ if { $synth::_heartbeat_ltor } {
+ incr synth::_heartbeat_offset 4
+ } else {
+ incr synth::_heartbeat_offset -4
+ }
+ place configure .status.heartbeat.image -x $synth::_heartbeat_offset
+
+ if { $synth::_heartbeat_offset < (5 - $synth::_heartbeat_image_width) } {
+ set synth::_heartbeat_ltor 1
+ } elseif { $synth::_heartbeat_offset > ( $synth::_heartbeat_image_width -5) } {
+ set synth::_heartbeat_ltor 0
+ }
+ after 100 synth::_heartbeat_update
+ }
+ }
+ }
+ after 100 synth::_heartbeat_update
+
+ } elseif { 0 } {
+ # The eCos logo, alternating between a normal and an inverse version
+ variable _heartbeat_image_width [image width $synth::image_running1]
+ variable _heartbeat_inverse ""
+ variable _heartbeat_normal ""
+ variable _heartbeat_inverse_width 1
+ variable _heartbeat_normal_width 1
+
+ canvas .status.heartbeat_canvas -width [image width $synth::image_running1] -height [image height $synth::image_running1]
+ pack .status.heartbeat_canvas -side left
+ label .status.heartbeat_canvas.background -image $synth::image_running1 -anchor w -borderwidth 0
+ label .status.heartbeat_canvas.inverse -image $synth::image_running2 -anchor w -borderwidth 0
+ label .status.heartbeat_canvas.normal -image $synth::image_running1 -anchor w -borderwidth 0
+ .status.heartbeat_canvas create window 0 0 -anchor nw -window .status.heartbeat_canvas.background
+ set synth::_heartbeat_inverse [.status.heartbeat_canvas create window 0 0 -anchor nw -window .status.heartbeat_canvas.inverse]
+ raise .status.heartbeat_canvas.inverse .status.heartbeat_canvas.background
+ set synth::_heartbeat_normal [.status.heartbeat_canvas create window 0 0 -anchor nw -window .status.heartbeat_canvas.normal]
+ raise .status.heartbeat_canvas.normal .status.heartbeat_canvas.inverse
+
+ .status.heartbeat_canvas itemconfigure $synth::_heartbeat_inverse -width $synth::_heartbeat_inverse_width
+ .status.heartbeat_canvas itemconfigure $synth::_heartbeat_normal -width $synth::_heartbeat_normal_width
+
+ proc _heartbeat_update { } {
+ if { ! $synth::ecos_running } {
+ .status.heartbeat_canvas delete $synth::_heartbeat_inverse
+ .status.heartbeat_canvas delete $synth::_heartbeat_normal
+ } else {
+ if { $synth::_heartbeat_inverse_width < $synth::_heartbeat_image_width } {
+ incr synth::_heartbeat_inverse_width 2
+ .status.heartbeat_canvas itemconfigure $synth::_heartbeat_inverse -width $synth::_heartbeat_inverse_width
+ } elseif { $synth::_heartbeat_normal_width < $synth::_heartbeat_image_width } {
+ incr synth::_heartbeat_normal_width 2
+ .status.heartbeat_canvas itemconfigure $synth::_heartbeat_normal -width $synth::_heartbeat_normal_width
+ } else {
+ set synth::_heartbeat_inverse_width 1
+ set synth::_heartbeat_normal_width 1
+ .status.heartbeat_canvas itemconfigure $synth::_heartbeat_inverse -width $synth::_heartbeat_inverse_width
+ .status.heartbeat_canvas itemconfigure $synth::_heartbeat_normal -width $synth::_heartbeat_normal_width
+ }
+ after 100 synth::_heartbeat_update
+ }
+ }
+ after 100 synth::_heartbeat_update
+
+ } elseif { 0 } {
+ # The eCos logo moving left to right, then replaced by a slightly smaller
+ # mirror version moving right to left, sort of as if rotating around a torus
+ variable _heartbeat_image_width [image width $synth::image_running1]
+ variable _heartbeat_offset [expr -1 * [image width $synth::image_running1]]
+ variable _heartbeat_ltor 1
+
+ frame .status.heartbeat -width $synth::_heartbeat_image_width -height [image height $synth::image_running1]
+ pack .status.heartbeat -side left
+ label .status.heartbeat.label -image $synth::image_running1 -anchor w -borderwidth 0
+
+ place .status.heartbeat.label -x $synth::_heartbeat_offset -y 0
+
+ proc _heartbeat_update { } {
+ if { ! $synth::ecos_running } {
+ .status.heartbeat.label configure -image $synth::image_running1
+ place configure .status.heartbeat.label -x 0
+ } else {
+ if { $synth::_heartbeat_ltor } {
+ incr synth::_heartbeat_offset 4
+ } else {
+ incr synth::_heartbeat_offset -4
+ }
+ place configure .status.heartbeat.label -x $synth::_heartbeat_offset
+ if { $synth::_heartbeat_offset < (0 - $synth::_heartbeat_image_width) } {
+ .status.heartbeat.label configure -image $synth::image_running1
+ set synth::_heartbeat_ltor 1
+ } elseif { $synth::_heartbeat_offset > $synth::_heartbeat_image_width } {
+ .status.heartbeat.label configure -image $synth::image_running3
+ set synth::_heartbeat_ltor 0
+ }
+ after 100 synth::_heartbeat_update
+ }
+ }
+ after 100 synth::_heartbeat_update
+ }
+
+ label .status.running -width 10 -text "Running" -anchor w
+ pack .status.running -side left
+ proc _heartbeat_exit_hook { arg_list } {
+ .status.running configure -text "Exited"
+ }
+ synth::hook_add "ecos_exit" synth::_heartbeat_exit_hook
+
+ label .status.text -text "" -anchor w
+ pack .status.text -side left -fill x -expand 1
+ pack .status -side bottom -fill x
+}
+
+# }}}
+# {{{ Preferences
+
+namespace eval synth {
+
+ if { $synth::flag_debug } {
+ synth::report "Setting up preferences window.\n"
+ }
+
+ variable _pref_browser1 ""
+ variable _pref_browser2 ""
+ variable _pref_browser3 ""
+
+ toplevel .preferences
+ wm title .preferences "ecosynth preferences"
+ wm withdraw .preferences
+ wm protocol .preferences "WM_DELETE_WINDOW" [list synth::_menu_edit_preferences_cancel]
+ wm group .preferences .
+
+ # NOTE: the fixed-size padx/pady arguments should probably be determined
+ # using a font calculation. The fixed width for the column 0 entries is also
+ # a cheat.
+ set _pref_col0_width 24
+
+ frame .preferences.help
+ frame .preferences.help.frame -borderwidth 2 -relief groove
+ pack .preferences.help.frame -fill both -expand 1 -pady 10
+ frame .preferences.help.frame.blank -height 10
+ label .preferences.help.frame.label1 -text "Preferred browser" -width $synth::_pref_col0_width -anchor w
+ label .preferences.help.frame.label2 -text "First alternative" -width $synth::_pref_col0_width -anchor w
+ label .preferences.help.frame.label3 -text "Second alternative" -width $synth::_pref_col0_width -anchor w
+ entry .preferences.help.frame.entry1 -width 40 -relief sunken -textvariable synth::_pref_browser1
+ entry .preferences.help.frame.entry2 -width 40 -relief sunken -textvariable synth::_pref_browser2
+ entry .preferences.help.frame.entry3 -width 40 -relief sunken -textvariable synth::_pref_browser3
+ grid .preferences.help.frame.blank -row 0 -column 0
+ grid .preferences.help.frame.label1 -row 1 -column 0 -sticky w
+ grid .preferences.help.frame.label2 -row 2 -column 0 -sticky w
+ grid .preferences.help.frame.label3 -row 3 -column 0 -sticky w
+ grid .preferences.help.frame.entry1 -row 1 -column 1 -sticky ew
+ grid .preferences.help.frame.entry2 -row 2 -column 1 -sticky ew
+ grid .preferences.help.frame.entry3 -row 3 -column 1 -sticky ew
+ grid columnconfigure .preferences.help.frame 0 -weight 0
+ grid columnconfigure .preferences.help.frame 1 -weight 1
+
+ label .preferences.help.title -text "Help"
+ place .preferences.help.title -in .preferences.help.frame -relx .1 -x -5 -y -10 -bordermode outside
+ pack .preferences.help -fill both -expand 1 -padx 10
+
+ frame .preferences.buttons
+ button .preferences.buttons.ok -text "OK" -command [list synth::_menu_edit_preferences_ok]
+ button .preferences.buttons.cancel -text "Cancel" -command [list synth::_menu_edit_preferences_cancel]
+ pack .preferences.buttons.ok .preferences.buttons.cancel -side left -expand 1
+ pack .preferences.buttons -side bottom -fill x -pady 4
+
+ frame .preferences.separator -height 2 -borderwidth 1 -relief sunken
+ pack .preferences.separator -side bottom -fill x -pady 4
+
+ bind .preferences <KeyPress-Return> [list synth::_menu_edit_preferences_ok]
+ bind .preferences <KeyPress-Escape> [list synth::_menu_edit_preferences_cancel]
+
+ variable _saved_focus ""
+ proc _menu_edit_preferences { } {
+ set synth::_saved_focus [focus]
+ set synth::_pref_browser1 $synth::_browser1
+ set synth::_pref_browser2 $synth::_browser2
+ set synth::_pref_browser3 $synth::_browser3
+ if { "normal" == [wm state .preferences] } {
+ raise .preferences
+ } else {
+ wm deiconify .preferences
+ }
+ focus .preferences.help.frame.entry1
+ }
+
+ proc _menu_edit_preferences_ok { } {
+ if { $synth::_browser1 != $synth::_pref_browser1 } {
+ set synth::_browser1 $synth::_pref_browser1
+ }
+ if { $synth::_browser2 != $synth::_pref_browser2 } {
+ set synth::_browser2 $synth::_pref_browser2
+ }
+ if { $synth::_browser3 != $synth::_pref_browser3 } {
+ set synth::_browser3 $synth::_pref_browser3
+ }
+
+ wm withdraw .preferences
+ catch { focus $synth::_saved_focus }
+ }
+
+ proc _menu_edit_preferences_cancel { } {
+ wm withdraw .preferences
+ catch { focus $synth::_saved_focus }
+ }
+
+ .menubar.edit add command -label "Preferences..." -command [list synth::_menu_edit_preferences]
+}
+
+# }}}
+# {{{ Clean-up
+
+# ----------------------------------------------------------------------------
+# GUI clean-up.
+#
+# Once all the device-specific scripts have been loaded and initialized, it
+# is time to go through the various components of the GUI and clean up
+# anything that is not actually required.
+namespace eval synth {
+
+ proc _cleanup_gui { } {
+
+ if { $synth::flag_debug } {
+ synth::report "Cleaning up unused GUI items.\n"
+ }
+
+ # File, Edit, View and Help should always have contents, unless
+ # the user has deleted entries via the mainrc file. The Windows
+ # menu will be empty unless contents have been added. There is
+ # always a global binding for ctrl-Q, and the window manager
+ # should always provide a way of killing off the application,
+ # so there is no need to treat File specially.
+ if { 0 == [.menubar.file index end] } {
+ .menubar delete "File"
+ }
+ if { 0 == [.menubar.edit index end] } {
+ .menubar delete "Edit"
+ }
+ if { 0 == [.menubar.view index end] } {
+ .menubar delete "View"
+ }
+ if { 0 == [.menubar.windows index end] } {
+ .menubar delete "Windows"
+ }
+ if { 0 == [.menubar.help index end] } {
+ .menubar delete "Help"
+ }
+
+ # If the toolbar is empty get rid of it.
+ if { 0 == [llength [winfo children .toolbar]] } {
+ pack forget .toolbar
+ destroy .toolbar
+ }
+
+ set can_destroy [list]
+ # Remove some or all of the top, left hand, right hand or bottom
+ # sets of frames, if nobody is using them.
+ if { (0 == [llength [pack slaves .main.nw]]) &&
+ (0 == [llength [pack slaves .main.n]]) &&
+ (0 == [llength [pack slaves .main.ne]]) } {
+ lappend can_destroy .main.nw .main.border_nw_n .main.n .main.border_n_ne .main.ne
+ lappend can_destroy .main.border_nw_w .main.border_n_centre .main.border_ne_e
+ }
+ if { (0 == [llength [pack slaves .main.nw]]) &&
+ (0 == [llength [pack slaves .main.w]]) &&
+ (0 == [llength [pack slaves .main.sw]]) } {
+ lappend can_destroy .main.nw .main.border_nw_w .main.w .main.border_w_sw .main.sw
+ lappend can_destroy .main.border_nw_n .main.border_w_centre .main.border_w_sw
+ }
+ if { (0 == [llength [pack slaves .main.ne]]) &&
+ (0 == [llength [pack slaves .main.e]]) &&
+ (0 == [llength [pack slaves .main.se]]) } {
+ lappend can_destroy .main.ne .main.border_ne_e .main.e .main.border_e_se .main.se
+ lappend can_destroy .main.border_n_ne .main.border_centre_e .main.border_s_se
+ }
+ if { (0 == [llength [pack slaves .main.sw]]) &&
+ (0 == [llength [pack slaves .main.s]]) &&
+ (0 == [llength [pack slaves .main.se]]) } {
+ lappend can_destroy .main.sw .main.border_sw_s .main.s .main.border_s_se .main.se
+ lappend can_destroy .main.border_w_sw .main.border_centre_s .main.border_e_se
+ }
+
+ foreach frame [lsort -unique $can_destroy] {
+ grid forget $frame
+ }
+ foreach frame [lsort -unique $can_destroy] {
+ destroy $frame
+ }
+
+ # Now that the full window layout is known the .main frame can be
+ # packed. Doing this before now could cause problems because the
+ # desired sizes of the subwindows are not known.
+ pack .main -expand 1 -fill both
+ }
+}
+
+# }}}
+# {{{ Screen dump support
+
+# Create screen dumps for the main window or for various subwindows.
+# Normally disabled, but useful when generating documentation.
+# FIXME: there seem to be problems getting the desired info about
+# transient windows, e.g. sizes. Hence the generated dumps still
+# require a lot of hand editing for now.
+if { 0 } {
+
+ bind . <Alt-w> {
+ exec xwd -out main.xwd -frame -id [winfo id .]
+ }
+
+ bind . <Alt-f> {
+ .menubar invoke "File"
+ after 100 exec xwd -out menu_file.xwd -frame -id [winfo id .]
+ }
+
+ bind . <Alt-e> {
+ .menubar invoke "Edit"
+ after 100 exec xwd -out menu_edit.xwd -frame -id [winfo id .]
+ }
+
+ bind . <Alt-v> {
+ .menubar invoke "View"
+ after 100 exec xwd -out menu_view.xwd -frame -id [winfo id .]
+ }
+
+ # The Help menu will extend beyond the window boundaries
+ bind . <Alt-h> {
+ .menubar invoke "Help"
+ after 100 exec xwd -out menu_help.xwd -root
+ }
+}
+
+# }}}
+
+# }}}
+}
+
+# {{{ Device instantiation
+
+# ----------------------------------------------------------------------------
+# This code handles the loading of device-specific scripts in response
+# to requests from the eCos application, and the instantiation of devices.
+# The application's request provides four pieces of information, held in
+# null-terminated strings in the request buffer:
+#
+# package name e.g. hal/synth/arch
+# package version e.g. current
+# device type e.g. console or ethernet
+# device instance e.g. eth0, or an empty string
+# device data e.g. 1024x768 for frame buffer resolution
+#
+# The first two pieces of information can be concatenated to give a
+# path to the install location. The third identifies a suitable
+# tcl script, e.g. console.tcl. This is sufficient to locate and load
+# the tcl script. It should return an instantiation procedure which will
+# be invoked with the instance name (or an empty string if there will only
+ # ever be one instance of this device type). The instantiation procedure
+# will then be called with a number and the device instance string, and
+# should return a handler for all requests intended for that device.
+#
+# If the package name and version are empty strings then an application-specific
+# device is being initialized, and the code will search in the current
+# directory and in ~/.ecos/synth
+
+namespace eval synth {
+ # Map package/version/type on to an instantiation procedure
+ array set _instantiation_procs [list]
+
+ # Map device instances on to handlers.
+ array set _device_handlers [list]
+ array set _device_names [list]
+ variable _next_device_id 1
+
+ # Let scripts know their install location and their source dir
+ variable device_install_dir ""
+ variable device_src_dir ""
+
+ # One handler is predefined.
+ set synth::_device_handlers(0) synth::_handle_ecosynth_requests
+ set synth::_device_names(0) "ecosynth I/O auxiliary"
+
+ proc _handle_INSTANTIATE { data } {
+
+ set list [split $data \0]
+ if { [llength $list] < 5 } {
+ synth::send_reply -1 0 ""
+ return
+ }
+ set package_dir [lindex $list 0]
+ set package_version [lindex $list 1]
+ set device_type [lindex $list 2]
+ set device_instance [lindex $list 3]
+ set device_data [lindex $list 4]
+
+ if { ![info exists synth::_instantiation_procs($package_dir,$package_version,$device_type)] } {
+ # The required script has not yet been loaded.
+ if { "" != $package_dir } {
+ # The device is provided by a package
+ set synth::device_install_dir [file join $synth::_ecosynth_libexecdir "ecos" $package_dir $package_version]
+ set synth::device_src_dir [file join $synth::_ecosynth_repository $package_dir $package_version]
+
+ set script [file join $::synth::device_install_dir "[set device_type].tcl"]
+ if { ![file exists $script] } {
+ synth::report_error "Unable to initialize device $device_type\n Script \"$script\" not found.\n"
+ synth::send_reply -1 0 ""
+ return
+ } elseif { ![file readable $script] } {
+ synth::report_error "Unable to initialize device $device_type\n Script \"$script\" not readable.\n"
+ synth::send_reply -1 0 ""
+ return
+ }
+
+ # Is there a more recent version in the repository
+ if { [info exists ::env(ECOSYNTH_DEVEL)] } {
+ set _orig_name [file join $synth::device_src_dir "host" "[set device_type].tcl"]
+ if { [file exists $_orig_name] && [file readable $_orig_name] } {
+ if { [file mtime $_orig_name] >= [file mtime $script] } {
+ puts "$_orig_name is more recent than install: executing that."
+ set script $_orig_name
+ }
+ }
+ }
+ } else {
+ # The device is application-specific
+ set script [file join [pwd] "[set device_type].tcl"]
+ if { ![file exists $script] || ![file readable $script] } {
+ set script [file join "~/.ecos/synth" "[set device_type].tcl"]
+ if { ![file exists $script] || ![file readable $script] } {
+ synth::report_error "Unable to initialize device $device_type\n Script $device_type.tcl not found in [pwd] or ~/.ecos/synth\n"
+ synth::send_reply -1 0 ""
+ return
+ }
+ }
+ }
+
+ # The uplevel ensures that the device script operates at the global
+ # level, so any namespaces it creates are also at global level
+ # and not nested inside synth. This avoids having to add
+ # synth:: to lots of variable accesses and generally avoids confusion
+ set result [catch { uplevel #0 source $script } instantiator]
+ if { 0 != $result } {
+ synth::report_error "Unable to initialize device $device_type\n Error loading script \"$script\"\n $instantiator\n"
+ synth::send_reply -1 0 ""
+ return
+ }
+
+ set synth::_instantiation_procs($package_dir,$package_version,$device_type) $instantiator
+ }
+
+ set handler [$synth::_instantiation_procs($package_dir,$package_version,$device_type) \
+ $synth::_next_device_id $device_instance $device_data]
+ if { "" == $handler } {
+ synth::send_reply -1 0 ""
+ } else {
+ set result $synth::_next_device_id
+ incr synth::_next_device_id
+
+ set synth::_device_handlers($result) $handler
+ if { "" != $device_instance } {
+ set synth::_device_names($result) $device_instance
+ } else {
+ set synth::_device_names($result) $device_type
+ }
+ synth::send_reply $result 0 ""
+ }
+ }
+}
+
+# }}}
+# {{{ Interrupt handling
+
+# ----------------------------------------------------------------------------
+# Interrupt handling. Device handlers can request an interrupt number
+# using allocate_interrupt, and typically they will transmit this
+# number to the eCos device driver during initialization. Device handlers
+# can at any time call raise_interrupt with that number, which typically
+# will result in SIGIO being sent to the eCos application. The latter will
+# send a request to retrieve a mask of current pending interrupts.
+#
+# Exit handling, in the sense of the user selecting File->Exit, is also
+# handled here. Such an exit request also involves raising SIGIO and
+# then sending a specially format response to the get-pending request.
+
+namespace eval synth {
+
+ # The next interrupt number to be allocated. Interrupt source 0 is reserved
+ # for the timer, which is handled within eCos itself via SIGALRM
+ # rather than by the I/O auxiliary.
+ variable _interrupt_next 1
+
+ # Keep track of which interrupts belong to which devices, for display and
+ # diagnostic purposes.
+ array set _interrupt_names [list]
+ set _interrupt_names(0) "system clock"
+
+ # A mask of current pending interrupts
+ variable _interrupt_pending 0
+
+ # Is an exit request pending?
+ variable _interrupt_exit_pending 0
+
+ # Allow other code to hook into the interrupt system, e.g. to display
+ # pending interrupts.
+ synth::hook_define "interrupt"
+
+ # For now interrupts are always allocated dynamically, which effectively
+ # means in the order of C++ static constructors. This means that interrupt
+ # allocation depends on the application, and may even change as the application
+ # is relinked.
+ #
+ # An alternative approach would allow device scripts to request specific
+ # interrupt numbers, making the system a bit more deterministic, but
+ # introducing complications such as shared interrupt numbers. On the other
+ # hand that would make it easier to test chained interrupt support and
+ # the like.
+ # FIXME: add support for allocating specific interrupt numbers
+ proc interrupt_allocate { name } {
+ if { $synth::_interrupt_next == 32 } {
+ synth::report_error "Unable to allocate an interrupt vector for $name\nAll 32 interrupt vectors are already in use.\n"
+ return -1
+ }
+ set result $synth::_interrupt_next
+ set synth::_interrupt_names($result) $name
+ incr synth::_interrupt_next
+ return $result
+ }
+
+ # Allow information about the device->interrupt mappings to be retrieved
+ proc interrupt_get_max { } {
+ return [expr $synth::_interrupt_next - 1]
+ }
+ proc interrupt_get_devicename { number } {
+ if { [info exists synth::_interrupt_names($number) ] } {
+ return $synth::_interrupt_names($number)
+ } else {
+ return ""
+ }
+ }
+
+ # Raise a specific interrupt. If the interrupt is already pending
+ # this has no effect because a SIGIO will have been sent to the
+ # eCos application already. Otherwise SIGIO needs to be raised.
+ proc interrupt_raise { number } {
+ if { $number >= $synth::_interrupt_next } {
+ error "Attempt to raise invalid interrupt $number."
+ }
+ if { !$synth::ecos_running } {
+ return
+ }
+ set or_mask [expr 0x01 << $number]
+ if { 0 == ($or_mask & $synth::_interrupt_pending) } {
+ # This interrupt was not previously pending, so action is needed.
+ set synth::_interrupt_pending [expr $synth::_interrupt_pending | $or_mask]
+ synth::hook_call "interrupt" $number
+ synth::_send_SIGIO
+ }
+ }
+
+ # Request application exit. This is typically called in response to
+ # File->Exit.
+ proc request_application_exit { } {
+ set synth::_interrupt_exit_pending 1
+ synth::_send_SIGIO
+ }
+
+ # The eCos application wants to know about pending interrupts. It maintains
+ # its own set of pending interrupts, so once the information has been
+ # transferred there are no pending interrupts left in the I/O auxiliary,
+ # only in the eCos app. A pending exit is indicated by non-empty data,
+ # the actual data does not matter.
+ proc _handle_GET_IRQ_PENDING { } {
+ if { $synth::_interrupt_exit_pending } {
+ synth::send_reply $synth::_interrupt_pending 1 "x"
+ } else {
+ synth::send_reply $synth::_interrupt_pending 0 ""
+ }
+ set synth::_interrupt_pending 0
+ }
+}
+
+# }}}
+# {{{ Initialization complete
+
+# ----------------------------------------------------------------------------
+# This is called once all static constructors have been run, i.e. when all
+# eCos devices should be initialized. It does the following:
+#
+# 1) invoke any "initialized" hooks set up by device scripts.
+#
+# 2) run the per-user mainrc.tcl script, if it exists, so that users can
+# install hooks, modify the GUI display, etc.
+#
+# 3) warn about any unused command line arguments
+#
+# 4) optionally warn about any unused entries in the target definition file
+#
+# 5) clean up the GUI, e.g. remove unwanted windows and borders, and display it.
+#
+# However if the user specified --help then, instead of all the above,
+# a help message is displayed and the auxiliary exits, hopefully taking the
+# eCos application with it.
+
+namespace eval synth {
+
+ proc _handle_CONSTRUCTORS_DONE { } {
+
+ if { $synth::flag_help } {
+ puts "Usage : <eCos application> <options>"
+ puts " Options are passed to the I/O auxiliary, and are not"
+ puts " accessible to the eCos application."
+ puts "Standard options:"
+ puts " -io : run with I/O facilities."
+ puts " -nio : run with no I/O facilities at all."
+ puts " -nw, --no-windows : run in console mode."
+ puts " -w, --windows : run in GUI mode (default)."
+ puts " -v, --version : display the version of the I/O auxiliary."
+ puts " -h, --help : show this help text."
+ puts " -k, --keep-going : ignore errors in init scripts or the"
+ puts " target definition file."
+ puts " -nr, --no-rc : do not run the user's init scripts."
+ puts " -x, --exit : terminate I/O auxiliary as soon as the eCos"
+ puts " application exits (default in console mode)."
+ puts " -nx, --no-exit : I/O auxiliary keeps running even after eCos"
+ puts " application has exited (default in GUI mode)."
+ puts " -V, --verbose : provide additional output during the run."
+ puts " -l <file>, --logfile <file> : send all output to the specified file. In"
+ puts " GUI mode this in addition to the main text"
+ puts " window. In console mode this is instead of"
+ puts " stdout."
+ puts " -t <file>, --target <file> : use the specified .tdf file as the target"
+ puts " definition. The auxiliary will look for this"
+ puts " file in the current directory, ~/.ecos, and"
+ puts " finally the install location."
+ puts " -geometry <geometry> : size and position for the main window."
+ synth::hook_call "help"
+ exit 1
+ }
+
+ synth::hook_call "ecos_initialized"
+
+ # ----------------------------------------------------------------------------
+ if { !$synth::flag_no_rc } {
+ set _config_file [file join "~/.ecos/synth" "mainrc.tcl"]
+ if { [file exists $_config_file] } {
+ if { [file readable $_config_file] } {
+ if { [catch { source $_config_file } msg ] } {
+ set error "Failed to execute user initialization file \"$_config_file\"\n"
+ append error " $msg\n"
+ if { $synth::flag_verbose } {
+ append error "------- backtrace ------------------------------------------\n"
+ append error $::errorInfo
+ append error "\n------- backtrace ends -------------------------------------\n"
+ }
+ synth::report_error $error
+ }
+ } else {
+ synth::report_error "No read access to user initialization file \"$_config_file\"\n"
+ }
+ }
+ unset _config_file
+ }
+
+ # ----------------------------------------------------------------------------
+ # Report any arguments that have not been used up by the auxiliary itself
+ # or by any device handlers
+ set unconsumed_args [synth::argv_get_unconsumed]
+ foreach arg $unconsumed_args {
+ synth::report_warning "Unrecognised command line option \"$arg\", ignored.\n"
+ }
+
+ # ----------------------------------------------------------------------------
+ if { $synth::flag_verbose } {
+ set unconsumed_devices [synth::tdf_get_unconsumed_devices]
+ set unconsumed_options [synth::tdf_get_unconsumed_options]
+ if { (0 != [llength $unconsumed_devices]) || (0 != [llength $unconsumed_options]) } {
+ set msg "Target definition file $synth::target_definition\n"
+ foreach dev $unconsumed_devices {
+ append msg " synth_device \"$dev\" not recognised.\n"
+ }
+ foreach option $unconsumed_options {
+ set dev [lindex $option 0]
+ set opt [lindex $option 1]
+ append msg " synth_device \"$dev\", option \"$opt\" not recognised.\n"
+ }
+ synth::report_warning $msg
+ }
+ }
+
+ # ----------------------------------------------------------------------------
+ if { $synth::flag_gui } {
+ synth::_cleanup_gui
+ wm deiconify .
+ }
+
+ # ----------------------------------------------------------------------------
+ # Finally send a reply back to the application so it can really
+ # start running. Alternatively, if any errors occurred during
+ # initialization and the user did not specify --keep-going then
+ # send back an error code, causing the eCos application to terminate.
+ if { (0 == $synth::_error_count) || $synth::flag_keep_going } {
+ synth::send_reply 1 0 ""
+ } else {
+ synth::send_reply 0 0 ""
+ }
+ }
+}
+
+# }}}
+# {{{ Requests for the I/O auxiliary itself
+
+# ----------------------------------------------------------------------------
+# There are three requests which can be aimed at the I/O auxiliary itself,
+# rather than at device-specific scripts. These are: INSTANTIATE to instantiate
+# a device; CONSTRUCTORS_DONE to indicate when initialization is complete;
+# and GET_IRQ_PENDING which deals with interrupts.
+
+namespace eval synth {
+
+ proc _handle_ecosynth_requests { devid request arg1 arg2 request_data request_len reply_len } {
+ if { 0x01 == $request } {
+ synth::_handle_INSTANTIATE $request_data
+ } elseif { 0x02 == $request } {
+ synth::_handle_CONSTRUCTORS_DONE
+ } elseif { 0x03 == $request } {
+ synth::_handle_GET_IRQ_PENDING
+ } elseif { 0x04 == $request } {
+ synth::_handle_GET_VERSION
+ } else {
+ error "The eCos application has sent an invalid request sent to the I/O auxiliary"
+ }
+ }
+
+ variable _SYNTH_AUXILIARY_PROTOCOL_VERSION 0x01
+ proc _handle_GET_VERSION { } {
+ synth::send_reply $synth::_SYNTH_AUXILIARY_PROTOCOL_VERSION 0 ""
+ }
+}
+
+# }}}
+# {{{ Application exit
+
+# ----------------------------------------------------------------------------
+# The application has exited. This is detected by an EOF event on the pipe
+# from the eCos application.
+#
+# First the rest of the system is informed about the event using the
+# appropriate hook. This should ensure that the various device-specific
+# scripts do the right thing, e.g shut down sub-processes. Next, if
+# the immediate exit flag is set then that is obeyed. This flag is set by
+# default when in command-line mode because there is no point in continuing
+# to run if there is neither an application nor a GUI for the user to interact
+# with. It also gets set if the user has explicitly requested an exit.
+#
+# The exit call will invoke the appropriate hooks.
+namespace eval synth {
+
+ proc _application_has_exited { } {
+
+ set synth::ecos_running 0
+ synth::hook_call "ecos_exit"
+
+ # Depending on command-line arguments and whether or not the GUI is present,
+ # the auxiliary should now exit
+ if { $synth::flag_immediate_exit } {
+ exit 0
+ } elseif { !$synth::flag_gui } {
+ synth::report "eCos application has exited: I/O auxiliary still running in the background.\n"
+ }
+ }
+}
+
+# }}}
+# {{{ Communication with the eCos application
+
+namespace eval synth {
+
+ # ----------------------------------------------------------------------------
+ # The basic communication routines between the auxiliary and the
+ # eCos application. _read_request is invoked whenever there is
+ # a pending event on the pipe from the eCos application, either
+ # a request or an EOF. It
+
+ # Keep track of a couple of things to detect protocol mismatches.
+ variable _reply_expected 0
+ variable _expected_rxlen 0
+
+ # Receive a single request from the eCos application and invoke the
+ # appropriate handler.
+ proc _read_request { } {
+ # Read a single request from the application, or possibly EOF
+ set devid 0
+ set reqcode 0
+ set arg1 0
+ set arg2 0
+ set txlen 0
+ set txdata ""
+ set rxlen 0
+ set request [read $synth::_channel_from_app 24]
+
+ if { [eof $synth::_channel_from_app] } {
+ fileevent $synth::_channel_from_app readable ""
+ synth::_application_has_exited
+ return
+ }
+
+ # If a real request is sent then currently the application should
+ # not be expecting a reply
+ if { $synth::_reply_expected } {
+ error "The eCos application should not be sending a request when there is still a reply pending"
+ }
+
+ set binary_result [binary scan $request "iiiiii" devid reqcode arg1 arg2 txlen rxlen]
+ if { 6 != $binary_result } {
+ error "Internal error decoding request from eCos application"
+ }
+
+ # If running on a 64-bit platform then the above numbers will have been sign-extended,
+ # which could lead to confusing results
+ set devid [expr $devid & 0x0FFFFFFFF]
+ set reqcode [expr $reqcode & 0x0FFFFFFFF]
+ set arg1 [expr $arg1 & 0x0FFFFFFFF]
+ set arg2 [expr $arg2 & 0x0FFFFFFFF]
+ set txlen [expr $txlen & 0x0FFFFFFFF]
+ set rxlen [expr $rxlen & 0x0FFFFFFFF]
+
+ # The top bit of rxlen is special and indicates whether or not a reply is expected.
+ set synth::_reply_expected [expr 0 != ($rxlen & 0x080000000)]
+ set synth::_expected_rxlen [expr $rxlen & 0x07FFFFFFF]
+
+ # Is there additional data to be read
+ if { $txlen > 0 } {
+ set txdata [read $synth::_channel_from_app $txlen]
+ if { [eof $synth::_channel_from_app] } {
+ fileevent $synth::_channel_from_app readable ""
+ synth::_application_has_exited
+ return
+ }
+ }
+
+ # The devid can be used to get hold of a handler function, and that will do
+ # the hard work.
+ if { ![info exists synth::_device_handlers($devid)] } {
+ error "A request has been received for an unknown device $devid"
+ }
+
+ $synth::_device_handlers($devid) $devid $reqcode $arg1 $arg2 $txdata $txlen $synth::_expected_rxlen
+ }
+
+ # Register _read_request as the handler for file events on the pipe from
+ # the application.
+ fileevent $synth::_channel_from_app readable synth::_read_request
+
+ # Send a reply back to eCos. This consists of a two-word structure,
+ # result and length, followed by the data if any. Currently this
+ # raises an error if there is a mismatch between the specified and
+ # actual length of the data. Possibly the code should cope with
+ # data strings that exceed the specified length, extracting a
+ # suitable substring.
+ proc send_reply { result { length 0 } { data "" } } {
+ # Make sure that a reply is actually expected.
+ if { !$synth::_reply_expected } {
+ error "Attempt to send reply to application when no request has been sent"
+ } else {
+ set synth::_reply_expected 0
+ }
+
+ if { $length > $synth::_expected_rxlen } {
+ error "Reply contains more data than the application expects: $length bytes instead of $synth::_expected_rxlen"
+ }
+ if { ($length > 0) && ([string length $data] != $length) } {
+ error "Mismatch between specified and actual data length: $length [string length $data]"
+ }
+ if { !$synth::ecos_running } {
+ return
+ }
+
+ set struct [binary format "ii" $result $length]
+ # Ignore any errors when writing down the pipe. The only likely error is
+ # when the application has exited, causing a SIGPIPE which Tcl
+ # will handle. The application should be waiting for this response.
+ catch {
+ puts -nonewline $synth::_channel_to_app $struct
+ if { $length > 0 } {
+ puts -nonewline $synth::_channel_to_app $data
+ }
+ }
+ }
+}
+
+# }}}
+
+# {{{ initrc
+
+# ----------------------------------------------------------------------------
+# Just before control is returned to the eCos application, run the per-user
+# file, ~/.ecos/synth/initrc.tcl. The main GUI is now in place and the target
+# definition file has been read in, but no eCos static constructors have
+# been run yet and hence no devices have been loaded or activated.
+# All the various core procedures have been defined. initrc gives the user
+# a chance to install hooks, redefine some internals, and so on.
+# Another initialization file mainrc.tcl gets read in later, just before
+# the eCos application really starts running.
+#
+# Possibly ecosynth should also read in a system-wide initialization
+# file equivalent to emacs' site-start.el, but the extra complexity
+# does not seem warranted just yet.
+
+if { !$synth::flag_no_rc } {
+ set _config_file [file join "~/.ecos/synth" "initrc.tcl"]
+ if { [file exists $_config_file] } {
+ if { [file readable $_config_file] } {
+ if { [catch { source $_config_file } msg ] } {
+ set error "Failed to execute user initialization file \"$_config_file\"\n"
+ append error " $msg\n"
+ if { $synth::flag_verbose } {
+ append error "------- backtrace ------------------------------------------\n"
+ append error $::errorInfo
+ append error "\n------- backtrace ends -------------------------------------\n"
+ }
+ synth::report_error $error
+ }
+ } else {
+ synth::report_error "No read access to user initialization file \"$_config_file\"\n"
+ }
+ }
+ unset _config_file
+}
+
+# }}}
+# {{{ Done
+
+# ----------------------------------------------------------------------------
+# The last few steps.
+
+# Once everything has been initialized the application can be woken up again.
+# It should be blocked waiting for a single byte on the pipe.
+if { $synth::flag_debug } {
+ synth::report "Core initialization complete, resuming the eCos application.\n"
+}
+
+puts -nonewline $synth::_channel_to_app "."
+
+# Enter the event loop. In console mode there is a problem if -nx has been
+# specified: there may not be any event handlers left once the eCos application
+# has exited, so the vwait would abort. This is avoided by a dummy after proc.
+if { !$synth::flag_gui && !$synth::flag_immediate_exit } {
+ namespace eval synth {
+ proc _dummy_after_handler { } {
+ after 1000000 synth::_dummy_after_handler
+ }
+ }
+ after 1000000 synth::_dummy_after_handler
+}
+
+vwait synth::_ecosynth_exit
+
+# }}}
diff --git a/ecos/packages/hal/synth/arch/current/host/help.xbm b/ecos/packages/hal/synth/arch/current/host/help.xbm
new file mode 100644
index 0000000..4486cfb
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/help.xbm
@@ -0,0 +1,6 @@
+#define help_width 16
+#define help_height 15
+static unsigned char help_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0xe0, 0x03, 0x30, 0x06, 0x30, 0x06,
+ 0x00, 0x06, 0x00, 0x03, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01,
+ 0x80, 0x01, 0x00, 0x00, 0x00, 0x00};
diff --git a/ecos/packages/hal/synth/arch/current/host/paste.xbm b/ecos/packages/hal/synth/arch/current/host/paste.xbm
new file mode 100644
index 0000000..bcd9fdd
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/paste.xbm
@@ -0,0 +1,6 @@
+#define paste_width 16
+#define paste_height 15
+static unsigned char paste_bits[] = {
+ 0x00, 0x00, 0xe0, 0x01, 0x3e, 0x3f, 0xd1, 0x22, 0x09, 0x24, 0xf9, 0x27,
+ 0x01, 0x20, 0xc1, 0x3f, 0x41, 0x20, 0x41, 0x50, 0x41, 0x77, 0x41, 0x40,
+ 0x41, 0x4e, 0x7e, 0x40, 0xc0, 0x7f};
diff --git a/ecos/packages/hal/synth/arch/current/host/running1.ppm b/ecos/packages/hal/synth/arch/current/host/running1.ppm
new file mode 100644
index 0000000..dc461b0
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/running1.ppm
Binary files differ
diff --git a/ecos/packages/hal/synth/arch/current/host/running2.ppm b/ecos/packages/hal/synth/arch/current/host/running2.ppm
new file mode 100644
index 0000000..38ccc9f
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/running2.ppm
Binary files differ
diff --git a/ecos/packages/hal/synth/arch/current/host/running3.ppm b/ecos/packages/hal/synth/arch/current/host/running3.ppm
new file mode 100644
index 0000000..32a02b2
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/running3.ppm
Binary files differ
diff --git a/ecos/packages/hal/synth/arch/current/host/save.xbm b/ecos/packages/hal/synth/arch/current/host/save.xbm
new file mode 100644
index 0000000..8546835
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/save.xbm
@@ -0,0 +1,6 @@
+#define save_width 16
+#define save_height 15
+static unsigned char save_bits[] = {
+ 0x00, 0x00, 0xfe, 0xff, 0x0a, 0xa0, 0x0a, 0xe0, 0x0a, 0xa0, 0x0a, 0xa0,
+ 0x0a, 0xa0, 0x0a, 0xa0, 0xf2, 0x9f, 0x02, 0x80, 0xf2, 0x9f, 0xf2, 0x93,
+ 0xf2, 0x93, 0xf2, 0x93, 0xfc, 0xff, };
diff --git a/ecos/packages/hal/synth/arch/current/host/saveall.xbm b/ecos/packages/hal/synth/arch/current/host/saveall.xbm
new file mode 100644
index 0000000..358a544
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/saveall.xbm
@@ -0,0 +1,6 @@
+#define saveall_width 16
+#define saveall_height 15
+static unsigned char saveall_bits[] = {
+ 0x00, 0x00, 0xfe, 0xff, 0x0a, 0xa0, 0x4a, 0xea, 0xaa, 0xaa, 0xea, 0xaa,
+ 0xaa, 0xaa, 0x0a, 0xa0, 0xf2, 0x9f, 0x02, 0x80, 0xf2, 0x9f, 0xf2, 0x93,
+ 0xf2, 0x93, 0xf2, 0x93, 0xfc, 0xff, };
diff --git a/ecos/packages/hal/synth/arch/current/host/tick_no.xbm b/ecos/packages/hal/synth/arch/current/host/tick_no.xbm
new file mode 100644
index 0000000..cc89fa1
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/tick_no.xbm
@@ -0,0 +1,5 @@
+#define tick_no_width 11
+#define tick_no_height 11
+static unsigned char tick_no_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0x8c, 0x01, 0xd8, 0x00, 0x70, 0x00,
+ 0xd8, 0x00, 0x8c, 0x01, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00};
diff --git a/ecos/packages/hal/synth/arch/current/host/tick_yes.xbm b/ecos/packages/hal/synth/arch/current/host/tick_yes.xbm
new file mode 100644
index 0000000..e100142
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/tick_yes.xbm
@@ -0,0 +1,5 @@
+#define tick_yes_width 11
+#define tick_yes_height 11
+static unsigned char tick_yes_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x01, 0xc4, 0x01, 0xec, 0x00,
+ 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/ecos/packages/hal/synth/arch/current/host/user_initrc.tcl b/ecos/packages/hal/synth/arch/current/host/user_initrc.tcl
new file mode 100644
index 0000000..e0a941d
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/user_initrc.tcl
@@ -0,0 +1,9 @@
+# ~/.ecos/synth/initrc.tcl
+#
+# This configuration file is executed by ecosynth, the eCos synthetic
+# target auxiliary program, early on during initialization. Typically
+# this file is used to set up search paths and similar variables. The
+# eCos synthetic target documentation should be consulted for more
+# information.
+#
+# This file is executed in a Tcl interpreter, so Tcl syntax applies.
diff --git a/ecos/packages/hal/synth/arch/current/host/user_mainrc.tcl b/ecos/packages/hal/synth/arch/current/host/user_mainrc.tcl
new file mode 100644
index 0000000..a85cfc9
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/host/user_mainrc.tcl
@@ -0,0 +1,10 @@
+# ~/.ecos/synth/mainrc.tcl
+#
+# This configuration file is executed by ecosynth, the eCos synthetic
+# target auxiliary program, just before the application is allowed
+# to continue. The target definition file has been processed and the
+# GUI has been set up, although usually the event loop will not have
+# been entered and no windows will have been displayed yet.
+#
+# This file is executed in a Tcl interpreter, so Tcl syntax applies.
+
diff --git a/ecos/packages/hal/synth/arch/current/include/hal_arch.h b/ecos/packages/hal/synth/arch/current/include/hal_arch.h
new file mode 100644
index 0000000..8950604
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/include/hal_arch.h
@@ -0,0 +1,89 @@
+#ifndef CYGONCE_HAL_HAL_ARCH_H
+#define CYGONCE_HAL_HAL_ARCH_H
+
+//=============================================================================
+//
+// hal_arch.h
+//
+// Architecture specific abstractions for synthetic target.
+//
+//=============================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+//
+// eCos 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.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): proven
+// Contributors:proven, pjo, nickg,bartv
+// Date: 1998-10-05
+// Purpose: Define architecture abstractions
+// Usage: #include <cyg/hal/hal_arch.h>
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+// ----------------------------------------------------------------------------
+// Architectural definitions such as processor save state information.
+// For the synthetic target most of this information has to be
+// provided by the variant HALs.
+
+#include <cyg/hal/var_arch.h>
+
+//-----------------------------------------------------------------------------
+// Exception handling function.
+// This function is provided by either the kernel or the common HAL to
+// deliver an exception to the current thread.
+// NOTE: the declaration should move to a common package.
+externC void cyg_hal_deliver_exception( CYG_WORD code, CYG_ADDRWORD data );
+
+//-----------------------------------------------------------------------------
+// Execution reorder barrier.
+// When optimizing the compiler can reorder code. In multithreaded systems
+// where the order of actions is vital, this can sometimes cause problems.
+// This macro may be inserted into places where reordering should not happen.
+
+#define HAL_REORDER_BARRIER() asm volatile ( "" : : : "memory" )
+
+//-----------------------------------------------------------------------------
+// Idle thread code.
+// This macro is called in the idle thread loop, and gives the HAL the
+// chance to insert code. In the synthetic target it involves blocking
+// until there is a signal.
+
+externC void hal_idle_thread_action(cyg_uint32 loop_count);
+
+#define HAL_IDLE_THREAD_ACTION(_count_) hal_idle_thread_action(_count_)
+
+//--------------------------------------------------------------------------
+#endif // CYGONCE_HAL_HAL_ARCH_H
+// End of hal_arch.h
diff --git a/ecos/packages/hal/synth/arch/current/include/hal_cache.h b/ecos/packages/hal/synth/arch/current/include/hal_cache.h
new file mode 100644
index 0000000..61435d0
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/include/hal_cache.h
@@ -0,0 +1,87 @@
+#ifndef CYGONCE_HAL_CACHE_H
+#define CYGONCE_HAL_CACHE_H
+
+//=============================================================================
+//
+// hal_cache.h
+//
+// HAL cache control API
+//
+//=============================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+//
+// eCos 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.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): nickg
+// Contributors:proven,bartv
+// Date: 1998-10-29
+// Purpose: Cache control API
+// Description: The macros defined here provide the HAL APIs for handling
+// cache control operations.
+// Usage:
+// #include <cyg/hal/hal_cache.h>
+// ...
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+// ----------------------------------------------------------------------------
+// The synthetic target does not have a cache. The underlying hardware
+// is quite likely to have a cache, but the synthetic target code has
+// no way of manipulating it. A minimal set of no-op #define's is
+// required.
+
+#include <cyg/infra/cyg_type.h>
+
+#define HAL_ICACHE_ENABLE()
+#define HAL_ICACHE_DISABLE()
+#define HAL_ICACHE_SYNC()
+#define HAL_ICACHE_INVALIDATE_ALL()
+#define HAL_ICACHE_IS_ENABLED(_state_) \
+ CYG_MACRO_START \
+ (_state_) = 0; \
+ CYG_MACRO_END
+
+#define HAL_DCACHE_ENABLE()
+#define HAL_DCACHE_DISABLE()
+#define HAL_DCACHE_SYNC()
+#define HAL_DCACHE_INVALIDATE_ALL()
+#define HAL_DCACHE_IS_ENABLED(_state_) \
+ CYG_MACRO_START \
+ (_state_) = 0; \
+ CYG_MACRO_END
+
+//-----------------------------------------------------------------------------
+#endif // ifndef CYGONCE_HAL_CACHE_H
+// End of hal_cache.h
diff --git a/ecos/packages/hal/synth/arch/current/include/hal_diag.h b/ecos/packages/hal/synth/arch/current/include/hal_diag.h
new file mode 100644
index 0000000..e5ae7d5
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/include/hal_diag.h
@@ -0,0 +1,77 @@
+#ifndef CYGONCE_HAL_HAL_DIAG_H
+#define CYGONCE_HAL_HAL_DIAG_H
+
+//=============================================================================
+//
+// hal_diag.h
+//
+// Synthetic target HAL Support for Kernel Diagnostic Routines
+//
+//=============================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+//
+// eCos 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.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): proven
+// Contributors:proven, bartv
+// Date: 1998-10-05
+// Purpose: HAL Support for Kernel Diagnostic Routines
+// Description: Diagnostic routines for use during kernel development.
+// Usage: #include "cyg/hal/hal_diag.h"
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <cyg/infra/cyg_type.h>
+
+//-----------------------------------------------------------------------------
+// functions implemented in hal_diag.c
+
+externC void hal_diag_init( void );
+
+externC void hal_diag_read_char(char *c);
+
+externC void hal_diag_write_char(char c);
+
+//-----------------------------------------------------------------------------
+
+#define HAL_DIAG_INIT() hal_diag_init()
+
+#define HAL_DIAG_READ_CHAR(_c_) hal_diag_read_char(&_c_)
+
+#define HAL_DIAG_WRITE_CHAR(_c_) hal_diag_write_char(_c_)
+
+//-----------------------------------------------------------------------------
+// end of hal_diag.h
+#endif // CYGONCE_HAL_HAL_DIAG_H
diff --git a/ecos/packages/hal/synth/arch/current/include/hal_intr.h b/ecos/packages/hal/synth/arch/current/include/hal_intr.h
new file mode 100644
index 0000000..6e1bb23
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/include/hal_intr.h
@@ -0,0 +1,262 @@
+#ifndef CYGONCE_HAL_HAL_INTR_H
+#define CYGONCE_HAL_HAL_INTR_H
+
+//==========================================================================
+//
+// hal_intr.h
+//
+// HAL Interrupt and clock support
+//
+//==========================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+//
+// eCos 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.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): proven
+// Contributors: proven, jskov, pjo, nickg, bartv
+// Date: 1999-02-20
+// Purpose: Define Interrupt support
+// Description: The macros defined here provide the HAL APIs for handling
+// interrupts and the clock.
+//
+// Usage:
+// #include <cyg/hal/hal_intr.h>
+// ...
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+// Interrupt and exception handling in the synthetic target is very much
+// tied up with POSIX signal handling.
+//
+// There are two interrupt sources to consider. The system clock is
+// provided most conveniently by a timer signal SIGALRM. All other
+// interrupts are handled by communication with the auxiliary program
+// and involve SIGIO. The model that is actually presented to
+// higher-level code is a single VSR, and 32 ISRs. ISR 0 is
+// arbitrarily assigned to the clock. The remaining 31 ISRs correspond
+// to devices managed through the auxiliary, effectively providing an
+// interrupt controller. A single VSR suffices because it is passed
+// the signal number as argument.
+//
+// Exceptions also correspond to signals, but are not handled through
+// the same VSR: slightly different processing is needed for
+// interrupts vs. exceptions, for example the latter does not involve
+// calling interrupt_end(). The exceptions of interest are SIGILL,
+// SIGBUS, SIGFPE, and SIGSEGV. SIGBUS and SIGSEGV are treated as a
+// single exception. Obviously there are other signals but they do not
+// have obvious meanings in the context of the synthetic target. NOTE:
+// SIGSTKFLT may be needed as well at some point.
+
+#define CYGNUM_HAL_INTERRUPT_RTC 0
+#define CYGNUM_HAL_ISR_MIN 0
+#define CYGNUM_HAL_ISR_MAX 31
+#define CYGNUM_HAL_ISR_COUNT (CYGNUM_HAL_ISR_MAX + 1)
+
+#define CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION 0
+#define CYGNUM_HAL_EXCEPTION_DATA_ACCESS 1
+#define CYGNUM_HAL_EXCEPTION_FPU 2
+
+#define CYGNUM_HAL_EXCEPTION_MIN 0
+#define CYGNUM_HAL_EXCEPTION_MAX CYGNUM_HAL_EXCEPTION_FPU
+#define CYGNUM_HAL_EXCEPTION_COUNT (CYGNUM_HAL_EXCEPTION_MAX + 1)
+
+#define CYGNUM_HAL_VECTOR_SIGNAL 0
+#define CYGNUM_HAL_VSR_MIN 0
+#define CYGNUM_HAL_VSR_MAX CYGNUM_HAL_VECTOR_SIGNAL
+#define CYGNUM_HAL_VSR_COUNT (CYGNUM_HAL_VSR_MAX + 1)
+
+// These #include's cannot happen until after the above are defined.
+// There are dependencies on e.g. CYGNUM_HAL_EXCEPTION_COUNT.
+// Basic data types
+#include <cyg/infra/cyg_type.h>
+
+// cyg_vector_t etc., supplied either by the kernel or the common HAL
+#include <cyg/hal/drv_api.h>
+
+// Nearly all interrupt state control happens via functions. This
+// facilitates debugging, for example it is easier to set breakpoints
+// that way, at the cost of performance. However performance is not a
+// critical issue for the synthetic target, Instead it is intended to
+// facilitate application development, and hence debugability has a
+// higher priority. There is one exception: the sequence
+// disable_interrupts() followed by restore_interrupts() occurs
+// frequently and is worth some inlining.
+//
+// Note: some of the details such as the existence of a global
+// variable hal_interrupts_enabled are known to the context switch
+// code in the variant HAL.
+typedef cyg_bool_t CYG_INTERRUPT_STATE;
+externC volatile cyg_bool_t hal_interrupts_enabled;
+externC void hal_enable_interrupts(void);
+externC cyg_bool_t hal_interrupt_in_use(cyg_vector_t);
+externC void hal_interrupt_attach(cyg_vector_t, cyg_ISR_t*, CYG_ADDRWORD, CYG_ADDRESS);
+externC void hal_interrupt_detach(cyg_vector_t, cyg_ISR_t*);
+externC void (*hal_vsr_get(cyg_vector_t))(void);
+externC void hal_vsr_set(cyg_vector_t, void (*)(void), void (**)(void));
+externC void hal_interrupt_mask(cyg_vector_t);
+externC void hal_interrupt_unmask(cyg_vector_t);
+externC void hal_interrupt_acknowledge(cyg_vector_t);
+externC void hal_interrupt_configure(cyg_vector_t, cyg_bool_t, cyg_bool_t);
+externC void hal_interrupt_set_level(cyg_vector_t, cyg_priority_t);
+
+
+#define HAL_ENABLE_INTERRUPTS() \
+ CYG_MACRO_START \
+ hal_enable_interrupts(); \
+ CYG_MACRO_END
+
+#define HAL_DISABLE_INTERRUPTS(_old_) \
+ CYG_MACRO_START \
+ _old_ = hal_interrupts_enabled; \
+ hal_interrupts_enabled = false; \
+ CYG_MACRO_END
+
+#define HAL_RESTORE_INTERRUPTS(_old_) \
+ CYG_MACRO_START \
+ if (!_old_) { \
+ hal_interrupts_enabled = false; \
+ } else if (!hal_interrupts_enabled) { \
+ hal_enable_interrupts(); \
+ } \
+ CYG_MACRO_END
+
+#define HAL_QUERY_INTERRUPTS(_old_) \
+ CYG_MACRO_START \
+ _old_ = hal_interrupts_enabled; \
+ CYG_MACRO_END
+
+#define HAL_TRANSLATE_VECTOR(_vector_, _index_) \
+ CYG_MACRO_START \
+ (_index_) = (_vector_); \
+ CYG_MACRO_END
+
+#define HAL_INTERRUPT_IN_USE(_vector_, _state_) \
+ CYG_MACRO_START \
+ (_state_) = hal_interrupt_in_use(_vector_); \
+ CYG_MACRO_END
+
+#define HAL_INTERRUPT_ATTACH(_vector_, _isr_, _data_, _object_ ) \
+ CYG_MACRO_START \
+ hal_interrupt_attach(_vector_, _isr_, (CYG_ADDRWORD) _data_, (CYG_ADDRESS) _object_); \
+ CYG_MACRO_END
+
+#define HAL_INTERRUPT_DETACH(_vector_, _isr_) \
+ CYG_MACRO_START \
+ hal_interrupt_detach(_vector_, _isr_); \
+ CYG_MACRO_END
+
+#define HAL_VSR_GET(_vector_, _vsr_) \
+ CYG_MACRO_START \
+ (*_vsr_) = hal_vsr_get(_vector_); \
+ CYG_MACRO_END
+
+#define HAL_VSR_SET(_vector_, _vsr_, _poldvsr_) \
+ CYG_MACRO_START \
+ hal_vsr_set(_vector_, _vsr_, _poldvsr_); \
+ CYG_MACRO_END
+
+#define HAL_INTERRUPT_MASK(_vector_) \
+ CYG_MACRO_START \
+ hal_interrupt_mask(_vector_); \
+ CYG_MACRO_END
+
+#define HAL_INTERRUPT_UNMASK(_vector_) \
+ CYG_MACRO_START \
+ hal_interrupt_unmask(_vector_); \
+ CYG_MACRO_END
+
+#define HAL_INTERRUPT_ACKNOWLEDGE(_vector_) \
+ CYG_MACRO_START \
+ hal_interrupt_acknowledge(_vector_); \
+ CYG_MACRO_END
+
+#define HAL_INTERRUPT_CONFIGURE(_vector_, _level_, _up_) \
+ CYG_MACRO_START \
+ hal_interrupt_configure(_vector_, _level_, _up_); \
+ CYG_MACRO_END
+
+#define HAL_INTERRUPT_SET_LEVEL(_vector_, _level_) \
+ CYG_MACRO_START \
+ hal_interrupt_set_level(_vector_, _level_); \
+ CYG_MACRO_END
+
+// Additional data exported by the synthetic target interrupt handling
+// subsystem. These two variables correspond to typical interrupt
+// status and mask registers.
+extern volatile cyg_uint32 synth_pending_isrs;
+extern volatile cyg_uint32 synth_masked_isrs;
+
+// ----------------------------------------------------------------------------
+// The clock support
+externC void hal_clock_initialize(cyg_uint32);
+externC cyg_uint32 hal_clock_read(void);
+
+#define HAL_CLOCK_INITIALIZE( _period_ ) \
+ CYG_MACRO_START \
+ hal_clock_initialize(_period_); \
+ CYG_MACRO_END
+
+// No special action is needed for reset.
+#define HAL_CLOCK_RESET( _vector_, _period_ ) \
+ CYG_EMPTY_STATEMENT
+
+#define HAL_CLOCK_READ(_pvalue_) \
+ CYG_MACRO_START \
+ *(_pvalue_) = hal_clock_read(); \
+ CYG_MACRO_END
+
+// ----------------------------------------------------------------------------
+// HAL_DELAY_US() support. The macro is provided by the processor-specific
+// HAL, but the bogomips rating is provided by the architectural code.
+extern int hal_bogomips;
+#include <cyg/hal/var_intr.h>
+
+// ----------------------------------------------------------------------------
+// Resetting the Synth target is not possible, but existing the process is.
+externC void cyg_hal_sys_exit(int);
+#define HAL_PLATFORM_RESET() \
+ CYG_MACRO_START \
+ cyg_hal_sys_exit(0); \
+ CYG_MACRO_END
+
+// ----------------------------------------------------------------------------
+// Test case exit support.
+#define CYGHWR_TEST_PROGRAM_EXIT() \
+ CYG_MACRO_START \
+ cyg_hal_sys_exit(0); \
+ CYG_MACRO_END
+//---------------------------------------------------------------------------
+#endif // ifndef CYGONCE_HAL_HAL_INTR_H
+// End of hal_intr.h
diff --git a/ecos/packages/hal/synth/arch/current/include/hal_io.h b/ecos/packages/hal/synth/arch/current/include/hal_io.h
new file mode 100644
index 0000000..f540e30
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/include/hal_io.h
@@ -0,0 +1,620 @@
+#ifndef CYGONCE_HAL_HAL_IO_H
+#define CYGONCE_HAL_HAL_IO_H
+
+//=============================================================================
+//
+// hal_io.h
+//
+// HAL device IO register support.
+//
+//=============================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+//
+// eCos 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.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): nickg
+// Contributors:nickg, bartv, alunn, jlarmour
+// Date: 1998-02-17
+// Purpose: Define IO register support
+// Description: The macros defined here provide the HAL APIs for handling
+// device IO control registers.
+//
+// For the synthetic target these macros should never
+// actually be used since the application will run as an
+// ordinary user application and should not have
+// permission to access any real hardware. Instead
+// hardware access should go via the auxiliary. Possibly
+// the macros should be #pragma poison'd, but some people
+// may want to run the synthetic target in a way that
+// does involve accessing real hardware.
+//
+// The synthetic target provides some additional I/O
+// facilities in the form of Linux system calls. A useful
+// subset of these are prototyped here, together with
+// associated constants. There are also I/O operations to
+// interact with the auxiliary.
+//
+// Usage:
+// #include <cyg/hal/hal_io.h>
+// ...
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <cyg/infra/cyg_type.h>
+
+#include <cyg/hal/var_io.h> // Variant-specific definitions
+
+//-----------------------------------------------------------------------------
+// IO Register address.
+// This type is for recording the address of an IO register.
+
+typedef volatile CYG_ADDRWORD HAL_IO_REGISTER;
+
+//-----------------------------------------------------------------------------
+// BYTE Register access.
+// Individual and vectorized access to 8 bit registers.
+
+#define HAL_READ_UINT8( _register_, _value_ ) \
+ CYG_MACRO_START \
+ ((_value_) = *((volatile CYG_BYTE *)(_register_))); \
+ CYG_MACRO_END
+
+#define HAL_WRITE_UINT8( _register_, _value_ ) \
+ CYG_MACRO_START \
+ (*((volatile CYG_BYTE *)(_register_)) = (_value_)); \
+ CYG_MACRO_END
+
+#define HAL_READ_UINT8_VECTOR( _register_, _buf_, _count_, _step_ ) \
+ CYG_MACRO_START \
+ cyg_count32 _i_,_j_; \
+ for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) { \
+ (_buf_)[_i_] = ((volatile CYG_BYTE *)(_register_))[_j_]; \
+ } \
+ CYG_MACRO_END
+
+#define HAL_WRITE_UINT8_VECTOR( _register_, _buf_, _count_, _step_ ) \
+ CYG_MACRO_START \
+ cyg_count32 _i_,_j_; \
+ for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) { \
+ ((volatile CYG_BYTE *)(_register_))[_j_] = (_buf_)[_i_]; \
+ } \
+ CYG_MACRO_END
+
+
+//-----------------------------------------------------------------------------
+// 16 bit access.
+// Individual and vectorized access to 16 bit registers.
+
+#define HAL_READ_UINT16( _register_, _value_ ) \
+ CYG_MACRO_START \
+ ((_value_) = *((volatile CYG_WORD16 *)(_register_))); \
+ CYG_MACRO_END
+
+#define HAL_WRITE_UINT16( _register_, _value_ ) \
+ CYG_MACRO_START \
+ (*((volatile CYG_WORD16 *)(_register_)) = (_value_)); \
+ CYG_MACRO_END
+
+#define HAL_READ_UINT16_VECTOR( _register_, _buf_, _count_, _step_ ) \
+ CYG_MACRO_START \
+ cyg_count32 _i_,_j_; \
+ for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) { \
+ (_buf_)[_i_] = ((volatile CYG_WORD16 *)(_register_))[_j_]; \
+ } \
+ CYG_MACRO_END
+
+#define HAL_WRITE_UINT16_VECTOR( _register_, _buf_, _count_, _step_ ) \
+ CYG_MACRO_START \
+ cyg_count32 _i_,_j_; \
+ for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) { \
+ ((volatile CYG_WORD16 *)(_register_))[_j_] = (_buf_)[_i_]; \
+ } \
+ CYG_MACRO_END
+
+//-----------------------------------------------------------------------------
+// 32 bit access.
+// Individual and vectorized access to 32 bit registers.
+
+#define HAL_READ_UINT32( _register_, _value_ ) \
+ CYG_MACRO_START \
+ ((_value_) = *((volatile CYG_WORD32 *)(_register_))); \
+ CYG_MACRO_END
+
+#define HAL_WRITE_UINT32( _register_, _value_ ) \
+ CYG_MACRO_START \
+ (*((volatile CYG_WORD32 *)(_register_)) = (_value_)); \
+ CYG_MACRO_END
+
+#define HAL_READ_UINT32_VECTOR( _register_, _buf_, _count_, _step_ ) \
+ CYG_MACRO_START \
+ cyg_count32 _i_,_j_; \
+ for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) { \
+ (_buf_)[_i_] = ((volatile CYG_WORD32 *)(_register_))[_j_]; \
+ } \
+ CYG_MACRO_END
+
+#define HAL_WRITE_UINT32_VECTOR( _register_, _buf_, _count_, _step_ ) \
+ CYG_MACRO_START \
+ cyg_count32 _i_,_j_; \
+ for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) { \
+ ((volatile CYG_WORD32 *)(_register_))[_j_] = (_buf_)[_i_]; \
+ } \
+ CYG_MACRO_END
+
+// ----------------------------------------------------------------------------
+// Linux system calls and associated structures and constants. This is
+// by no means a complete list, but there is enough information for
+// the needs of the relevant HAL packages. The information needs to be
+// kept in synch with the Linux header files, but in practice
+// divergence will be rare because that would imply incompatible
+// changes in the Linux kernel API.
+//
+// It may seem tempting to import the Linux header files directly, but
+// that would prevent cross-compilation and introduce all kinds of
+// namespace pollution.
+//
+// The actual implementation lives in variant HAL packages since
+// typically they involve direct system calls via bits of assembler.
+// Note that only a subset of system calls are actually implemented,
+// so the variant HALs may need to be updated if this list needs to
+// be extended.
+
+// Error codes.
+#define CYG_HAL_SYS_EINTR 4
+#define CYG_HAL_SYS_EAGAIN 11
+
+// Signal-related information
+#define CYG_HAL_SYS_SIGHUP 1
+#define CYG_HAL_SYS_SIGINT 2
+#define CYG_HAL_SYS_SIGQUIT 3
+#define CYG_HAL_SYS_SIGILL 4
+#define CYG_HAL_SYS_SIGTRAP 5
+#define CYG_HAL_SYS_SIGABRT 6
+#define CYG_HAL_SYS_SIGBUS 7
+#define CYG_HAL_SYS_SIGFPE 8
+#define CYG_HAL_SYS_SIGKILL 9
+#define CYG_HAL_SYS_SIGUSR1 10
+#define CYG_HAL_SYS_SIGSEGV 11
+#define CYG_HAL_SYS_SIGUSR2 12
+#define CYG_HAL_SYS_SIGPIPE 13
+#define CYG_HAL_SYS_SIGALRM 14
+#define CYG_HAL_SYS_SIGTERM 15
+#define CYG_HAL_SYS_SIGSTKFLT 16
+#define CYG_HAL_SYS_SIGCHLD 17
+#define CYG_HAL_SYS_SIGCONT 18
+#define CYG_HAL_SYS_SIGSTOP 19
+#define CYG_HAL_SYS_SIGTSTP 20
+#define CYG_HAL_SYS_SIGTTIN 21
+#define CYG_HAL_SYS_SIGTTOU 22
+#define CYG_HAL_SYS_SIGURG 23
+#define CYG_HAL_SYS_SIGXCPU 24
+#define CYG_HAL_SYS_SIGXFSZ 25
+#define CYG_HAL_SYS_SIGVTALRM 26
+#define CYG_HAL_SYS_SIGPROF 27
+#define CYG_HAL_SYS_SIGWINCH 28
+#define CYG_HAL_SYS_SIGIO 29
+#define CYG_HAL_SYS_SIGPWR 30
+#define CYG_HAL_SYS_SIGSYS 31
+
+#define CYG_HAL_SYS_SA_NOCLDSTOP 0x00000001
+#define CYG_HAL_SYS_SA_NOCLDWAIT 0x00000002
+#define CYG_HAL_SYS_SA_SIGINFO 0x00000004
+#define CYG_HAL_SYS_SA_RESTORER 0x04000000
+#define CYG_HAL_SYS_SA_RESTART 0x10000000
+#define CYG_HAL_SYS_SA_NODEFER 0x40000000
+
+#define CYG_HAL_SYS_SIG_BLOCK 0
+#define CYG_HAL_SYS_SIG_UNBLOCK 1
+#define CYG_HAL_SYS_SIG_SETMASK 2
+
+#define CYG_HAL_SYS__NSIG 64
+#define CYG_HAL_SYS__SIGBITS (8 * sizeof(unsigned long))
+#define CYG_HAL_SYS__SIGELT(_d_) ((_d_) / CYG_HAL_SYS__SIGBITS)
+#define CYG_HAL_SYS__SIGMASK(_d_) ((unsigned long)1 << ((_d_) % CYG_HAL_SYS__SIGBITS))
+
+typedef struct cyg_hal_sys_sigset_t {
+ unsigned long hal_sig_bits[CYG_HAL_SYS__NSIG / CYG_HAL_SYS__SIGBITS];
+} cyg_hal_sys_sigset_t;
+
+#define CYG_HAL_SYS_SIGFILLSET(_set_) \
+ CYG_MACRO_START \
+ unsigned int __i; \
+ for (__i = 0; __i < (CYG_HAL_SYS__NSIG / CYG_HAL_SYS__SIGBITS); __i++) { \
+ (_set_)->hal_sig_bits[__i] = ~0; \
+ } \
+ CYG_MACRO_END
+
+#define CYG_HAL_SYS_SIGEMPTYSET(_set_) \
+ CYG_MACRO_START \
+ unsigned int __i; \
+ for (__i = 0; __i < (CYG_HAL_SYS__NSIG / CYG_HAL_SYS__SIGBITS); __i++) { \
+ (_set_)->hal_sig_bits[__i] = 0; \
+ } \
+ CYG_MACRO_END
+
+#define CYG_HAL_SYS_SIGADDSET(_set_, _bit_) \
+ CYG_MACRO_START \
+ (_set_)->hal_sig_bits[CYG_HAL_SYS__SIGELT(_bit_ - 1)] |= CYG_HAL_SYS__SIGMASK(_bit_ - 1); \
+ CYG_MACRO_END
+
+#define CYG_HAL_SYS_SIGDELSET(_set_, _bit_) \
+ CYG_MACRO_START \
+ (_set_)->hal_sig_bits[CYG_HAL_SYS__SIGELT(_bit_ - 1)] &= ~CYG_HAL_SYS__SIGMASK(_bit_ - 1); \
+ CYG_MACRO_END
+
+#define CYG_HAL_SYS_SIGISMEMBER(_set_, _bit_) \
+ (0 != ((_set_)->hal_sig_bits[CYG_HAL_SYS__SIGELT(_bit_ - 1)] & CYG_HAL_SYS__SIGMASK(_bit_ - 1)))
+
+// The kernel sigaction structure has changed, to allow for >32
+// signals. This is the old version, i.e. a struct old_sigaction, for
+// use with the sigaction() system call rather than rt_sigaction(). It
+// is preferred to the more modern version because gdb knows about
+// rt_sigaction() and will start intercepting signals, but it seems to
+// ignore sigaction().
+struct cyg_hal_sys_sigaction {
+ void (*hal_handler)(int);
+ long hal_mask;
+ int hal_flags;
+ void (*hal_restorer)(void);
+};
+
+// Time support.
+struct cyg_hal_sys_timeval {
+ long hal_tv_sec;
+ long hal_tv_usec;
+};
+
+struct cyg_hal_sys_timezone {
+ int hal_tz_minuteswest;
+ int hal_tz_dsttime;
+};
+
+// Select support. Initially this is used only by the idle handler.
+#define CYG_HAL_SYS_FD_SETSIZE 1024
+#define CYG_HAL_SYS__NFDBITS (8 * sizeof(unsigned long))
+#define CYG_HAL_SYS__FDELT(_d_) ((_d_) / CYG_HAL_SYS__NFDBITS)
+#define CYG_HAL_SYS__FDMASK(_d_) ((unsigned long)1 << ((_d_) % CYG_HAL_SYS__NFDBITS))
+
+struct cyg_hal_sys_fd_set {
+ unsigned long hal_fds_bits[CYG_HAL_SYS_FD_SETSIZE / CYG_HAL_SYS__NFDBITS];
+};
+#define CYG_HAL_SYS_FD_ZERO(_fdsp_) \
+ do { \
+ unsigned int __i; \
+ for (__i = 0; \
+ __i < (CYG_HAL_SYS_FD_SETSIZE / CYG_HAL_SYS__NFDBITS); \
+ __i++) { \
+ (_fdsp_)->hal_fds_bits[__i] = 0; \
+ } \
+ } while (0);
+
+#define CYG_HAL_SYS_FD_SET(_fd_, _fdsp_) \
+ CYG_MACRO_START \
+ (_fdsp_)->hal_fds_bits[CYG_HAL_SYS__FDELT(_fd_)] |= CYG_HAL_SYS__FDMASK(_fd_); \
+ CYG_MACRO_END
+
+#define CYG_HAL_SYS_FD_CLR(_fd_, _fdsp_) \
+ CYG_MACRO_START \
+ (_fdsp_)->hal_fds_bits[CYG_HAL_SYS__FDELT(_fd_)] &= ~CYG_HAL_SYS__FDMASK(_fd_); \
+ CYG_MACRO_END
+
+#define CYG_HAL_SYS_FD_ISSET(_fd_, _fdsp_) \
+ (0 != ((_fdsp_)->hal_fds_bits[CYG_HAL_SYS__FDELT(_fd_)] & CYG_HAL_SYS__FDMASK(_fd_)))
+
+// Interval timer support, needed for the clock.
+#define CYG_HAL_SYS_ITIMER_REAL 0
+#define CYG_HAL_SYS_ITIMER_VIRTUAL 1
+#define CYG_HAL_SYS_ITIMER_PROF 2
+
+struct cyg_hal_sys_itimerval {
+ struct cyg_hal_sys_timeval hal_it_interval;
+ struct cyg_hal_sys_timeval hal_it_value;
+};
+
+// System calls and related constants, or rather the subset that is
+// needed internally.
+#define CYG_HAL_SYS_R_OK 0x04
+#define CYG_HAL_SYS_W_OK 0x02
+#define CYG_HAL_SYS_X_OK 0x01
+#define CYG_HAL_SYS_F_OK 0x00
+
+/* lseek whence flags */
+#define CYG_HAL_SYS_SEEK_SET 0 /* Seek from beginning of file. */
+#define CYG_HAL_SYS_SEEK_CUR 1 /* Seek from current position. */
+#define CYG_HAL_SYS_SEEK_END 2 /* Seek from end of file. */
+
+/* open/fcntl flags */
+
+#define CYG_HAL_SYS_O_RDONLY 0
+#define CYG_HAL_SYS_O_WRONLY 01
+#define CYG_HAL_SYS_O_RDWR 02
+#define CYG_HAL_SYS_O_CREAT 0100
+#define CYG_HAL_SYS_O_EXCL 0200
+#define CYG_HAL_SYS_O_NOCTTY 0400
+#define CYG_HAL_SYS_O_TRUNC 01000
+#define CYG_HAL_SYS_O_APPEND 02000
+#define CYG_HAL_SYS_O_NONBLOCK 04000
+#define CYG_HAL_SYS_O_NDELAY CYG_HAL_SYS_O_NONBLOCK
+#define CYG_HAL_SYS_O_SYNC 010000
+#define CYG_HAL_SYS_O_FSYNC CYG_HAL_SYS_O_SYNC
+#define CYG_HAL_SYS_O_ASYNC 020000
+
+/* open mode flags */
+#define CYG_HAL_SYS_S_IRUSR 0400
+#define CYG_HAL_SYS_S_IREAD CYG_HAL_SYS_S_IRUSR
+#define CYG_HAL_SYS_S_IWUSR 0200
+#define CYG_HAL_SYS_S_IWRITE CYG_HAL_SYS_S_IWUSR
+#define CYG_HAL_SYS_S_IXUSR 0100
+#define CYG_HAL_SYS_S_IEXEC CYG_HAL_SYS_S_IXUSR
+#define CYG_HAL_SYS_S_IRWXU \
+ (CYG_HAL_SYS_S_IREAD|CYG_HAL_SYS_S_IWRITE|CYG_HAL_SYS_S_IEXEC)
+#define CYG_HAL_SYS_S_IRWXG (CYG_HAL_SYS_S_IRWXU>>3)
+#define CYG_HAL_SYS_S_IRGRP (CYG_HAL_SYS_S_IRUSR>>3)
+#define CYG_HAL_SYS_S_IWGRP (CYG_HAL_SYS_S_IWUSR>>3)
+#define CYG_HAL_SYS_S_IXGRP (CYG_HAL_SYS_S_IXUSR>>3)
+#define CYG_HAL_SYS_S_IRWXO (CYG_HAL_SYS_S_IRWXG>>3)
+#define CYG_HAL_SYS_S_IROTH (CYG_HAL_SYS_S_IRGRP>>3)
+#define CYG_HAL_SYS_S_IWOTH (CYG_HAL_SYS_S_IWGRP>>3)
+#define CYG_HAL_SYS_S_IXOTH (CYG_HAL_SYS_S_IXGRP>>3)
+
+/* stat flags */
+#define CYG_HAL_SYS_S_IFMT 0170000 /*bitmask for the file type bitfields*/
+#define CYG_HAL_SYS_S_IFSOCK 0140000 /*socket*/
+#define CYG_HAL_SYS_S_IFLNK 0120000 /*symbolic link*/
+#define CYG_HAL_SYS_S_IFREG 0100000 /*regular file*/
+#define CYG_HAL_SYS_S_IFBLK 0060000 /*block device*/
+#define CYG_HAL_SYS_S_IFDIR 0040000 /*directory*/
+#define CYG_HAL_SYS_S_IFCHR 0020000 /*character device*/
+#define CYG_HAL_SYS_S_IFIFO 0010000 /*fifo*/
+#define CYG_HAL_SYS_S_ISUID 0004000 /*set UID bit*/
+#define CYG_HAL_SYS_S_ISGID 0002000 /*set GID bit (see below)*/
+#define CYG_HAL_SYS_S_ISVTX 0001000 /*sticky bit (see below)*/
+
+struct cyg_hal_sys_mmap_args {
+ unsigned long addr;
+ unsigned long len;
+ unsigned long prot;
+ unsigned long flags;
+ unsigned long fd;
+ unsigned long offset;
+};
+
+/* Protection flags for mmap */
+#define CYG_HAL_SYS_PROT_READ 0x1 /* page can be read */
+#define CYG_HAL_SYS_PROT_WRITE 0x2 /* page can be written */
+#define CYG_HAL_SYS_PROT_EXEC 0x4 /* page can be executed */
+#define CYG_HAL_SYS_PROT_NONE 0x0 /* page can not be accessed */
+
+/* Sharing types and other flags */
+#define CYG_HAL_SYS_MAP_SHARED 0x01 /* Share changes. */
+#define CYG_HAL_SYS_MAP_PRIVATE 0x02 /* Changes are private. */
+#define CYG_HAL_SYS_MAP_FIXED 0x10 /* Interpret addr exactly. */
+
+struct cyg_hal_sys_dirent
+{
+ unsigned long d_ino;
+ unsigned long d_off;
+ unsigned short int d_reclen;
+ char d_name[256];
+};
+
+struct cyg_hal_sys_timespec
+{
+ unsigned int tv_sec;
+ unsigned int tv_nsec;
+};
+
+// NOTE: This corresponds to __old_kernel_stat in the kernel sources
+// and should be used with cyg_hal_sys_oldstat etc.
+
+struct cyg_hal_sys_old_stat
+{
+ unsigned short st_dev; /* device */
+ unsigned short st_ino; /* inode */
+ unsigned short st_mode; /* protection */
+ unsigned short st_nlink; /* number of hard links */
+ unsigned short st_uid; /* user ID of owner */
+ unsigned short st_gid; /* group ID of owner */
+ unsigned short st_rdev; /* device type (if inode device) */
+ unsigned long st_size; /* total size, in bytes */
+ unsigned long st_atime; /* time of last access */
+ unsigned long st_mtime; /* time of last modification */
+ unsigned long st_ctime; /* time of last change */
+};
+
+struct cyg_hal_sys_new_stat
+{
+ unsigned long st_dev;
+ unsigned long st_ino;
+ unsigned short st_mode;
+ unsigned short st_nlink;
+ unsigned short st_uid;
+ unsigned short st_gid;
+ unsigned long st_rdev;
+ unsigned long st_size;
+ unsigned long st_blksize;
+ unsigned long st_blocks;
+ unsigned long st_atime;
+ unsigned long st_atime_nsec;
+ unsigned long st_mtime;
+ unsigned long st_mtime_nsec;
+ unsigned long st_ctime;
+ unsigned long st_ctime_nsec;
+ unsigned long __unused4;
+ unsigned long __unused5;
+};
+
+// System calls, or rather the subset that is needed internally or by
+// applications which want to access the host OS.
+
+externC unsigned long cyg_hal_sys_write(int, const void*, long);
+externC unsigned long cyg_hal_sys_read(int, void*, long);
+externC int cyg_hal_sys_lseek(int, int, int);
+externC int cyg_hal_sys_open(const char *,int,int);
+externC int cyg_hal_sys_fdatasync(int);
+externC int cyg_hal_sys_sigaction(int,
+ const struct cyg_hal_sys_sigaction*,
+ struct cyg_hal_sys_sigaction*);
+externC int cyg_hal_sys_sigprocmask(int,
+ const cyg_hal_sys_sigset_t*,
+ cyg_hal_sys_sigset_t*);
+externC int cyg_hal_sys__newselect(int,
+ struct cyg_hal_sys_fd_set*,
+ struct cyg_hal_sys_fd_set*,
+ struct cyg_hal_sys_fd_set*,
+ struct cyg_hal_sys_timeval*);
+externC int cyg_hal_sys_setitimer(int,
+ const struct cyg_hal_sys_itimerval*,
+ struct cyg_hal_sys_itimerval*);
+externC int cyg_hal_sys_gettimeofday(struct cyg_hal_sys_timeval*,
+ struct cyg_hal_sys_timezone*);
+
+externC int cyg_hal_sys_access(const char*, int);
+externC int cyg_hal_sys_fork(void);
+externC int cyg_hal_sys_execve(const char*, const char* [], const char* []);
+externC int cyg_hal_sys_pipe(int []);
+externC int cyg_hal_sys_close(int);
+externC int cyg_hal_sys_dup2(int, int);
+externC int cyg_hal_sys_unlink(const char*);
+externC int cyg_hal_sys_rename(const char*, const char*);
+
+#define CYG_HAL_SYS_IPCOP_semop 1
+#define CYG_HAL_SYS_IPCOP_semget 2
+#define CYG_HAL_SYS_IPCOP_semctl 3
+#define CYG_HAL_SYS_IPCOP_msgsnd 11
+#define CYG_HAL_SYS_IPCOP_msgrcv 12
+#define CYG_HAL_SYS_IPCOP_msgget 13
+#define CYG_HAL_SYS_IPCOP_msgctl 14
+#define CYG_HAL_SYS_IPCOP_shmat 21
+#define CYG_HAL_SYS_IPCOP_shmdt 22
+#define CYG_HAL_SYS_IPCOP_shmget 23
+#define CYG_HAL_SYS_IPCOP_shmctl 24
+
+/*The ipc system call, which is used by the following shmem
+ functions. These may be unportable*/
+
+// Generic system call. Depending on the value of call, it will
+// perform the following functions.
+externC int cyg_hal_sys_ipc(int call, int first, int second,
+ int third, void* ptr);
+//get an identifier for a shared memory segment
+externC int cyg_hal_sys_shmget (int key, int size, int shmflg);
+//attach to an shared memory segment
+externC void * cyg_hal_sys_shmat (int shmid, const void* shmaddr,
+ int shmflg);
+//detach from it again
+externC int cyg_hal_sys_shmdt (const void* shmaddr);
+
+// Convert a pathname and an identifier into a System V IPC key
+externC int cyg_hal_sys_ftok(const char* path, int id);
+
+// The actual implementation appears to return the new brk() value.
+externC void* cyg_hal_sys_brk(void*);
+
+// Returns the number of characters placed in the buffer or <0 for error,
+// not a char*.
+externC int cyg_hal_sys_getcwd(char*, int);
+
+// mmap on the "host" system - this may be unportable. This is the
+// really system call into the kernel which passes one structure
+// containing all the arguments.
+externC int cyg_hal_sys_mmapx(struct cyg_hal_sys_mmap_args *);
+
+// This is the mmap call that users are used to.
+externC int cyg_hal_sys_mmap(void *addr,
+ unsigned long length,
+ unsigned long prot,
+ unsigned long flags,
+ unsigned long fd,
+ unsigned long off);
+
+externC int cyg_hal_sys_readdir(unsigned int fd,
+ struct cyg_hal_sys_dirent *dp,
+ unsigned int count);
+// Old syscall versions
+externC int cyg_hal_sys_oldlstat(const char* name,
+ struct cyg_hal_sys_old_stat *buf);
+externC int cyg_hal_sys_oldfstat(int fd, struct cyg_hal_sys_old_stat *buf);
+externC int cyg_hal_sys_oldstat(const char* name,
+ struct cyg_hal_sys_old_stat *buf);
+// New syscall versions
+externC int cyg_hal_sys_newlstat(const char* name,
+ struct cyg_hal_sys_new_stat *buf);
+externC int cyg_hal_sys_newfstat(int fd, struct cyg_hal_sys_new_stat *buf);
+externC int cyg_hal_sys_newstat(const char* name,
+ struct cyg_hal_sys_old_stat *buf);
+
+externC int cyg_hal_sys_mkdir(const char* path, int mode);
+
+// Access to environmental data
+extern int cyg_hal_sys_argc;
+extern const char** cyg_hal_sys_argv;
+extern const char** cyg_hal_sys_environ;
+
+// ----------------------------------------------------------------------------
+// Interaction between the application and the auxiliary.
+
+// Is the auxiliary actually in use/available? This flag should be tested by
+// device drivers prior to attempting any communication with the auxiliary.
+extern cyg_bool synth_auxiliary_running;
+
+// The fundamental I/O operation: sending a request to the auxiliary and
+// optionally getting back a reply. A null pointer for the response field
+// indicates that no reply is expected.
+externC void synth_auxiliary_xchgmsg(int /* devid */, int /* request */,
+ int /* arg1 */, int /* arg2 */,
+ const unsigned char* /* txdata */, int /* txlen */,
+ int* /* response */,
+ unsigned char* /* rxdata */, int* /* actual_rxlen */,
+ int /* rxlen */);
+
+// Request that the auxiliary instantiates a given device, loading appropriate
+// support code as required. This function takes the following arguments:
+// 1) the location of the package that should provide this device, e.g.
+// devs/eth/synth
+// 2) the version of that package currently being used, e.g. "current"
+// 3) the name of the device, e.g. "ethernet". This identifies the
+// Tcl script that should be loaded to handle requests for this device.
+// 4) the name of the device instance, e.g. "eth0".
+// 5) device-specific initialization data.
+externC int synth_auxiliary_instantiate(const char*, const char*, const char*, const char*, const char*);
+
+// Support for generating strings
+#define SYNTH_MAKESTRING1(a) #a
+#define SYNTH_MAKESTRING(a) SYNTH_MAKESTRING1(a)
+
+//-----------------------------------------------------------------------------
+#endif // ifndef CYGONCE_HAL_HAL_IO_H
+// End of hal_io.h
diff --git a/ecos/packages/hal/synth/arch/current/src/synth.ld b/ecos/packages/hal/synth/arch/current/src/synth.ld
new file mode 100644
index 0000000..f008b6e
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/src/synth.ld
@@ -0,0 +1,237 @@
+//==========================================================================
+//
+// synth.ld
+//
+// Linker script for the synthetic target
+//
+//==========================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2009 Free Software Foundation, Inc.
+//
+// eCos 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.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): jskov
+// Contributors:jskov, bartv
+// Date: 1999-01-18
+// Purpose: synthetic target linker script
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+STARTUP(vectors.o)
+ENTRY(_start)
+#ifdef EXTRAS
+INPUT(extras.o)
+#endif
+#if (__GNUC__ >= 3)
+GROUP(libtarget.a libgcc.a libsupc++.a libgcc_eh.a)
+#else
+GROUP(libtarget.a libgcc.a)
+#endif
+
+#define ALIGN_LMA 8
+#define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1))
+#define LMA_EQ_VMA
+#define FORCE_OUTPUT . = .
+
+
+#define SECTIONS_BEGIN
+
+#define SECTION_vectors(_region_, _vma_, _lma_) \
+ .vectors _vma_ : _lma_ \
+ { FORCE_OUTPUT; KEEP(*(.vectors)) } \
+ > _region_
+
+#define SECTION_text(_region_, _vma_, _lma_) \
+ .text _vma_ : _lma_ \
+ { _stext = .; \
+ *(.text*) *(.gnu.warning) *(.gnu.linkonce.t.*) *(.init) \
+ *(.note.gnu.build-id) \
+ } \
+ > _region_ \
+ _etext = .; PROVIDE (etext = .);
+
+#define SECTION_fini(_region_, _vma_, _lma_) \
+ .fini _vma_ : _lma_ \
+ { FORCE_OUTPUT; *(.fini) } \
+ > _region_
+
+#define SECTION_rodata1(_region_, _vma_, _lma_) \
+ .rodata1 _vma_ : _lma_ \
+ { FORCE_OUTPUT; *(.rodata1) } \
+ > _region_
+
+#define SECTION_rodata(_region_, _vma_, _lma_) \
+ .rodata _vma_ : _lma_ \
+ { FORCE_OUTPUT; *(.rodata*) *(.gnu.linkonce.r.*) } \
+ > _region_
+
+#define SECTION_fixup(_region_, _vma_, _lma_) \
+ .fixup _vma_ : _lma_ \
+ { _FIXUP_START_ = ABSOLUTE(.); *(.fixup) _FIXUP_END_ = ABSOLUTE(.);} \
+ > _region_
+
+#define SECTION_gcc_except_table(_region_, _vma_, _lma_) \
+ .gcc_except_table _vma_ : _lma_ \
+ { _EXCEPT_START_ = ABSOLUTE(.); \
+ *(.gcc_except_table) \
+ *(.gcc_except_table.*) \
+ _EXCEPT_END_ = ABSOLUTE(.);} \
+ > _region_
+
+#define SECTION_eh_frame(_region_, _vma_, _lma_) \
+ . = _vma_ ; \
+ . = ALIGN(ALIGN_LMA) ; \
+ .eh_frame_hdr . : _lma_ \
+ { \
+ FORCE_OUTPUT; \
+ *(.eh_frame_hdr) \
+ } > _region_ = 0 \
+ . = ALIGN(ALIGN_LMA) ; \
+ .eh_frame . : FOLLOWING(.eh_frame_hdr) \
+ { \
+ FORCE_OUTPUT; \
+ __EH_FRAME_BEGIN__ = .; \
+ KEEP(*(.eh_frame)) \
+ KEEP(*(.eh_frame*)) \
+ __EH_FRAME_END__ = .; \
+ . = ALIGN(4) ; \
+ . = . + 8; \
+ } > _region_ = 0
+
+#define SECTION_RELOCS(_region_, _vma_, _lma_) \
+ .rel.text : \
+ { \
+ *(.rel.text) \
+ *(.rel.text.*) \
+ *(.rel.gnu.linkonce.t*) \
+ } > _region_ \
+ .rela.text : \
+ { \
+ *(.rela.text) \
+ *(.rela.text.*) \
+ *(.rela.gnu.linkonce.t*) \
+ } > _region_ \
+ .rel.data : \
+ { \
+ *(.rel.data) \
+ *(.rel.data.*) \
+ *(.rel.gnu.linkonce.d*) \
+ } > _region_ \
+ .rela.data : \
+ { \
+ *(.rela.data) \
+ *(.rela.data.*) \
+ *(.rela.gnu.linkonce.d*) \
+ } > _region_ \
+ .rel.rodata : \
+ { \
+ *(.rel.rodata) \
+ *(.rel.rodata.*) \
+ *(.rel.gnu.linkonce.r*) \
+ } > _region_ \
+ .rela.rodata : \
+ { \
+ *(.rela.rodata) \
+ *(.rela.rodata.*) \
+ *(.rela.gnu.linkonce.r*) \
+ } > _region_ \
+ .rel.got : { *(.rel.got) } > _region_ \
+ .rela.got : { *(.rela.got) } > _region_ \
+ .rel.ctors : { *(.rel.ctors) } > _region_ \
+ .rela.ctors : { *(.rela.ctors) } > _region_ \
+ .rel.dtors : { *(.rel.dtors) } > _region_ \
+ .rela.dtors : { *(.rela.dtors) } > _region_ \
+ .rel.init : { *(.rel.init) } > _region_ \
+ .rela.init : { *(.rela.init) } > _region_ \
+ .rel.fini : { *(.rel.fini) } > _region_ \
+ .rela.fini : { *(.rela.fini) } > _region_ \
+ .rel.bss : { *(.rel.bss) } > _region_ \
+ .rela.bss : { *(.rela.bss) } > _region_ \
+ .rel.plt : { *(.rel.plt) } > _region_ \
+ .rela.plt : { *(.rela.plt) } > _region_ \
+ .rel.dyn : { *(.rel.dyn) } > _region_
+
+// Note: The __ in the name is an encoding of the .
+#define SECTION_rel__got(_region_, _vma_, _lma_) \
+ .rel.got _vma_ : _lma_ \
+ { *(.rel.got) } \
+ > _region_
+
+#define SECTION_data(_region_, _vma_, _lma_) \
+ .data _vma_ : _lma_ \
+ { __ram_data_start = ABSOLUTE(.); *(.data*) *(.gnu.linkonce.d.*) \
+ _GOT1_START_ = ABSOLUTE(.); *(.got1) _GOT1_END_ = ABSOLUTE(.); \
+ /* Put .ctors and .dtors next to the .got2 section, so that */ \
+ /* the pointers get relocated with -mrelocatable. */ \
+ . = ALIGN(8); __CTOR_LIST__ = ABSOLUTE(.); \
+ KEEP(*(SORT(.ctors*))) __CTOR_END__ = ABSOLUTE(.); \
+ __DTOR_LIST__ = ABSOLUTE(.); \
+ KEEP(*(SORT(.dtors*))) __DTOR_END__ = ABSOLUTE(.); \
+ . = ALIGN(32); \
+ KEEP(*( SORT (.ecos.table.*))); \
+ _GOT2_START_ = ABSOLUTE(.); *(.got2) _GOT2_END_ = ABSOLUTE(.); \
+ _GOT_START_ = ABSOLUTE(.); _GLOBAL_OFFSET_TABLE_ = ABSOLUTE(. + 32768); \
+ _SDA_BASE_ = ABSOLUTE(.); *(.got.plt) *(.got) \
+ _GOT_END_ = ABSOLUTE(.); *(.dynamic) \
+ /* We want the small data sections together, so single-instruction */ \
+ /* offsets can access them all, and initialized data all before */ \
+ /* uninitialized, so we can shorten the on-disk segment size. */ \
+ _SDATA_START_ = ABSOLUTE(.); *(.sdata*) *(.gnu.linkonce.s.*) } \
+ > _region_ \
+ __rom_data_start = LOADADDR(.data); \
+ __ram_data_end = .; PROVIDE(__ram_data_end = .); \
+ _edata = .; PROVIDE (edata = .);
+
+#define SECTION_sbss(_region_, _vma_, _lma_) \
+ .sbss _vma_ : _lma_ \
+ { __bss_start = ABSOLUTE (.); \
+ _SBSS_START_ = ABSOLUTE(.); *(.sbss*) *(.gnu.linkonce.sb.*) \
+ _SBSS_END_ = ABSOLUTE(.); \
+ *(.scommon*) } \
+ > _region_
+
+#define SECTION_bss(_region_, _vma_, _lma_) \
+ .bss _vma_ : _lma_ \
+ { FORCE_OUTPUT; *(.dynbss*) *(.bss*) *(COMMON) *(.gnu.linkonce.b.*) } \
+ > _region_ \
+ __bss_end = .;
+
+#define SECTIONS_HEAP(_region_, _start_, _end_) \
+ .synth_heap _start_ : \
+ { FORCE_OUTPUT; . = _end_ - _start_ ; } \
+ > _region_
+
+#define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .);
+
+#include <pkgconf/system.h>
+#include CYGHWR_MEMORY_LAYOUT_LDI
diff --git a/ecos/packages/hal/synth/arch/current/src/synth_diag.c b/ecos/packages/hal/synth/arch/current/src/synth_diag.c
new file mode 100644
index 0000000..13f9b99
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/src/synth_diag.c
@@ -0,0 +1,156 @@
+//=============================================================================
+//
+// synth_diag.c
+//
+// Synthetic target diagnostic output code
+//
+//=============================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2009 Free Software Foundation, Inc.
+//
+// eCos 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.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): proven
+// Contributors:proven, bartv
+// Date: 1998-10-05
+// Purpose: HAL diagnostic output
+// Description: Implementations of HAL diagnostic output support.
+//
+// There are two possible ways of performing I/O. The first
+// involves simply writing to stdout. This is robust, but
+// has some disadvantages such as the output getting mixed up
+// with gdb output. The second involves sending the data on
+// to the auxiliary, less robust but much more flexible.
+//
+// Similarly, input can be handled by reading from stdin or
+// by a suitable device in the auxiliary.
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <cyg/infra/cyg_type.h>
+#include <cyg/hal/hal_diag.h>
+#include <cyg/hal/hal_io.h>
+#include <cyg/hal/hal_intr.h>
+#include <cyg/infra/cyg_ass.h>
+
+//-----------------------------------------------------------------------------
+// If the auxiliary exists, hal_diag_init() will try to contact it and
+// instantiate a console device. Subsequent console writes will be
+// redirected to that device, as long as the auxiliary is up and running.
+// If the auxiliary is not being used or has exited, console writes
+// will instead go to stdout.
+//
+// This code also contains an implementation of hal_diag_read_char()
+// which is probably not very useful. Currently it works by reading
+// from stdin, but no attempt is made to set the tty into raw mode
+// or anything like that.
+
+static int auxiliary_console_id = -1;
+
+void hal_diag_init( void )
+{
+ if (synth_auxiliary_running) {
+ auxiliary_console_id = synth_auxiliary_instantiate("hal/synth/arch", SYNTH_MAKESTRING(CYGPKG_HAL_SYNTH), "console",
+ (const char*) 0, (const char*) 0);
+ }
+}
+
+// Output a single character.
+//
+// The calling code will output one character at a time. Output
+// involves at least one system call, and this is expensive for
+// a single character (especially when used in conjunction with
+// I/O intensive facilities like unbuffered tracing). Therefore
+// this code will buffer lines up to 128 characters before
+// doing the I/O.
+//
+// NOTE: one problem is that there is no support for flushing buffers
+// at this level. Therefore if say C library stdio ends up mapped to
+// HAL diagnostics I/O then functions like fflush() and setvbuf() will
+// not behave the way they should. There is no simple workaround at
+// this level, the required information is not available.
+
+void hal_diag_write_char(char c)
+{
+ static int diag_index = 0;
+ static unsigned char diag_buffer[128];
+ int ints_state;
+
+ CYG_ASSERT(diag_index < 128, "Diagnostic buffer overflow");
+ HAL_DISABLE_INTERRUPTS(ints_state);
+
+ diag_buffer[diag_index++] = (unsigned char) c;
+ if (('\n' == c) || (128 == diag_index)) {
+ if ((-1 != auxiliary_console_id) && synth_auxiliary_running) {
+ synth_auxiliary_xchgmsg(auxiliary_console_id, 0, 0, 0, diag_buffer, diag_index, (int *) 0, (unsigned char*) 0, (int *)0, 0);
+ diag_index = 0;
+ } else {
+ int written;
+ unsigned char* next = diag_buffer;
+
+ while (diag_index > 0) {
+ written = cyg_hal_sys_write(1, next, diag_index);
+ if (written > 0) {
+ diag_index -= written;
+ next += written;
+ } else if ((-CYG_HAL_SYS_EINTR != written) && (-CYG_HAL_SYS_EAGAIN != written)) {
+ CYG_FAIL("Unexpected error writing to stdout.");
+ diag_index = 0;
+ break;
+ }
+ }
+ CYG_ASSERT(0 == diag_index, "All data should have been written out");
+ diag_index = 0;
+ }
+ }
+ HAL_RESTORE_INTERRUPTS(ints_state);
+}
+
+// Diagnostic input. It is not clear that this is actually useful,
+// input would normally go to gdb rather than to the application. If
+// keyboard input really is required then that should be handled via a
+// suitable device driver interacting with the auxiliary, not at the
+// HAL level. The read syscall will get woken up by the itimer alarm,
+// but we don't want to stop reading if that's the case
+
+void hal_diag_read_char(char *c)
+{
+ int rc;
+ do {
+ rc = cyg_hal_sys_read(0, c, 1);
+ } while ((-CYG_HAL_SYS_EINTR == rc) || (-CYG_HAL_SYS_EAGAIN == rc));
+}
+
+//-----------------------------------------------------------------------------
+// End of hal_diag.c
diff --git a/ecos/packages/hal/synth/arch/current/src/synth_entry.c b/ecos/packages/hal/synth/arch/current/src/synth_entry.c
new file mode 100644
index 0000000..68003c2
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/src/synth_entry.c
@@ -0,0 +1,219 @@
+//==========================================================================
+//
+// synth_entry.c
+//
+// Entry code for Linux synthetic target.
+//
+//==========================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
+//
+// eCos 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.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): proven
+// Contributors:proven, jskov, bartv
+// Date: 1999-01-06
+// Purpose: Entry point for Linux synthetic target.
+//
+//####DESCRIPTIONEND####
+//
+//=========================================================================
+
+#include <pkgconf/system.h>
+#include <pkgconf/hal.h>
+#include <cyg/infra/cyg_type.h>
+#include <cyg/infra/cyg_ass.h>
+#include <cyg/infra/diag.h>
+#include <cyg/hal/hal_arch.h>
+#include <cyg/hal/hal_intr.h>
+#include <cyg/hal/hal_io.h>
+#include CYGHWR_MEMORY_LAYOUT_H
+
+/*------------------------------------------------------------------------*/
+/* C++ support - run initial constructors */
+
+#ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG
+cyg_bool cyg_hal_stop_constructors;
+#endif
+
+typedef void (*pfunc) (void);
+extern pfunc __CTOR_LIST__[];
+extern pfunc __CTOR_END__[];
+
+void
+cyg_hal_invoke_constructors (void)
+{
+#ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG
+ static pfunc *p = &__CTOR_END__[-1];
+
+ cyg_hal_stop_constructors = 0;
+ for (; p >= __CTOR_LIST__; p--) {
+ (*p) ();
+ if (cyg_hal_stop_constructors) {
+ p--;
+ break;
+ }
+ }
+#else
+ pfunc *p;
+
+ for (p = &__CTOR_END__[-1]; p >= __CTOR_LIST__; p--)
+ (*p) ();
+#endif
+}
+
+// ----------------------------------------------------------------------------
+// The low-level entry point is platform-specific, typically in the
+// assember file vectors.S. However that entry point simply jumps
+// directly here, with no further processing or stack manipulation.
+// The HAL specification defines clearly what should happen during
+// startup.
+
+externC void cyg_start( void );
+externC void synth_hardware_init(void);
+externC void synth_hardware_init2(void);
+
+void _linux_entry( void )
+{
+ // "Initialize various cpu status registers, including disabling interrupts."
+ // That is a no-op for the synthetic target, in particular interrupts are
+ // already disabled.
+
+ // "Set up any CPU memory controller to access ROM, RAM, and I/O
+ // devices correctly". The ROM and RAM are set up via the linker
+ // script and taken care of automatically during loading. There
+ // are no memory-mapped devices. Arguably the auxiliary should be
+ // started up here, but instead that is left to platform
+ // initialization.
+
+ // "Enable the cache". Effectively the synthetic target has no cache,
+ // anything provided by the hardware is not readily accessible.
+
+ // "Set up the stack pointer". The system starts up a program with a
+ // suitable stack.
+
+ // "Initialize any global pointer register". There is no such register.
+
+ // Perform platform-specific initialization. Actually, all Linux
+ // platforms can share this. It involves setting up signal handlers,
+ // starting the I/O auxiliary, and so on.
+ synth_hardware_init();
+
+ // This is not a ROM startup, so no need to worry about copying the
+ // .data section.
+
+ // "Zero the .bss section". Linux will have done this for us.
+
+ // "Create a suitable C stack frame". Already done.
+
+ // Invoke the C++ constructors.
+ cyg_hal_invoke_constructors();
+
+ // Once the C++ constructors have been invoked, a second stage
+ // of hardware initialization is desirable. At this point all
+ // eCos device drivers should have been initialized so the
+ // I/O auxiliary will have loaded the appropriate support
+ // scripts, and the auxiliary can now map the window(s) on to
+ // the display and generally operate normally.
+ synth_hardware_init2();
+
+ // "Call cyg_start()". OK.
+ cyg_start();
+
+ // "Drop into an infinite loop". Not a good idea for the synthetic
+ // target. Instead, exit.
+ cyg_hal_sys_exit(0);
+}
+
+// ----------------------------------------------------------------------------
+// Stub functions needed for linking with various versions of gcc
+// configured for Linux rather than i386-elf.
+
+#if (__GNUC__ < 3)
+// 2.95.x libgcc.a __pure_virtual() calls __write().
+int __write(void)
+{
+ return -1;
+}
+#endif
+
+#if (__GNUC__ >= 3)
+// Versions of gcc/g++ after 3.0 (approx.), when configured for Linux
+// native development (specifically, --with-__cxa_enable), have
+// additional dependencies related to the destructors for static
+// objects. When compiling C++ code with static objects the compiler
+// inserts a call to __cxa_atexit() with __dso_handle as one of the
+// arguments. __cxa_atexit() would normally be provided by glibc, and
+// __dso_handle is part of crtstuff.c. Synthetic target applications
+// are linked rather differently, so either a differently-configured
+// compiler is needed or dummy versions of these symbols should be
+// provided. If these symbols are not actually used then providing
+// them is still harmless, linker garbage collection will remove them.
+
+void
+__cxa_atexit(void (*arg1)(void*), void* arg2, void* arg3)
+{
+}
+void* __dso_handle = (void*) &__dso_handle;
+
+// gcc 3.2.2 (approx). The libsupc++ version of the new operator pulls
+// in exception handling code, even when using the nothrow version and
+// building with -fno-exceptions. libgcc_eh.a provides the necessary
+// functions, but requires a dl_iterate_phdr() function. That is related
+// to handling dynamically loaded code so is not applicable to eCos.
+int
+dl_iterate_phdr(void* arg1, void* arg2)
+{
+ return -1;
+}
+#endif
+
+#if (__GNUC__ >= 4)
+// First noticed with gcc 4.1.1. There is now code to detect stack
+// smashing.
+void __attribute__ ((noreturn))
+__stack_chk_fail_local(void)
+{
+ CYG_FAIL("Stack smashing detected, aborting");
+ diag_printf("Application error: stack smashing detected.\n");
+ cyg_hal_sys_exit(1);
+ for (;;);
+}
+// Another symbol which indicates a similar problem occurred.
+void __stack_chk_fail(void)
+{
+ __stack_chk_fail_local();
+}
+#endif
+
+//-----------------------------------------------------------------------------
+// End of entry.c
diff --git a/ecos/packages/hal/synth/arch/current/src/synth_intr.c b/ecos/packages/hal/synth/arch/current/src/synth_intr.c
new file mode 100644
index 0000000..e754b94
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/src/synth_intr.c
@@ -0,0 +1,1400 @@
+//=============================================================================
+//
+// synth_intr.c
+//
+// Interrupt and clock code for the Linux synthetic target.
+//
+//=============================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
+//
+// eCos 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.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): bartv
+// Contributors: bartv, asl
+// Date: 2001-03-30
+// Purpose: Implement the interrupt subsystem for the synthetic target
+//####DESCRIPTIONEND####
+//=============================================================================
+
+// sigprocmask handling.
+//
+// In the synthetic target interrupts and exceptions are based around
+// POSIX sighandlers. When the clock ticks a SIGALRM signal is raised.
+// When the I/O auxiliary wants to raise some other interrupt, it
+// sends a SIGIO signal. When an exception occurs this results in
+// signals like SIGILL and SIGSEGV. This implies an implementation
+// where the VSR is the signal handler. Disabling interrupts would
+// then mean using sigprocmask() to block certain signals, and
+// enabling interrupts means unblocking those signals.
+//
+// However there are a few problems. One of these is performance: some
+// bits of the system such as buffered tracing make very extensive use
+// of enabling and disabling interrupts, so making a sigprocmask
+// system call each time adds a lot of overhead. More seriously, there
+// is a subtle discrepancy between POSIX signal handling and hardware
+// interrupts. Signal handlers are expected to return, and then the
+// system automatically passes control back to the foreground thread.
+// In the process, the sigprocmask is manipulated before invoking the
+// signal handler and restored afterwards. Interrupt handlers are
+// different: it is quite likely that an interrupt results in another
+// eCos thread being activated, so the signal handler does not
+// actually return until the interrupted thread gets another chance to
+// run.
+//
+// The second problem can be addressed by making the sigprocmask part
+// of the thread state, saving and restoring it as part of a context
+// switch (c.f. siglongjmp()). This matches quite nicely onto typical
+// real hardware, where there might be a flag inside some control
+// register that controls whether or not interrupts are enabled.
+// However this adds more system calls to context switch overhead.
+//
+// The alternative approach is to implement interrupt enabling and
+// disabling in software. The sigprocmask is manipulated only once,
+// during initialization, such that certain signals are allowed
+// through and others are blocked. When a signal is raised the signal
+// handler will always be invoked, but it will decide in software
+// whether or not the signal should be processed immediately. This
+// alternative approach does not correspond particularly well with
+// real hardware: effectively the VSR is always allowed to run.
+// However for typical applications this will not really matter, and
+// the performance gains outweigh the discrepancy.
+//
+// Nested interrupts and interrupt priorities can be implemented in
+// software, specifically by manipulating the current mask of blocked
+// interrupts. This is not currently implemented.
+//
+// At first glance it might seem that an interrupt stack could be
+// implemented trivially using sigaltstack. This does not quite work:
+// signal handlers do not always return immediately, so the system
+// does not get a chance to clean up the signal handling stack. A
+// separate interrupt stack is possible but would have to be
+// implemented here, in software, e.g. by having the signal handler
+// invoke the VSR on that stack. Unfortunately the system may have
+// pushed quite a lot of state on to the current stack already when
+// raising the signal, so things could get messy.
+
+// ----------------------------------------------------------------------------
+#include <pkgconf/hal.h>
+#include <pkgconf/hal_synth.h>
+
+// There are various dependencies on the kernel, e.g. how exceptions
+// should be handled.
+#include <pkgconf/system.h>
+#ifdef CYGPKG_KERNEL
+# include <pkgconf/kernel.h>
+#endif
+
+#include <cyg/infra/cyg_type.h> // base types
+#include <cyg/infra/diag.h>
+#include <cyg/hal/hal_arch.h>
+#include <cyg/hal/hal_intr.h>
+#include <cyg/hal/hal_io.h>
+#include <cyg/infra/cyg_ass.h> // Assertions are safe in the synthetic target
+
+#include "synth_protocol.h"
+
+// ----------------------------------------------------------------------------
+// Statics.
+
+// The bogomips rating, used by HAL_DELAY_US()
+int hal_bogomips;
+
+// Are interrupts currently enabled?
+volatile cyg_bool_t hal_interrupts_enabled = false;
+
+// These flags are updated by the signal handler when a signal comes in
+// and interrupts are disabled.
+static volatile cyg_bool_t synth_sigio_pending = false;
+static volatile cyg_bool_t synth_sigalrm_pending = false;
+
+// The current VSR, to be invoked by the signal handler. This allows
+// application code to install an alternative VSR, without that VSR
+// having to check for interrupts being disabled and updating the
+// pending flags. Effectively, the VSR is only invoked when interrupts
+// are enabled.
+static void (*synth_VSR)(void) = (void (*)(void)) 0;
+
+// The current ISR status and mask registers, or rather software
+// emulations thereof. These are not static since application-specific
+// VSRs may want to examine/manipulate these. They are also not
+// exported in any header file, forcing people writing such VSRs to
+// know what they are doing.
+volatile cyg_uint32 synth_pending_isrs = 0;
+volatile cyg_uint32 synth_masked_isrs = 0xFFFFFFFF;
+
+// The vector of interrupt handlers.
+typedef struct synth_isr_handler {
+ cyg_ISR_t* isr;
+ CYG_ADDRWORD data;
+ CYG_ADDRESS obj;
+ cyg_priority_t pri;
+} synth_isr_handler;
+static synth_isr_handler synth_isr_handlers[CYGNUM_HAL_ISR_COUNT];
+
+static void synth_alrm_sighandler(int);
+static void synth_io_sighandler(int);
+
+// ----------------------------------------------------------------------------
+// Basic ISR and VSR handling.
+
+// The default ISR handler. The system should never receive an interrupt it
+// does not know how to handle.
+static cyg_uint32
+synth_default_isr(cyg_vector_t vector, cyg_addrword_t data)
+{
+ CYG_UNUSED_PARAM(cyg_vector_t, vector);
+ CYG_UNUSED_PARAM(cyg_addrword_t, data);
+ CYG_FAIL("Default isr handler should never get invoked");
+ return CYG_ISR_HANDLED;
+}
+
+// The VSR is invoked
+// 1) directly by a SIGALRM or SIGIO signal handler, if interrupts
+// were enabled.
+// 2) indirectly by hal_enable_interrupts(), if a signal happened
+// while interrupts were disabled. hal_enable_interrupts()
+// will have re-invoked the signal handler.
+//
+// On entry interrupts are disabled, and there should be one or more
+// pending ISRs which are not masked off.
+//
+// The implementation is as per the HAL specification, where
+// applicable.
+
+static void
+synth_default_vsr(void)
+{
+ int isr_vector;
+ cyg_uint32 isr_result;
+
+ CYG_ASSERT(!hal_interrupts_enabled, "VSRs should only be invoked when interrupts are disabled");
+ CYG_ASSERT(0 != (synth_pending_isrs & ~synth_masked_isrs), "VSRs should only be invoked when an interrupt is pending");
+
+ // No need to save the cpu state. Either we are in a signal
+ // handler and the system has done that for us, or we are called
+ // synchronously via enable_interrupts.
+
+ // Increment the kernel scheduler lock, if the kernel is present.
+ // This prevents context switching while interrupt handling is in
+ // progress.
+#ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT
+ cyg_scheduler_lock();
+#endif
+
+ // Do not switch to an interrupt stack - functionality is not
+ // implemented
+
+ // Do not allow nested interrupts - functionality is not
+ // implemented.
+
+ // Decode the actual external interrupt being delivered. This is
+ // determined from the pending and masked variables. Only one isr
+ // source can be handled here, since interrupt_end must be invoked
+ // with details of that interrupt. Multiple pending interrupts
+ // will be handled by a recursive call
+ HAL_LSBIT_INDEX(isr_vector, (synth_pending_isrs & ~synth_masked_isrs));
+ CYG_ASSERT((CYGNUM_HAL_ISR_MIN <= isr_vector) && (isr_vector <= CYGNUM_HAL_ISR_MAX), "ISR vector must be valid");
+
+ isr_result = (*synth_isr_handlers[isr_vector].isr)(isr_vector, synth_isr_handlers[isr_vector].data);
+
+ // Do not switch back from the interrupt stack, there isn't one.
+
+ // Interrupts were not enabled before, so they must be enabled
+ // now. This may result in a recursive invocation if other IRQs
+ // are still pending. The ISR should have either acknowledged or
+ // masked the current interrupt source, to prevent a recursive
+ // call for the current interrupt.
+ hal_enable_interrupts();
+
+ // Now call interrupt_end() with the result of the isr and the
+ // ISR's object This may return straightaway, or it may result in
+ // a context switch to another thread. In the latter case, when
+ // the current thread is reactivated we end up back here. The
+ // third argument should be a pointer to the saved state, but that
+ // is only relevant for thread-aware debugging which is not yet
+ // supported by the synthetic target.
+ {
+ extern void interrupt_end(cyg_uint32, CYG_ADDRESS, HAL_SavedRegisters*);
+ interrupt_end(isr_result, synth_isr_handlers[isr_vector].obj, (HAL_SavedRegisters*) 0);
+ }
+
+ // Restore machine state and return to the interrupted thread.
+ // That requires no effort here.
+}
+
+// Enabling interrupts. If a SIGALRM or SIGIO arrived at an inconvenient
+// time, e.g. when already interacting with the auxiliary, then these
+// will have been left pending and must be serviced now. Next, enabling
+// interrupts means checking the interrupt pending and mask registers
+// and seeing if the VSR should be invoked.
+void
+hal_enable_interrupts(void)
+{
+ hal_interrupts_enabled = true;
+ if (synth_sigalrm_pending) {
+ synth_sigalrm_pending = false;
+ synth_alrm_sighandler(CYG_HAL_SYS_SIGALRM);
+ }
+ if (synth_sigio_pending) {
+ synth_sigio_pending = false;
+ synth_io_sighandler(CYG_HAL_SYS_SIGIO);
+ }
+
+ // The interrupt mask "register" may have been modified while
+ // interrupts were disabled. If there are pending interrupts,
+ // invoke the VSR. The VSR must be invoked with interrupts
+ // disabled, and will return with interrupts enabled.
+ // An alternative implementation that might be more accurate
+ // is to raise a signal, e.g. SIGUSR1. That way all interrupts
+ // come in via the system's signal handling mechanism, and
+ // it might be possible to do something useful with saved contexts
+ // etc., facilitating thread-aware debugging.
+ if (0 != (synth_pending_isrs & ~synth_masked_isrs)) {
+ hal_interrupts_enabled = false;
+ (*synth_VSR)();
+ CYG_ASSERT( hal_interrupts_enabled, "Interrupts should still be enabled on return from the VSR");
+ }
+}
+
+// ----------------------------------------------------------------------------
+// Other interrupt-related routines. Mostly these just involve
+// updating some of the statics, but they may be called while
+// interrupts are still enabled so care has to be taken.
+
+cyg_bool_t
+hal_interrupt_in_use(cyg_vector_t vec)
+{
+ CYG_ASSERT( (CYGNUM_HAL_ISR_MIN <= vec) && (vec <= CYGNUM_HAL_ISR_MAX), "Can only attach to valid ISR vectors");
+ return synth_default_isr != synth_isr_handlers[vec].isr;
+}
+
+void
+hal_interrupt_attach(cyg_vector_t vec, cyg_ISR_t* isr, CYG_ADDRWORD data, CYG_ADDRESS obj)
+{
+ CYG_ASSERT( (CYGNUM_HAL_ISR_MIN <= vec) && (vec <= CYGNUM_HAL_ISR_MAX), "Can only attach to valid ISR vectors");
+ CYG_CHECK_FUNC_PTR( isr, "A valid ISR must be supplied");
+ // The object cannot be validated, it may be NULL if chained
+ // interrupts are enabled.
+ CYG_ASSERT( synth_isr_handlers[vec].isr == &synth_default_isr, "Only one ISR can be attached to a vector at the HAL level");
+ CYG_ASSERT( (false == hal_interrupts_enabled) || (0 != (synth_masked_isrs & (0x01 << vec))), "ISRs should only be attached when it is safe");
+
+ // The priority will have been installed shortly before this call.
+ synth_isr_handlers[vec].isr = isr;
+ synth_isr_handlers[vec].data = data;
+ synth_isr_handlers[vec].obj = obj;
+}
+
+void
+hal_interrupt_detach(cyg_vector_t vec, cyg_ISR_t* isr)
+{
+ CYG_ASSERT( (CYGNUM_HAL_ISR_MIN <= vec) && (vec <= CYGNUM_HAL_ISR_MAX), "Can only detach from valid ISR vectors");
+ CYG_CHECK_FUNC_PTR( isr, "A valid ISR must be supplied");
+ CYG_ASSERT( isr != &synth_default_isr, "An ISR must be attached before it can be detached");
+ CYG_ASSERT( (false == hal_interrupts_enabled) || (0 != (synth_masked_isrs & (0x01 << vec))), "ISRs should only be detached when it is safe");
+
+ // The Cyg_Interrupt destructor does an unconditional detach, even if the
+ // isr is not currently attached.
+ if (isr == synth_isr_handlers[vec].isr) {
+ synth_isr_handlers[vec].isr = &synth_default_isr;
+ synth_isr_handlers[vec].data = (CYG_ADDRWORD) 0;
+ synth_isr_handlers[vec].obj = (CYG_ADDRESS) 0;
+ }
+
+ // The priority is not updated here. This should be ok, if another
+ // isr is attached then the appropriate priority will be installed
+ // first.
+}
+
+void (*hal_vsr_get(cyg_vector_t vec))(void)
+{
+ CYG_ASSERT( (CYGNUM_HAL_VSR_MIN <= vec) && (vec <= CYGNUM_HAL_VSR_MAX), "Can only get valid VSR vectors");
+ return synth_VSR;
+}
+
+void
+hal_vsr_set(cyg_vector_t vec, void (*new_vsr)(void), void (**old_vsrp)(void))
+{
+ cyg_bool_t old;
+
+ CYG_ASSERT( (CYGNUM_HAL_VSR_MIN <= vec) && (vec <= CYGNUM_HAL_VSR_MAX), "Can only get valid VSR vectors");
+ CYG_CHECK_FUNC_PTR( new_vsr, "A valid VSR must be supplied");
+
+ // There is a theoretical possibility of two hal_vsr_set calls at
+ // the same time. The old and new VSRs must be kept in synch.
+ HAL_DISABLE_INTERRUPTS(old);
+ if (0 != old_vsrp) {
+ *old_vsrp = synth_VSR;
+ }
+ synth_VSR = new_vsr;
+ HAL_RESTORE_INTERRUPTS(old);
+}
+
+void
+hal_interrupt_mask(cyg_vector_t which)
+{
+ CYG_PRECONDITION( !hal_interrupts_enabled, "Interrupts should be disabled on entry to hal_interrupt_mask");
+ CYG_ASSERT((CYGNUM_HAL_ISR_MIN <= which) && (which <= CYGNUM_HAL_ISR_MAX), "A valid ISR vector must be supplied");
+ synth_masked_isrs |= (0x01 << which);
+}
+
+void
+hal_interrupt_unmask(cyg_vector_t which)
+{
+ CYG_PRECONDITION( !hal_interrupts_enabled, "Interrupts should be disabled on entry to hal_interrupt_unmask");
+ CYG_ASSERT((CYGNUM_HAL_ISR_MIN <= which) && (which <= CYGNUM_HAL_ISR_MAX), "A valid ISR vector must be supplied");
+ synth_masked_isrs &= ~(0x01 << which);
+}
+
+void
+hal_interrupt_acknowledge(cyg_vector_t which)
+{
+ cyg_bool_t old;
+ CYG_ASSERT((CYGNUM_HAL_ISR_MIN <= which) && (which <= CYGNUM_HAL_ISR_MAX), "A valid ISR vector must be supplied");
+
+ // Acknowledging an interrupt means clearing the bit in the
+ // interrupt pending "register".
+ // NOTE: does the auxiliary need to keep track of this? Probably
+ // not, the auxiliary can just raise SIGIO whenever a device wants
+ // attention. There may be a trade off here between additional
+ // communication and unnecessary SIGIOs.
+ HAL_DISABLE_INTERRUPTS(old);
+ synth_pending_isrs &= ~(0x01 << which);
+ HAL_RESTORE_INTERRUPTS(old);
+}
+
+void
+hal_interrupt_configure(cyg_vector_t which, cyg_bool_t level, cyg_bool_t up)
+{
+ CYG_ASSERT((CYGNUM_HAL_ISR_MIN <= which) && (which <= CYGNUM_HAL_ISR_MAX), "A valid ISR vector must be supplied");
+ // The synthetic target does not currently distinguish between
+ // level and edge interrupts. Possibly this information will have
+ // to be passed on to the auxiliary in future.
+ CYG_UNUSED_PARAM(cyg_vector_t, which);
+ CYG_UNUSED_PARAM(cyg_bool_t, level);
+ CYG_UNUSED_PARAM(cyg_bool_t, up);
+}
+
+void
+hal_interrupt_set_level(cyg_vector_t which, cyg_priority_t level)
+{
+ CYG_ASSERT((CYGNUM_HAL_ISR_MIN <= which) && (which <= CYGNUM_HAL_ISR_MAX), "A valid ISR vector must be supplied");
+ // The legal values for priorities are not defined at this time.
+ // Manipulating the interrupt priority level currently has no
+ // effect. The information is stored anyway, for future use.
+ synth_isr_handlers[which].pri = level;
+}
+
+// ----------------------------------------------------------------------------
+// Exception handling. Typically this involves calling into the kernel,
+// translating the POSIX signal number into a HAL exception number. In
+// practice these signals will generally be caught in the debugger and
+// will not have to be handled by eCos itself.
+
+static void
+synth_exception_sighandler(int sig)
+{
+ CYG_WORD ecos_exception_number = 0;
+ cyg_bool_t old;
+
+ // There is no need to save state, that will have been done by the
+ // system as part of the signal delivery process.
+
+ // Disable interrupts. Performing e.g. an interaction with the
+ // auxiliary after a SIGSEGV is dubious.
+ HAL_DISABLE_INTERRUPTS(old);
+
+ // Now decode the signal and turn it into an eCos exception.
+ switch(sig) {
+ case CYG_HAL_SYS_SIGILL:
+ ecos_exception_number = CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION;
+ break;
+ case CYG_HAL_SYS_SIGBUS:
+ case CYG_HAL_SYS_SIGSEGV:
+ ecos_exception_number = CYGNUM_HAL_EXCEPTION_DATA_ACCESS;
+ break;
+ case CYG_HAL_SYS_SIGFPE:
+ ecos_exception_number = CYGNUM_HAL_EXCEPTION_FPU;
+ break;
+ default:
+ CYG_FAIL("Unknown signal");
+ break;
+ }
+
+#ifdef CYGPKG_KERNEL_EXCEPTIONS
+ // Deliver the signal, usually to the kernel, possibly to the
+ // common HAL. The second argument should be the current
+ // savestate, but that is not readily accessible.
+ cyg_hal_deliver_exception(ecos_exception_number, (CYG_ADDRWORD) 0);
+
+ // It is now necessary to restore the machine state, including
+ // interrupts. In theory higher level code may have manipulated
+ // the machine state to prevent any recurrence of the exception.
+ // In practice the machine state is not readily accessible.
+ HAL_RESTORE_INTERRUPTS(old);
+#else
+ CYG_FAIL("Exception!!!");
+ for (;;);
+#endif
+}
+
+// ----------------------------------------------------------------------------
+// The clock support. This can be implemented using the setitimer()
+// and getitimer() calls. The kernel will install a suitable interrupt
+// handler for CYGNUM_HAL_INTERRUPT_RTC, but it depends on the HAL
+// for low-level manipulation of the clock hardware.
+//
+// There is a problem with HAL_CLOCK_READ(). The obvious
+// implementation would use getitimer(), but that has the wrong
+// behaviour: it is intended for fairly coarse intervals and works in
+// terms of system clock ticks, as opposed to a fine-grained
+// implementation that actually examines the system clock. Instead use
+// gettimeofday().
+
+static struct cyg_hal_sys_timeval synth_clock = { 0, 0 };
+
+void
+hal_clock_initialize(cyg_uint32 period)
+{
+ struct cyg_hal_sys_itimerval timer;
+
+ // Needed for hal_clock_read(), if HAL_CLOCK_READ() is used before
+ // the first clock interrupt.
+ cyg_hal_sys_gettimeofday(&synth_clock, (struct cyg_hal_sys_timezone*) 0);
+
+ // The synthetic target clock resolution is in microseconds. A typical
+ // value for the period will be 10000, corresponding to one timer
+ // interrupt every 10ms. Set up a timer to interrupt in period us,
+ // and again every period us after that.
+ CYG_ASSERT( period < 1000000, "Clock interrupts should happen at least once per second");
+ timer.hal_it_interval.hal_tv_sec = 0;
+ timer.hal_it_interval.hal_tv_usec = period;
+ timer.hal_it_value.hal_tv_sec = 0;
+ timer.hal_it_value.hal_tv_usec = period;
+
+ if (0 != cyg_hal_sys_setitimer(CYG_HAL_SYS_ITIMER_REAL, &timer, (struct cyg_hal_sys_itimerval*) 0)) {
+ CYG_FAIL("Failed to initialize the clock itimer");
+ }
+}
+
+static void
+synth_alrm_sighandler(int sig)
+{
+ CYG_PRECONDITION((CYG_HAL_SYS_SIGALRM == sig), "Only SIGALRM should be handled here");
+
+ if (!hal_interrupts_enabled) {
+ synth_sigalrm_pending = true;
+ return;
+ }
+
+ // Interrupts were enabled, but must be blocked before any further processing.
+ hal_interrupts_enabled = false;
+
+ // Update the cached value of the clock for hal_clock_read()
+ cyg_hal_sys_gettimeofday(&synth_clock, (struct cyg_hal_sys_timezone*) 0);
+
+ // Update the interrupt status "register" to match pending interrupts
+ // A timer signal means that IRQ 0 needs attention.
+ synth_pending_isrs |= 0x01;
+
+ // If any of the pending interrupts are not masked, invoke the
+ // VSR. That will reenable interrupts.
+ if (0 != (synth_pending_isrs & ~synth_masked_isrs)) {
+ (*synth_VSR)();
+ } else {
+ hal_interrupts_enabled = true;
+ }
+
+ // The VSR will have invoked interrupt_end() with interrupts
+ // enabled, and they should still be enabled.
+ CYG_ASSERT( hal_interrupts_enabled, "Interrupts should still be enabled on return from the VSR");
+}
+
+// Implementing hal_clock_read(). gettimeofday() in conjunction with
+// synth_clock gives the time since the last clock tick in
+// microseconds, the correct unit for the synthetic target.
+cyg_uint32
+hal_clock_read(void)
+{
+ int elapsed;
+ struct cyg_hal_sys_timeval now;
+ cyg_hal_sys_gettimeofday(&now, (struct cyg_hal_sys_timezone*) 0);
+
+ elapsed = (1000000 * (now.hal_tv_sec - synth_clock.hal_tv_sec)) + (now.hal_tv_usec - synth_clock.hal_tv_usec);
+ return elapsed;
+}
+
+// ----------------------------------------------------------------------------
+// The signal handler for SIGIO. This can also be invoked by
+// hal_enable_interrupts() to catch up with any signals that arrived
+// while interrupts were disabled. SIGIO is raised by the auxiliary
+// when it requires attention, i.e. when one or more of the devices
+// want to raise an interrupt. Finding out exactly which interrupt(s)
+// are currently pending in the auxiliary requires communication with
+// the auxiliary.
+//
+// If interrupts are currently disabled then the signal cannot be
+// handled immediately. In particular SIGIO cannot be handled because
+// there may already be ongoing communication with the auxiliary.
+// Instead some volatile flags are used to keep track of which signals
+// were raised while interrupts were disabled.
+//
+// It might be better to perform the interaction with the auxiliary
+// as soon as possible, i.e. either in the SIGIO handler or when the
+// current communication completes. That way the mask of pending
+// interrupts would remain up to date even when interrupts are
+// disabled, thus allowing applications to run in polled mode.
+
+// A little utility called when the auxiliary has been asked to exit,
+// implicitly affecting this application as well. The sole purpose
+// of this function is to put a suitably-named function on the stack
+// to make it more obvious from inside gdb what is happening.
+static void
+synth_io_handle_shutdown_request_from_auxiliary(void)
+{
+ cyg_hal_sys_exit(0);
+}
+
+static void
+synth_io_sighandler(int sig)
+{
+ CYG_PRECONDITION((CYG_HAL_SYS_SIGIO == sig), "Only SIGIO should be handled here");
+
+ if (!hal_interrupts_enabled) {
+ synth_sigio_pending = true;
+ return;
+ }
+
+ // Interrupts were enabled, but must be blocked before any further processing.
+ hal_interrupts_enabled = false;
+
+ // Update the interrupt status "register" to match pending interrupts
+ // Contact the auxiliary to find out what interrupts are currently pending there.
+ // If there is no auxiliary at present, e.g. because it has just terminated
+ // and things are generally somewhat messy, ignore it.
+ //
+ // This code also deals with the case where the user has requested program
+ // termination. It would be wrong for the auxiliary to just exit, since the
+ // application could not distinguish that case from a crash. Instead the
+ // auxiliary can optionally return an additional byte of data, and if that
+ // byte actually gets sent then that indicates pending termination.
+ if (synth_auxiliary_running) {
+ int result;
+ int actual_len;
+ unsigned char dummy[1];
+ synth_auxiliary_xchgmsg(SYNTH_DEV_AUXILIARY, SYNTH_AUXREQ_GET_IRQPENDING, 0, 0,
+ (const unsigned char*) 0, 0, // The auxiliary does not need any additional data
+ &result, dummy, &actual_len, 1);
+ synth_pending_isrs |= result;
+ if (actual_len) {
+ // The auxiliary has been asked to terminate by the user. This
+ // request has now been passed on to the eCos application.
+ synth_io_handle_shutdown_request_from_auxiliary();
+ }
+ }
+
+ // If any of the pending interrupts are not masked, invoke the VSR
+ if (0 != (synth_pending_isrs & ~synth_masked_isrs)) {
+ (*synth_VSR)();
+ } else {
+ hal_interrupts_enabled = true;
+ }
+
+ // The VSR will have invoked interrupt_end() with interrupts
+ // enabled, and they should still be enabled.
+ CYG_ASSERT( hal_interrupts_enabled, "Interrupts should still be enabled on return from the VSR");
+}
+
+// ----------------------------------------------------------------------------
+// Here we define an action to do in the idle thread. For the
+// synthetic target it makes no sense to spin eating processor time
+// that other processes could make use of. Instead we call select. The
+// itimer will still go off and kick the scheduler back into life,
+// giving us an escape path from the select. There is one problem: in
+// some configurations, e.g. when preemption is disabled, the idle
+// thread must yield continuously rather than blocking.
+void
+hal_idle_thread_action(cyg_uint32 loop_count)
+{
+#ifndef CYGIMP_HAL_IDLE_THREAD_SPIN
+ cyg_hal_sys__newselect(0,
+ (struct cyg_hal_sys_fd_set*) 0,
+ (struct cyg_hal_sys_fd_set*) 0,
+ (struct cyg_hal_sys_fd_set*) 0,
+ (struct cyg_hal_sys_timeval*) 0);
+#endif
+ CYG_UNUSED_PARAM(cyg_uint32, loop_count);
+}
+
+// ----------------------------------------------------------------------------
+// The I/O auxiliary.
+//
+// I/O happens via an auxiliary process. During startup this code attempts
+// to locate and execute a program ecosynth which should be installed in
+// ../libexec/ecosynth relative to some directory on the search path.
+// Subsequent I/O operations involve interacting with this auxiliary.
+
+#define MAKESTRING1(a) #a
+#define MAKESTRING2(a) MAKESTRING1(a)
+#define AUXILIARY "../libexec/ecos/hal/synth/arch/" MAKESTRING2(CYGPKG_HAL_SYNTH) "/ecosynth"
+
+// Is the auxiliary up and running?
+cyg_bool synth_auxiliary_running = false;
+
+// The pipes to and from the auxiliary.
+static int to_aux = -1;
+static int from_aux = -1;
+
+// Attempt to start up the auxiliary. Note that this happens early on
+// during system initialization so it is "known" that the world is
+// still simple, e.g. that no other files have been opened.
+static void
+synth_start_auxiliary(void)
+{
+#define BUFSIZE 256
+ char filename[BUFSIZE];
+ const char* path = 0;
+ int i, j;
+ cyg_bool found = false;
+ int to_aux_pipe[2];
+ int from_aux_pipe[2];
+ int child;
+ int aux_version;
+#if 1
+ // Check for a command line argument -io. Only run the auxiliary if this
+ // argument is provided, i.e. default to traditional behaviour.
+ for (i = 1; i < cyg_hal_sys_argc; i++) {
+ const char* tmp = cyg_hal_sys_argv[i];
+ if ('-' == *tmp) {
+ // Arguments beyond -- are reserved for use by the application,
+ // and should not be interpreted by the HAL itself or by ecosynth.
+ if (('-' == tmp[1]) && ('\0' == tmp[2])) {
+ break;
+ }
+ tmp++;
+ if ('-' == *tmp) {
+ // Do not distinguish between -io and --io
+ tmp++;
+ }
+ if (('i' == tmp[0]) && ('o' == tmp[1]) && ('\0' == tmp[2])) {
+ found = 1;
+ break;
+ }
+ }
+ }
+ if (!found) {
+ return;
+ }
+#else
+ // Check for a command line argument -ni or -nio. Always run the
+ // auxiliary unless this argument is given, i.e. default to full
+ // I/O support.
+ for (i = 1; i < cyg_hal_sys_argc; i++) {
+ const char* tmp = cyg_hal_sys_argv[i];
+ if ('-' == *tmp) {
+ if (('-' == tmp[1]) && ('\0' == tmp[2])) {
+ break;
+ }
+ tmp++;
+ if ('-' == *tmp) {
+ tmp++;
+ }
+ if ('n' == *tmp) {
+ tmp++;
+ if ('i' == *tmp) {
+ tmp++;
+ if ('\0' == *tmp) {
+ found = 1; // -ni or --ni
+ break;
+ }
+ if (('o' == *tmp) && ('\0' == tmp[1])) {
+ found = 1; // -nio or --nio
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (found) {
+ return;
+ }
+#endif
+
+ // The auxiliary must be found relative to the current search path,
+ // so look for a PATH= environment variable.
+ for (i = 0; (0 == path) && (0 != cyg_hal_sys_environ[i]); i++) {
+ const char *var = cyg_hal_sys_environ[i];
+ if (('P' == var[0]) && ('A' == var[1]) && ('T' == var[2]) && ('H' == var[3]) && ('=' == var[4])) {
+ path = var + 5;
+ }
+ }
+ if (0 == path) {
+ // Very unlikely, but just in case.
+ path = ".:/bin:/usr/bin";
+ }
+
+ found = 0;
+ while (!found && ('\0' != *path)) { // for every entry in the path
+ char *tmp = AUXILIARY;
+
+ j = 0;
+
+ // As a special case, an empty string in the path corresponds to the
+ // current directory.
+ if (':' == *path) {
+ filename[j++] = '.';
+ path++;
+ } else {
+ while ((j < BUFSIZE) && ('\0' != *path) && (':' != *path)) {
+ filename[j++] = *path++;
+ }
+ // If not at the end of the search path, move on to the next entry.
+ if ('\0' != *path) {
+ while ((':' != *path) && ('\0' != *path)) {
+ path++;
+ }
+ if (':' == *path) {
+ path++;
+ }
+ }
+ }
+ // Now append a directory separator, and then the name of the executable.
+ if (j < BUFSIZE) {
+ filename[j++] = '/';
+ }
+ while ((j < BUFSIZE) && ('\0' != *tmp)) {
+ filename[j++] = *tmp++;
+ }
+ // If there has been a buffer overflow, skip this entry.
+ if (j == BUFSIZE) {
+ filename[BUFSIZE-1] = '\0';
+ diag_printf("Warning: buffer limit reached while searching PATH for the I/O auxiliary.\n");
+ diag_printf(" : skipping current entry.\n");
+ } else {
+ // filename now contains a possible match for the auxiliary.
+ filename[j++] = '\0';
+ if (0 == cyg_hal_sys_access(filename, CYG_HAL_SYS_X_OK)) {
+ found = true;
+ }
+ }
+ }
+#undef BUFSIZE
+
+ if (!found) {
+ diag_printf("Error: unable to find the I/O auxiliary program on the current search PATH\n");
+ diag_printf(" : please install the appropriate host-side tools.\n");
+ cyg_hal_sys_exit(1);
+ }
+
+ // An apparently valid executable exists (or at the very least it existed...),
+ // so create the pipes that will be used for communication.
+ if ((0 != cyg_hal_sys_pipe(to_aux_pipe)) ||
+ (0 != cyg_hal_sys_pipe(from_aux_pipe))) {
+ diag_printf("Error: unable to set up pipes for communicating with the I/O auxiliary.\n");
+ cyg_hal_sys_exit(1);
+ }
+
+ // Time to fork().
+ child = cyg_hal_sys_fork();
+ if (child < 0) {
+ diag_printf("Error: failed to fork() process for the I/O auxiliary.\n");
+ cyg_hal_sys_exit(1);
+ } else if (child == 0) {
+ cyg_bool found_dotdot;
+ // There should not be any problems rearranging the file descriptors as desired...
+ cyg_bool unexpected_error = 0;
+
+ // In the child process. Close unwanted file descriptors, then some dup2'ing,
+ // and execve() the I/O auxiliary. The auxiliary will inherit stdin,
+ // stdout and stderr from the eCos application, so that functions like
+ // printf() work as expected. In addition fd 3 will be the pipe from
+ // the eCos application and fd 4 the pipe to the application. It is possible
+ // that the eCos application was run from some process other than a shell
+ // and hence that file descriptors 3 and 4 are already in use, but that is not
+ // supported. One possible workaround would be to close all file descriptors
+ // >= 3, another would be to munge the argument vector passing the file
+ // descriptors actually being used.
+ unexpected_error |= (0 != cyg_hal_sys_close(to_aux_pipe[1]));
+ unexpected_error |= (0 != cyg_hal_sys_close(from_aux_pipe[0]));
+
+ if (3 != to_aux_pipe[0]) {
+ if (3 == from_aux_pipe[1]) {
+ // Because to_aux_pipe[] was set up first it should have received file descriptors 3 and 4.
+ diag_printf("Internal error: file descriptors have been allocated in an unusual order.\n");
+ cyg_hal_sys_exit(1);
+ } else {
+ unexpected_error |= (3 != cyg_hal_sys_dup2(to_aux_pipe[0], 3));
+ unexpected_error |= (0 != cyg_hal_sys_close(to_aux_pipe[0]));
+ }
+ }
+ if (4 != from_aux_pipe[1]) {
+ unexpected_error |= (4 != cyg_hal_sys_dup2(from_aux_pipe[1], 4));
+ unexpected_error |= (0 != cyg_hal_sys_close(from_aux_pipe[1]));
+ }
+ if (unexpected_error) {
+ diag_printf("Error: internal error in auxiliary process, failed to manipulate pipes.\n");
+ cyg_hal_sys_exit(1);
+ }
+ // The arguments passed to the auxiliary are mostly those for
+ // the synthetic target application, except for argv[0] which
+ // is replaced with the auxiliary's pathname. The latter
+ // currently holds at least one ../, and cleaning this up is
+ // useful.
+ //
+ // If the argument vector contains -- then that and subsequent
+ // arguments are not passed to the auxiliary. Instead such
+ // arguments are reserved for use by the application.
+ do {
+ int len;
+ for (len = 0; '\0' != filename[len]; len++)
+ ;
+ found_dotdot = false;
+ for (i = 0; i < (len - 4); i++) {
+ if (('/' == filename[i]) && ('.' == filename[i+1]) && ('.' == filename[i+2]) && ('/' == filename[i+3])) {
+ j = i + 3;
+ for ( --i; (i >= 0) && ('/' != filename[i]); i--) {
+ CYG_EMPTY_STATEMENT;
+ }
+ if (i >= 0) {
+ found_dotdot = true;
+ do {
+ i++; j++;
+ filename[i] = filename[j];
+ } while ('\0' != filename[i]);
+ }
+ }
+ }
+ } while(found_dotdot);
+
+ cyg_hal_sys_argv[0] = filename;
+
+ for (i = 1; i < cyg_hal_sys_argc; i++) {
+ const char* tmp = cyg_hal_sys_argv[i];
+ if (('-' == tmp[0]) && ('-' == tmp[1]) && ('\0' == tmp[2])) {
+ cyg_hal_sys_argv[i] = (const char*) 0;
+ break;
+ }
+ }
+ cyg_hal_sys_execve(filename, cyg_hal_sys_argv, cyg_hal_sys_environ);
+
+ // An execute error has occurred. Report this here, then exit. The
+ // parent will detect a close on the pipe without having received
+ // any data, and it will assume that a suitable diagnostic will have
+ // been displayed already.
+ diag_printf("Error: failed to execute the I/O auxiliary.\n");
+ cyg_hal_sys_exit(1);
+ } else {
+ int rc;
+ char buf[1];
+
+ // Still executing the eCos application.
+ // Do some cleaning-up.
+ to_aux = to_aux_pipe[1];
+ from_aux = from_aux_pipe[0];
+ if ((0 != cyg_hal_sys_close(to_aux_pipe[0])) ||
+ (0 != cyg_hal_sys_close(from_aux_pipe[1]))) {
+ diag_printf("Error: internal error in main process, failed to manipulate pipes.\n");
+ cyg_hal_sys_exit(1);
+ }
+
+ // It is now a good idea to block until the auxiliary is
+ // ready, i.e. give it a chance to read in its configuration
+ // files, load appropriate scripts, pop up windows, ... This
+ // may take a couple of seconds or so. Once the auxiliary is
+ // ready it will write a single byte down the pipe. This is
+ // the only time that the auxiliary will write other than when
+ // responding to a request.
+ do {
+ rc = cyg_hal_sys_read(from_aux, buf, 1);
+ } while (-CYG_HAL_SYS_EINTR == rc);
+
+ if (1 != rc) {
+ // The auxiliary has not started up successfully, so exit
+ // immediately. It should have generated appropriate
+ // diagnostics.
+ cyg_hal_sys_exit(1);
+ }
+ }
+
+ // At this point the auxiliary is up and running. It should not
+ // generate any interrupts just yet since none of the devices have
+ // been initialized. Remember that the auxiliary is now running,
+ // so that the initialization routines for those devices can
+ // figure out that they should interact with the auxiliary rather
+ // than attempt anything manually.
+ synth_auxiliary_running = true;
+
+ // Make sure that the auxiliary is the right version.
+ synth_auxiliary_xchgmsg(SYNTH_DEV_AUXILIARY, SYNTH_AUXREQ_GET_VERSION, 0, 0,
+ (const unsigned char*) 0, 0,
+ &aux_version, (unsigned char*) 0, (int*) 0, 0);
+ if (SYNTH_AUXILIARY_PROTOCOL_VERSION != aux_version) {
+ synth_auxiliary_running = false;
+ diag_printf("Error: an incorrect version of the I/O auxiliary is installed\n"
+ " Expected version %d, actual version %d\n"
+ " Installed binary is %s\n",
+ SYNTH_AUXILIARY_PROTOCOL_VERSION, aux_version, filename);
+ cyg_hal_sys_exit(1);
+ }
+}
+
+// Write a request to the I/O auxiliary, and optionally get back a
+// reply. The dev_id is 0 for messages intended for the auxiliary
+// itself, for example a device instantiation or a request for the
+// current interrupt sate. Otherwise it identifies a specific device.
+// The request code is specific to the device, and the two optional
+// arguments are specific to the request.
+void
+synth_auxiliary_xchgmsg(int devid, int reqcode, int arg1, int arg2,
+ const unsigned char* txdata, int txlen,
+ int* result,
+ unsigned char* rxdata, int* actual_rxlen, int rxlen)
+{
+ unsigned char request[SYNTH_REQUEST_LENGTH];
+ unsigned char reply[SYNTH_REPLY_LENGTH];
+ int rc;
+ int reply_rxlen;
+ cyg_bool_t old_isrstate;
+
+ CYG_ASSERT(devid >= 0, "A valid device id should be supplied");
+ CYG_ASSERT((0 == txlen) || ((const unsigned char*)0 != txdata), "Data transmits require a transmit buffer");
+ CYG_ASSERT((0 == rxlen) || ((unsigned char*)0 != rxdata), "Data receives require a receive buffer");
+ CYG_ASSERT((0 == rxlen) || ((int*)0 != result), "If a reply is expected then space must be allocated");
+
+ // I/O interactions with the auxiliary must be atomic: a context switch in
+ // between sending the header and the actual data would be bad.
+ HAL_DISABLE_INTERRUPTS(old_isrstate);
+
+ // The auxiliary should be running for the duration of this
+ // exchange. However the auxiliary can disappear asynchronously,
+ // so it is not possible for higher-level code to be sure that the
+ // auxiliary is still running.
+ //
+ // If the auxiliary disappears during this call then usually this
+ // will cause a SIGCHILD or SIGPIPE, both of which result in
+ // termination. The exception is when the auxiliary decides to
+ // shut down stdout for some reason without exiting - that has to
+ // be detected in the read loop.
+ if (synth_auxiliary_running) {
+ request[SYNTH_REQUEST_DEVID_OFFSET + 0] = (devid >> 0) & 0x0FF;
+ request[SYNTH_REQUEST_DEVID_OFFSET + 1] = (devid >> 8) & 0x0FF;
+ request[SYNTH_REQUEST_DEVID_OFFSET + 2] = (devid >> 16) & 0x0FF;
+ request[SYNTH_REQUEST_DEVID_OFFSET + 3] = (devid >> 24) & 0x0FF;
+ request[SYNTH_REQUEST_REQUEST_OFFSET + 0] = (reqcode >> 0) & 0x0FF;
+ request[SYNTH_REQUEST_REQUEST_OFFSET + 1] = (reqcode >> 8) & 0x0FF;
+ request[SYNTH_REQUEST_REQUEST_OFFSET + 2] = (reqcode >> 16) & 0x0FF;
+ request[SYNTH_REQUEST_REQUEST_OFFSET + 3] = (reqcode >> 24) & 0x0FF;
+ request[SYNTH_REQUEST_ARG1_OFFSET + 0] = (arg1 >> 0) & 0x0FF;
+ request[SYNTH_REQUEST_ARG1_OFFSET + 1] = (arg1 >> 8) & 0x0FF;
+ request[SYNTH_REQUEST_ARG1_OFFSET + 2] = (arg1 >> 16) & 0x0FF;
+ request[SYNTH_REQUEST_ARG1_OFFSET + 3] = (arg1 >> 24) & 0x0FF;
+ request[SYNTH_REQUEST_ARG2_OFFSET + 0] = (arg2 >> 0) & 0x0FF;
+ request[SYNTH_REQUEST_ARG2_OFFSET + 1] = (arg2 >> 8) & 0x0FF;
+ request[SYNTH_REQUEST_ARG2_OFFSET + 2] = (arg2 >> 16) & 0x0FF;
+ request[SYNTH_REQUEST_ARG2_OFFSET + 3] = (arg2 >> 24) & 0x0FF;
+ request[SYNTH_REQUEST_TXLEN_OFFSET + 0] = (txlen >> 0) & 0x0FF;
+ request[SYNTH_REQUEST_TXLEN_OFFSET + 1] = (txlen >> 8) & 0x0FF;
+ request[SYNTH_REQUEST_TXLEN_OFFSET + 2] = (txlen >> 16) & 0x0FF;
+ request[SYNTH_REQUEST_TXLEN_OFFSET + 3] = (txlen >> 24) & 0x0FF;
+ request[SYNTH_REQUEST_RXLEN_OFFSET + 0] = (rxlen >> 0) & 0x0FF;
+ request[SYNTH_REQUEST_RXLEN_OFFSET + 1] = (rxlen >> 8) & 0x0FF;
+ request[SYNTH_REQUEST_RXLEN_OFFSET + 2] = (rxlen >> 16) & 0x0FF;
+ request[SYNTH_REQUEST_RXLEN_OFFSET + 3] = ((rxlen >> 24) & 0x0FF) | (((int*)0 != result) ? 0x080 : 0);
+
+ // sizeof(synth_auxiliary_request) < PIPE_BUF (4096) so a single write should be atomic,
+ // subject only to incoming clock or SIGIO or child-related signals.
+ do {
+ rc = cyg_hal_sys_write(to_aux, (const void*) &request, SYNTH_REQUEST_LENGTH);
+ } while (-CYG_HAL_SYS_EINTR == rc);
+
+ // Is there any more data to be sent?
+ if (0 < txlen) {
+ int sent = 0;
+ CYG_LOOP_INVARIANT(synth_auxiliary_running, "The auxiliary cannot just disappear");
+
+ while (sent < txlen) {
+ rc = cyg_hal_sys_write(to_aux, (const void*) &(txdata[sent]), txlen - sent);
+ if (-CYG_HAL_SYS_EINTR == rc) {
+ continue;
+ } else if (rc < 0) {
+ diag_printf("Internal error: unexpected result %d when sending buffer to auxiliary.\n", rc);
+ diag_printf(" : this application is exiting immediately.\n");
+ cyg_hal_sys_exit(1);
+ } else {
+ sent += rc;
+ }
+ }
+ CYG_ASSERT(sent <= txlen, "Amount of data sent should not exceed requested size");
+ }
+
+ // The auxiliary can now process this entire request. Is a reply expected?
+ if ((int*)0 != result) {
+ // The basic reply is also only a small number of bytes, so should be atomic.
+ do {
+ rc = cyg_hal_sys_read(from_aux, (void*) &reply, SYNTH_REPLY_LENGTH);
+ } while (-CYG_HAL_SYS_EINTR == rc);
+ if (rc <= 0) {
+ if (rc < 0) {
+ diag_printf("Internal error: unexpected result %d when receiving data from auxiliary.\n", rc);
+ } else {
+ diag_printf("Internal error: EOF detected on pipe from auxiliary.\n");
+ }
+ diag_printf(" : this application is exiting immediately.\n");
+ cyg_hal_sys_exit(1);
+ }
+ CYG_ASSERT(SYNTH_REPLY_LENGTH == rc, "The correct amount of data should have been read");
+
+ // Replies are packed in Tcl and assumed to be two 32-bit
+ // little-endian integers.
+ *result = (reply[SYNTH_REPLY_RESULT_OFFSET + 3] << 24) |
+ (reply[SYNTH_REPLY_RESULT_OFFSET + 2] << 16) |
+ (reply[SYNTH_REPLY_RESULT_OFFSET + 1] << 8) |
+ (reply[SYNTH_REPLY_RESULT_OFFSET + 0] << 0);
+ reply_rxlen = (reply[SYNTH_REPLY_RXLEN_OFFSET + 3] << 24) |
+ (reply[SYNTH_REPLY_RXLEN_OFFSET + 2] << 16) |
+ (reply[SYNTH_REPLY_RXLEN_OFFSET + 1] << 8) |
+ (reply[SYNTH_REPLY_RXLEN_OFFSET + 0] << 0);
+
+ CYG_ASSERT(reply_rxlen <= rxlen, "The auxiliary should not be sending more data than was requested.");
+
+ if ((int*)0 != actual_rxlen) {
+ *actual_rxlen = reply_rxlen;
+ }
+ if (reply_rxlen) {
+ int received = 0;
+
+ while (received < reply_rxlen) {
+ rc = cyg_hal_sys_read(from_aux, (void*) &(rxdata[received]), reply_rxlen - received);
+ if (-CYG_HAL_SYS_EINTR == rc) {
+ continue;
+ } else if (rc <= 0) {
+ if (rc < 0) {
+ diag_printf("Internal error: unexpected result %d when receiving data from auxiliary.\n", rc);
+ } else {
+ diag_printf("Internal error: EOF detected on pipe from auxiliary.\n");
+ }
+ diag_printf(" : this application is exiting immediately.\n");
+ } else {
+ received += rc;
+ }
+ }
+ CYG_ASSERT(received == reply_rxlen, "Amount received should be exact");
+ }
+ }
+ }
+
+ HAL_RESTORE_INTERRUPTS(old_isrstate);
+}
+
+// Instantiate a device. This takes arguments such as
+// devs/eth/synth/ecosynth, current, ethernet, eth0, and 200x100 If
+// the package and version are NULL strings then the device being
+// initialized is application-specific and does not belong to any
+// particular package.
+int
+synth_auxiliary_instantiate(const char* pkg, const char* version, const char* devtype, const char* devinst, const char* devdata)
+{
+ int result = -1;
+ unsigned char buf[512 + 1];
+ const char* str;
+ int index;
+
+ CYG_ASSERT((const char*)0 != devtype, "Device instantiations must specify a valid device type");
+ CYG_ASSERT((((const char*)0 != pkg) && ((const char*)0 != version)) || \
+ (((const char*)0 == pkg) && ((const char*)0 == version)), "If a package is specified then the version must be supplied as well");
+
+ index = 0;
+ str = pkg;
+ if ((const char*)0 == str) {
+ str = "";
+ }
+ while ( (index < 512) && ('\0' != *str) ) {
+ buf[index++] = *str++;
+ }
+ if (index < 512) buf[index++] = '\0';
+ str = version;
+ if ((const char*)0 == str) {
+ str = "";
+ }
+ while ((index < 512) && ('\0' != *str) ) {
+ buf[index++] = *str++;
+ }
+ if (index < 512) buf[index++] = '\0';
+ for (str = devtype; (index < 512) && ('\0' != *str); ) {
+ buf[index++] = *str++;
+ }
+ if (index < 512) buf[index++] = '\0';
+ if ((const char*)0 != devinst) {
+ for (str = devinst; (index < 512) && ('\0' != *str); ) {
+ buf[index++] = *str++;
+ }
+ }
+ if (index < 512) buf[index++] = '\0';
+ if ((const char*)0 != devdata) {
+ for (str = devdata; (index < 512) && ('\0' != *str); ) {
+ buf[index++] = *str++;
+ }
+ }
+ if (index < 512) {
+ buf[index++] = '\0';
+ } else {
+ diag_printf("Internal error: buffer overflow constructing instantiate request for auxiliary.\n");
+ diag_printf(" : this application is exiting immediately.\n");
+ cyg_hal_sys_exit(1);
+ }
+
+ if (synth_auxiliary_running) {
+ synth_auxiliary_xchgmsg(SYNTH_DEV_AUXILIARY, SYNTH_AUXREQ_INSTANTIATE, 0, 0,
+ buf, index,
+ &result,
+ (unsigned char*) 0, (int *) 0, 0);
+ }
+ return result;
+}
+
+// ----------------------------------------------------------------------------
+// SIGPIPE and SIGCHLD are special, related to the auxiliary process.
+//
+// A SIGPIPE can only happen when the application is writing to the
+// auxiliary, which only happens inside synth_auxiliary_xchgmsg() (this
+// assumes that no other code is writing down a pipe, e.g. to interact
+// with a process other than the standard I/O auxiliary). Either the
+// auxiliary has explicitly closed the pipe, which it is not supposed
+// to do, or more likely it has exited. Either way, there is little
+// point in continuing - unless we already know that the system is
+// shutting down.
+static void
+synth_pipe_sighandler(int sig)
+{
+ CYG_ASSERT(CYG_HAL_SYS_SIGPIPE == sig, "The right signal handler should be invoked");
+ if (synth_auxiliary_running) {
+ synth_auxiliary_running = false;
+ diag_printf("Internal error: communication with the I/O auxiliary has been lost.\n");
+ diag_printf(" : this application is exiting immediately.\n");
+ cyg_hal_sys_exit(1);
+ }
+}
+
+// Similarly it is assumed that there will be no child processes other than
+// the auxiliary. Therefore a SIGCHLD indicates that the auxiliary has
+// terminated unexpectedly. This is bad: normal termination involves
+// the application exiting and the auxiliary terminating in response,
+// not the other way around.
+//
+// As a special case, if it is known that the auxiliary is not currently
+// usable then the signal is ignored. This copes with the situation where
+// the auxiliary has just been fork()'d but has failed to initialize, or
+// alternatively where the whole system is in the process of shutting down
+// cleanly and it happens that the auxiliary got there first.
+static void
+synth_chld_sighandler(int sig)
+{
+ CYG_ASSERT(CYG_HAL_SYS_SIGCHLD == sig, "The right signal handler should be invoked");
+ if (synth_auxiliary_running) {
+ synth_auxiliary_running = false;
+ diag_printf("Internal error: the I/O auxiliary has terminated unexpectedly.\n");
+ diag_printf(" : this application is exiting immediately.\n");
+ cyg_hal_sys_exit(1);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// Initialization
+
+void
+synth_hardware_init(void)
+{
+ struct cyg_hal_sys_sigaction action;
+ struct cyg_hal_sys_sigset_t blocked;
+ int i;
+
+ // Set up a sigprocmask to block all signals except the ones we
+ // particularly want to handle. However do not block the tty
+ // signals - the ability to ctrl-C a program is important.
+ CYG_HAL_SYS_SIGFILLSET(&blocked);
+ CYG_HAL_SYS_SIGDELSET(&blocked, CYG_HAL_SYS_SIGILL);
+ CYG_HAL_SYS_SIGDELSET(&blocked, CYG_HAL_SYS_SIGBUS);
+ CYG_HAL_SYS_SIGDELSET(&blocked, CYG_HAL_SYS_SIGFPE);
+ CYG_HAL_SYS_SIGDELSET(&blocked, CYG_HAL_SYS_SIGSEGV);
+ CYG_HAL_SYS_SIGDELSET(&blocked, CYG_HAL_SYS_SIGPIPE);
+ CYG_HAL_SYS_SIGDELSET(&blocked, CYG_HAL_SYS_SIGCHLD);
+ CYG_HAL_SYS_SIGDELSET(&blocked, CYG_HAL_SYS_SIGALRM);
+ CYG_HAL_SYS_SIGDELSET(&blocked, CYG_HAL_SYS_SIGIO);
+ CYG_HAL_SYS_SIGDELSET(&blocked, CYG_HAL_SYS_SIGHUP);
+ CYG_HAL_SYS_SIGDELSET(&blocked, CYG_HAL_SYS_SIGINT);
+ CYG_HAL_SYS_SIGDELSET(&blocked, CYG_HAL_SYS_SIGQUIT);
+ CYG_HAL_SYS_SIGDELSET(&blocked, CYG_HAL_SYS_SIGTERM);
+ CYG_HAL_SYS_SIGDELSET(&blocked, CYG_HAL_SYS_SIGCONT);
+ CYG_HAL_SYS_SIGDELSET(&blocked, CYG_HAL_SYS_SIGSTOP);
+ CYG_HAL_SYS_SIGDELSET(&blocked, CYG_HAL_SYS_SIGTSTP);
+
+ if (0 != cyg_hal_sys_sigprocmask(CYG_HAL_SYS_SIG_SETMASK, &blocked, (cyg_hal_sys_sigset_t*) 0)) {
+ CYG_FAIL("Failed to initialize sigprocmask");
+ }
+
+ // Now set up the VSR and ISR statics
+ synth_VSR = &synth_default_vsr;
+ for (i = 0; i < CYGNUM_HAL_ISR_COUNT; i++) {
+ synth_isr_handlers[i].isr = &synth_default_isr;
+ synth_isr_handlers[i].data = (CYG_ADDRWORD) 0;
+ synth_isr_handlers[i].obj = (CYG_ADDRESS) 0;
+ synth_isr_handlers[i].pri = CYGNUM_HAL_ISR_COUNT;
+ }
+
+ // Install signal handlers for SIGIO and SIGALRM, the two signals
+ // that may cause the VSR to run. SA_NODEFER is important: it
+ // means that the current signal will not be blocked while the
+ // signal handler is running. Combined with a mask of 0, it means
+ // that the sigprocmask does not change when a signal handler is
+ // invoked, giving eCos the flexibility to switch to other threads
+ // instead of having the signal handler return immediately.
+ action.hal_mask = 0;
+ action.hal_flags = CYG_HAL_SYS_SA_NODEFER;
+ action.hal_handler = &synth_alrm_sighandler;
+ action.hal_restorer = (void (*)(void)) 0;
+#ifdef CYG_HAL_SYS_SIGACTION_ADJUST
+ CYG_HAL_SYS_SIGACTION_ADJUST(CYG_HAL_SYS_SIGALRM, &action);
+#endif
+ if (0 != cyg_hal_sys_sigaction(CYG_HAL_SYS_SIGALRM, &action, (struct cyg_hal_sys_sigaction*) 0)) {
+ CYG_FAIL("Failed to install signal handler for SIGALRM");
+ }
+ action.hal_handler = &synth_io_sighandler;
+ if (0 != cyg_hal_sys_sigaction(CYG_HAL_SYS_SIGIO, &action, (struct cyg_hal_sys_sigaction*) 0)) {
+ CYG_FAIL("Failed to install signal handler for SIGIO");
+ }
+
+ // Install handlers for the various exceptions. For now these also
+ // operate with unchanged sigprocmasks, allowing nested
+ // exceptions. It is not clear that this is entirely a good idea,
+ // but in practice these exceptions will usually be handled by gdb
+ // anyway.
+ action.hal_handler = &synth_exception_sighandler;
+ if (0 != cyg_hal_sys_sigaction(CYG_HAL_SYS_SIGILL, &action, (struct cyg_hal_sys_sigaction*) 0)) {
+ CYG_FAIL("Failed to install signal handler for SIGILL");
+ }
+ if (0 != cyg_hal_sys_sigaction(CYG_HAL_SYS_SIGBUS, &action, (struct cyg_hal_sys_sigaction*) 0)) {
+ CYG_FAIL("Failed to install signal handler for SIGBUS");
+ }
+ if (0 != cyg_hal_sys_sigaction(CYG_HAL_SYS_SIGFPE, &action, (struct cyg_hal_sys_sigaction*) 0)) {
+ CYG_FAIL("Failed to install signal handler for SIGFPE");
+ }
+ if (0 != cyg_hal_sys_sigaction(CYG_HAL_SYS_SIGSEGV, &action, (struct cyg_hal_sys_sigaction*) 0)) {
+ CYG_FAIL("Failed to install signal handler for SIGSEGV");
+ }
+
+ // Also cope with SIGCHLD and SIGPIPE. SIGCHLD indicates that the
+ // auxiliary has terminated, which is a bad thing. SIGPIPE
+ // indicates that a write to the auxiliary has terminated, but
+ // the error condition was caught at a different stage.
+ action.hal_handler = &synth_pipe_sighandler;
+ if (0 != cyg_hal_sys_sigaction(CYG_HAL_SYS_SIGPIPE, &action, (struct cyg_hal_sys_sigaction*) 0)) {
+ CYG_FAIL("Failed to install signal handler for SIGPIPE");
+ }
+ action.hal_handler = &synth_chld_sighandler;
+ action.hal_flags |= CYG_HAL_SYS_SA_NOCLDSTOP | CYG_HAL_SYS_SA_NOCLDWAIT;
+ if (0 != cyg_hal_sys_sigaction(CYG_HAL_SYS_SIGCHLD, &action, (struct cyg_hal_sys_sigaction*) 0)) {
+ CYG_FAIL("Failed to install signal handler for SIGCHLD");
+ }
+
+ // Determine the processor's bogomips rating. This adds some
+ // start-up overhead to all applications, even if HAL_DELAY_US()
+ // is not used. However doing it on demand in the first call
+ // to HAL_DELAY_US() would risk running out of file descriptors.
+ {
+ int fd;
+ char buf[4096]; // much larger than current /proc/cpuinfo, but still small enough for synthetic target stacks
+ int read;
+ int i;
+
+ fd = cyg_hal_sys_open("/proc/cpuinfo", CYG_HAL_SYS_O_RDONLY, 0);
+ if (fd < 0) {
+ CYG_FAIL("Failed to open /proc/cpuinfo, needed for BogoMips rating");
+ }
+ read = cyg_hal_sys_read(fd, buf, 4096);
+ cyg_hal_sys_close(fd);
+
+ for (i = 0; i < read; i++) {
+ if ((buf[i ] == 'b') && (buf[i+1] == 'o') && (buf[i+2] == 'g') && (buf[i+3] == 'o') &&
+ (buf[i+4] == 'm') && (buf[i+5] == 'i') && (buf[i+6] == 'p') && (buf[i+7] == 's')) {
+
+ for ( i += 8; (i < read) && ((buf[i] < '1') || (buf[i] > '9')); i++) {
+ ;
+ }
+ // Only bother with the integer part of the rating
+ for ( ; (i < read) && (buf[i] >= '0') && (buf[i] <= '9'); i++) {
+ hal_bogomips = (10 * hal_bogomips) + (buf[i] - '0');
+ }
+ break;
+ }
+ }
+ if (0 == hal_bogomips) {
+ CYG_FAIL("Failed to find bogomips entry in /proc/cpuinfo");
+ }
+ }
+
+ // Start up the auxiliary process.
+ synth_start_auxiliary();
+
+ // All done. At this stage interrupts are still disabled, no ISRs
+ // have been installed, and the clock is not yet ticking.
+ // Exceptions can come in and will be processed normally. SIGIO
+ // and SIGALRM could come in, but nothing has yet been done
+ // to make that happen.
+}
+
+// Second-stage hardware init. This is called after all C++ static
+// constructors have been run, which should mean that all device
+// drivers have been initialized and will have performed appropriate
+// interactions with the I/O auxiliary. There should now be a
+// message exchange with the auxiliary to let it know that there will
+// not be any more devices, allowing it to remove unwanted frames,
+// run the user's mainrc.tcl script, and so on. Also this is the
+// time that the various toplevels get mapped on to the display.
+//
+// This request blocks until the auxiliary is ready. The return value
+// indicates whether or not any errors occurred on the auxiliary side,
+// and that those errors have not been suppressed using --keep-going
+
+void
+synth_hardware_init2(void)
+{
+ if (synth_auxiliary_running) {
+ int result;
+ synth_auxiliary_xchgmsg(SYNTH_DEV_AUXILIARY, SYNTH_AUXREQ_CONSTRUCTORS_DONE,
+ 0, 0, (const unsigned char*) 0, 0,
+ &result,
+ (unsigned char*) 0, (int*) 0, 0);
+ if ( !result ) {
+ cyg_hal_sys_exit(1);
+ }
+ }
+}
diff --git a/ecos/packages/hal/synth/arch/current/src/synth_protocol.h b/ecos/packages/hal/synth/arch/current/src/synth_protocol.h
new file mode 100644
index 0000000..010d164
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/src/synth_protocol.h
@@ -0,0 +1,123 @@
+#ifndef CYGONCE_HAL_SYNTH_PROTOCOL_H
+#define CYGONCE_HAL_SYNTH_PROTOCOL_H
+
+//=============================================================================
+//
+// synth_protocol.h
+//
+// Generic protocol between eCos and the I/O auxiliary.
+//
+//=============================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// eCos 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.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): bartv
+// Contributors:bartv
+// Date: 2002-08-05
+// Purpose: Protocol definitions.
+// Description: This header file defines the protocol used between the
+// synthetic target HAL and the I/O auxiliary. The relevant
+// code in the latter is implemented in Tcl (making
+// use of the "binary" command) so this header file is
+// not actually used on the host-side. Instead the protocol
+// is defined in terms of byte arrays.
+//
+// The header file is not exported to any higher-level packages
+// that wish to communicate with the auxiliary. Instead those
+// packages are expected to use the functions synth_auxiliary_xchgmsg()
+// and synth_auxiliary_instantiate().
+//
+// Usage: #include "synth_protocol.h"
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+// Messages from the eCos synthetic target application to the I/O
+// auxiliary are exactly 24 bytes long, consisting of six 32-bit
+// little-endian integers. Inside the auxiliary they will be decoded
+// using the Tcl binary scan command and the format i6. The top bit
+// of RXLEN is overloaded to indicate whether or not a reply is expected
+// at all.
+#define SYNTH_REQUEST_LENGTH 24
+#define SYNTH_REQUEST_DEVID_OFFSET 0
+#define SYNTH_REQUEST_REQUEST_OFFSET 4
+#define SYNTH_REQUEST_ARG1_OFFSET 8
+#define SYNTH_REQUEST_ARG2_OFFSET 12
+#define SYNTH_REQUEST_TXLEN_OFFSET 16
+#define SYNTH_REQUEST_RXLEN_OFFSET 20
+
+// And the response. This consists of two 32-bit little-endian integers,
+// a result code and an actual rx_len field.
+#define SYNTH_REPLY_LENGTH 8
+#define SYNTH_REPLY_RESULT_OFFSET 0
+#define SYNTH_REPLY_RXLEN_OFFSET 4
+
+// Device 0 is special, it is for control messages with the auxiliary
+// itself - for example, to instantiate a device.
+#define SYNTH_DEV_AUXILIARY 0
+
+// Requests intended directly for the auxiliary.
+
+// Instantiate a device. arg1 and arg2 are ignored. The tx buffer
+// holds a string for the given device. The rx buffer will be for a
+// single integer, the device id or -1.
+#define SYNTH_AUXREQ_INSTANTIATE 0x01
+
+// Second-stage initialization, once all eCos device drivers have been
+// activated.
+#define SYNTH_AUXREQ_CONSTRUCTORS_DONE 0x02
+
+// Get the current mask of pending interrupts. arg1 and arg2 are
+// ignored, and there is no tx buffer. The reply code holds the irq
+// pending mask. Normally there is no additional reply data, but if
+// rx_len is non-zero then that indicates that the auxiliary has been
+// asked to exit.
+#define SYNTH_AUXREQ_GET_IRQPENDING 0x03
+
+// Versioning. The core protocol cannot be changed without breaking
+// lots of code. However it is still a good idea to allow the eCos
+// application to verify that the host-side is the right version, in
+// case new requests are added. arg1 and arg2 are ignored, there is no
+// tx buffer or reply data, and the reply code holds the version.
+#define SYNTH_AUXREQ_GET_VERSION 0x04
+
+// The version has to be kept in synch with ecosynth.tcl
+#define SYNTH_AUXILIARY_PROTOCOL_VERSION 0x01
+
+// The console device is also provided by the architectural package,
+// but only implements one function (write some output) so there is no
+// need for any function codes.
+
+#endif // CYGONCE_HAL_SYNTH_PROTOCOL.H
diff --git a/ecos/packages/hal/synth/arch/current/src/synth_syscalls.c b/ecos/packages/hal/synth/arch/current/src/synth_syscalls.c
new file mode 100644
index 0000000..5cb4fa8
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/src/synth_syscalls.c
@@ -0,0 +1,107 @@
+//=============================================================================
+//
+// synth_syscalls.c
+//
+// Synthetic target access to more complex system calls
+//
+//=============================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2004 Free Software Foundation, Inc.
+//
+// eCos 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.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): Andrew Lunn
+// Contributors:Alexander Neundorf
+// Date: 2004-12-15
+// Purpose: Access to more complex system calls which require marshalling.
+// Description:
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <cyg/infra/cyg_type.h>
+#include <cyg/hal/hal_diag.h>
+#include <cyg/hal/hal_io.h>
+
+void * cyg_hal_sys_shmat(int shmid, const void* shmaddr, int shmflg)
+{
+ void * result;
+ void * raddr;
+
+ result = (void *) cyg_hal_sys_ipc(CYG_HAL_SYS_IPCOP_shmat,
+ shmid,
+ shmflg,
+ (int) (&raddr),
+ (void*)shmaddr);
+ return raddr;
+}
+
+int cyg_hal_sys_shmget(int key, int size, int shmflg)
+{
+ return cyg_hal_sys_ipc(CYG_HAL_SYS_IPCOP_shmget, key, size, shmflg, NULL);
+}
+
+int cyg_hal_sys_shmdt(const void* shmaddr)
+{
+ return cyg_hal_sys_ipc(CYG_HAL_SYS_IPCOP_shmdt, 0, 0, 0,
+ ((void *) shmaddr));
+}
+
+int
+cyg_hal_sys_mmap(void *addr, unsigned long length, unsigned long prot,
+ unsigned long flags, unsigned long fd, unsigned long off)
+{
+
+ struct cyg_hal_sys_mmap_args args;
+
+ args.addr = (unsigned long) addr;
+ args.len = length;
+ args.prot = prot = prot;
+ args.flags = flags;
+ args.fd = fd;
+ args.offset = off;
+
+ return (cyg_hal_sys_mmapx(&args));
+}
+
+int cyg_hal_sys_ftok(const char* path, int id)
+{
+ struct cyg_hal_sys_old_stat st;
+
+ if (cyg_hal_sys_oldstat(path, &st) != 0)
+ return (cyg_uint32)-1;
+
+ return (cyg_uint32) (id << 24 |
+ (st.st_dev & 0xff) << 16 |
+ (st.st_ino & 0xffff));
+}
diff --git a/ecos/packages/hal/synth/arch/current/tests/ftok.c b/ecos/packages/hal/synth/arch/current/tests/ftok.c
new file mode 100644
index 0000000..6e8c456
--- /dev/null
+++ b/ecos/packages/hal/synth/arch/current/tests/ftok.c
@@ -0,0 +1,86 @@
+/*=================================================================
+//
+// cache.c
+//
+// SYNTH ftok test
+//
+//==========================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// eCos 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.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): asl
+// Contributors: asl
+// Date: 05/11/2005
+//####DESCRIPTIONEND####
+*/
+
+#ifndef HOST
+#include <cyg/hal/hal_io.h>
+#include <cyg/infra/diag.h>
+
+#define printf diag_printf
+#define ftok cyg_hal_sys_ftok
+
+#else
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/ipc.h>
+#endif
+
+int main(void)
+{
+ printf("ftok(\"/etc/passwd\",0x12)) = 0x%8x\n",
+ ftok("/etc/passwd",0x12));
+
+ printf("ftok(\"/etc/passwd\",0x72)) = 0x%8x\n",
+ ftok("/etc/passwd",0x72));
+
+ printf("ftok(\"/boot/vmlinuz\",0x72)) = 0x%8x\n",
+ ftok("/boot/vmlinuz",0x72));
+
+ printf("ftok(\"/boot/vmlinuz\",0x12)) = 0x%8x\n",
+ ftok("/boot/vmlinuz",0x12));
+
+ return 0;
+}
+
+#ifndef HOST
+
+externC void
+cyg_start( void )
+{
+ main();
+}
+#endif
diff --git a/ecos/packages/hal/synth/i386linux/current/ChangeLog b/ecos/packages/hal/synth/i386linux/current/ChangeLog
new file mode 100644
index 0000000..d813084
--- /dev/null
+++ b/ecos/packages/hal/synth/i386linux/current/ChangeLog
@@ -0,0 +1,453 @@
+2011-06-05 John Dallaway <john@dallaway.org.uk>
+
+ * src/syscall-i386-linux-1.0.S: Fix .size and .type expressions to
+ avoid build error with binutils 2.21.x. Patch from Tom Schouten.
+
+2009-08-11 Bart Veer <bartv@ecoscentric.com>
+
+ * src/tls.c: new module for TLS (thread local storage) support as
+ expected by gcc.
+
+ * cdl/hal_synth_i386.cdl, include/var_arch.h,
+ include/pkgconf/mlt_synth_i386_rom.ldi, src/vectors.s: add TLS
+ support.
+
+2009-07-14 Bart Veer <bartv@ecoscentric.com>
+
+ * cdl/hal_synth_i386.cdl: when building on x86_64 machines, use
+ gcc -m32 instead of i686-pc-linux-gnu.
+
+2009-07-09 Bart Veer <bartv@ecoscentric.com>
+
+ * src/syscall-i386-linux-1.0.S: add rename() system call.
+
+2009-01-31 Bart Veer <bartv@ecoscentric.com>
+
+ * cdl/hal_synth_i386.cdl: update compiler flags for gcc 4.x
+
+2005-11-19 Bart Veer <bartv@ecoscentric.com>
+
+ * include/pkgconf/mlt_synth_i386_rom.ldi: add new heap section to
+ avoid the use of brk()
+
+2005-11-05 Andrew Lunn <andrew.lunn@ascom.ch>
+
+ * src/syscall-i386-linux-1.0.S: renamed prev_?stat to old?stat to
+ match the kernel. Removed STATCALL2 macro because it caused
+ confusion. Added the new?stat system calls.
+
+2005-06-26 Bart Veer <bartv@ecoscentric.com>
+
+ * include/var_intr.h (HAL_DELAY_US): new header to supply
+ processor-specific HAL_DELAY_US() macro
+
+2005-03-21 Bart Veer <bartv@ecoscentric.com>
+
+ * cdl/hal_synth_i386.cdl, src/profile.c: add profiling support.
+
+2005-03-11 Bart Veer <bartv@ecoscentric.com>
+
+ * include/var_io.h, src/syscall-i386-linux-1.0.S:
+ Improve support for returning from signal handlers
+
+2004-12-14 Alexander Neundorf <neundorf@kde.org>
+
+ * src/syscall-i386-linux-1.0.S: Add ipc system call
+
+2004-08-04 Alexander Neundorf <alexander.neundorf@jenoptik.com>
+
+ * src/syscall-i386-linux-1.0.S: Add mkdir system call
+
+2004-06-21 Alexander Neundorf <alexander.neundorf@jenoptik.com>
+
+ * src/syscall-i386-linux-1.0.S:
+ Add readdir, lstat and fstat system calls
+
+2004-04-22 Jani Monoses <jani@iv.ro>
+
+ * cdl/hal_synth_i386.cdl :
+ Invoke tail with stricter syntax that works in latest coreutils.
+
+2002-09-15 Bart Veer <bartv@ecoscentric.com>
+
+ * src/syscall-i386-linux-1.0.S:
+ Add access system call
+
+2002-08-04 Bart Veer <bartv@tymora.demon.co.uk>
+
+ * src/vectors.S (_start):
+ Store argv and environ in cyg_hal_sys_... variables
+
+2002-04-29 Jonathan Larmour <jlarmour@redhat.com>
+
+ * src/vectors.S:
+ Don't use .file as it can confuse debugging since the .file
+ doesn't contain the path and therefore the debugger will never
+ know where it lives! This conflicts with using -Wa,--gstabs.
+
+2002-04-10 Jonathan Larmour <jlarmour@redhat.com>
+
+ * include/pkgconf/mlt_synth_i386_rom.ldi: Define eh_frame and
+ RELOCS sections.
+
+2001-11-1 Andrew Lunn <andrew.lunn@ascom.ch>
+
+ * src/syscall-i386-linux-1.0.S: Added mmap system call
+
+2001-12-07 Bart Veer <bartv@redhat.com>
+
+ * src/syscall-i386-linux-1.0.S: added getcwd() system call
+
+2001-08-02 Bart Veer <bartv@redhat.com>
+
+ * src/context.S, include/arch.inc, include/var_arch.h:
+ Update thread context manipulation code to do the
+ right thing with respect to interrupt state.
+
+ * src/context.S (hal_setjmp):
+ Fixed bug in hal_setjmp() that corrupted EBX.
+
+2001-04-27 Bart Veer <bartv@redhat.com>
+
+ * All files
+ Major reorganization and clean-up of the synthetic target.
+
+2000-11-02 Jonathan Larmour <jlarmour@redhat.com>
+
+ * src/entry.c (_linux_entry): Extend memory using brk() syscall to
+ match memory layout
+
+ * src/syscall-i386-linux-1.0.S: Add brk syscall
+
+2000-10-20 Jonathan Larmour <jlarmour@redhat.com>
+
+ * include/pkgconf/mlt_i386_linux_ram.mlt:
+ Add heap1 section
+
+ * include/pkgconf/mlt_i386_linux_ram.h:
+ * include/pkgconf/mlt_i386_linux_ram.ldi:
+ Regenerated
+
+2000-10-20 Jonathan Larmour <jlarmour@redhat.com>
+
+ * cdl/hal_i386_linux.cdl: Correct memory layout file name
+
+2000-03-03 John Dallaway <jld@cygnus.co.uk>
+
+ * cdl/hal_i386_linux.cdl (CYGBLD_GLOBAL_COMMAND_PREFIX):
+
+ Revert most recent change for now to avoid breaking the
+ release system.
+
+2000-03-02 Jonathan Larmour <jlarmour@redhat.co.uk>
+
+ * cdl/hal_i386_linux.cdl (CYGBLD_GLOBAL_COMMAND_PREFIX): Use native
+ toolchain by default, and describe versions to be used
+
+2000-02-29 Jesper Skov <jskov@redhat.com>
+
+ * include/plf_intr.h: Don't include kernel headers.
+
+2000-02-16 Jesper Skov <jskov@redhat.com>
+
+ * src/hal_diag.c (hal_diag_write_char): Check that write call is
+ successful.
+
+2000-02-16 Nick Garnett <nickg@cygnus.co.uk>
+
+ * include/variant.inc: Added missed copyright notice.
+
+2000-02-15 Nick Garnett <nickg@cygnus.co.uk>
+
+ * include/variant.inc:
+ * include/var_intr.h:
+ * include/plf_intr.h:
+ These files added to make this HAL consistent with PC
+ version. They also contains some code moved out of the
+ architecture HAL.
+
+2000-01-24 John Dallaway <jld@cygnus.co.uk>
+
+ * cdl/*.cdl:
+
+ Remove obsolete option CYGTST_TESTING_IDENTIFIER.
+
+2000-01-21 Jesper Skov <jskov@cygnus.co.uk>
+ CR 902062-CR
+ * src/hal_diag.c:
+ * src/syscall-i386-linux-1.0.S:
+ Sync after write.
+
+ * src/hal_startup.c: Make signals NODEFER.
+
+2000-01-19 Hugo Tyson <hmt@cygnus.co.uk>
+
+ * cdl/*.cdl: Add descriptions to a number of options &c which were
+ lacking same, also tidied up other typos as noticed en passant.
+
+1999-12-20 Gary Thomas <gthomas@cygnus.co.uk>
+
+ * cdl/hal_i386_linux.cdl: Add -Wl for linker options.
+
+1999-11-25 Gary Thomas <gthomas@cygnus.co.uk>
+
+ * include/pkgconf/mlt_i386_linux_ram.h: New file(s).
+
+1999-11-01 Jesper Skov <jskov@cygnus.co.uk>
+
+ * cdl/hal_i386_linux.cdl: Added.
+ Use define_proc for const header defs.
+1999-10-05 Jonathan Larmour <jlarmour@cygnus.co.uk>
+
+ * src/linux_misc.c: Fix some really minor spelling typos
+
+ * src/hal_diag.c (hal_diag_read_char): Check if we were woken up by
+ the itimer alarm (which is used for rescheduling) - in which case
+ just read again.
+
+
+1999-10-05 Jesper Skov <jskov@cygnus.co.uk>
+
+ * include/pkgconf/hal_i386_linux.h: Changed to use REAL TIME as
+ default.
+
+ From Andrew Lunn (lunn@ma.tech.ascom.ch)
+ * src/PKGconf.mak:
+ * src/linux_misc.c: [added]
+ * src/syscall-i386-linux-1.0.S:
+ Added idle thread action, reducing host load when eCos is idle.
+
+1999-08-16 John Dallaway <jld@cygnus.co.uk>
+
+ * include/pkgconf/hal_i386_linux.h:
+
+ Proper case package display string.
+
+1999-05-20 Gary Thomas <gthomas@cygnus.co.uk>
+
+ * include/pkgconf/hal_i386_linux.h: Move RTC setup here.
+
+1999-05-14 Jesper Skov <jskov@cygnus.co.uk>
+ PR 18956
+ * include/pkgconf/mlt_i386_linux_ram.mlt:
+ * include/pkgconf/mlt_i386_linux_ram.ldi:
+ Fixed problem with rel_got.
+ Encode . in section name as __.
+
+1999-04-08 John Dallaway <jld@cygnus.co.uk>
+
+ * include/pkgconf/mlt_*.*: Use double underscore substitution
+ for period character in SECTION_* macro names (PR 19787)
+
+1999-04-08 John Dallaway <jld@cygnus.co.uk>
+
+ * include/pkgconf/*.ldi: Revised SECTION_* macro arguments to
+ avoid padded output sections (PR 19787)
+
+1999-03-22 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/linux.S: Added comment.
+ Doh! Managed to break compilation with a comment...
+
+1999-03-16 Jesper Skov <jskov@cygnus.co.uk>
+ PR 19483
+ * src/linux.S (cyg_hal_hardware_init): Fiddled some more with the
+ bits to no avail.
+
+ * src/hal_startup.c:
+ Renamed hal_ to cyg_hal_.
+ Added exception handling.
+
+1999-03-12 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/hal_startup.c (cyg_hal_isr_init): Initialize ISR table with
+ pointers to default ISR routine.
+
+1999-03-12 Jesper Skov <jskov@cygnus.co.uk>
+ PR 19486
+ * src/linux.S (cyg_hal_hardware_init): Only enable zero divide
+ exceptions.
+
+1999-03-11 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/hal_startup.c:
+ * src/entry.c:
+ Renamed hal_isr_init to cyg_hal_isr_init.
+
+ * src/hal_startup.c: Also catch SIGFPE.
+
+ * src/entry.c: Call cyg_hal_hardware_init.
+
+ * src/linux.S: [added]
+ * src/PKGconf.mak:
+ Added file to hold startup assembly code.
+
+1999-03-11 John Dallaway <jld@cygnus.co.uk>
+
+ * include/pkgconf/*.ldi: add copyright notices
+
+1999-03-04 John Dallaway <jld@cygnus.co.uk>
+
+ * include/pkgconf/*.ldi: give all LDI files unique names so
+ that they can co-exist in an eCos build tree (PR 19184)
+ * include/pkgconf/*.mlt: give all MLT files unique names so
+ that they can co-exist in an eCos build tree (PR 19184)
+
+1999-02-25 Nick Garnett <nickg@cygnus.co.uk>
+
+ * src/hal_startup.c:
+ Changed label used to access scheduler lock to one that is not
+ mangled by C++. This is intended to make support for interrupt
+ handling in non-kernel configurations easier.
+
+1999-02-22 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/syscall-i386-linux-1.0.S: Added copyright header.
+
+1999-02-20 Jonathan Larmour <jlarmour@cygnus.co.uk>
+
+ * src/hal_startup.c:
+ Rename hal_interrupts_deffered -> hal_interrupts_deferred
+ Rename CYG_ISR/VSR_* -> CYGNUM_HAL_ISR/VSR_* in line with HAL changes
+ Rename CYG_VECTOR_RTC -> CYGNUM_HAL_INTERRUPT_RTC
+
+ * src/syscall-i386-linux-1.0.S:
+ Add a FIX ME
+
+1999-02-08 John Dallaway <jld@cygnus.co.uk>
+
+ * include/pkgconf/ram.mlt: New memory layout save file
+
+1999-02-05 John Dallaway <jld@cygnus.co.uk>
+
+ * include/pkgconf/*.ldi: Remove LMA_EQ_VMA macro definition.
+
+1999-01-29 Jesper Skov <jskov@cygnus.co.uk>
+
+ * include/pkgconf/hal_i386_linux.h: Changed CDL type back to radio
+ to get consistent ConfigTool output.
+
+1999-01-27 Jesper Skov <jskov@cygnus.co.uk>
+
+ * include/pkgconf/ram.ldi: Commented out the rel_got change.
+
+1999-01-25 Jesper Skov <jskov@cygnus.co.uk>
+
+ * include/pkgconf/ram.ldi: Added rel.got section.
+
+1999-01-22 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/hal_startup.c: Moved external declarations into top-level
+ scope to avoid compiler warning.
+
+1999-01-19 Jesper Skov <jskov@cygnus.co.uk>
+
+ * include/pkgconf/hal_i386_linux.h: Removed startup
+ config. Changed linux entry to dummy instead of bool.
+
+1999-01-12 Jesper Skov <jskov@cygnus.co.uk>
+
+ * include/pkgconf/hal_i386_linux.h: Added config for real-time
+ timer.
+
+1999-01-12 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/hal_diag.c: Removed hal_diag_write_line.
+
+ * src/entry.c: Removed main/argv stuff.
+
+1999-01-12 Jesper Skov <jskov@cygnus.co.uk>
+
+ * include/pkgconf/hal_i386_linux.h: Added.
+
+1999-01-11 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/hal_startup.c (hal_default_vsr):
+ * src/linux.ld (cyg_hal_sched_lock):
+ Added C-symbol reference to the scheduler lock.
+
+1999-01-11 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/hal_startup.c (hal_default_vsr): Allow interrupt disable
+ count to be bigger than 1.
+
+1999-01-11 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/linux.ld: Added fix me. Remember to clean up.
+
+ * src/hal_startup.c: Removed bogus include statement.
+ Added CYGPKG_KERNEL config handling.
+
+ * src/hal_diag.c: Removed bogus include statements and functions.
+
+1999-01-07 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/hal_startup.c (hal_isr_init): Use CYG_VECTOR_RTC rather than
+ hardcoded value.
+
+1999-01-07 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/syscall-i386-linux-1.0.S:
+ * src/hal_diag.c:
+ * src/PKGconf.mak:
+ Removed tabs & fixed comment style.
+
+1999-01-07 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/PKGconf.mak: Cleaned up.
+
+ * src/entry.c: Added (from proven's crtbegin.c).
+
+ * src/linux.ld: Added.
+
+ * src/hal_startup.cxx: (Deleted)
+ * src/hal_startup.c: (Added)
+ Changed code to C, cleaned up.
+
+1999-01-06 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/hal_diag.c: Fixed warnings. Output chars in batches to avoid
+ problems with pkgtest - also improves performance.
+
+1999-01-06 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/syscall-i386-linux-1.0.S: Set behavior to match __ELF__.
+
+1998-12-18 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/syscall-i386-linux-1.0.S:
+ * src/hal_startup.cxx:
+ Fixed compiler warnings.
+
+Fri Dec 4 13:49:03 GMT 1998
+
+ * src/syscall-i386-linux-1.0.S: Fix to work with Bart's latest tools.
+ For some reason it doesn't define __ELF__ but, we really don't care.
+
+Mon Nov 9 15:18:11 GMT 1998 Chris Provenzano <proven@cygnus.com>
+
+ Initial i386 linux port.
+
+//===========================================================================
+// ####GPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2011 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.
+// -------------------------------------------
+// ####GPLCOPYRIGHTEND####
+//===========================================================================
diff --git a/ecos/packages/hal/synth/i386linux/current/cdl/hal_synth_i386.cdl b/ecos/packages/hal/synth/i386linux/current/cdl/hal_synth_i386.cdl
new file mode 100644
index 0000000..b0e9887
--- /dev/null
+++ b/ecos/packages/hal/synth/i386linux/current/cdl/hal_synth_i386.cdl
@@ -0,0 +1,174 @@
+# ====================================================================
+#
+# hal_synth_i386.cdl
+#
+# i386-specific synthetic target configuration data
+#
+# ====================================================================
+## ####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2009 Free Software Foundation, Inc.
+##
+## eCos 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.
+##
+## eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+##
+## As a special exception, if other files instantiate templates or use
+## macros or inline functions from this file, or you compile this file
+## and link it with other works to produce a work based on this file,
+## this file does not by itself cause the resulting work to be covered by
+## the GNU General Public License. However the source code for this file
+## must still be made available in accordance with section (3) of the GNU
+## General Public License v2.
+##
+## This exception does not invalidate any other reasons why a work based
+## on this file might be covered by the GNU General Public License.
+## -------------------------------------------
+## ####ECOSGPLCOPYRIGHTEND####
+# ====================================================================
+######DESCRIPTIONBEGIN####
+#
+# Author(s): jskov
+# Original data: jskov
+# Contributors: bartv
+# Date: 1999-11-01
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+cdl_package CYGPKG_HAL_SYNTH_I386 {
+ parent CYGPKG_HAL_SYNTH
+ display "Linux/i386 synthetic target"
+ description "
+ The Linux/i386 Synthetic Target HAL package provides the
+ support needed to run eCos binaries on top of the i386
+ Linux kernel."
+
+ include_dir cyg/hal
+ define_header hal_synth_i386.h
+ define_proc {
+ puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H <pkgconf/hal_synth_i386.h>"
+ }
+ # On the synthetic target the default main stack size is smaller than
+ # the recommended minimum from var_arch.h
+ requires { !CYGPKG_LIBC_STARTUP || CYGINT_LIBC_STARTUP_MAIN_NO_STACK_SIZE || (CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE >= (16 * 1024)) }
+
+ implements CYGINT_PROFILE_HAL_TIMER
+ implements CYGINT_PROFILE_HAL_MCOUNT
+
+ make {
+ <PREFIX>/lib/vectors.o : <PACKAGE>/src/vectors.S
+ $(CC) -Wp,-MD,vectors.tmp $(INCLUDE_PATH) $(CFLAGS) -c -o $@ $<
+ @echo $@ ": \\" > $(notdir $@).deps
+ @tail -n +2 vectors.tmp >> $(notdir $@).deps
+ @echo >> $(notdir $@).deps
+ @rm vectors.tmp
+ }
+ compile context.S syscall-i386-linux-1.0.S profile.c tls.c
+
+ cdl_component CYG_HAL_STARTUP {
+ display "Startup type"
+ flavor data
+ legal_values {"ROM"}
+ default_value {"ROM"}
+ no_define
+ define -file system.h CYG_HAL_STARTUP
+ description "
+ At the moment only ROM startup is supported. In the context
+ of the synthetic target this means a read-only region for
+ code and a read-write region for data."
+ }
+
+ cdl_component CYGBLD_GLOBAL_OPTIONS {
+ display "Global build options"
+ flavor none
+ parent CYGPKG_NONE
+ description "
+ Global build options including control over
+ compiler flags, linker flags and choice of toolchain."
+
+
+ cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX {
+ display "Global command prefix"
+ flavor data
+ no_define
+ if { ($tcl_platform(os) == "Linux") && [string match "i*86" $tcl_platform(machine)] } {
+ default_value { "" }
+ } elseif { ($tcl_platform(os) == "Linux") && [string equal "x86_64" $tcl_platform(machine)] } {
+ default_value { "" }
+ } else {
+ default_value { "i686-pc-linux-gnu" }
+ }
+ description "
+ This option specifies the command prefix used when
+ invoking the build tools. You must be using gcc-2.95.2 or
+ later, and \"ld -v\" must report a version more recent than
+ 2.9.1."
+ }
+
+ cdl_option CYGBLD_GLOBAL_CFLAGS {
+ display "Global compiler flags"
+ flavor data
+ no_define
+ if { ($tcl_platform(os) == "Linux") && [string equal "x86_64" $tcl_platform(machine)] } {
+ default_value { CYGBLD_GLOBAL_WARNFLAGS . " -m32 -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions " }
+ } else {
+ default_value { CYGBLD_GLOBAL_WARNFLAGS . " -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions " }
+ }
+ description "
+ This option controls the global compiler flags which
+ are used to compile all packages by
+ default. Individual packages may define
+ options which override these global flags."
+ }
+
+ cdl_option CYGBLD_GLOBAL_LDFLAGS {
+ display "Global linker flags"
+ flavor data
+ no_define
+ if { ($tcl_platform(os) == "Linux") && [string equal "x86_64" $tcl_platform(machine)] } {
+ default_value { "-m32 -g -nostdlib -Wl,--gc-sections -Wl,-static" }
+ } else {
+ default_value { "-g -nostdlib -Wl,--gc-sections -Wl,-static" }
+ }
+ description "
+ This option controls the global linker flags. Individual
+ packages may define options which override these global flags."
+ }
+ }
+
+ cdl_component CYGHWR_MEMORY_LAYOUT {
+ display "Memory layout"
+ flavor data
+ no_define
+ calculated { "mlt_synth_i386_rom" }
+
+ cdl_option CYGHWR_MEMORY_LAYOUT_LDI {
+ display "Memory layout linker script fragment"
+ flavor data
+ no_define
+ define -file system.h CYGHWR_MEMORY_LAYOUT_LDI
+ calculated { "<pkgconf/mlt_synth_i386_rom.ldi>" }
+ }
+
+ cdl_option CYGHWR_MEMORY_LAYOUT_H {
+ display "Memory layout header file"
+ flavor data
+ no_define
+ define -file system.h CYGHWR_MEMORY_LAYOUT_H
+ calculated { "<pkgconf/mlt_synth_i386_rom.h>" }
+ }
+ }
+}
diff --git a/ecos/packages/hal/synth/i386linux/current/include/arch.inc b/ecos/packages/hal/synth/i386linux/current/include/arch.inc
new file mode 100644
index 0000000..1e42b59
--- /dev/null
+++ b/ecos/packages/hal/synth/i386linux/current/include/arch.inc
@@ -0,0 +1,76 @@
+##=============================================================================
+##
+## arch.inc
+##
+## i386 assembler header file for the synthetic target
+##
+##=============================================================================
+## ####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+##
+## eCos 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.
+##
+## eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+##
+## As a special exception, if other files instantiate templates or use
+## macros or inline functions from this file, or you compile this file
+## and link it with other works to produce a work based on this file,
+## this file does not by itself cause the resulting work to be covered by
+## the GNU General Public License. However the source code for this file
+## must still be made available in accordance with section (3) of the GNU
+## General Public License v2.
+##
+## This exception does not invalidate any other reasons why a work based
+## on this file might be covered by the GNU General Public License.
+## -------------------------------------------
+## ####ECOSGPLCOPYRIGHTEND####
+##=============================================================================
+#######DESCRIPTIONBEGIN####
+##
+## Author(s): jskov
+## Contributors:jskov, nickg, bartv
+## Date: 1999-01-20
+## Purpose: i386 definitions.
+## Description: This file contains various definitions and macros that are
+## useful for writing assembly code for the i386
+## Usage:
+## #include <cyg/hal/arch.inc>
+## ...
+##
+##
+######DESCRIPTIONEND####
+##
+##=============================================================================
+
+#------------------------------------------------------------------------------
+# Exception, interrupt and thread context save area layout
+# The layout of this structure is also defined in "hal_arch.h", for C
+# code. Do not change this without changing that (or vice versa).
+
+ # See SYSV ABI4, i386 supplement (page 37-38)
+ # http://www.sco.com/products/layered/develop/devspecs/abi386-4.pdf
+
+ # Callee save registers (eax, ecx, and edx are scratch registers)
+ .equ i386reg_esp, 0
+ .equ i386reg_next_context, 4 # only used when dropping through...
+ .equ i386reg_ebp, 8 # ...from switch_ to load_context.
+ .equ i386reg_ebx, 12
+ .equ i386reg_esi, 16
+ .equ i386reg_edi, 20
+ .equ i386reg_interrupts, 24
+ .equ i386reg_context_size, 28
+
+#------------------------------------------------------------------------------
+# end of arch.inc
diff --git a/ecos/packages/hal/synth/i386linux/current/include/basetype.h b/ecos/packages/hal/synth/i386linux/current/include/basetype.h
new file mode 100644
index 0000000..43d9f55
--- /dev/null
+++ b/ecos/packages/hal/synth/i386linux/current/include/basetype.h
@@ -0,0 +1,81 @@
+#ifndef CYGONCE_HAL_BASETYPE_H
+#define CYGONCE_HAL_BASETYPE_H
+
+//=============================================================================
+//
+// basetype.h
+//
+// Standard types for x86 synthetic target.
+//
+//=============================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+//
+// eCos 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.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): proven
+// Contributors:proven
+// Date: 1998-10-02
+// Purpose: Define architecture base types.
+// Usage: Included by "cyg_type.h", do not use directly
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+//-----------------------------------------------------------------------------
+// Characterize the architecture
+
+#define CYG_BYTEORDER CYG_LSBFIRST // Little endian
+
+//-----------------------------------------------------------------------------
+// I386 does not usually use labels with underscores.
+
+//#define CYG_LABEL_NAME(_name_) _name_
+
+//-----------------------------------------------------------------------------
+// Override the alignment definitions from cyg_type.h. x86 requires
+// 32 *byte* alignment because gcc sometimes tries to be clever with
+// aligning things on cache lines.
+
+#define CYGARC_ALIGNMENT 32
+#define CYGARC_P2ALIGNMENT 5
+
+//-----------------------------------------------------------------------------
+// Define the standard variable sizes
+
+// The ix86 architecture uses the default definitions of the base types,
+// so we do not need to define any here.
+
+//-----------------------------------------------------------------------------
+#endif // CYGONCE_HAL_BASETYPE_H
+// End of basetype.h
diff --git a/ecos/packages/hal/synth/i386linux/current/include/pkgconf/mlt_synth_i386_rom.h b/ecos/packages/hal/synth/i386linux/current/include/pkgconf/mlt_synth_i386_rom.h
new file mode 100644
index 0000000..1fe0c75
--- /dev/null
+++ b/ecos/packages/hal/synth/i386linux/current/include/pkgconf/mlt_synth_i386_rom.h
@@ -0,0 +1,20 @@
+// eCos memory layout - Fri Oct 20 08:40:39 2000
+
+// This is a generated file - do not edit
+
+#ifndef __ASSEMBLER__
+#include <cyg/infra/cyg_type.h>
+#include <stddef.h>
+
+#endif
+#define CYGMEM_REGION_rom (0x1000000)
+#define CYGMEM_REGION_rom_SIZE (0x800000)
+#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R)
+#define CYGMEM_REGION_ram (0x2000000)
+#define CYGMEM_REGION_ram_SIZE (0x800000)
+#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W)
+#ifndef __ASSEMBLER__
+extern char CYG_LABEL_NAME (__heap1) [];
+#endif
+#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1))
+#define CYGMEM_SECTION_heap1_SIZE (0x2800000 - (size_t) CYG_LABEL_NAME (__heap1))
diff --git a/ecos/packages/hal/synth/i386linux/current/include/pkgconf/mlt_synth_i386_rom.ldi b/ecos/packages/hal/synth/i386linux/current/include/pkgconf/mlt_synth_i386_rom.ldi
new file mode 100644
index 0000000..4d03b35
--- /dev/null
+++ b/ecos/packages/hal/synth/i386linux/current/include/pkgconf/mlt_synth_i386_rom.ldi
@@ -0,0 +1,31 @@
+#include <cyg/infra/cyg_type.inc>
+
+MEMORY
+{
+ rom : ORIGIN = 0x01000000, LENGTH = 0x800000
+ ram : ORIGIN = 0x02000000, LENGTH = 0x800000
+}
+
+SECTIONS
+{
+ SECTIONS_BEGIN
+ SECTION_vectors (rom, 0x01000000, LMA_EQ_VMA)
+ SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA)
+ SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA)
+ SECTION_rodata1 (rom, ALIGN (0x8), LMA_EQ_VMA)
+ SECTION_rodata (rom, ALIGN (0x8), LMA_EQ_VMA)
+ SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA)
+ SECTION_RELOCS (rom, ALIGN (0x4), LMA_EQ_VMA)
+ SECTION_eh_frame (rom, ALIGN (0x4), LMA_EQ_VMA)
+ SECTION_rel__got (rom, ALIGN (0x1), LMA_EQ_VMA)
+ SECTION_gcc_except_table (rom, ALIGN (0x1), LMA_EQ_VMA)
+ .tls 0x02000000 : {
+ *(.tls.*)
+ } > ram
+ SECTION_data (ram, 0x02000100, LMA_EQ_VMA)
+ SECTION_sbss (ram, ALIGN (0x4) , LMA_EQ_VMA)
+ SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA)
+ CYG_LABEL_DEFN(__heap1) = ALIGN (0x10);
+ SECTIONS_HEAP(ram, __heap1, 0x02800000)
+ SECTIONS_END
+}
diff --git a/ecos/packages/hal/synth/i386linux/current/include/var_arch.h b/ecos/packages/hal/synth/i386linux/current/include/var_arch.h
new file mode 100644
index 0000000..8b76c59
--- /dev/null
+++ b/ecos/packages/hal/synth/i386linux/current/include/var_arch.h
@@ -0,0 +1,229 @@
+#ifndef CYGONCE_HAL_VAR_ARCH_H
+#define CYGONCE_HAL_VAR_ARCH_H
+
+//=============================================================================
+//
+// var_arch.h
+//
+// Per-processor information such as processor save states.
+//
+//=============================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2009 Free Software Foundation, Inc.
+//
+// eCos 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.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): proven
+// Contributors:proven, pjo, nickg,bartv
+// Date: 1998-10-05
+// Purpose: Define architecture abstractions
+// Usage: #include <cyg/hal/hal_arch.h>
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+
+#include <cyg/infra/cyg_type.h>
+
+//-----------------------------------------------------------------------------
+// Processor saved states. This structure is also defined in arch.inc for
+// assembly code. Do not change this without changing that (or vice versa).
+// Note: there is no need to worry about floating point contexts, see context.S
+
+typedef struct
+{
+ cyg_uint32 esp;
+ cyg_uint32 next_context; // only used when dropping through...
+ cyg_uint32 ebp; // ...from switch_ to load_context
+ cyg_uint32 ebx;
+ cyg_uint32 esi;
+ cyg_uint32 edi;
+ cyg_bool interrupts; // Are interrupts enabled for this thread?
+} HAL_SavedRegisters;
+
+// An additional structure used for per-thread data. This is not
+// actually part of the standard HAL. However gcc can generate code
+// which expects one of these structures to be accessible via
+// %gs:0, e.g. when -fstack-protector is enabled.
+//
+// This definition is based on one in the glibc sources.
+typedef struct _HAL_TLS_Data {
+ void* tls_tcb;
+ void* tls_dtv;
+ void* tls_self;
+ int tls_multiple_threads;
+ void* tls_sysinfo;
+ void* tls_stack_guard;
+ void* tls_pointer_guard;
+ int tls_gscope_flag;
+ int tls_private_futex;
+ void* tls_private_tm[5];
+} _HAL_TLS_Data;
+
+//-----------------------------------------------------------------------------
+// Bit manipulation routines. These are provided by the processor variant
+// HAL to allow for processor-specific implementations.
+
+#define HAL_LSBIT_INDEX(index, mask) \
+CYG_MACRO_START \
+ asm volatile( "bsfl %1,%0\n" \
+ : "=r" (index) \
+ : "r" (mask) \
+ ); \
+CYG_MACRO_END
+
+#define HAL_MSBIT_INDEX(index, mask) \
+CYG_MACRO_START \
+ asm volatile( "bsrl %1,%0\n" \
+ : "=r" (index) \
+ : "r" (mask) \
+ ); \
+CYG_MACRO_END
+
+//-----------------------------------------------------------------------------
+// Context Initialization
+// Initialize the context of a thread.
+// Arguments:
+// _sp_ name of variable containing current sp, will be written with new sp
+// _thread_ thread object address, passed as argument to entry point
+// _entry_ entry point address.
+// _id_ bit pattern used in initializing registers, for debugging.
+
+#define HAL_THREAD_INIT_CONTEXT( _sparg_, _thread_, _entry_, _id_ ) \
+ CYG_MACRO_START \
+ register CYG_WORD* _sp_ = ((CYG_WORD*)((_sparg_) &~15)); \
+ register HAL_SavedRegisters *_regs_; \
+ \
+ /* The 'ret' executed at the end of hal_thread_load_context will */ \
+ /* use the last entry on the stack as a return pointer (_entry_). */ \
+ /* Cyg_HardwareThread::thread_entry expects one argument at stack */ \
+ /* offset 4 (_thread_). The (0xDEADBEEF) entry is the return addr */ \
+ /* for thread_entry (which is never used). */ \
+ *(--_sp_) = (CYG_WORD)(0); \
+ *(--_sp_) = (CYG_WORD)(0); \
+ *(--_sp_) = (CYG_WORD)(0); \
+ *(--_sp_) = (CYG_WORD)(0); \
+ *(--_sp_) = (CYG_WORD)(_thread_); \
+ *(--_sp_) = (CYG_WORD)(0); \
+ *(--_sp_) = (CYG_WORD)(_entry_); \
+ \
+ _regs_ = (HAL_SavedRegisters *) \
+ ((unsigned long)_sp_ - sizeof(HAL_SavedRegisters)); \
+ _regs_->esp = (CYG_WORD) _sp_; \
+ _regs_->ebx = (CYG_WORD)(_id_); \
+ _regs_->ebp = (CYG_WORD)(_id_); \
+ _regs_->esi = (CYG_WORD)(_id_); \
+ _regs_->edi = (CYG_WORD)(_id_); \
+ _regs_->interrupts = true; \
+ (_sparg_) = (CYG_ADDRESS) _regs_; \
+ CYG_MACRO_END
+
+//-----------------------------------------------------------------------------
+// Context switch macros.
+// The arguments are pointers to locations where the stack pointer
+// of the current thread is to be stored, and from where the sp of the
+// next thread is to be fetched.
+
+externC void hal_thread_switch_context( CYG_ADDRESS _to_, CYG_ADDRESS _from_ );
+externC void hal_thread_load_context( CYG_ADDRESS _to_ )
+ __attribute__ ((noreturn));
+
+#define HAL_THREAD_SWITCH_CONTEXT(_fspptr_,_tspptr_) \
+ hal_thread_switch_context((CYG_ADDRESS)_tspptr_,(CYG_ADDRESS)_fspptr_);
+
+#define HAL_THREAD_LOAD_CONTEXT(_tspptr_) \
+ hal_thread_load_context( (CYG_ADDRESS)_tspptr_ );
+
+//-----------------------------------------------------------------------------
+// HAL setjmp
+
+#define CYGARC_JMP_BUF_SP 0
+#define CYGARC_JMP_BUF_EBP 1
+#define CYGARC_JMP_BUF_EBX 2
+#define CYGARC_JMP_BUF_ESI 3
+#define CYGARC_JMP_BUF_EDI 4
+#define CYGARC_JMP_BUF_PC 5
+
+#define CYGARC_JMP_BUF_SIZE 6
+
+typedef cyg_uint32 hal_jmp_buf[CYGARC_JMP_BUF_SIZE];
+
+externC int hal_setjmp(hal_jmp_buf env);
+externC void hal_longjmp(hal_jmp_buf env, int val);
+
+//-----------------------------------------------------------------------------
+// Minimal and sensible stack sizes: the intention is that applications
+// will use these to provide a stack size in the first instance prior to
+// proper analysis. Idle thread stack should be this big.
+
+// THESE ARE NOT INTENDED TO BE MICROMETRICALLY ACCURATE FIGURES.
+// THEY ARE HOWEVER ENOUGH TO START PROGRAMMING.
+// YOU MUST MAKE YOUR STACKS LARGER IF YOU HAVE LARGE "AUTO" VARIABLES!
+
+// This is not a config option because it should not be adjusted except
+// under "enough rope" sort of disclaimers.
+
+// Stack frame overhead per call. 3 local registers (edi, esi, ebx) and
+// return address.
+#define CYGNUM_HAL_STACK_FRAME_SIZE (4 * 4)
+
+// Stack needed for a context switch (i386reg_context_size from i386.inc)
+#define CYGNUM_HAL_STACK_CONTEXT_SIZE (4 * 24)
+
+// Interrupt stack size. Interrupts are handled by signals so the relevant
+// data is MINSIGSTKSIZE (see man sigaltstack) or 2048. Given the
+// multiplier *15 for STACK_SIZE_MINIMUM, this should be adequate.
+#define CYGNUM_HAL_STACK_INTERRUPT_SIZE 2048
+
+// We define a minimum stack size as the minimum any thread could ever
+// legitimately get away with. We can throw asserts if users ask for less
+// than this. Allow enough for three interrupt sources - clock, serial and
+// one other
+//
+// On the synthetic target memory is cheap so comparatively large stacks
+// are possible. This avoids stack overflow problems when working with
+// the synthetic target, although arguably the problem is now deferred to
+// when the application is moved to real hardware where it will be more
+// difficult to track down.
+#define CYGNUM_HAL_STACK_SIZE_MINIMUM (16 * 1024)
+#define CYGNUM_HAL_STACK_SIZE_TYPICAL (32 * 1024)
+
+//--------------------------------------------------------------------------
+// Macros for switching context between two eCos instances (jump from
+// code in ROM to code in RAM or vice versa).
+#define CYGARC_HAL_SAVE_GP()
+#define CYGARC_HAL_RESTORE_GP()
+
+//--------------------------------------------------------------------------
+#endif // CYGONCE_HAL_VAR_ARCH_H
+// End of var_arch.h
diff --git a/ecos/packages/hal/synth/i386linux/current/include/var_intr.h b/ecos/packages/hal/synth/i386linux/current/include/var_intr.h
new file mode 100644
index 0000000..75a458a
--- /dev/null
+++ b/ecos/packages/hal/synth/i386linux/current/include/var_intr.h
@@ -0,0 +1,78 @@
+#ifndef CYGONCE_HAL_VAR_INTR_H
+#define CYGONCE_HAL_VAR_INTR_H
+
+//=============================================================================
+//
+// var_intr.h
+//
+// Processor-specific interrupt support
+//
+//=============================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// eCos 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.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): bartv
+// Date: 2005-06-26
+// Usage: #include <cyg/hal/hal_intr.h>
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+// The architectural HAL provides the bogomips rating. This is an
+// outer loop for the number of us and an inner loop for 1us. The
+// alignment of the inner loop can greatly affect performance. The
+// *16 of the bogomips rating seems to give about the right results
+// on a range of hardware.
+#define HAL_DELAY_US(_us_) \
+ CYG_MACRO_START \
+ asm volatile ( \
+ "1:\n" \
+ "movl %2,%1\n" \
+ "sal $0x4,%1\n" \
+ ".align 16\n" \
+ "2:\n" \
+ "decl %1\n" \
+ "jns 2b\n" \
+ "decl %0\n" \
+ "jns 1b\n" \
+ : \
+ : "r" (_us_), "r" (0), "g" (hal_bogomips+1) \
+ : "cc"); \
+ CYG_MACRO_END
+
+
+//--------------------------------------------------------------------------
+#endif // CYGONCE_HAL_VAR_INTR_H
+// End of var_intr.h
diff --git a/ecos/packages/hal/synth/i386linux/current/include/var_io.h b/ecos/packages/hal/synth/i386linux/current/include/var_io.h
new file mode 100644
index 0000000..daa6070
--- /dev/null
+++ b/ecos/packages/hal/synth/i386linux/current/include/var_io.h
@@ -0,0 +1,103 @@
+#ifndef CYGONCE_HAL_VAR_IO_H
+#define CYGONCE_HAL_VAR_IO_H
+
+//=============================================================================
+//
+// var_io.h
+//
+// Processor-specific I/O support
+//
+//=============================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+//
+// eCos 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.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): bartv
+// Date: 2003-10-08
+// Usage: #include <cyg/hal/hal_io.h>
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <cyg/infra/cyg_type.h>
+
+// In theory an application signal handler can just return straight to
+// the kernel. In reality this is usually the case as well, but with
+// some kernel versions on some processors it is necessary instead to
+// exit via a sigreturn system call.
+externC void cyg_hal_sys_restore(void);
+externC void cyg_hal_sys_restore_rt(void);
+
+#define CYG_HAL_SYS_SIGACTION_ADJUST(_sig_, _sigaction_) \
+ CYG_MACRO_START \
+ (_sigaction_)->hal_flags |= CYG_HAL_SYS_SA_RESTORER; \
+ (_sigaction_)->hal_restorer = &cyg_hal_sys_restore; \
+ CYG_MACRO_END
+
+// Additional information passed to a signal handler. This is useful
+// for e.g. profiling.
+struct cyg_hal_sys_sigcontext {
+ unsigned short hal_gs;
+ unsigned short hal_gsh;
+ unsigned short hal_fs;
+ unsigned short hal_fsh;
+ unsigned short hal_es;
+ unsigned short hal_esh;
+ unsigned short hal_ds;
+ unsigned short hal_dsh;
+ unsigned long hal_edi;
+ unsigned long hal_esi;
+ unsigned long hal_ebp;
+ unsigned long hal_esp;
+ unsigned long hal_ebx;
+ unsigned long hal_edx;
+ unsigned long hal_ecx;
+ unsigned long hal_eax;
+ unsigned long hal_trapno;
+ unsigned long hal_err;
+ unsigned long hal_eip;
+ unsigned short hal_cs;
+ unsigned short hal_csh;
+ unsigned long hal_eflags;
+ unsigned long hal_esp_at_signal;
+ unsigned short hal_ss;
+ unsigned short hal_ssh;
+ void* hal_fpstate;
+ unsigned long hal_oldmask;
+ unsigned long hal_cr2;
+};
+
+//--------------------------------------------------------------------------
+#endif // CYGONCE_HAL_VAR_IO_H
+// End of var_io.h
diff --git a/ecos/packages/hal/synth/i386linux/current/src/context.S b/ecos/packages/hal/synth/i386linux/current/src/context.S
new file mode 100644
index 0000000..7eed18c
--- /dev/null
+++ b/ecos/packages/hal/synth/i386linux/current/src/context.S
@@ -0,0 +1,223 @@
+##=============================================================================
+##
+## context.S
+##
+## x86 thread context manipulation.
+##
+##=============================================================================
+## ####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+##
+## eCos 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.
+##
+## eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+##
+## As a special exception, if other files instantiate templates or use
+## macros or inline functions from this file, or you compile this file
+## and link it with other works to produce a work based on this file,
+## this file does not by itself cause the resulting work to be covered by
+## the GNU General Public License. However the source code for this file
+## must still be made available in accordance with section (3) of the GNU
+## General Public License v2.
+##
+## This exception does not invalidate any other reasons why a work based
+## on this file might be covered by the GNU General Public License.
+## -------------------------------------------
+## ####ECOSGPLCOPYRIGHTEND####
+##=============================================================================
+#######DESCRIPTIONBEGIN####
+##
+## Author(s): jskov
+## Contributors:jskov, pjo, nickg, bartv
+## Date: 1999-03-11
+## Purpose: CPU-specific code
+## Description: This file contains the code needed to manage the
+## CPU on an i386/Linux synthetic target.
+##
+######DESCRIPTIONEND####
+##
+##=============================================================================
+
+#include <cyg/hal/arch.inc>
+
+#------------------------------------------------------------------------------
+# function declaration macro
+
+#define FUNC_START(name) \
+ .globl name; \
+name:
+
+#------------------------------------------------------------------------------
+# Context switch and setjmp/longjmp support.
+# Based on PowerPC context.S, using data from SYSV ABI4, i386
+# supplement (page 37-38)
+# http://www.sco.com/products/layered/develop/devspecs/abi386-4.pdf
+#
+# There is no need to worry about saving floating point context. If
+# a switch occurs because of an interrupt/signal, the system will have
+# saved the fpu state already before the signal handler was invoked,
+# and the state will be returned when the signal handler returns i.e.
+# when the interrupted thread is reactivated. If a context switch is
+# voluntary, for example a call to cyg_thread_yield(), then according
+# to the calling conventions all fpu registers are CALL_USED_REGISTERS
+# (gcc/config/i386/i386.h) and will have been saved by the calling
+# code.
+#
+# FIXME: it may be appropriate to match eCos thread contexts
+# more closely onto Linux sigcontexts - that might facilitate
+# thread-aware debugging.
+
+# hal_thread_switch_context
+# Switch thread contexts
+# : 0(%esp) : return address
+# : 4(%esp) : address of sp of next thread to execute
+# : 8(%esp) : address of sp save location of current thread
+#
+# %eax, %ecx, and %edx are ours to abuse.
+
+ .extern hal_interrupts_enabled
+ .extern hal_enable_interrupts
+
+FUNC_START(hal_thread_switch_context)
+ movl 4(%esp),%eax # next context ptr
+ movl 8(%esp),%edx # this context ptr
+
+ # Make room on the stack for the context
+ movl %esp,%ecx # keep original SP
+ sub $i386reg_context_size,%esp
+
+ # Save next context ptr in this context. Necessary because
+ # hal_thread_load_context expects to find the ptr on the stack,
+ # not in a register as on PPC.
+ movl %eax,i386reg_next_context(%esp)
+
+ # Save registers
+ movl %ecx,i386reg_esp(%esp) # original esp
+ movl %ebp,i386reg_ebp(%esp)
+ movl %ebx,i386reg_ebx(%esp)
+ movl %esi,i386reg_esi(%esp)
+ movl %edi,i386reg_edi(%esp)
+
+ # And interrupt state
+ movl hal_interrupts_enabled,%eax
+ movl %eax,i386reg_interrupts(%esp)
+
+ # Store the context ptr
+ movl %esp,(%edx)
+
+ # Now fall through to hal_thread_load_context
+
+
+#------------------------------------------------------------------------------
+# hal_thread_load_context
+# Load thread context
+# : 4(%esp) = i386reg_next_context(%esp) = address of sp of thread to execute
+# Note that this function is also the second half of hal_thread_switch_context
+# and is simply dropped into from it.
+#
+# %eax, %ecx, and %edx are ours to abuse.
+
+FUNC_START(hal_thread_load_context)
+
+ movl i386reg_next_context(%esp),%eax # get new context ptr
+ movl (%eax),%eax
+
+ # Restore registers
+ movl i386reg_ebp(%eax),%ebp
+ movl i386reg_ebx(%eax),%ebx
+ movl i386reg_esi(%eax),%esi
+ movl i386reg_edi(%eax),%edi
+ movl i386reg_esp(%eax),%esp
+
+ # And see what needs to happen about interrupts
+ movl i386reg_interrupts(%eax),%eax
+ cmpl hal_interrupts_enabled,%eax
+ je interrupts_ok
+
+ # The saved interrupt state differs from the current one.
+ # If interrupts are supposed to be enabled then invoke
+ # hal_enable_interrupts. That can be done as a tail call.
+ # If interrupts are supposed to be disabled then just
+ # update the global variable.
+ cmpl $0,%eax
+ jne hal_enable_interrupts
+ movl %eax,hal_interrupts_enabled
+
+interrupts_ok:
+ ret
+
+
+#------------------------------------------------------------------------------
+# HAL longjmp, setjmp implementations
+# hal_setjmp saves only to callee save registers ebp, ebx, esi, edi and
+# and esp+pc into buffer supplied in 4(esp)
+# Note: These definitions are repeated in hal_arch.h. If changes are required
+# remember to update both sets.
+
+#define CYGARC_JMP_BUF_SP 0
+#define CYGARC_JMP_BUF_EBP 1
+#define CYGARC_JMP_BUF_EBX 2
+#define CYGARC_JMP_BUF_ESI 3
+#define CYGARC_JMP_BUF_EDI 4
+#define CYGARC_JMP_BUF_PC 5
+
+#define CYGARC_JMP_BUF_SIZE 6
+
+FUNC_START(hal_setjmp)
+ # Get jmpbuf pointer
+ movl 4(%esp),%eax
+
+ # Save regular registers
+ movl %ebp,CYGARC_JMP_BUF_EBP*4(%eax)
+ movl %ebx,CYGARC_JMP_BUF_EBX*4(%eax)
+ movl %esi,CYGARC_JMP_BUF_ESI*4(%eax)
+ movl %edi,CYGARC_JMP_BUF_EDI*4(%eax)
+
+ # Stack and PC
+ movl %esp,CYGARC_JMP_BUF_SP*4(%eax)
+ movl 0(%esp),%edx
+ movl %edx,CYGARC_JMP_BUF_PC*4(%eax)
+
+ # Return 0
+ xor %eax,%eax
+ ret
+
+
+# hal_longjmp loads state from 4(esp) and returns to PC stored in state
+
+FUNC_START(hal_longjmp)
+ # Get return value
+ movl 8(%esp),%eax
+
+ # Get jmpbuf pointer
+ movl 4(%esp),%ecx
+
+ # Restore regular registers
+ movl CYGARC_JMP_BUF_EBP*4(%ecx),%ebp
+ movl CYGARC_JMP_BUF_EBX*4(%ecx),%ebx
+ movl CYGARC_JMP_BUF_ESI*4(%ecx),%esi
+ movl CYGARC_JMP_BUF_EDI*4(%ecx),%edi
+
+ # Restore stack pointer
+ movl CYGARC_JMP_BUF_SP*4(%ecx),%esp
+
+ # Put return address on stack
+ movl CYGARC_JMP_BUF_PC*4(%ecx),%edx
+ movl %edx,0(%esp)
+
+ ret
+
+#------------------------------------------------------------------------------
+# end of linux.S
diff --git a/ecos/packages/hal/synth/i386linux/current/src/profile.c b/ecos/packages/hal/synth/i386linux/current/src/profile.c
new file mode 100644
index 0000000..f83bbee
--- /dev/null
+++ b/ecos/packages/hal/synth/i386linux/current/src/profile.c
@@ -0,0 +1,184 @@
+//=============================================================================
+//
+// profile.c
+//
+// Support for profiling on x86 synthetic target
+//
+//=============================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+//
+// eCos 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.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): bartv
+// Contributors: bartv
+// Date: 2003-10-12
+//
+//####DESCRIPTIONEND####
+//=============================================================================
+
+#include <pkgconf/system.h>
+#ifdef CYGPKG_PROFILE_GPROF
+#include <pkgconf/hal_synth.h>
+#include <pkgconf/hal_synth_i386.h>
+#include <cyg/infra/cyg_type.h>
+#include <cyg/infra/cyg_ass.h>
+#include <cyg/hal/hal_io.h>
+#include <cyg/hal/hal_intr.h>
+#include <cyg/profile/profile.h>
+
+#if 1
+// Profiling support.
+//
+// The profile timer uses the ITIMER_PROF, which means we get a SIGPROF
+// signal at the desired rate. The signal handler can obtain the address
+// of the interrupted code via a sigcontext structure. The contents of
+// the sigcontext structure and exactly how it gets passed to the signal
+// handler depends on the architecture, hence this code is x86-specific.
+//
+// The results of this profiling code seem a lot poorer than on other
+// targets, but it is not clear why. There may be some subtle
+// interaction between the system and profiling clocks.
+static void
+synth_prof_sighandler(int sig, struct cyg_hal_sys_sigcontext context)
+{
+ __profile_hit((CYG_ADDRWORD) context.hal_eip);
+ CYG_UNUSED_PARAM(int, sig);
+}
+
+int
+hal_enable_profile_timer(int resolution)
+{
+ struct cyg_hal_sys_sigaction action;
+ struct cyg_hal_sys_sigset_t mask;
+ struct cyg_hal_sys_itimerval timer;
+
+ // We want profiling to be an atomic operation. __profile_hit() is
+ // a very simple function which should return quickly, and there
+ // is no need for a DSR or context switching. Hence everything
+ // including SIGIO and SIGALRM are blocked, effectively giving the
+ // profiling timer the highest priority.
+ action.hal_mask = 0xffffffff;
+ action.hal_flags = CYG_HAL_SYS_SA_RESTORER;
+ action.hal_handler = (void (*)(int)) &synth_prof_sighandler;
+ action.hal_restorer = &cyg_hal_sys_restore;
+
+ if (0 != cyg_hal_sys_sigaction(CYG_HAL_SYS_SIGPROF, &action, (struct cyg_hal_sys_sigaction*) 0)) {
+ CYG_FAIL("Failed to install signal handler for SIGPROF");
+ }
+
+ // The resolution is limited by the underlying 100Hz system clock,
+ // there is no hardware timer which can generate faster clock
+ // interrupts.
+ if (resolution < 10000) {
+ resolution = 10000;
+ } else {
+ resolution = (resolution + 5000) / 10000;
+ resolution *= 10000;
+ }
+ timer.hal_it_interval.hal_tv_sec = 0;
+ timer.hal_it_interval.hal_tv_usec = resolution;
+ timer.hal_it_value.hal_tv_sec = 0;
+ timer.hal_it_value.hal_tv_usec = resolution;
+ if (0 != cyg_hal_sys_setitimer(CYG_HAL_SYS_ITIMER_PROF, &timer, (struct cyg_hal_sys_itimerval*) 0)) {
+ CYG_FAIL("Failed to initialize the profiling itimer");
+ }
+
+ // Now unblock SIGPROF
+ CYG_HAL_SYS_SIGEMPTYSET(&mask);
+ CYG_HAL_SYS_SIGADDSET(&mask, CYG_HAL_SYS_SIGPROF);
+ if (0 != cyg_hal_sys_sigprocmask(CYG_HAL_SYS_SIG_UNBLOCK, &mask, (cyg_hal_sys_sigset_t*)0)) {
+ CYG_FAIL("Failed to unblock SIGPROF");
+ }
+
+ return resolution;
+}
+
+#else
+
+// An alternative implementation that overloads the SIGALRM handler
+// rather than using SIGPROF. It does not seem to work any better.
+static void (*synth_profile_old_alrm_sighandler)(int);
+
+static void
+synth_profile_alrm_sighandler(int sig, struct cyg_hal_sys_sigcontext context)
+{
+ __profile_hit((CYG_ADDRWORD) context.hal_eip);
+ (*synth_profile_old_alrm_sighandler)(sig);
+}
+
+int
+hal_enable_profile_timer(int resolution)
+{
+ struct cyg_hal_sys_sigaction action;
+
+ if (0 != cyg_hal_sys_sigaction(CYG_HAL_SYS_SIGALRM, (const struct cyg_hal_sys_sigaction*)0, &action)) {
+ CYG_FAIL("Failed to retrieve old signal handler for SIGALRM");
+ }
+ synth_profile_old_alrm_sighandler = action.hal_handler;
+ action.hal_handler = (void (*)(int)) &synth_profile_alrm_sighandler;
+ if (0 != cyg_hal_sys_sigaction(CYG_HAL_SYS_SIGALRM, &action, (struct cyg_hal_sys_sigaction*)0)) {
+ CYG_FAIL("Failed to install new signal handler for SIGALRM");
+ }
+
+ return CYGNUM_HAL_RTC_PERIOD;
+}
+
+#endif
+
+// mcount() can be implemented largely using compiler built-ins. However
+// there are two complications. The generic profiling code assumes
+// __profile_mcount() is called with interrupts disabled. Blocking interrupts
+// won't stop the low-level signal handlers, so mcount() calls from those
+// may get lost because of the nesting test but that is fairly harmless.
+// Those signal handlers will complete before control returns here, i.e.
+// we have strict nesting, so there is no risk of the nested flag remaining
+// set while a context switch occurs. Also if eCos itself is built with
+// -pg then the compiler will insert a recursive call to mcount(), and
+// we have to guard against that.
+void
+mcount(void)
+{
+ static int nested = 0;
+ int enabled;
+
+ HAL_DISABLE_INTERRUPTS(enabled);
+ if (!nested) {
+ nested = 1;
+ __profile_mcount((CYG_ADDRWORD)__builtin_return_address(1),
+ (CYG_ADDRWORD)__builtin_return_address(0));
+ nested = 0;
+ }
+ HAL_RESTORE_INTERRUPTS(enabled);
+}
+
+#endif
diff --git a/ecos/packages/hal/synth/i386linux/current/src/syscall-i386-linux-1.0.S b/ecos/packages/hal/synth/i386linux/current/src/syscall-i386-linux-1.0.S
new file mode 100644
index 0000000..def5c2b
--- /dev/null
+++ b/ecos/packages/hal/synth/i386linux/current/src/syscall-i386-linux-1.0.S
@@ -0,0 +1,458 @@
+//=============================================================================
+//
+// syscall-i386-linux-1.0.S
+//
+// Linux system call interface functions for i386.
+//
+//=============================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
+//
+// eCos 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.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): proven
+// Contributors:proven,bartv
+// Date: 1998-10-06
+// Description: Machine dependent syscalls for i386/i486/i586
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+// The numbers come from <asm/unistd.h>
+#define SYS_setup 0 // Used only by init, to get system going.
+#define SYS_exit 1
+#define SYS_fork 2
+#define SYS_read 3
+#define SYS_write 4
+#define SYS_open 5
+#define SYS_close 6
+#define SYS_waitpid 7
+#define SYS_creat 8
+#define SYS_link 9
+#define SYS_unlink 10
+#define SYS_execve 11
+#define SYS_chdir 12
+#define SYS_time 13
+#define SYS_prev_mknod 14
+#define SYS_chmod 15
+#define SYS_lchown 16
+#define SYS_break 17
+#define SYS_oldstat 18
+#define SYS_lseek 19
+#define SYS_getpid 20
+#define SYS_mount 21
+#define SYS_umount 22
+#define SYS_setuid 23
+#define SYS_getuid 24
+#define SYS_stime 25
+#define SYS_ptrace 26
+#define SYS_alarm 27
+#define SYS_oldfstat 28
+#define SYS_pause 29
+#define SYS_utime 30
+#define SYS_stty 31
+#define SYS_gtty 32
+#define SYS_access 33
+#define SYS_nice 34
+#define SYS_ftime 35
+#define SYS_sync 36
+#define SYS_kill 37
+#define SYS_rename 38
+#define SYS_mkdir 39
+#define SYS_rmdir 40
+#define SYS_dup 41
+#define SYS_pipe 42
+#define SYS_times 43
+#define SYS_prof 44
+#define SYS_brk 45
+#define SYS_setgid 46
+#define SYS_getgid 47
+#define SYS_signal 48
+#define SYS_geteuid 49
+#define SYS_getegid 50
+#define SYS_acct 51
+#define SYS_phys 52
+#define SYS_lock 53
+#define SYS_ioctl 54
+#define SYS_fcntl 55
+#define SYS_mpx 56
+#define SYS_setpgid 57
+#define SYS_ulimit 58
+#define SYS_oldolduname 59
+#define SYS_umask 60
+#define SYS_chroot 61
+#define SYS_prev_ustat 62
+#define SYS_dup2 63
+#define SYS_getppid 64
+#define SYS_getpgrp 65
+#define SYS_setsid 66
+#define SYS_sigaction 67
+#define SYS_siggetmask 68
+#define SYS_sigsetmask 69
+#define SYS_setreuid 70
+#define SYS_setregid 71
+#define SYS_sigsuspend 72
+#define SYS_sigpending 73
+#define SYS_sethostname 74
+#define SYS_setrlimit 75
+#define SYS_getrlimit 76
+#define SYS_getrusage 77
+#define SYS_gettimeofday 78
+#define SYS_settimeofday 79
+#define SYS_getgroups 80
+#define SYS_setgroups 81
+#define SYS_select 82
+#define SYS_symlink 83
+#define SYS_oldlstat 84
+#define SYS_readlink 85
+#define SYS_uselib 86
+#define SYS_swapon 87
+#define SYS_reboot 88
+#define SYS_readdir 89
+#define SYS_mmapx 90
+#define SYS_munmap 91
+#define SYS_truncate 92
+#define SYS_ftruncate 93
+#define SYS_fchmod 94
+#define SYS_fchown 95
+#define SYS_getpriority 96
+#define SYS_setpriority 97
+#define SYS_profil 98
+#define SYS_statfs 99
+#define SYS_fstatfs 100
+#define SYS_ioperm 101
+#define SYS_socketcall 102
+#define SYS_klog 103
+#define SYS_setitimer 104
+#define SYS_getitimer 105
+#define SYS_newstat 106
+#define SYS_newlstat 107
+#define SYS_newfstat 108
+#define SYS_olduname 109
+#define SYS_iopl 110
+#define SYS_vhangup 111
+#define SYS_idle 112
+#define SYS_vm86old 113
+#define SYS_wait4 114
+#define SYS_swapoff 115
+#define SYS_sysinfo 116
+#define SYS_ipc 117
+#define SYS_fsync 118
+#define SYS_sigreturn 119
+#define SYS_clone 120
+#define SYS_setdomainname 121
+#define SYS_uname 122
+#define SYS_modify_ldt 123
+#define SYS_adjtimex 124
+#define SYS_mprotect 125
+#define SYS_sigprocmask 126
+#define SYS_create_module 127
+#define SYS_init_module 128
+#define SYS_delete_module 129
+#define SYS_get_kernel_syms 130
+#define SYS_quotactl 131
+#define SYS_getpgid 132
+#define SYS_fchdir 133
+#define SYS_bdflush 134
+#define SYS_sysfs 135
+#define SYS_personality 136
+#define SYS_afs_syscall 137 // Syscall for Andrew File System
+#define SYS_setfsuid 138
+#define SYS_setfsgid 139
+#define SYS__llseek 140
+#define SYS_getdents 141
+#define SYS__newselect 142
+#define SYS_flock 143
+#define SYS_syscall_flock 143
+#define SYS_msync 144
+#define SYS_readv 145
+#define SYS_syscall_readv 145
+#define SYS_writev 146
+#define SYS_syscall_writev 146
+#define SYS_getsid 147
+#define SYS_fdatasync 148
+#define SYS__sysctl 149
+#define SYS_mlock 150
+#define SYS_munlock 151
+#define SYS_mlockall 152
+#define SYS_munlockall 153
+#define SYS_sched_setparam 154
+#define SYS_sched_getparam 155
+#define SYS_sched_setscheduler 156
+#define SYS_sched_getscheduler 157
+#define SYS_sched_yield 158
+#define SYS_sched_get_priority_max 159
+#define SYS_sched_get_priority_min 160
+#define SYS_sched_rr_get_interval 161
+#define SYS_nanosleep 162
+#define SYS_mremap 163
+#define SYS_setresuid 164
+#define SYS_getresuid 165
+#define SYS_vm86 166
+#define SYS_query_module 167
+#define SYS_poll 168
+#define SYS_nfsservctl 169
+#define SYS_setresgid 170
+#define SYS_getresgid 171
+#define SYS_prctl 172
+#define SYS_rt_sigreturn 173
+#define SYS_rt_sigaction 174
+#define SYS_rt_sigprocmask 175
+#define SYS_rt_sigpending 176
+#define SYS_rt_sigtimedwait 177
+#define SYS_rt_sigqueueinfo 178
+#define SYS_rt_sigsuspend 179
+#define SYS_pread 180
+#define SYS_pwrite 181
+#define SYS_chown 182
+#define SYS_getcwd 183
+#define SYS_capget 184
+#define SYS_capset 185
+#define SYS_sigaltstack 186
+#define SYS_sendfile 187
+#define SYS_getpmsg 188
+#define SYS_putpmsg 189
+#define SYS_vfork 190
+#define SYS_ugetrlimit 191
+#define SYS_mmap2 192
+#define SYS_truncate64 193
+#define SYS_ftruncate64 194
+#define SYS_stat64 195
+#define SYS_lstat64 196
+#define SYS_fstat64 197
+#define SYS_lchown32 198
+#define SYS_getuid32 199
+#define SYS_getgid32 200
+#define SYS_geteuid32 201
+#define SYS_getegid32 202
+#define SYS_setreuid32 203
+#define SYS_setregid32 204
+#define SYS_getgroups32 205
+#define SYS_setgroups32 206
+#define SYS_fchown32 207
+#define SYS_setresuid32 208
+#define SYS_getresuid32 209
+#define SYS_setresgid32 210
+#define SYS_getresgid32 211
+#define SYS_chown32 212
+#define SYS_setuid32 213
+#define SYS_setgid32 214
+#define SYS_setfsuid32 215
+#define SYS_setfsgid32 216
+#define SYS_pivot_root 217
+#define SYS_mincore 218
+#define SYS_madvise 219
+#define SYS_madvise1 219
+#define SYS_getdents64 220
+#define SYS_fcntl64 221
+
+
+#define NAME(X) cyg_hal_sys_##X
+#define END(X) 1: ; .type NAME(X),@function ; .size NAME(X),1b - NAME(X)
+
+#define SYSCALL0(x) \
+ .globl NAME(x) ; \
+ \
+NAME(x): \
+ \
+ push %ebx; \
+ lea SYS_##x, %eax; \
+ int $0x80; \
+ pop %ebx; \
+ ret; \
+ \
+ END(x)
+
+#define SYSCALL1(x) \
+ .globl NAME(x) ; \
+ \
+NAME(x): \
+ \
+ push %ebx; \
+ mov 8(%esp), %ebx; \
+ lea SYS_##x, %eax; \
+ int $0x80; \
+ pop %ebx; \
+ ret; \
+ \
+ END(x)
+
+#define SYSCALL2(x) \
+ .globl NAME(x) ; \
+ \
+NAME(x): \
+ \
+ push %ebx; \
+ mov 8(%esp), %ebx; \
+ mov 12(%esp), %ecx; \
+ lea SYS_##x, %eax; \
+ int $0x80; \
+ pop %ebx; \
+ ret; \
+ \
+ END(x)
+
+#define SYSCALL3(x) \
+ .globl NAME(x) ; \
+ \
+NAME(x): \
+ \
+ push %ebx; \
+ mov 8(%esp), %ebx; \
+ mov 12(%esp), %ecx; \
+ mov 16(%esp), %edx; \
+ lea SYS_##x, %eax; \
+ int $0x80; \
+ pop %ebx; \
+ ret; \
+ END(x)
+
+
+#define SYSCALL4(x) \
+ .globl NAME(x) ; \
+ \
+NAME(x): \
+ \
+ push %ebx; \
+ push %esi; \
+ mov 12(%esp), %ebx; \
+ mov 16(%esp), %ecx; \
+ mov 20(%esp), %edx; \
+ mov 24(%esp), %esi; \
+ lea SYS_##x, %eax; \
+ int $0x80; \
+ pop %esi; \
+ pop %ebx; \
+ ret; \
+ END(x)
+
+#define SYSCALL5(x) \
+ .globl NAME(x) ; \
+ \
+NAME(x): \
+ \
+ push %ebx; \
+ push %esi; \
+ push %edi; \
+ mov 16(%esp), %ebx; \
+ mov 20(%esp), %ecx; \
+ mov 24(%esp), %edx; \
+ mov 28(%esp), %esi; \
+ mov 32(%esp), %edi; \
+ lea SYS_##x, %eax; \
+ int $0x80; \
+ pop %edi; \
+ pop %esi; \
+ pop %ebx; \
+ ret; \
+ END(x)
+
+
+//==========================================================================
+// Initial asm stuff for all functions.
+ .text
+ .align 2
+
+SYSCALL1(exit)
+SYSCALL0(fork)
+SYSCALL3(read)
+SYSCALL3(write)
+SYSCALL3(open)
+SYSCALL1(close)
+SYSCALL3(waitpid)
+SYSCALL2(creat)
+SYSCALL2(link)
+SYSCALL1(unlink)
+SYSCALL3(execve)
+SYSCALL1(chdir)
+SYSCALL1(time)
+SYSCALL2(chmod)
+SYSCALL3(lseek)
+SYSCALL0(getpid)
+SYSCALL0(getuid)
+SYSCALL1(nice)
+SYSCALL2(kill)
+SYSCALL2(rename)
+SYSCALL1(dup)
+SYSCALL1(pipe)
+SYSCALL1(brk)
+SYSCALL3(ioctl)
+SYSCALL3(fcntl)
+SYSCALL1(chroot)
+SYSCALL2(dup2)
+SYSCALL3(sigaction)
+SYSCALL2(gettimeofday)
+SYSCALL1(mmapx)
+SYSCALL2(socketcall)
+SYSCALL3(setitimer)
+SYSCALL3(sigprocmask)
+SYSCALL5(_newselect)
+SYSCALL3(readv)
+SYSCALL3(writev)
+SYSCALL1(fdatasync)
+SYSCALL2(getcwd)
+SYSCALL2(access)
+SYSCALL3(readdir)
+SYSCALL2(oldlstat)
+SYSCALL2(oldfstat)
+SYSCALL2(oldstat)
+SYSCALL2(newlstat)
+SYSCALL2(newfstat)
+SYSCALL2(newstat)
+SYSCALL2(mkdir)
+SYSCALL5(ipc)
+
+// ----------------------------------------------------------------------------
+// Special support for returning from a signal handler. In theory no special
+// action is needed, but with some versions of the kernel on some
+// architectures that is not good enough. Instead returning has to happen
+// via another system call.
+
+ .align 16
+ .global cyg_hal_sys_restore_rt
+cyg_hal_sys_restore_rt:
+ movl $SYS_rt_sigreturn, %eax
+ int $0x80
+1:
+ .type cyg_hal_sys_restore_rt,@function
+ .size cyg_hal_sys_restore_rt,1b - cyg_hal_sys_restore_rt
+
+ .align 8
+ .global cyg_hal_sys_restore
+cyg_hal_sys_restore:
+ popl %eax
+ movl $SYS_sigreturn, %eax
+ int $0x80
+1:
+ .type cyg_hal_sys_restore,@function
+ .size cyg_hal_sys_restore,1b - cyg_hal_sys_restore
diff --git a/ecos/packages/hal/synth/i386linux/current/src/tls.c b/ecos/packages/hal/synth/i386linux/current/src/tls.c
new file mode 100644
index 0000000..6ba4edc
--- /dev/null
+++ b/ecos/packages/hal/synth/i386linux/current/src/tls.c
@@ -0,0 +1,128 @@
+//=============================================================================
+//
+// tls.c
+//
+// Support for the per-thread data expected by parts of gcc
+//
+//=============================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// eCos 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.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): bartv
+// Contributors: bartv
+// Date: 2009-08-09
+//
+//####DESCRIPTIONEND####
+//=============================================================================
+
+#include <pkgconf/mlt_synth_i386_rom.h>
+#include <cyg/hal/hal_arch.h>
+
+// At the time of writing some parts of gcc assume thread-local storage as
+// provided by glibc. Of particular concern is -fstack-protector which is
+// enabled by default in some distros. Without matching target-side support
+// this causes synthetic target eCos applications to SEGV early on.
+
+// eCos only needs a single TLS data structure. This will need alignment
+// suitable for filling in an x86 descriptor table entry, so the linker
+// script places this structure right at the start of RAM.
+//
+// Installing a TLS area involves a system call set_thread_area().
+// This system call should be called from the assembler startup
+// before any C code starts running, or we'll run into problems with
+// -fstack-protector-all. However all relevant data can be
+// statically initialized.
+
+_HAL_TLS_Data _hal_synth_tls_data __attribute__ ((section (".tls._hal_synth_tls_data") )) = {
+ // The meaning of most of the tls fields is not clear, so just
+ // initialize them to 0 for now - until something else
+ // stops working.
+ .tls_tcb = (void*) 0,
+ .tls_dtv = (void*) 0,
+ .tls_self = (void*) 0,
+ .tls_multiple_threads = 0,
+ .tls_sysinfo = (void*) 0,
+ // This is the important one for the purposes of -fstack-protector.
+ // The compiler assumes that %gs:0x14 points at the base of the stack.
+ // For now we just point at the start of RAM. It should be possible
+ // to update this during context switches and at the start of interrupt
+ // handling to get a partial implementation of stack overflow checking.
+ .tls_stack_guard = (void*) CYGMEM_REGION_ram,
+
+ .tls_pointer_guard = (void*) 0,
+ .tls_gscope_flag = 0,
+ .tls_private_futex = 0,
+ .tls_private_tm[0] = (void*) 0,
+ .tls_private_tm[1] = (void*) 0,
+ .tls_private_tm[2] = (void*) 0,
+ .tls_private_tm[3] = (void*) 0,
+ .tls_private_tm[4] = (void*) 0
+};
+
+// The argument to set_thread_area() is not a _hal_synth_tls_data,
+// unfortunately. Instead it is a user_desc structure as per
+// <asm/ldt.h>.
+typedef struct _HAL_user_desc {
+ int ud_entry_number;
+ unsigned long ud_base_addr;
+ int ud_limits;
+ int ud_flags;
+} _HAL_user_desc;
+
+#define _HAL_USER_DESC_FLAGS_SEG_32BIT (0x01 << 0)
+#define _HAL_USER_DESC_FLAGS_CONTENTS_MASK (0x03 << 1)
+#define _HAL_USER_DESC_FLAGS_CONTENTS_SHIFT 1
+#define _HAL_USER_DESC_FLAGS_CONTENTS_DATA (0x00 << 1)
+#define _HAL_USER_DESC_FLAGS_CONTENTS_STACK (0x01 << 1)
+#define _HAL_USER_DESC_FLAGS_CONTENTS_CODE (0x02 << 1)
+#define _HAL_USER_DESC_FLAGS_READ_EXEC_ONLY (0x01 << 3)
+#define _HAL_USER_DESC_FLAGS_LIMIT_IN_PAGES (0x01 << 4)
+#define _HAL_USER_DESC_FLAGS_SEG_NOT_PRESENT (0x01 << 5)
+#define _HAL_USER_DESC_FLAGS_USEABLE (0x01 << 6)
+
+
+// And it can also be statically initialized. There is no need to worry
+// about alignment this time. Note that one of the fields gets updated
+// by the system call so this cannot be a const structure.
+
+_HAL_user_desc _hal_synth_user_desc = {
+ .ud_entry_number = -1, // Let the kernel pick the descriptor table entry
+ .ud_base_addr = (unsigned long) &_hal_synth_tls_data,
+ .ud_limits = 1, // A single page will do
+ .ud_flags = (_HAL_USER_DESC_FLAGS_SEG_32BIT |
+ _HAL_USER_DESC_FLAGS_CONTENTS_DATA |
+ _HAL_USER_DESC_FLAGS_READ_EXEC_ONLY |
+ _HAL_USER_DESC_FLAGS_LIMIT_IN_PAGES |
+ _HAL_USER_DESC_FLAGS_USEABLE)
+};
diff --git a/ecos/packages/hal/synth/i386linux/current/src/vectors.S b/ecos/packages/hal/synth/i386linux/current/src/vectors.S
new file mode 100644
index 0000000..768a5bb
--- /dev/null
+++ b/ecos/packages/hal/synth/i386linux/current/src/vectors.S
@@ -0,0 +1,131 @@
+##=============================================================================
+##
+## vectors.S
+##
+## x86 exception vectors
+##
+##=============================================================================
+## ####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+##
+## eCos 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.
+##
+## eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+##
+## As a special exception, if other files instantiate templates or use
+## macros or inline functions from this file, or you compile this file
+## and link it with other works to produce a work based on this file,
+## this file does not by itself cause the resulting work to be covered by
+## the GNU General Public License. However the source code for this file
+## must still be made available in accordance with section (3) of the GNU
+## General Public License v2.
+##
+## This exception does not invalidate any other reasons why a work based
+## on this file might be covered by the GNU General Public License.
+## -------------------------------------------
+## ####ECOSGPLCOPYRIGHTEND####
+##=============================================================================
+#######DESCRIPTIONBEGIN####
+##
+## Author(s): bartv
+## Contributors:bartv
+## Date: 2001-03-16
+## Purpose: Synthetic target startup
+## Description: When running on real hardware vectors.S contains
+## initialization code and usually the low-level interrupt and
+## exception support. On the synthetic target the latter is
+## handled by C code. The main initialization that is needed is
+## to jump into the C startup.
+##
+######DESCRIPTIONEND####
+##
+##=============================================================================
+
+# According the SVR4/i386 ABI, most registers are undefined. However
+# there is some interesting information on the stack:
+# %esp argc
+# %esp+4 argv[0]
+# ... argv[1 onwards]
+# %esp + (argc*4) NULL
+# ... environ[0]
+# ... ...
+# ... NULL
+#
+# There are some other things that could be done, for example aligning
+# the stack to a 16-byte boundary for SSE, but it is not clear which of
+# those things are actually useful. The glibc source file
+# sysdeps/i386/elf/start.S contains some relevant information.
+
+#==============================================================================
+
+ .file "vectors.S"
+
+ .extern _hal_synth_user_desc
+ .extern _linux_entry
+
+ .data
+ .global cyg_hal_sys_argc
+cyg_hal_sys_argc:
+ .long 0
+ .global cyg_hal_sys_argv
+cyg_hal_sys_argv:
+ .long 0
+ .global cyg_hal_sys_environ
+cyg_hal_sys_environ:
+ .long 0
+
+ .text
+ .globl _start
+_start:
+ popl %eax
+ movl %eax, cyg_hal_sys_argc
+ movl %esp, %ebx
+ movl %ebx, cyg_hal_sys_argv
+ inc %eax
+ addl %eax, %eax
+ addl %eax, %eax
+ addl %eax, %ebx
+ movl %ebx, cyg_hal_sys_environ
+
+ // Clear the frame pointer, to facilitate debugging
+ xorl %ebp, %ebp
+
+ // Align the stack to a 16-byte boundary.
+ andl $0xFFFFFFF0, %esp
+
+ // Set up the TLS section. This must be done before any
+ // C code gets to run, or -fstack-protector-all will fail.
+
+ // _hal_synth_user_desc is statically initialized in tls.c
+ movl $_hal_synth_user_desc,%ebx
+ // Syscall 243, set_thread_area
+ movl $0xf3, %eax
+ int $0x80
+
+ // The syscall may have failed. That should only happen if running
+ // on an old kernel which predates set_thread_area(), in which case
+ // we are probably also using an old gcc which does not yet support
+ // -fstack-protector. There is no obvious way forward if we are trying
+ // to run an executable built with recent gcc on an old kernel.
+ test %eax, %eax
+ jne 1f
+
+ // gs value = (_hal_synth_user_desc.ud_entry_number * 8) + 3
+ movl _hal_synth_user_desc,%eax
+ lea 0x3(,%eax,8),%eax
+ mov %eax,%gs
+
+1:
+ jmp _linux_entry