hal-i386-pc-20000210.html

Release notes for hal-i386-pc-20000210.tgz

Patrick O'Grady
patrick@softprocess.com

Contents

Introduction

Welcome to the February 10th, 2000 prerelease of the eCos HAL for a '386 or better PC!

The code assumes that you're using the CVS release of eCos on a UNIX host system.

This release supports the COM ports (8250s and 16550s), fixes an important bug when calling DSRs, includes break character support, properly handles segment violations, and enables 16550 FIFOs for GDB, configures the A20 line properly, supports software reset, allows malloc() to use all of conventional memory, and has a much cleaner installation, and making the boot diskette is much easier.  Use this code with the 'current' eCos source tree. The release is in ftp://sourceware.cygnus.com/pub/ecos/contrib/hal/i386/hal-i386-pc-20000210.tgz.

Installation Instructions

Use CVS to check out the current version of the ecos source tree (http://sourceware.cygnus.com/ecos/anoncvs.html), then untar this archive on top of it: use 'tar xvfz hal-i386-pc-20000210.tgz' in the same directory you ran the CVS checkout command:

cvs -d :pserver:anoncvs@anoncvs.cygnus.com:/cvs/ecos -z 9 co -P ecos
tar xvfz hal-i386-pc-20000210.tgz
To build a floppy disk, generate a stub-only version of the OS:
mkdir ecos-i386-stub
cd ecos-i386-stub
tclsh ../ecos/packages/pkgconf.tcl \
    --target i386 \
    --platform pc \
    --startup floppy \
    --disable-kernel \
    --disable-uitron \
    --disable-libc \
    --disable-libm \
    --disable-io \
    --disable-io_serial \
    --disable-wallclock \
    --disable-watchdog
make
(Now put a floppy disk in /dev/rfd0.1440)
make -C hal/i386/pc/current/src diskette
The last make instruction builds the GDB stub rom and writes it on to the floppy disk.  The stub has a simple debug mode which writes all of the transactions with GDB to the video display, so after booting you should see some cryptic message appear at the top of the target systems' display.  The stub is currently only tested to work with COM1.

Configure the regular OS with:

mkdir ecos-i386
cd ecos-i386
tclsh ../ecos/packages/pkgconf.tcl \
   --target i386 \
   --platform pc \
   --startup ram
make
make tests



Enhancements and fixes
 

I've added a pc_serial.c module which supports both 8250 and 16550 serial ports--special thanks to the AEB which has 16550s too.  So far I've only tested COM2 (/dev/tty1), 'cause GDB uses COM1.  If the driver detects a 16550a, then the FIFOs will be used to reduce interrupt overhead. Ah, whoops, didn't quite pass the right parameter for the interrupt object into DSRs.  All better now. The GDB stub now supports the break character ^C--so if your program runs away while running under GDB, just press Ctrl/C to stop it in it's tracks.  I've used the '386s DR0 to support this feature.  I've also fixed a bug in the support for segment violations--those types of exceptions push an extra value on to the stack which I didn't take off (the code was in the original stub, I just didn't understand why).  And if the GDB stub is communicating with the host through a 16550, it'll turn on the FIFO. Added a hal_pc_reset() function which uses the infameous triple-fault CPU reset technique to generate a software reset of the computer; and tweeked the malloc() call so that it now is configured to use all of standard memory.  I've also added hal_pc_idle_instrument and hal_pc_unidle_instrument macros in variant.inc to help detect the amount of CPU idle time: the hal_idle_thread_action() function calls hal_pc_idle_instrument before executing the 'hlt' instruction, and any interrupt invokes the hal_pc_unidle_instrument macro.  I use these to toggle an I/O bit... using an oscilloscope to watch that bit makes it really easy to see how busy the processor is.

Known Problems and Stuff to do

The serial ports don't have RTS/CTS or XON/XOFF handling, so we need to add that. I want to tweek the malloc driver so that it can use extended memory as well.  I hope that we can just mark the section from the top of standard memory (almost always 640k) to 1MB as allocated, and have the rest of memory go from there.

File list

Here are the components in the archive, representing those files changed from the current eCos source tree:

