📄 hal-porting-structure.html
字号:
<!-- Copyright (C) 2003 Red Hat, 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. -->
<HTML
><HEAD
><TITLE
>HAL Structure</TITLE
><meta name="MSSmartTagsPreventParsing" content="TRUE">
<META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="eCos Reference Manual"
HREF="ecos-ref.html"><LINK
REL="UP"
TITLE=" Porting Guide"
HREF="hal-porting-guide.html"><LINK
REL="PREVIOUS"
TITLE=" Porting Guide"
HREF="hal-porting-guide.html"><LINK
REL="NEXT"
TITLE="Virtual Vectors (eCos/ROM Monitor Calling Interface)"
HREF="hal-calling-if.html"></HEAD
><BODY
CLASS="SECTION"
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="hal-porting-guide.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 11. Porting Guide</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="hal-calling-if.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECTION"
><H1
CLASS="SECTION"
><A
NAME="HAL-PORTING-STRUCTURE">HAL Structure</H1
><P
>In order to write an eCos HAL it's a good idea to have at least a
passing understanding of how the HAL interacts with the rest of the
system.</P
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN8658">HAL Classes</H2
><P
>The eCos HAL consists of four HAL sub-classes. This table gives a
brief description of each class and partly reiterates the description
in <A
HREF="hal-architecture-variant-and-platform.html"
>Chapter 7</A
>. The links
refer to the on-line CVS tree (specifically to the sub-HALs used by
the PowerPC MBX target).</P
><DIV
CLASS="INFORMALTABLE"
><A
NAME="AEN8662"><P
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><THEAD
><TR
><TH
ALIGN="LEFT"
VALIGN="TOP"
>HAL type</TH
><TH
ALIGN="LEFT"
VALIGN="TOP"
>Description</TH
><TH
ALIGN="LEFT"
VALIGN="TOP"
>Functionality Overview</TH
></TR
></THEAD
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Common HAL <A
HREF="http://sourceware.cygnus.com/cgi-bin/cvsweb.cgi/ecos/packages/hal/common/current?cvsroot=ecos"
TARGET="_top"
>(hal/common)</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Configuration options and functionality shared by all HALs.</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Generic debugging functionality, driver API, eCos/ROM monitor
calling interface, and tests.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Architecture HAL <A
HREF="http://sourceware.cygnus.com/cgi-bin/cvsweb.cgi/ecos/packages/hal/powerpc/arch/current?cvsroot=ecos"
TARGET="_top"
>(hal/<architecture>/arch)</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Functionality specific to the given architecture. Also default
implementations of some functionality which can be overridden by
variant or platform HALs.</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Architecture specific debugger functionality (handles single
stepping, exception-to-signal conversion, etc.),
exception/interrupt vector definitions and handlers, cache
definition and control macros, context switching code, assembler
functions for early system initialization, configuration options,
and possibly tests. </TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Variant HAL <A
HREF="http://sourceware.cygnus.com/cgi-bin/cvsweb.cgi/ecos/packages/hal/powerpc/mpc8xx/current?cvsroot=ecos"
TARGET="_top"
>(hal/<architecture>/<variant>)</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Some CPU architectures consist of a number variants, for example
MIPS CPUs come in both 32 and 64 bit versions, and some variants
have embedded features additional to the CPU core.</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Variant extensions to the architecture code (cache,
exception/interrupt), configuration options, possibly drivers for
variant on-core devices, and possibly tests.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Platform HAL <A
HREF="http://sourceware.cygnus.com/cgi-bin/cvsweb.cgi/ecos/packages/hal/powerpc/mbx/current?cvsroot=ecos"
TARGET="_top"
>(hal/<architecture>/<platform>)</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Contains functionality and configuration options specific to the
platform.</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Early platform initialization code, platform memory layout
specification, configuration options (processor speed, compiler
options), diagnostic IO functions, debugger IO functions,
platform specific extensions to architecture or variant code
(off-core interrupt controller), and possibly tests.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Auxiliary HAL <A
HREF="http://sourceware.cygnus.com/cgi-bin/cvsweb.cgi/ecos/packages/hal/powerpc/quicc/current?cvsroot=ecos"
TARGET="_top"
>(hal/<architecture>/<module>)</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Some variants share common modules on the core. Motorola's PowerPC
QUICC is an example of such a module.</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Module specific functionality (interrupt controller, simple
device drivers), possibly tests.</TD
></TR
></TBODY
></TABLE
><P
></P
></DIV
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN8695">File Descriptions</H2
><P
>Listed below are the files found in various HALs, with a short
description of what each file contains. When looking in existing HALs
beware that they do not necessarily follow this naming scheme.
If you are writing a new HAL, please try to follow it as
closely as possible. Still, no two targets are the same, so sometimes
it makes sense to use additional files.</P
><DIV
CLASS="SECTION"
><H3
CLASS="SECTION"
><A
NAME="AEN8698">Common HAL</H3
><DIV
CLASS="INFORMALTABLE"
><A
NAME="AEN8700"><P
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><THEAD
><TR
><TH
ALIGN="LEFT"
VALIGN="TOP"
>File</TH
><TH
ALIGN="LEFT"
VALIGN="TOP"
>Description</TH
></TR
></THEAD
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>include/dbg-thread-syscall.h</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Defines the thread debugging syscall function. This is used by
the ROM monitor to access the thread debugging API in the RAM
application. .</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>include/dbg-threads-api.h</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Defines the thread debugging API. .</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>include/drv_api.h</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Defines the driver API.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>include/generic-stub.h</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Defines the generic stub features.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>include/hal_if.h</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Defines the ROM/RAM calling interface API.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>include/hal_misc.h</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Defines miscellaneous helper functions shared by all HALs.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>include/hal_stub.h</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Defines eCos mappings of GDB stub features.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>src/dbg-threads-syscall.c</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Thread debugging implementation.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>src/drv_api.c</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Driver API implementation. Depending on configuration this
provides either wrappers for the kernel API, or a minimal
implementation of these features. This allows drivers to be written
relying only on HAL features.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>src/dummy.c</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Empty dummy file ensuring creation of libtarget.a.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>src/generic-stub.c</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Generic GDB stub implementation. This provides the
communication protocol used to communicate with GDB over a serial
device or via the network.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>src/hal_if.c</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>ROM/RAM calling interface implementation. Provides wrappers from
the calling interface API to the eCos features used for the
implementation.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>src/hal_misc.c</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Various helper functions shared by all platforms and
architectures.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>src/hal_stub.c</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Wrappers from eCos HAL features to the features required by the
generic GDB stub.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>src/stubrom/stubrom.c</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>The file used to build eCos GDB stub images. Basically a
cyg_start function with a hard coded breakpoint.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>src/thread-packets.c</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>More thread debugging related functions.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>src/thread-pkts.h</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Defines more thread debugging related function.</TD
></TR
></TBODY
></TABLE
><P
></P
></DIV
></DIV
><DIV
CLASS="SECTION"
><H3
CLASS="SECTION"
><A
NAME="AEN8775">Architecture HAL</H3
><P
>Some architecture HALs may add extra files for architecture
specific serial drivers, or for handling interrupts and exceptions if it
makes sense.</P
><P
>Note that many of the definitions in these files are only
conditionally defined - if the equivalent variant or platform headers
provide the definitions, those override the generic architecture
definitions.</P
><DIV
CLASS="INFORMALTABLE"
><A
NAME="AEN8779"><P
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><THEAD
><TR
><TH
ALIGN="LEFT"
VALIGN="TOP"
>File</TH
><TH
ALIGN="LEFT"
VALIGN="TOP"
>Description</TH
></TR
></THEAD
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>include/arch.inc</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Various assembly macros used during system initialization.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>include/basetype.h</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Endian, label, alignment, and type size definitions. These
override common defaults in CYGPKG_INFRA.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>include/hal_arch.h</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Saved register frame format, various thread, register and stack
related macros.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>include/hal_cache.h</TT
></TD
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -