File: i386-pc-0.1.html Release notes for the prerelease version (0.1) of hal/i386/pc. 1.0 Introduction This module contains some code to support running eCos-1.2.1 on a standard PC. Two startup models are provided: floppy and ram. Also included is an incomplete GDB stub for downloading programs and basic debugging. This release is incomplete--a list of problems are listed below for anyone interested in helping to complete this port. I've been using FreeBSD for my development environment, so if you're using Windows, you'll have to figure out a few of the commands for yourself--hopefully someone can volunteer to help with this configuration. I may have messed up some Linux configuration stuff--I don't currently have a Linux system to test with. Some of the installation examples shown here may be using ksh specific syntax; any more generalized suggestions are encouraged. 1.1 What do I get? The incomplete GDB stub, interrupt support (ISRs and DSRs), and basic multithreading. Not much else has been tested yet--I've successfully ran a few of the test programs (including thread0, thread1, and other multithreading examples), and not been so successful with others (thread2). This release takes care of a bunch of '386 CPU configuration issues, including switching to protected mode and detecting the vector and saving/restoring the CPU state when an interrupt is triggered. 1.2 What don't I get? Windows development platforms. GDB isn't thread-aware. Complete testing of all of the features of the system. Drivers for serial ports or other devices. This is a great starting point for finishing the rest of the port: please contribute all the help you can. 2.0 Included files Here is a list of the files added or modified by this package: ecos-1.2.1/packages/targets Added the pc platform, listing 'ram' and 'floppy' startups. Changed the development tool prefix from 'i686-pc-linux-gnu' to 'i386-elf'. Made the PC platform use the CYGPKG_HAL_I386_PC package. ecos-1.2.1/packages/packages Added CYGPKG_HAL_I386_PC package. ecos-1.2.1/packages/pkgconf/makevars I'm using FreeBSD instead of linux; so I had to add a '-C' option to the install program. This will likely break other systems. ecos-1.2.1/packages/kernel/v1_2_1/include/pkgconf/kernel.h Added identifiers for initializing the real time clock for CYG_HAL_I386_PC systems. You can bet that these identifiers will be moved to a more platform-specific place soon. ecos-1.2.1/packages/hal/i386/pc/v1_2_1/ChangeLog ecos-1.2.1/packages/hal/i386/pc/v1_2_1/include/hal_diag.h ecos-1.2.1/packages/hal/i386/pc/v1_2_1/include/pkgconf/mlt_i386_pc_ram.ldi ecos-1.2.1/packages/hal/i386/pc/v1_2_1/include/pkgconf/mlt_i386_pc_ram.mlt ecos-1.2.1/packages/hal/i386/pc/v1_2_1/include/pkgconf/mlt_i386_pc_floppy.ldi ecos-1.2.1/packages/hal/i386/pc/v1_2_1/include/pkgconf/hal_i386_pc.h ecos-1.2.1/packages/hal/i386/pc/v1_2_1/include/plf_stub.h ecos-1.2.1/packages/hal/i386/pc/v1_2_1/include/hal_platform_ints.h ecos-1.2.1/packages/hal/i386/pc/v1_2_1/src/entry.c ecos-1.2.1/packages/hal/i386/pc/v1_2_1/src/hal_diag.c ecos-1.2.1/packages/hal/i386/pc/v1_2_1/src/hal_startup.c ecos-1.2.1/packages/hal/i386/pc/v1_2_1/src/PKGconf.mak ecos-1.2.1/packages/hal/i386/pc/v1_2_1/src/pc.S ecos-1.2.1/packages/hal/i386/pc/v1_2_1/src/plf_stub.c ecos-1.2.1/packages/hal/i386/pc/v1_2_1/src/hal_clock.c These files were originally copied from the linux synthetic target and modified for use with the PC. The mlt_i386_pc_floppy.ldi script (for 'floppy' startup) tells the linker to place the startup code at location 0x1000 (4k bytes). The stack will work from 0x1000 down. The startup code will read in the rest of its own image (note that this is only marginally tested--there may be problems with reading larger images), and then switch to protected mode. The GDB stub is the only program that's been tested with this startup. It just stops with a breakpoint after completing initialization. The mlt_i386_pc_ram.ldi script (for 'ram' startup) is intended for applications to be loaded and executed under the GDB stub. The code is loaded at 0x8000 (32k bytes)--therefore requiring that the stub be less than 32k bytes long. vectors.S in this mode assumes that we've already configured for protected (flat memory model) mode. ecos-1.2.1/packages/hal/i386/arch/v1_2_1/include/hal_arch.h ecos-1.2.1/packages/hal/i386/arch/v1_2_1/include/hal_intr.h ecos-1.2.1/packages/hal/i386/arch/v1_2_1/include/i386.inc ecos-1.2.1/packages/hal/i386/arch/v1_2_1/include/i386_stub.h ecos-1.2.1/packages/hal/i386/arch/v1_2_1/src/context.S ecos-1.2.1/packages/hal/i386/arch/v1_2_1/src/hal_misc.c ecos-1.2.1/packages/hal/i386/arch/v1_2_1/src/i386.ld ecos-1.2.1/packages/hal/i386/arch/v1_2_1/src/PKGconf.mak ecos-1.2.1/packages/hal/i386/arch/v1_2_1/src/vectors.S ecos-1.2.1/packages/hal/i386/arch/v1_2_1/src/i386_stub.c ecos-1.2.1/packages/hal/i386/arch/v1_2_1/src/hal_intr.c ecos-1.2.1/packages/hal/i386/arch/v1_2_1/src/i386_context.c These files have been modified for use with the PC platform. Modifications here have *very likely* broken the linux synthetic target; and a bunch of stuff here will eventually be rearranged--for example, vectors.S contains the startup code which is very platform specific-- there should be another module for initialization of the platform itself, and the linker scripts should be updated to include that code first. ecos-1.2.1/packages/hal/common/v1_2_1/tests/intr.c The interrupt test program was modified with the proper real time clock values for use with the PC. ecos-1.2.1/packages/hal/common/v1_2_1/src/stubrom/PKGconf.mak A 'diskette' rule was added to the makefile; use 'make diskette' in order to create a bootable diskette. Not likely to work on non-unix systems; you will also have to give yourself write permission on '/dev/rfd0.1440'; and the code will only work when booting from 3.5" disks. 3.0 Installation I've included just the modified or added files with the standard distribution, so installation requires installing the development tools, unpacking the eCos distribution, and putting the modified stuff on top of it. 3.1 Configuration of the development tools To configure the development tools for 'i386-elf' targets, try using this command. I've unpacked the tools into ~/cygnus/ecosSWtools-990319. You may have to substitute different values per your installation: $ mkdir ~/cygnus/i386-tools $ cd ~/cygnus/i386-tools $ SWTOOLS=~/cygnus/ecosSWtools-990319 $ SWHOST=`~/cygnus/ecosSWtools-990319/src/config.guess` $ $SWTOOLS/src/configure -v \ --prefix=$SWTOOLS \ --exec-prefix=$SWTOOLS/H-$SWHOST \ --target=i386-elf $ make $ make install This configuration stuff is from http://sourceware.cygnus.com/ecos/install-linux.html. I don't recall having any trouble creating any of the tools--I did it so long ago that I don't really remember if anything needed tweeking--although it does seem like you'll have trouble if you have '.' in your path (see the webpage). If you have trouble, just drop a note onto ecos-discuss@sourceware.cygnus.com. Finally, after all the compilation is done, make sure that your PATH includes the tool installation directory, and that the environment variable XCC is set to 'i386-elf-gcc'. 3.2 Add new sources for eCos The procedure for adding the new files isn't very smart: tar will simply overwrite any existing files that are updated in the archive--so I've made a point of only including the minimum necessary for the update. It's quite possible that my changes have broken the linux synthetic target--I don't have a system for testing that configuration. Untar the ecos-1.2.1.tgz file--I've been using ~/cygnus: $ cd ~/cygnus $ tar xvfz ecos-1.2.1.tgz This creates the ecos-1.2.1 subdirectory with all of the source tree. Untar hal-i386-pc-0.1.tar on top of it: $ tar xvf hal-i386-pc-0.1.tar Now all of the source files are in place. 3.3 Build an eCos GDB stub floppy I've been doing this in ~/cygnus/ecos-i386-stub: $ mkdir ~cygnus/ecos-i386-stub $ cd ~cygnus/ecos-i386-stub $ tclsh ~/cygnus/ecos-1.2.1/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 It's probably a good idea to 'rm -r ~/cygnus/ecos-i386-stub' first if you are reinstalling. Apply a few patches to pkgconf/hal.h to turn on the stub: $ patch pkgconf/hal.h hal.h.diff The file hal.h.diff is wherever you untarred this file. Now compile the system and the stub rom: $ make $ make -C hal/common/v1_2_1/src/stubrom To write the stub onto the disk: $ make -C hal/common/v1_2_1/src/stubrom diskette This step could fail for a number of reasons: I don't think that Windows users will have 'dd' available; the system will require write permission for '/dev/rfd0.1440'; and the boot code itself only works with 3.5" drives. The diskette can now be used to reboot virtually any '386 or better PC. All communication with GDB running in the host computer is performed over COM1. I also put in a debugging feature: all characters sent and received over the COM port are poked into the VGA display buffer--so all transactions with the host computer can be monitored by watching the display. 3.4 Configuration of eCos applications Configure the operating system: $ mkdir ~/cygnus/ecos-i386 $ cd ~/cygnus/ecos-i386 $ tclsh ~/cygnus/ecos-1.2.1/packages/pkgconf.tcl \ --target i386 \ --platform pc \ --startup ram And make sure that the environment variable PKG_INSTALL_DIR points to it: $ PKG_INSTALL_DIR=~/cygnus/ecos-i386/install $ export PKG_INSTALL_DIR The operating system and test programs are built with: $ make $ make tests So long as everything compiles ok, you should be able to build an application program for downloading with GDB. 4.0 What do I do if ...? Post a note to ecos-discuss@sourceware.cygnus.com. Someone there knows how to help you. Good luck! -patrick Patrick O'Grady patrick@plasticgrape.com