ARM PID Hardware Setup

eCos comes with two ROM images that provide GDB support for the ARM PID board. The first ROM image provides a port of the CygMon ROM monitor, which includes a command-line interface and a GDB remote stub. The second ROM image provides a remote GDB stub only, which is a minimal environment for downloading and debugging eCos programs solely using GDB.

eCos, CygMon and the GDB stubs all support the PID fitted with both ARM7T and ARM9 daughterboards. CygMon and the stubs can be programmed into either the programmable ROM (U12) or the FLASH (U13). Pre-built forms of both ROM images are provided in the directory loaders/arm-pid under the root of your eCos installation, along with a tool that will program the stubs into the FLASH memory on the board. CygMon images are prefixed with the name 'cygmon' and GDB stub ROM images are given the prefix 'gdb_module'. Images may be provided in a number of formats including ELF (.img extension), binary (.bin extension) and SREC (.srec extension). Note that some unreliability has been experienced in downloading files using Angel 1.00. Angel 1.02 appears to be more robust in this application.

Installing the Stubs into FLASH

Preparing the Binaries

These two binary preparation steps are not strictly necessary as the eCos distribution ships with pre-compiled binaries in the directory loaders/arm-pid relative to the installation root.

Building the ROM images with the eCos Configuration Tool

  1. Start with a new document - selecting the File->New menu item if necessary to do this.

  2. Choose the Build -> Templates menu item, and then select the ARM PID hardware.

  3. While still displaying the Build -> Templates dialog box, select either the "stubs" package template to build a GDB stub image, or the "cygmon" template to build the CygMon ROM Monitor. Click OK.

  4. Build eCos using Build -> Library

  5. When the build completes, the image files can be found in the bin/ subdirectory of the install tree. GDB stub ROM images have the prefix "gdb_module". CygMon images have the prefix "cygmon".

Building the ROM images with ecosconfig

  1. Make an empty directory to contain the build tree, and cd into it.

  2. To build a GDB stub ROM image, enter the command:

    $ ecosconfig new pid stubs

    or to build a CygMon ROM monitor image, enter the command:

    $ ecosconfig new pid cygmon
  3. Enter the commands:

    $ ecosconfig tree
    $ make
  4. When the build completes, the image files can be found in the bin/ subdirectory of the install tree. GDB stub ROM images have the prefix "gdb_module". CygMon images have the prefix "cygmon".

Building the FLASH Tool with the eCos Configuration Tool

  1. Start with a new document - selecting the File->New menu item if necessary to do this.

  2. Choose the Build->Templates menu item, and then select the ARM PID hardware.

  3. Enable the "Build flash programming tool" option in the ARM PID HAL (CYGBLD_BUILD_FLASH_TOOL) and resolve any resulting configuration conflicts.

  4. Build eCos using Build -> Library

  5. When the build completes, the FLASH tool image file can be found in the bin/ subdirectory of the install tree, with the prefix "prog_flash"

Building the FLASH Tool with ecosconfig

  1. Make an empty directory to contain the build tree, and cd into it

  2. Enter the command:

    $ ecosconfig new pid
  3. Edit the file ecos.ecc and enable the option CYGBLD_BUILD_FLASH_TOOL by uncommenting its user_value property and setting it to 1.

  4. Enter the commands:

    $ ecosconfig resolve

    [there will be some output]

    $ ecosconfig tree
    $ make
  5. When the build completes, the FLASH tool image file can be found in the bin/ subdirectory of the install tree, with the prefix "prog_flash"

Prepare the Board for FLASH Programming

Each time a new image is to be programmed in the FLASH, the jumpers on the board must be set to allow Angel to run:

  1. Set jumper 7-8 on LK6 [using the Angel code in the 16 bit EPROM]

  2. Set jumper 5-6 on LK6 [select 8bit ROM mode]

  3. Set jumper LK18 [ROM remap - this is also required for eCos]

  4. Set S1 to 0-0-1-1 [20MHz operation]

  5. Open jumper LK4 [enable little-endian operation] Attach a serial cable from Serial A on the PID board to connector 1 on the development system. This is the cable through which the binaries will be downloaded. Attach a serial cable from Serial B on the PID board to connector 2 on the development system (or any system that will work as a terminal). Through this cable, the FLASH tool will write its instructions (at 38400 baud).

Program the FLASH

  1. Download the FLASH ROM image onto the PID board. For example. for the GDB stubs image:
    bash$ arm-elf-gdb -nw gdb_module.img
    GNU gdb 4.18-DEVTOOLSVERSION
    Copyright 1998 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License,
    and you are welcome to change it and/or distribute copies
    of it under certain conditions. Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB. Type "show warranty" for details.
    This GDB was configured as "--host=i586-pc-cygwin32 --target=arm-elf".
    (no debugging symbols found)...
    (gdb) target rdi s=com1
    Angel Debug Monitor for PID (Built with Serial(x1), Parallel, DCC) 1.00
    (Advanced RISC Machines SDT 2.10)
    Angel Debug Monitor rebuilt on Jan 20 1997 at 02:33:43
    Connected to ARM RDI target.
    (gdb) load
    Loading section .rom_vectors, size 0x44 lma 0x60000
    Loading section .text, size 0x1f3c lma 0x60044
    Loading section .rodata, size 0x2c lma 0x61f80
    Loading section .data, size 0x124 lma 0x61fac
    Start address 0x60044 , load size 8400
    Transfer rate: 5169 bits/sec.
    (gdb) q 
    The program is running.  Exit anyway? (y or n) y 

    Note: On a UNIX or Linux system, the serial port must be /dev/ttyS0 instead of COM1. You need to make sure that the /dev/ttyS0 files have the right permissions:
    $ su
     Password:
     # chmod o+rw /dev/ttyS0*
     # exit 
    		      
    If you are programming the GDB stub image, it will now be located at 0x60000..0x64000. If you are programming the Cygmon ROM Monitor, it will be located at 0x60000..0x80000.

  2. Now download the FLASH programmer tool

    bash$ arm-elf-gdb prog_flash.img 
    GNU gdb 4.18-DEVTOOLSVERSION
    Copyright 1998 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License,
    and you are welcome to change it and/or distribute
    copies of it under certain conditions. Type "show copying" to see
    the conditions. There is absolutely no warranty for GDB.  Type "show
    warranty" for details.
    This GDB was configured as "--host=i586-pc-cygwin32 --target=arm-elf".
    (gdb) target rdi s=com1
    Angel Debug Monitor for PID (Built with Serial(x1), Parallel, DCC) 1.00
    (Advanced RISC Machines SDT 2.10)
    Angel Debug Monitor rebuilt on Jan 20 1997 at 02:33:43
    Connected to ARM RDI target.
    (gdb) load
    Loading section .rom_vectors, size 0x44 lma 0x40000
    Loading section .text, size 0x44a4 lma 0x40044
    Loading section .rodata, size 0x318 lma 0x444e8
    Loading section .data, size 0x1c8 lma 0x44800
    Start address 0x40044 , load size 18888
    Transfer rate: 5596 bits/sec.
    (gdb) c
  3. The FLASH tool will output some text on the board serial port B at 38400 baud:

    ARM
    eCos
    
    FLASH here!
    manuf: 8, device: 40
    Error: Wrong Manufaturer: 08
    ... Please change FLASH jumper
  4. This text is repeated until you remove the jumper 7-8 on LK6. Then the output will be:

    manuf: 1F, device: A4
    AT29C040A recognised
    About to program FLASH using data at 60000..64000
    *** Press RESET now to abort!
  5. You have about 10 seconds to abort the operation by pressing reset. After this timeout, the FLASH programming happens:

    ...Programming FLASH 
    All done!
  6. Quit/kill the GDB process, which will hang.

  7. Next time you reset the board, the stub will be in control, communicating on Serial A at 38400 baud.

Note: If you do not have two serial ports available on your host computer, you may still verify the FLASH programming completed successfully by quitting/killing the GDB process after running "c" in step 2 above. Then switch the serial cable on the PID from Serial A to Serial B and run a terminal emulator on the host computer. In a few seconds you should see the the repeated text described in step 2 above and you may continue the remaining steps as normal.

Programming the FLASH for big-endian mode

The process is almost identical to the previous instructions which apply to a PID board running in little-endian mode only.

The only adjustments to make are that if programming a GDB stub ROM image (or CygMon ROM monitor image), you must enable the option "Use Big-endian mode" in the eCos Configuration Tool (CYGHWR_HAL_ARM_BIGENDIAN if using ecosconfig and editing ecos.ecc).

When programming the FLASH there are two options:

  1. Program FLASH using the little-endian FLASH tool. After powering off, replace the ROM controller with the special big-endian version which can be acquired from ARM. (This has not been tested by Red Hat).

  2. Use a special big-endian version of the FLASH tool which byte-swaps all the words as they are written to the FLASH.

Build this tool by enabling the "Build flash programming tool for BE images on LE boards" option (CYGBLD_BUILD_FLASH_TOOL_BE), resulting in a utility with the prefix "prog_flash_BE_image_LE_system" which should be used instead of "prog_flash".

Note that there is a limitation to this method: no sub-word data can be read from the ROM. To work around this, the .rodata section is folded into the .data section and thus copied to RAM before the system starts.

Given that Thumb instructions are 16 bit, it is not possible to run ROM-startup Thumb binaries on the PID board using this method.

When the image has been programmed, power off the board, and set jumper LK4 to enable big-endian operation.

Installing the Stubs into ROM

  1. Program the binary image file gdb_module.bin into ROM referring to the instructions of your ROM programmer.

  2. Plug the ROM into socket U12 and install jumper LK6 pins 7-8 to enable the ROM.