ecos/packages/packages
ecos/packages/targets
ecos/packages/hal/i386/arch/current/include/hal_arch.h
ecos/packages/hal/i386/arch/current/include/hal_intr.h
ecos/packages/hal/i386/arch/current/include/arch.inc
ecos/packages/hal/i386/arch/current/include/i386_stub.h
ecos/packages/hal/i386/arch/current/src/hal_intr.c
ecos/packages/hal/i386/arch/current/src/PKGconf.mak
ecos/packages/hal/i386/arch/current/src/hal_misc.c
ecos/packages/hal/i386/arch/current/src/vectors.S
ecos/packages/hal/i386/arch/current/src/i386_stub.c
ecos/packages/hal/i386/pc/current/include/var_intr.h
ecos/packages/hal/i386/pc/current/include/plf_stub.h
ecos/packages/hal/i386/pc/current/include/plf_misc.h
ecos/packages/hal/i386/pc/current/include/plf_intr.h
ecos/packages/hal/i386/pc/current/include/platform.inc
ecos/packages/hal/i386/pc/current/include/variant.inc
ecos/packages/hal/i386/pc/current/include/hal_diag.h
ecos/packages/hal/i386/pc/current/include/pkgconf/mlt_i386_pc_ram.mlt
ecos/packages/hal/i386/pc/current/include/pkgconf/mlt_i386_pc_ram.ldi
ecos/packages/hal/i386/pc/current/include/pkgconf/mlt_i386_pc_ram.h
ecos/packages/hal/i386/pc/current/include/pkgconf/mlt_i386_pc_floppy.ldi
ecos/packages/hal/i386/pc/current/include/pkgconf/hal_i386_pc.h
ecos/packages/hal/i386/pc/current/src/var_misc.c
ecos/packages/hal/i386/pc/current/src/plf_stub.c
ecos/packages/hal/i386/pc/current/src/plf_misc.c
ecos/packages/hal/i386/pc/current/src/hal_startup.c
ecos/packages/hal/i386/pc/current/src/hal_diag.c
ecos/packages/hal/i386/pc/current/src/PKGconf.mak
ecos/packages/hal/i386/pc/current/src/pool.cxx
ecos/packages/io/serial/current/include/pkgconf/io_serial.h
ecos/packages/io/serial/current/src/PKGconf.mak
ecos/packages/io/serial/current/src/common/tty.c
ecos/packages/io/serial/current/src/i386/pc_serial.c
ecos/packages/io/serial/current/src/i386/pc_serial.h
ecos/packages/language/c/libc/current/src/stdlib/malloc.cxx
ecos/packages/pkgconf/makevars

Hmm, Interesting...

Here's a dump from tm_basic, which is a thorough test of the performance of the system.  I'm running on a pretty old 486DX2-66:

Startup, main stack             : stack used   104 size  1792
Startup              : Idlethread stack used    52 size  2048

eCos Kernel Timings
Notes: all times are in microseconds (.000001) unless otherwise stated

Reading the hardware clock takes 13 'ticks' overhead
... this value will be factored out of all other measurements
Clock interrupt took   33.30 microseconds (39 raw clock ticks)

