⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sh4_202_md.sgml

📁 开放源码实时操作系统源码.
💻 SGML
📖 第 1 页 / 共 3 页
字号:
<!-- DOCTYPE part  PUBLIC "-//OASIS//DTD DocBook V3.1//EN" -->

<!-- {{{ Banner                         -->

<!-- =============================================================== -->
<!--                                                                 -->
<!--     sh4_202_md.sgml                                             -->
<!--                                                                 -->
<!--     MicroDev platform HAL documentation.                         -->
<!--                                                                 -->
<!-- =============================================================== -->
<!-- ####COPYRIGHTBEGIN####                                          -->
<!--                                                                 -->
<!-- =============================================================== -->
<!-- Copyright (C) 2003 Nick Garnett .                         -->
<!-- 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                   -->
<!-- =============================================================== -->
<!--                                                                 -->      
<!-- ####COPYRIGHTEND####                                            -->
<!-- =============================================================== -->
<!-- =============================================================== -->
<!-- #####DESCRIPTIONBEGIN####                                       -->
<!--                                                                 -->
<!-- Author(s):   nickg                                              -->
<!-- Contact(s):  nickg                                              -->
<!-- Date:        2003/09/08                                         -->
<!-- Version:     0.01                                               -->
<!--                                                                 -->
<!-- ####DESCRIPTIONEND####                                          -->
<!-- =============================================================== -->

<!-- }}} -->

<part id="hal-sh4-microdev-part"><title>SuperH SH4-202 MicroDev Board Support</title>

<!-- {{{ Overview                       -->

<refentry id="sh4-microdev">
  <refmeta>
    <refentrytitle>Overview</refentrytitle>
  </refmeta>
  <refnamediv>
    <refname>eCos Support for the SuperH SH4-202 MicroDev Board</refname>
    <refpurpose>Overview</refpurpose>
  </refnamediv>

  <refsect1 id="sh4-microdev-description"><title>Description</title>
    <para>
The SuperH SH4-202 MicroDev board (henceforth just "MicroDev") has
an SH4-202 processor, 64MB of external SDRAM, 32MB of external flash
memory, an SMSC LAN91C111 ethernet controller and connectors plus
required support chips for all the on-chip peripherals.
    </para>
    <para>
For typical eCos development, a RedBoot image is programmed into the
flash memory, and the board will boot this image from reset. RedBoot
provides gdb stub functionality so it is then possible to download and
debug stand-alone and eCos applications via the gdb debugger. This can
happen over either a serial line or over ethernet.
    </para>
  </refsect1>

  <refsect1 id="sh4-microdev-hardware"><title>Supported Hardware</title>
    <para>
The flash memory consists of 128 blocks of 256k bytes each.
In a typical setup, the first 
flash block is used for the ROM RedBoot image
and the second is used to store a version of RedBoot that can run out of
RAM. The topmost two blocks are used to manage the flash and hold RedBoot fconfig
values. The remaining 124 blocks between 0xA0080000 and 0xA1F7FFFF can be
used by application code.
    </para>
    <para>
The board is fitted with a PLCC socket suitable for an EEPROM (or PROM) such as
the 1Mbit ST M29WO10B. This is enabled by toggling two DIP switches, after which
the EEPROM is mapped into the same address as the flash memory. Therefore,
the flash is not accessible if booting from the EEPROM.
    </para>
    <para>
There is a serial driver <varname>CYGPKG_DEVS_SERIAL_SH_SCIF</varname>
which supports the on-chip serial device. This device
can be used by RedBoot for communication with the host. If this device
is needed by the application, either directly or via the serial
driver, then it cannot also be used for RedBoot communication. Another
communication channel such as ethernet should be used instead. The
serial driver package is loaded automatically when configuring for the
MicroDev target.
    </para>
    <para>
There is an ethernet driver <varname>CYGPKG_DEVS_ETH_SH_MICRODEV</varname>
for the on-chip ethernet device. This driver is also loaded
automatically when configuring for the MicroDev target.
    </para>
    <para>
eCos manages the on-chip interrupt controller. Timer 0 is used to
implement the eCos system clock, and timer 1 is used to implement a
microsecond delay function. Timer 2 is unused and
left for the application. Other on-chip devices (FEMI, EMI, INTC, TMU,
CAC, UBC) are initialized only as far as is necessary for eCos to
run. Other devices (eg RTC, DMAC, etc) are not touched.
    </para>
  </refsect1>

  <refsect1 id="sh4-microdev-tools"><title>Tools</title>
    <para>
The MicroDev port is intended to work with GNU tools configured for an
sh-elf target. The original port was done using sh-elf-gcc version
3.2.1, sh-elf-gdb version 5.3, and binutils version 2.13.1.
    </para>
<!-- DOES THIS APPLY?
    <para>
By default, eCos is built using the compiler flag
<option>-fomit-frame-pointer</option>. Omitting the frame pointer
eliminates some work on every function call and makes another register
available, so the code should be smaller and faster. However, without a
frame pointer, sh-elf-gdb is not always able to identify stack
frames, so it may be unable to provide accurate backtrace information.
Removing this compiler flag from the configuration option
<varname>CYGBLD_GLOBAL_CFLAGS</varname> avoids such debug problems.
    </para>
-->
  </refsect1>

</refentry>

<!-- }}} -->
<!-- {{{ Hardware setup                 -->

<refentry id="sh4-microdev-setup">
  <refmeta>
    <refentrytitle>Setup</refentrytitle>
  </refmeta>
  <refnamediv>
    <refname>Setup</refname>
    <refpurpose>Preparing the MicroDev board for eCos Development</refpurpose>
  </refnamediv>

  <refsect1 id="sh4-microdev-setup-overview"><title>Overview</title>
    <para>
In a typical development environment, the MicroDev board boots from
flash into the RedBoot ROM monitor. eCos applications are configured
for RAM startup and then downloaded and run on the board via the
debugger sh-elf-gdb. Preparing the board therefore usually involves
programming a suitable RedBoot image into flash memory. Alternatively
RedBoot may be programmed into a PLCC EEPROM and inserted into socket U21,
although in that case, the flash memory is not accessible.
    </para>
    <para>
The following RedBoot configurations are supported:
    </para>
    <informaltable frame="all">
      <tgroup cols="4" colsep="1" rowsep="1" align="left">
        <thead>
          <row>
            <entry>Configuration</entry>
            <entry>Description</entry>
            <entry>Use</entry>
            <entry>File</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>ROM</entry>
            <entry>RedBoot running from the board's flash</entry>
            <entry>redboot_ROM.ecm</entry>
            <entry>redboot_ROM.bin</entry>
          </row>
          <row>
            <entry>EEPROM</entry>
            <entry>RedBoot running from the board's socketed EEPROM</entry>
            <entry>redboot_EEPROM.ecm</entry>
            <entry>redboot_EEPROM.bin</entry>
          </row>
          <row>
            <entry>RAM</entry>
            <entry>Used for upgrading ROM version</entry>
            <entry>redboot_RAM.ecm</entry>
            <entry>redboot_RAM.bin</entry>
          </row>
        </tbody>
      </tgroup>
    </informaltable>
    <para>
For serial communications, all versions run with 8 bits, no parity, and
1 stop bit at 38400 baud. This baud rate can be changed via the
configuration option
<varname>CYGNUM_HAL_SH_SH4_SCIF_BAUD_RATE</varname> and rebuilding
RedBoot. RedBoot also supports ethernet communication and flash
management.
    </para>
  </refsect1>

  <refsect1 id="sh4-microdev-setup-first"><title>Initial Installation</title>
   <refsect2 id="sh4-microdev-flash"><title>Flash Installation</title>
    <para>
This process assumes that the board is connected to a SuperH Micro
Probe. The Micro Probe should be set up as described in Appendix A of
the "SH4 Development Tools User Guide". You should also have access to
the SuperH development tools since it is necessary to use the version
of GDB that comes with those tools to access the Micro Probe,
<command>sh-elf-gdb</command> will not work.
    </para>
    <para>
Programming the RedBoot ROM monitor into flash memory requires an
application that can manage flash blocks. RedBoot itself has this
capability. Rather than have a separate application that is used only
for flash management during the initial installation, a special
RAM-resident version of RedBoot is loaded into memory and run. This
version can then be used to load the normal flash-resident version of
RedBoot and program it into the flash.
    </para>
    <para>
The first step is to connect an RS232 null modem cable between the MicroDev
serial port and the host PC. Next start a terminal emulation application such as
HyperTerminal or minicom on the host PC and set the serial
communication parameters to 38400 baud, 8 data bits, no parity, 1 stop
bit (8N1) and no flow control (handshaking). 
    </para>
    <para>
Now run the <command>sh4gdb</command> command, giving it the name of
the RAM redboot ELF file, connect to the Micro Probe, load the
executable and run it. The entire session should look like this:
    </para>
    <screen>
$ <userinput>sh4gdb redboot_RAM.elf</userinput>
GNU gdb 5.2.1
Copyright 2002 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=i686-pc-linux-gnu --target=sh-superh-elf"...
(gdb) <userinput>sh4si superh</userinput>
The target is assumed to be little endian
The target architecture is assumed to be sh4
0xa0000000 in ?? ()
(gdb) <userinput>load</userinput>
Loading section .vectors, size 0x9e0 lma 0x88010000
Loading section .text, size 0x1ab20 lma 0x880109e0
Loading section .rodata, size 0x3e6c lma 0x8802b500
Loading section .data, size 0xf30 lma 0x8802f370
Start address 0x88010000, load size 131740
Transfer rate: 351306 bits/sec, 433 bytes/write.
(gdb) <userinput>cont</userinput>
Continuing.
    </screen>
    <para>
The required <filename>redboot_RAM.elf</filename> file is normally

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -