Warning, /bsps/i386/pc386/README.md is written in an unsupported language. File is not indexed.
0001 pc386
0002 =====
0003
0004 This board support package works with a target PC
0005
0006 This BSP supports a standard Intel/AMD PC on i386 and up CPUs. If on
0007 a Pentium or above, the TSC register is used for timing calibration
0008 purposes rather than relying entirely on the i8254.
0009
0010 Partial support is implemented for more modern PCs which do not have
0011 a complete complement of legacy peripherals.
0012
0013
0014 Console/Printk Device Selection
0015 -------------------------------
0016 The pc386 console device driver supports a variety of devices
0017 including the VGA/keyboard and a number of serial ports. The
0018 default console is selected based on which devices are present
0019 in the following order of priority:
0020
0021 + VGA and keyboard
0022 + COM1 through COM4aaa
0023
0024 + Any COM devices on the PCI bus including IO and memory mapped.
0025
0026 Beyond the dynamic probing for device presence, a combination of
0027 configure and boot time options are available. By default, all devices
0028 are enabled. The configure time options are:
0029
0030 + BSP_ENABLE_VGA - value of 1 to enable, 0 to disable
0031 + BSP_ENABLE_COM1_COM4 - value of 1 to enable, 0 to disable
0032 + BSP_USE_COM1_AS_CONSOLE - value of 1 forces console to COM1
0033
0034 An example of using these to force the console to COM1 is:
0035
0036 ```shell
0037 ../rtems/configure --target=i386-rtems4.12 \
0038 USE_COM1_AS_CONSOLE=1 --enable-rtemsbsp=pc386 \
0039 ... other arguments ...
0040 ```
0041
0042 The --console and --printk options can be used to specify the
0043 device associated with stdin, stdout, and stderr as well as
0044 the device associated with kernel debug IO (e.g. printk()/getk()).
0045 Both take the name of a device without the "/dev/" prefix.
0046
0047 The --console argument is interpreted first and assumed to
0048 specify the console and kernel debug IO device. The --printk
0049 is then interpreted to specify the debug kernel IO device.
0050 For example,
0051
0052 ```shell
0053 --console=/dev/com1 --printk=/dev/vgacons
0054 ```
0055
0056 specifies that com1 is to be used for stdin, stdout, and stderr
0057 while the VGA console is to be used for kernel debug IO.
0058 Note that the lower case com1 is intentional as this maps to
0059 the RTEMS device /dev/com1.
0060
0061 The device name may be followed by a baud rate. The following
0062 example illustrates this:
0063
0064 ```shell
0065 --console=/dev/com1,19200 --printk=/dev/vgacons
0066 ```
0067
0068 If the specified device is not present, then a suitable fallback
0069 device is selected. The fallback order is based upon the probe
0070 order listed earlier.
0071
0072 PCI UART devices are /dev/pcicom1 etc as they are probed and found.
0073
0074 GDB
0075 ---
0076
0077 GDB can be support using:
0078
0079 ```
0080 --gdb=/dev/com1,115200 : where the device and baudrate are selectable.
0081 --gdb-break : halt at a break point in the BSP and wait for GDB.
0082 --gdb-remote-debug : Output the GDB remote protocol data to printk
0083 ```
0084
0085 The GDB stub details and in shared/comm/GDB.HOWTO.
0086
0087
0088 SMP
0089 ---
0090 The following files were developed by Erich Boleyn <erich@uruk.org>.
0091 The original files were copied from http://www.uruk.org/mps/ and committed
0092 into cvs as is. These files will be modified for RTEMS smp support,
0093 but the original files are being committed in order to track any file
0094 changes that occur. We are attempting to keep these changes as minimal
0095 and conainted as possible.
0096
0097 * start/smp-imps.c
0098 * ../include/bsp/smp-imps.h
0099 * ../include/bsp/apic.h
0100
0101
0102 Status
0103 ------
0104 There are a wide range of PC configurations. This BSP has been tested
0105 on only a handful. There are configurations which do not yet work. The
0106 failure is suspected to be video card related. Here is a list of
0107 successes and failures.
0108
0109 ```
0110 SUCCESSES
0111 =========
0112 GRUB - AMD K6 MMX 200Mhz + S3 ViRGE
0113 GRUB - 486 DX 33Mhz + Cirrus Logic CL-GD540x/542x
0114 GRUB - Pentium MMX 166Mhz + S3 Trio 64V2
0115 GRUB - Pentium (P54C) 120Mhz + S3 Trio 64V+
0116 GRUB - Pentium-S 133Mhz + S3 Trio 64V2
0117
0118 FAILURES
0119 ========
0120 GRUB - 486 DX2 66Mhz + Cirrus Logic CL-GD5428 - reset
0121 GRUB - PII 333 Mhz + STB Vision 128 - reset
0122 GRUB - PII 300 Mhz + Permedia - reset
0123 GRUB - Pentium 60 Mhz + Mach 32/64 - reset
0124 ```
0125
0126
0127 dec21140
0128 --------
0129 The dec21140 network driver is found in libchip/networking.
0130
0131
0132 HOWTO
0133 -----
0134 +-----------------------------------------------------------------------------+
0135 | RTEMS 4.6.0 PC386 BSP HOWTO - 2003/05/08 |
0136 | |
0137 +-----------------------------------------------------------------------------+
0138 | (C) Copyright 1998 - |
0139 | - NavIST Group - Real-Time Distributed Systems and Industrial Automation |
0140 | |
0141 | http://pandora.ist.utl.pt |
0142 | |
0143 | Instituto Superior Tecnico * Lisboa * PORTUGAL |
0144 +-----------------------------------------------------------------------------+
0145 | Disclaimer: |
0146 | |
0147 | This file is provided "AS IS" without warranty of any kind, either |
0148 | expressed or implied. |
0149 +-----------------------------------------------------------------------------+
0150 | History: |
0151 | 12 June 2000 - Updated to 4.5 (Joel) |
0152 | 8 May 2003 - PXE GRUB (Chris Johns) |
0153 +-----------------------------------------------------------------------------+
0154
0155
0156 1. Introduction
0157 ---------------
0158
0159 This tries to explain how to setup the RTEMS host environment so
0160 that RTEMS applications can be built for and run in a bare PC 386 or
0161 above.
0162
0163 It covers essentially the aspects of loading images, since
0164 information concerning other issues such as building the development
0165 tools and the RTEMS distribution can be found in the 'RTEMS 4.6.0
0166 On-Line Library' under 'Getting Started with RTEMS for C/C++ Users'.
0167
0168 Please note that everything in the following text using the
0169 notation '<...>' is just an alias to something and should always be
0170 substituted by the real thing!
0171
0172
0173 2. Building the GNU C/C++ Cross Compiler Toolset
0174 ------------------------------------------------
0175
0176 Obtaining, building and installing the tools for building the
0177 PC386 BSP of RTEMS is covered in detail in the 'RTEMS 4.6.0 On-Line
0178 Library' -> 'Getting Started with RTEMS for C/C++ Users'. You can
0179 either use pre-built toolset executables or build your own from
0180 the instructions given there.
0181
0182 This BSP is designed to work only with ELF toolset configurations.
0183 This is format used by the i386-rtems target.
0184
0185
0186 4. Building RTEMS
0187 -----------------
0188 Obtaining, building and installing the tools for building the
0189 PC386 BSP is covered in detail in the 'RTEMS 4.6.0 On-Line Library' ->
0190 'Getting Started with RTEMS for C/C++ Users' -> 'Building RTEMS'.
0191
0192 When running configure, use the following values for the listed
0193 options with an i386-rtems toolset:
0194
0195 ```shell
0196 --target=i386-rtems
0197 --enable-rtemsbsp=pc386
0198 ```
0199
0200 5. RTEMS Tests
0201 --------------
0202
0203 If you've completed the last step successfully, you'll find the
0204 RTEMS sample and test files that can be loaded with GRUB in the
0205 '<build_point>/pc386/tests' directory, RTEMS sample and test files in
0206 a format suitable for use with NetBoot in the
0207 '<build_point>/pc386/BootImgs' directory.
0208
0209
0210 6. Loading RTEMS PC386 applications
0211 -----------------------------------
0212
0213 6.1. Unarchiving
0214 ----------------
0215
0216 Files which have been "tarred, gzipped" (i.e. .tar.gz or .tgz
0217 extension) may be unarchived with a command similar to one of the
0218 following:
0219
0220 ```shell
0221 zcat <file>.tgz | tar xvof -
0222 ```
0223 OR
0224
0225 ```shell
0226 gunzip -c <file>.tgz | tar xvof -
0227 ```
0228 OR
0229
0230 ```shell
0231 tar xzvf <file>.tgz
0232 ```
0233 NOTE: gunzip -c is equivalent to zcat. On commercial (non-Linux)
0234 Unices, since the GNU utilities are not the standard 'tar' will be
0235 gtar (GNU tar) and 'zcat' will be 'gzcat'.
0236
0237 Given that the necessary utility programs are installed, any of
0238 the above commands will extract the contents of <file>.tar.gz into the
0239 current directory. To view the contents of an archive without
0240 restoring any files, use a command similar to the following:
0241
0242 ```shell
0243 zcat <file>.tgz | tar tvf -
0244 ```
0245
0246 6.2 Using GRUB to load RTEMS PC386 applications from Floppy
0247 -----------------------------------------------------------
0248
0249 Using GRUB (GRand Unified Bootloader) is the simplest way to load
0250 and run your PC386 BSP samples, tests and programs. You will need to build GRUB
0251 so you need a working GCC and friends. The online documentation for GRUB lists
0252 what you need:
0253
0254 - http://www.gnu.org/manual/grub/html_node/index.html
0255
0256 You can get the latest release of GRUB from its homepage:
0257
0258 - http://www.gnu.org/software/grub/
0259
0260 Once you obtain the .tar.gz archive from:
0261
0262 - ftp://alpha.gnu.org/gnu/grub/
0263
0264 Download the lastest version (grub-0.93.tar.gz), change to a temporary
0265 directory (you won't need the grub files after this and can just go ahead and
0266 delete the whole directory structure that was generated) and unarchive
0267 'grub-0.93.tar.gz' following the instructions given above in [2. Unarchiving].
0268
0269 ```shell
0270 $ cd /tmp
0271 $ mkdir grub
0272 $ cd grub
0273 $ cat grub-0.93.tar.gz | gzip -d | tar xf -
0274 ```
0275
0276 after this is done create a build directory and decend into it:
0277
0278 ```shell
0279 $ mkdir build
0280 $ cd build
0281 ``
0282 then configure GRUB with the standard options:
0283
0284 ```shell
0285 $ ../grub-0.93/configure
0286 ```
0287
0288 and if successful run make:
0289
0290 ```shell
0291 $ make
0292 ```
0293
0294 Once complete you should have the 'stage1' and 'stage2' files. They will be
0295 in the directories with the same name.
0296
0297 You should have two (2) formatted diskettes available. One of
0298 these will only be used temporarily to create the other one, and we'll
0299 refer to it as 'RAW GRUB' diskette (you can label it accordingly if
0300 you wish). The other diskette, which we will refer to as 'GRUB FS'
0301 should be high-level formatted with one of GRUB's supported file
0302 systems, which are: DOS FAT, BSD FFS, and Linux ext2fs.
0303
0304 A DOS FAT diskette can, obviously, be created under DOS with the
0305 'FORMAT' command. Under Linux, the following commands are available to
0306 add file systems to low-level formatted diskettes:
0307
0308 1. To add a DOS FAT file system to a low-level formatted diskette:
0309
0310 a) If you have mtools installed:
0311
0312 'mformat a:'.
0313
0314 b) Assuming that you are formatting the diskette in the first
0315 floppy disk drive ('/dev/fd0' under Linux):
0316
0317 'mkdosfs /dev/fd0' or
0318
0319 'mkfs.msdos /dev/fd0'.
0320
0321 2. To add a Linux ext2fs file system to a low-level formatted
0322 diskette, assuming that you are formatting the diskette in the
0323 first floppy disk drive ('/dev/fd0' under Linux):
0324
0325 'mke2fs /dev/fd0' or
0326
0327 'mkfs.ext2 /dev/fd0'.
0328
0329 Next we will install using 'rawrite' or 'dd' to the 'GRUB RAW'
0330 diskette.
0331
0332 NOTE: This will destroy any data currently on the diskette.
0333
0334 Execute your OS's equivalent of (this should work for recent
0335 FreeBSD versions and Linux just fine):
0336
0337 ```shell
0338 dd if=stage1/stage1 of=/dev/fd0 bs=512 count=1
0339 dd if=stage2/stage2 of=/dev/fd0 bs=512 seek=1
0340 ```
0341
0342 Under DOS/Windows/NT, courtesy of Eric Hanchrow (erich@microsoft.com):
0343
0344 * Use the copy /b command to binary concatenate the stage1 and
0345 stage2 files together via:
0346
0347 ```shell
0348 copy /b stage1\stage1 stage2\stage2 grub.raw
0349 ```
0350
0351 * Use rawrite.exe (which is available in many places on the net and
0352 in some Linux distributions) to write grub.raw to a diskette.
0353
0354 (CCJ: I am not sure about the Windows location etc)
0355
0356 Next stage: copy the 'stage1' and 'stage2' files to the 'GRUB FS'
0357 diskette (if you are using Linux you can mount the diskette in an
0358 appropriate mount point and then 'cp' the files to it, if it is either
0359 a DOS FAT or an EXT2FS diskette, or in the case of a DOS FAT diskette
0360 you can use 'mcopy' from 'mtools'.)
0361
0362 After this is done boot a PC using the 'GRUB RAW' diskette. After
0363 this is done, you will get GRUB's command line interface. Exchange
0364 'GRUB RAW' with the 'GRUB FS' diskette in the drive and issue the
0365 following command from GRUB's prompt:
0366
0367 ```shell
0368 install=(fd0)/stage1 (fd0) (fd0)/stage2 0x8000 (fd0)/grubmenu
0369 ```
0370 This command will make the 'GRUB FS' diskette bootable. After this
0371 is done, you won't require the 'GRUB RAW' diskette anymore and you can
0372 delete the 'stage1' file from the 'GRUB FS' diskette.
0373
0374 Next copy all the files you wish to load to the diskette. The GRUB
0375 loadable test and sample files in the RTEMS distribution have '.exe'
0376 extension and can be found under the build point in the 'pc386/tests'
0377 directory. You can compress this files with gzip to save space if you
0378 wish. GRUB loads 'gzipped' files transparently.
0379
0380 Finally you have to create a GRUB menu configuration file. We will
0381 call this file 'grubmenu'. You can call it anything as long as you use
0382 the correct name in the 'install' command where we used 'grubmenu'.
0383
0384 The 'grubmenu' file, as far as we are interested has the following
0385 syntax:
0386
0387 title= Hello World Test
0388 kernel= (fd0)/hello.exe.gz
0389
0390 You can add as many of this entries as you want to the 'grubmenu'
0391 file. There should be one for each program you wish to load. The
0392 'title=' line provides a description for the program that will appear
0393 after boot in the GRUB menu for the user to choose and the 'kernel='
0394 line describes where the file can be found by GRUB (you should leave
0395 the '(fd0)/' part and just substitute the rest if you've copied the
0396 files to the root directory of the diskette.
0397
0398 Just boot the PC with the 'GRUB FS' diskette and you will be able
0399 to choose which program you want to load from GRUB's menu.
0400
0401 The GRUB documentation is available in HTML format in the 'docs'
0402 directory of the GRUB tree starting with the 'index.html' file.
0403
0404
0405 6.3 Using GRUB to load RTEMS PC386 applications via PXE NetBoot
0406 ----------------------------------------------------------------
0407
0408 PXE is the Intel Preboot Execution Environment. A number of PC
0409 manufactures provide a PXE option in the BIOS. This is usually a
0410 Net Boot option in a BIOS configuration screen. The simplist way to
0411 load an RTEMS application via PXE is to use GRUB as a first stage
0412 loader.
0413
0414 You will need to determine your network card, and have a working
0415 network with a DHCP (or BOOTP), and TFTP server.
0416
0417 You may to find a TFTP server that does not support option
0418 negotiations. A google search shows a number of PC's have a buggy
0419 PXE loader. Supressing option negotiations seems to make them
0420 work.
0421
0422 You will need to build GRUB for your network card. Follow the
0423 procedure in item 6.2 up to the configure point. At this point
0424 run the following configure command:
0425
0426 ```shell
0427 $ ../grub-0.93/configure --enable-diskless --enable-eepro100
0428 ```
0429
0430 for an Etherexpress Pro 100 network card, then run make:
0431
0432 ```shell
0433 $ make
0434 ```
0435
0436 Once complete you should have the 'stage2/pxegrub' file. Copy
0437 this to your TFTP server's download directory. Configure your
0438 DHCP server to provide an IP address and download the image. For
0439 the ISC server found on operating systems such as Linux something
0440 like the following should do:
0441
0442 ```shell
0443 #
0444 # PC loading RTEMS via PXE and GRUB
0445 #
0446
0447 group
0448 {
0449 filename "/tftpboot/pxeboot";
0450 host rtems-pc { hardware ethernet 00:08:c7:73:41:65; }
0451 }
0452 ```
0453
0454 If all works your PC should boot and load GRUB over the network:
0455
0456 ```shell
0457 GRUB version 0.93 (639K lower / 64512K upper memory)
0458
0459 Address: 10.10.10.10
0460 NetMask: 255.255.255.0
0461 Server: 10.10.10.1
0462 Gateway: 10.10.10.1
0463
0464 [ Minimal BASH-like line editing is supported. For the first word, TAB
0465 lists possible command completions. Anywhere else TAB lists the possible
0466 completions of a device/filename. ]
0467
0468 grub>
0469 ```
0470 Copy your RTEMS executable to the TFTP server directory then enter
0471 the following GRUB commands:
0472
0473 ```shell
0474 grub> root (nd)
0475 Filesystem type is tftp, using whole disk
0476
0477 grub> kernel ticker.exe
0478 [Multiboot-elf, <0x100000:0x1e5a4:0x2b08>, shtab=0x122140, entry=0x10000c]
0479
0480 grub> boot
0481 ```
0482
0483 The GRUB documents how to get GRUB to load a configuration file.
0484
0485
0486 6.4 Using NetBoot to load RTEMS PC386 applications
0487 ---------------------------------------------------
0488
0489 To load the '*.bt' files you can
0490
0491 Alternatively, if you have a PC connected to a network with a
0492 BOOTP server and a TFTP server (this can very well be you're Linux
0493 RTEMS host system), you can use Gero Kuhlmann's NetBoot loader, to
0494 load RTEMS to a diskless PC across a network. You can get it from:
0495
0496 ftp://sunsite.unc.edu/pub/Linux/system/boot/ethernet/netboot-0.7.3.tar.gz
0497
0498 or in any of Sunsite's mirrors. It is also available from NetBoot's
0499 homepage:
0500
0501 http://www.han.de/~gero/netboot
0502
0503 After unarchiving 'netboot-0.7.3.tar.gz' you should change to the
0504 base directory of this and run:
0505
0506 ```shell
0507 ./configure --disable-mknbi-dos --disable-mknbi-linux --disable-mknbi-mgl
0508 ```
0509
0510 Afterwards, you should follow the instructions contained in the
0511 'INSTALL' file also contained in the base directory, on how to setup the
0512 server(s) and to build a boot ROM for the client PC network card, or a
0513 boot diskette, and the PC client should be able to load the '*.bt' files
0514 from the server.
0515
0516 The important sections to check in the 'INSTALL FILE' are the last two:
0517
0518 - Setup of the server (only the BOOTP and TFTP parts - ignore NFS).
0519 ===================
0520
0521 - Setup of the client including building the bootrom
0522 ==================================================
0523
0524 all the rest can be safely ignored if you don't care to examine it.
0525
0526
0527 7. Technical Information
0528 ------------------------
0529
0530 NOTE: All the following paths are relative to the base directory
0531 of the RTEMS distribution.
0532
0533 As of the writing of this HOWTO, PC386 images can be loaded either
0534 in low memory 0x10000 (64KB) until 0x97C00 (607K) using NetBoot or in
0535 high memory from 0x100000 (1024KB) until the top of the available
0536 memory using either NetBoot or GRUB.
0537
0538 If you want to change the default loading address from 1024KB to
0539 something else, just change the value of the variable RELOCADDR in the
0540 'make/custom/pc386.cfg' file to the new value you want (make sure you
0541 follow the instructions indicated before the definition of RELOCADDR).
0542
0543 Remember that GRUB restricts the loading addresses to values above
0544 0x100000 (1024KB), only NetBoot can load images in low memory.
0545
0546 After you make any changes to RELOCADDR and if you are using
0547 NetLoader, you'll have to recompile the
0548 'c/src/lib/libbsp/i386/pc386/start/start16.s' file. The easiest way to
0549 achieve this is just to 'make clean' and the 'make all' again. The
0550 quickest way is to change to
0551 '<build_point>/c/src/lib/libbsp/i386/pc386/start' and 'make
0552 RTEMS_BSP=pc386 clean all'.
0553
0554 When programming interrupt handlers take into account that the PIC
0555 is reprogrammed and so you should use the interface functions provided
0556 in '<build_point>/pc386/lib/include/irq.h> to guarantee that everything
0557 works ok.