Testing parameters:
   Clock samples:            32
   Threads:                  53
   Thread switches:         128
   Mutexes:                  32
   Mailboxes:                32
   Semaphores:               32
   Scheduler operations:    128
   Counters:                 32
   Alarms:                   32
 

                                 Confidence
     Ave     Min     Max     Var  Ave  Min  Function
  ======  ======  ======  ====== ========== ========
   52.74   44.42   99.73    4.43   62%  26% Create thread
    4.60    4.19   17.60    0.73   88%  88% Yield thread [all suspended]
   10.99    7.54   54.48    2.96   62%  50% Suspend [suspended] thread
    3.94    2.51   22.63    1.07   58%  37% Resume thread
    8.11    5.87   22.63    2.02   41%  71% Set priority
    5.39    4.19   10.90    0.82   64%  33% Get priority
   26.01   17.60  124.87    4.85   73%  24% Kill [suspended] thread
    4.51    4.19    9.22    0.54   84%  84% Yield [no other] thread
   10.04    7.54   19.28    1.15   92%   3% Resume [suspended low prio] thread
    3.75    2.51    5.87    0.79   62%  32% Resume [runnable low prio] thread
    9.03    5.87   19.28    0.85   66%   1% Suspend [runnable] thread
    4.60    4.19    7.54    0.64   77%  77% Yield [only low prio] thread
    4.03    2.51   10.90    0.80   62%  26% Suspend [runnable->not runnable]
   15.29   12.57   31.01    1.23   92%   3% Kill [runnable] thread
    9.60    7.54   81.29    2.70   98%  98% Destroy [dead] thread
   18.71   15.92   39.39    1.27   96%   1% Destroy [runnable] thread
   58.27   54.48  113.14    3.95   96%  96% Resume [high priority] thread
   10.53    9.22   29.33    0.86   65%  32% Thread switch

    0.86    0.00   19.28    0.34   80%  17% Scheduler lock
    2.17    0.84    7.54    0.65   73%  24% Scheduler unlock [0 threads]
    2.32    0.84    7.54    0.62   71%  21% Scheduler unlock [1 suspended]
    2.27    0.84    7.54    0.69   67%  24% Scheduler unlock [many suspended]
    2.19    0.84    7.54    0.63   74%  23% Scheduler unlock [many low prio]

    4.24    2.51   29.33    1.57   53%  43% Init mutex
   10.11    2.51   67.88    4.18   71%  21% Lock [unlocked] mutex
    6.86    4.19   71.24    4.02   96%  96% Unlock [locked] mutex
    4.56    2.51   27.66    1.52   71%  25% Trylock [unlocked] mutex
    3.19    2.51    7.54    0.89   65%  65% Trylock [locked] mutex
    1.31    0.84    7.54    0.77   81%  81% Destroy mutex
   44.42   42.74   76.27    1.99   96%  96% Unlock/Lock mutex

    8.28    5.87   64.53    3.52   96%  96% Create mbox
    6.44    4.19   22.63    2.29   75%  71% Peek [empty] mbox
   10.00    4.19   88.00    5.04   87%  87% Put [first] mbox
    1.07    0.00    7.54    0.67   71%  15% Peek [1 msg] mbox
    5.76    4.19   14.25    0.69   75%  21% Put [second] mbox
    0.89    0.00    2.51    0.51   59%  25% Peek [2 msgs] mbox
   10.53    5.87   91.35    5.07   96%  96% Get [first] mbox
    8.70    5.87   24.30    2.34   59%  46% Get [second] mbox
    7.33    4.19   76.27    4.33   96%  96% Tryput [first] mbox
    6.08    4.19   37.71    2.07   96%  93% Peek item [non-empty] mbox
    7.54    4.19   59.50    3.25   84%  84% Tryget [non-empty] mbox
    4.82    4.19   12.57    0.94   75%  75% Peek item [empty] mbox
    4.87    4.19   10.90    0.94   68%  68% Tryget [empty] mbox
    1.07    0.00    7.54    0.58   81%   9% Waiting to get mbox
    1.07    0.00    9.22    0.69   75%  15% Waiting to put mbox
    7.59    4.19   47.77    2.51   90%  65% Delete mbox
   22.21   19.28   51.12    1.99   93%  75% Put/Get mbox

    3.61    2.51    9.22    0.96   53%  43% Init semaphore
    5.45    2.51    9.22    2.23   59%  46% Post [0] semaphore
    3.56    2.51   10.90    1.05   96%  50% Wait [1] semaphore
    3.98    2.51   32.69    1.92   96%  96% Trywait [0] semaphore
    3.51    2.51    9.22    0.99   96%  50% Trywait [1] semaphore
    1.94    0.84   10.90    1.10   96%  50% Peek semaphore
    1.36    0.84    7.54    0.82   78%  78% Destroy semaphore
   18.54   15.92   31.01    1.28   93%   3% Post/Wait semaphore

    4.82    2.51   27.66    1.62   81%  15% Create counter
    5.81    4.19   15.92    0.91   62%  28% Get counter value
    1.68    0.84   10.90    1.10   96%  65% Set counter value
    5.24    4.19   14.25    1.24   93%  59% Tick counter
    1.78    0.84    9.22    1.06   96%  56% Delete counter

    5.66    4.19   24.30    1.56   90%  53% Create alarm
   11.26    7.54   37.71    3.03   75%  56% Initialize alarm
    1.15    0.00   10.90    0.78   78%  12% Disable alarm
    9.11    7.54   32.69    1.77   93%  93% Enable alarm
    1.83    0.84    9.22    1.06   96%  53% Delete alarm
    5.92    4.19   12.57    0.62   75%  15% Tick counter [1 alarm]
   27.92   27.66   36.04    0.51   96%  96% Tick counter [many alarms]
    9.85    9.22   17.60    0.94   75%  75% Tick & fire counter [1 alarm]
  145.88  144.99  155.05    1.22   90%  68% Tick & fire counters [>1 together]
   32.06   31.01   42.74    1.18   96%  56% Tick & fire counters [>1 separately]
   19.79   17.60   96.38    1.21   92%   6% Alarm latency [0 threads]
   22.20   19.28   74.59    2.48   60%  55% Alarm latency [2 threads]
   48.23   37.71   93.03    7.06   60%  52% Alarm latency [many threads]
   44.33   42.74  163.43    1.98   99%  97% Alarm -> thread resume latency

  251     212     336  (main stack:   856)  Thread stack used (592 total)
All done, main stack            : stack used   856 size  1792
All done             : Idlethread stack used   320 size  2048

Timing complete - 28520 ms total