📄 sh4-microdev-port.html
字号:
<!-- Copyright (C) 2009 Free Software Foundation, Inc. -->
<!-- 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 is obtained from the copyright holder. -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>The HAL Port</TITLE
><meta name="MSSmartTagsPreventParsing" content="TRUE">
<META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="eCos Reference Manual"
HREF="ecos-ref.html"><LINK
REL="UP"
TITLE="SuperH SH4-202 MicroDev Board Support"
HREF="hal-sh4-microdev-part.html"><LINK
REL="PREVIOUS"
TITLE="Configuration"
HREF="sh4-microdev-config.html"><LINK
REL="NEXT"
TITLE="SA11X0 USB Device Driver"
HREF="devs-usb-sa11x0-ref.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>eCos Reference Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sh4-microdev-config.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="devs-usb-sa11x0-ref.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SH4-MICRODEV-PORT"
></A
>The HAL Port</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN19817"
></A
><H2
>Name</H2
>HAL Port -- Implementation Details</DIV
><DIV
CLASS="REFSECT1"
><A
NAME="SH4-MICRODEV-PORT-OVERVIEW"
></A
><H2
>Overview</H2
><P
>This documentation explains how the eCos HAL specification has been
mapped onto the MicroDev hardware, and should be read in conjunction
with that specification. The MicroDev platform HAL package complements
the SH architectural HAL and the SH4 variant HAL. It provides
functionality which is specific to the target board.
</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="SH4-MICRODEV-PORT-STARTUP"
></A
><H2
>Startup</H2
><P
>Following a hard or soft reset the HAL will initialize or
reinitialize most of the on-chip peripherals. There is an exception
for RAM startup applications which depend on a ROM monitor for certain
services.
</P
><P
>For ROM startup, the HAL will perform additional initialization,
setting up the external DRAM and programming the various internal
registers. The values used for most of these registers are assigned
fixed values from a table in the header <TT
CLASS="FILENAME"
>cyg/hal/platform.inc</TT
>.
</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="SH4-MICRODEV-PORT-LINKER"
></A
><H2
>Linker Scripts and Memory Maps</H2
><P
>The platform HAL package provides the memory layout information needed
to generate the linker script. The key memory locations are as follows:
</P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>off-chip Flash</DT
><DD
><P
>This is located at address 0x00000000 of the physical memory space and is
therefore accessible in the P1 region at location 0x80000000. An
uncached shadow of this memory is available in the P2 region at 0xA0000000.
The contents of the flash are organized as described earlier.
</P
></DD
><DT
>off-chip EEPROM</DT
><DD
><P
>If selected by the DIP switches, this occupies the same addresses as the
off-chip flash, and the flash is no longer visible.
</P
></DD
><DT
>external SDRAM</DT
><DD
><P
>This is located at address 0x08000000 of the physical memory space and is
therefore accessable in the P1 region at location 0x88000000. An
uncached shadow of this memory is available in the P2 region at 0xA8000000. The
first 256 bytes are used for hardware exception vectors. The next 256
bytes are normally used for the eCos virtual vectors, allowing
RAM-based applications to use services provided by the ROM
monitor. For ROM startup, all remaining SDRAM is available. For RAM
startup, available SDRAM starts at location 0x80100000, with the bottom
1MB reserved for use by RedBoot.
</P
></DD
><DT
>on-chip peripherals</DT
><DD
><P
>These are accessible via the P4 region at location 0xE0000000 onwards.
</P
></DD
><DT
>off-chip peripherals</DT
><DD
><P
>The ethernet device is located at 0xA7500000. The FPGA interrupt
controller is located at 0x06110000. These are the only
off-chip peripherals accessed by eCos. All others are left
untouched.
</P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="SH4-MICRODEV-PORT-CLOCK"
></A
><H2
>Clock Support</H2
><P
>The platform HAL provides configuration options for the eCos system
clock. This always uses the hardware timer 0, which should not be used
directly by application code. Timer 1 is used to implement a
microsecond resolution busy delay service. Timer 2 is not used by eCos
so application code is free to manipulate this as required. The
actual HAL macros for managing the clock are provided by the SH architecture
processor HAL.
</P
><P
>There is a software model of the structure of the SH family clock
supply subsystem which performs the correct calculations to yield not
only the inputs for the CPU clock but also the peripheral clocks fed
to the serial device, memory controllers and other devices. The values
for the master crystal, the PLL multipliers and various dividers are
supplied by the platform HAL. Some care must be taken in defining
these since wrong values will cause the timers and the SCIF baud rate
to be miscalculated. If the OSCAR chip switches are changed from the
default then the value of <CODE
CLASS="VARNAME"
>CYGHWR_HAL_SH_OOC_XTAL</CODE
>
must be changed to match.
</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="SH4-MICRODEV-PORT-OTHER-HAL"
></A
><H2
>Other Issues</H2
><P
>The MicroDev platform HAL does not affect the implementation of other
parts of the eCos HAL specification. The
SH4 variant HAL, and the SH architectural HAL documentation
should be consulted for further details.
</P
><P
>It should be noted that the floating point support in the SH HAL has a
caveat that, if the FPSCR register is changed, it may get reverted at a
later stage by certain operations performed by the GCC compiler. This
behaviour is intentional as the alternative would be to update the GCC
compiler's internal state about the FPSCR at every context switch which
would be expensive for a feature that is unlikely to be used frequently.
If the FPSCR is to be changed by the application, the developer
should call the function <CODE
CLASS="FUNCTION"
>__set_fpscr(int)</CODE
>, passing it
the new FPSCR value.
</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sh4-microdev-config.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ecos-ref.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="devs-usb-sa11x0-ref.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Configuration</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="hal-sh4-microdev-part.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SA11X0 USB Device Driver</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -