<!-- Copyright (C) 2003 Red Hat, Inc. -->
|
<!-- Copyright (C) 2003 Red Hat, Inc. -->
|
<!-- This material may be distributed only subject to the terms -->
|
<!-- This material may be distributed only subject to the terms -->
|
<!-- and conditions set forth in the Open Publication License, v1.0 -->
|
<!-- and conditions set forth in the Open Publication License, v1.0 -->
|
<!-- or later (the latest version is presently available at -->
|
<!-- or later (the latest version is presently available at -->
|
<!-- http://www.opencontent.org/openpub/). -->
|
<!-- http://www.opencontent.org/openpub/). -->
|
<!-- Distribution of the work or derivative of the work in any -->
|
<!-- Distribution of the work or derivative of the work in any -->
|
<!-- standard (paper) book form is prohibited unless prior -->
|
<!-- standard (paper) book form is prohibited unless prior -->
|
<!-- permission is obtained from the copyright holder. -->
|
<!-- permission is obtained from the copyright holder. -->
|
<HTML
|
<HTML
|
><HEAD
|
><HEAD
|
><TITLE
|
><TITLE
|
>Platform HAL Porting</TITLE
|
>Platform HAL Porting</TITLE
|
><meta name="MSSmartTagsPreventParsing" content="TRUE">
|
><meta name="MSSmartTagsPreventParsing" content="TRUE">
|
<META
|
<META
|
NAME="GENERATOR"
|
NAME="GENERATOR"
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
|
"><LINK
|
"><LINK
|
REL="HOME"
|
REL="HOME"
|
TITLE="eCos Reference Manual"
|
TITLE="eCos Reference Manual"
|
HREF="ecos-ref.html"><LINK
|
HREF="ecos-ref.html"><LINK
|
REL="UP"
|
REL="UP"
|
TITLE=" Porting Guide"
|
TITLE=" Porting Guide"
|
HREF="hal-porting-guide.html"><LINK
|
HREF="hal-porting-guide.html"><LINK
|
REL="PREVIOUS"
|
REL="PREVIOUS"
|
TITLE="HAL Coding Conventions"
|
TITLE="HAL Coding Conventions"
|
HREF="hal-porting-coding-conventions.html"><LINK
|
HREF="hal-porting-coding-conventions.html"><LINK
|
REL="NEXT"
|
REL="NEXT"
|
TITLE="Variant HAL Porting"
|
TITLE="Variant HAL Porting"
|
HREF="hal-porting-variant.html"></HEAD
|
HREF="hal-porting-variant.html"></HEAD
|
><BODY
|
><BODY
|
CLASS="SECTION"
|
CLASS="SECTION"
|
BGCOLOR="#FFFFFF"
|
BGCOLOR="#FFFFFF"
|
TEXT="#000000"
|
TEXT="#000000"
|
LINK="#0000FF"
|
LINK="#0000FF"
|
VLINK="#840084"
|
VLINK="#840084"
|
ALINK="#0000FF"
|
ALINK="#0000FF"
|
><DIV
|
><DIV
|
CLASS="NAVHEADER"
|
CLASS="NAVHEADER"
|
><TABLE
|
><TABLE
|
SUMMARY="Header navigation table"
|
SUMMARY="Header navigation table"
|
WIDTH="100%"
|
WIDTH="100%"
|
BORDER="0"
|
BORDER="0"
|
CELLPADDING="0"
|
CELLPADDING="0"
|
CELLSPACING="0"
|
CELLSPACING="0"
|
><TR
|
><TR
|
><TH
|
><TH
|
COLSPAN="3"
|
COLSPAN="3"
|
ALIGN="center"
|
ALIGN="center"
|
>eCos Reference Manual</TH
|
>eCos Reference Manual</TH
|
></TR
|
></TR
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="10%"
|
WIDTH="10%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
><A
|
><A
|
HREF="hal-porting-coding-conventions.html"
|
HREF="hal-porting-coding-conventions.html"
|
ACCESSKEY="P"
|
ACCESSKEY="P"
|
>Prev</A
|
>Prev</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="80%"
|
WIDTH="80%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
>Chapter 11. Porting Guide</TD
|
>Chapter 11. Porting Guide</TD
|
><TD
|
><TD
|
WIDTH="10%"
|
WIDTH="10%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
><A
|
><A
|
HREF="hal-porting-variant.html"
|
HREF="hal-porting-variant.html"
|
ACCESSKEY="N"
|
ACCESSKEY="N"
|
>Next</A
|
>Next</A
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><HR
|
><HR
|
ALIGN="LEFT"
|
ALIGN="LEFT"
|
WIDTH="100%"></DIV
|
WIDTH="100%"></DIV
|
><DIV
|
><DIV
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><H1
|
><H1
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><A
|
><A
|
NAME="HAL-PORTING-PLATFORM">Platform HAL Porting</H1
|
NAME="HAL-PORTING-PLATFORM">Platform HAL Porting</H1
|
><P
|
><P
|
>This is the type of port that takes the least effort. It basically
|
>This is the type of port that takes the least effort. It basically
|
consists of describing the platform (board) for the HAL: memory
|
consists of describing the platform (board) for the HAL: memory
|
layout, early platform initialization, interrupt controllers, and a
|
layout, early platform initialization, interrupt controllers, and a
|
simple serial device driver.</P
|
simple serial device driver.</P
|
><P
|
><P
|
>Doing a platform port requires a preexisting architecture and
|
>Doing a platform port requires a preexisting architecture and
|
possibly a variant HAL port.</P
|
possibly a variant HAL port.</P
|
><DIV
|
><DIV
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><H2
|
><H2
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><A
|
><A
|
NAME="AEN9415">HAL Platform Porting Process</H2
|
NAME="AEN9415">HAL Platform Porting Process</H2
|
><DIV
|
><DIV
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><H3
|
><H3
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><A
|
><A
|
NAME="AEN9417">Brief overview</H3
|
NAME="AEN9417">Brief overview</H3
|
><P
|
><P
|
>The easiest way to make a new platform HAL is simply to copy an
|
>The easiest way to make a new platform HAL is simply to copy an
|
existing platform HAL of the same architecture/variant and change all
|
existing platform HAL of the same architecture/variant and change all
|
the files to match the new one. In case this is the first platform for
|
the files to match the new one. In case this is the first platform for
|
the architecture/variant, a platform HAL from another architecture
|
the architecture/variant, a platform HAL from another architecture
|
should be used as a template.</P
|
should be used as a template.</P
|
><P
|
><P
|
>The best way to start a platform port is to concentrate on getting
|
>The best way to start a platform port is to concentrate on getting
|
RedBoot to run. RedBoot is a simpler environment than full eCos, it
|
RedBoot to run. RedBoot is a simpler environment than full eCos, it
|
does not use interrupts or threads, but covers most of the
|
does not use interrupts or threads, but covers most of the
|
basic startup requirements.</P
|
basic startup requirements.</P
|
><P
|
><P
|
>RedBoot normally runs out of FLASH or ROM and provides program loading
|
>RedBoot normally runs out of FLASH or ROM and provides program loading
|
and debugging facilities. This allows further HAL development to
|
and debugging facilities. This allows further HAL development to
|
happen using RAM startup configurations, which is desirable for the
|
happen using RAM startup configurations, which is desirable for the
|
simple reason that downloading an image which you need to test is
|
simple reason that downloading an image which you need to test is
|
often many times faster than either updating a flash part, or indeed,
|
often many times faster than either updating a flash part, or indeed,
|
erasing and reprogramming an EPROM.</P
|
erasing and reprogramming an EPROM.</P
|
><P
|
><P
|
>There are two approaches to getting to this first goal:</P
|
>There are two approaches to getting to this first goal:</P
|
><P
|
><P
|
></P
|
></P
|
><OL
|
><OL
|
TYPE="1"
|
TYPE="1"
|
><LI
|
><LI
|
><P
|
><P
|
>The board is equipped with a ROM monitor which allows "load and go" of
|
>The board is equipped with a ROM monitor which allows "load and go" of
|
ELF, binary, S-record or some other image type which can be created
|
ELF, binary, S-record or some other image type which can be created
|
using <SPAN
|
using <SPAN
|
CLASS="APPLICATION"
|
CLASS="APPLICATION"
|
>objcopy</SPAN
|
>objcopy</SPAN
|
>. This allows you to develop
|
>. This allows you to develop
|
RedBoot by downloading and running the code (saving time).</P
|
RedBoot by downloading and running the code (saving time).</P
|
><P
|
><P
|
>When the stub is running it is a good idea to examine the various
|
>When the stub is running it is a good idea to examine the various
|
hardware registers to help you write the platform initialization code.</P
|
hardware registers to help you write the platform initialization code.</P
|
><P
|
><P
|
>Then you may have to fiddle a bit going through step two (getting it
|
>Then you may have to fiddle a bit going through step two (getting it
|
to run from ROM startup). If at all possible, preserve the original
|
to run from ROM startup). If at all possible, preserve the original
|
ROM monitor so you can revert to it if necessary.</P
|
ROM monitor so you can revert to it if necessary.</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
>The board has no ROM monitor. You need to get the platform
|
>The board has no ROM monitor. You need to get the platform
|
initialization and stub working by repeatedly making changes, updating
|
initialization and stub working by repeatedly making changes, updating
|
flash or EPROM and testing the changes. If you are lucky, you have a
|
flash or EPROM and testing the changes. If you are lucky, you have a
|
JTAG or similar CPU debugger to help you. If not, you will probably
|
JTAG or similar CPU debugger to help you. If not, you will probably
|
learn to appreciate LEDs. This approach may also be needed during the
|
learn to appreciate LEDs. This approach may also be needed during the
|
initial phase of moving RedBoot from RAM startup to ROM, since it is
|
initial phase of moving RedBoot from RAM startup to ROM, since it is
|
very unlikely to work first time.</P
|
very unlikely to work first time.</P
|
></LI
|
></LI
|
></OL
|
></OL
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><H3
|
><H3
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><A
|
><A
|
NAME="AEN9431">Step-by-step</H3
|
NAME="AEN9431">Step-by-step</H3
|
><P
|
><P
|
>Given that no two platforms are exactly the same, you may have to
|
>Given that no two platforms are exactly the same, you may have to
|
deviate from the below. Also, you should expect a fair amount of
|
deviate from the below. Also, you should expect a fair amount of
|
fiddling - things almost never go right the first time. See the hints
|
fiddling - things almost never go right the first time. See the hints
|
section below for some suggestions that might help debugging.</P
|
section below for some suggestions that might help debugging.</P
|
><P
|
><P
|
>The description below is based on the HAL layout used in the MIPS,
|
>The description below is based on the HAL layout used in the MIPS,
|
PC and MN10300 HALs. Eventually all HALs should be converted to look like
|
PC and MN10300 HALs. Eventually all HALs should be converted to look like
|
these - but in a transition period there will be other HALs which look
|
these - but in a transition period there will be other HALs which look
|
substantially different. Please try to adhere to the following as much is
|
substantially different. Please try to adhere to the following as much is
|
possible without causing yourself too much grief integrating with a
|
possible without causing yourself too much grief integrating with a
|
HAL which does not follow this layout.</P
|
HAL which does not follow this layout.</P
|
><DIV
|
><DIV
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><H4
|
><H4
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><A
|
><A
|
NAME="AEN9435">Minimal requirements</H4
|
NAME="AEN9435">Minimal requirements</H4
|
><P
|
><P
|
>These are the changes you must make before you attempt to build
|
>These are the changes you must make before you attempt to build
|
RedBoot. You are advised to read all the sources though.</P
|
RedBoot. You are advised to read all the sources though.</P
|
><P
|
><P
|
></P
|
></P
|
><OL
|
><OL
|
TYPE="1"
|
TYPE="1"
|
><LI
|
><LI
|
><P
|
><P
|
>Copy an existing platform HAL from the same or another
|
>Copy an existing platform HAL from the same or another
|
architecture. Rename the files as necessary to follow the
|
architecture. Rename the files as necessary to follow the
|
standard: CDL and MLT related files should contain the
|
standard: CDL and MLT related files should contain the
|
<arch>_<variant>_<platform> triplet.</P
|
<arch>_<variant>_<platform> triplet.</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
>Adjust CDL options. Primarily option naming, real-time
|
>Adjust CDL options. Primarily option naming, real-time
|
clock/counter, and CYGHWR_MEMORY_LAYOUT variables, but also other
|
clock/counter, and CYGHWR_MEMORY_LAYOUT variables, but also other
|
options may need editing. Look through the architecture/variant
|
options may need editing. Look through the architecture/variant
|
CDL files to see if there are any requirements/features which
|
CDL files to see if there are any requirements/features which
|
where not used on the platform you copied. If so, add appropriate
|
where not used on the platform you copied. If so, add appropriate
|
ones. See <A
|
ones. See <A
|
HREF="hal-porting-platform.html#HAL-PORTING-CDL-REQUIREMENTS"
|
HREF="hal-porting-platform.html#HAL-PORTING-CDL-REQUIREMENTS"
|
>the Section called <I
|
>the Section called <I
|
>HAL Platform CDL</I
|
>HAL Platform CDL</I
|
></A
|
></A
|
> for more
|
> for more
|
details.</P
|
details.</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
>Add the necessary packages and target descriptions to the
|
>Add the necessary packages and target descriptions to the
|
top-level <TT
|
top-level <TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>ecos.db</TT
|
>ecos.db</TT
|
> file. See <A
|
> file. See <A
|
HREF="hal-porting-platform.html#HAL-PORTING-ECOS-DATABASE"
|
HREF="hal-porting-platform.html#HAL-PORTING-ECOS-DATABASE"
|
>the Section called <I
|
>the Section called <I
|
>eCos Database</I
|
>eCos Database</I
|
></A
|
></A
|
>. Initially, the target entry
|
>. Initially, the target entry
|
should only contain the HAL packages. Other hardware support
|
should only contain the HAL packages. Other hardware support
|
packages will be added later.</P
|
packages will be added later.</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
>Adjust the MLT files in
|
>Adjust the MLT files in
|
<TT
|
<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>include/pkgconf</TT
|
>include/pkgconf</TT
|
> to match the memory layout on
|
> to match the memory layout on
|
the platform. For initial testing it should be enough to just hand
|
the platform. For initial testing it should be enough to just hand
|
edit .h and .ldi files, but eventually you should generate all
|
edit .h and .ldi files, but eventually you should generate all
|
files using the memory layout editor in the configuration
|
files using the memory layout editor in the configuration
|
tool. See <A
|
tool. See <A
|
HREF="hal-porting-platform.html#HAL-PORTING-PLATFORM-MEMORY-LAYOUT"
|
HREF="hal-porting-platform.html#HAL-PORTING-PLATFORM-MEMORY-LAYOUT"
|
>the Section called <I
|
>the Section called <I
|
>Platform Memory Layout</I
|
>Platform Memory Layout</I
|
></A
|
></A
|
> for
|
> for
|
more details.</P
|
more details.</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
> Edit the <TT
|
> Edit the <TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>misc/redboot_<STARTUP>.ecm</TT
|
>misc/redboot_<STARTUP>.ecm</TT
|
> for
|
> for
|
the startup type you have chosen to begin with. Rename any
|
the startup type you have chosen to begin with. Rename any
|
platform specific options and remove any that do not apply. In the
|
platform specific options and remove any that do not apply. In the
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>cdl_configuration</TT
|
>cdl_configuration</TT
|
> section, comment out any
|
> section, comment out any
|
extra packages that are added, particularly packages such as
|
extra packages that are added, particularly packages such as
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>CYGPKG_IO_FLASH</TT
|
>CYGPKG_IO_FLASH</TT
|
> and
|
> and
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>CYGPKG_IO_ETH_DRIVERS</TT
|
>CYGPKG_IO_ETH_DRIVERS</TT
|
>. These are not needed for
|
>. These are not needed for
|
initial porting and will be added back later.
|
initial porting and will be added back later.
|
</P
|
</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
>If the default IO macros are not correct, override them in
|
>If the default IO macros are not correct, override them in
|
plf_io.h. This may be necessary if the platform uses a different
|
plf_io.h. This may be necessary if the platform uses a different
|
endianness from the default for the CPU.</P
|
endianness from the default for the CPU.</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
>Leave out/comment out code that enables caches and/or MMU if
|
>Leave out/comment out code that enables caches and/or MMU if
|
possible. Execution speed will not be a concern until the port is
|
possible. Execution speed will not be a concern until the port is
|
feature complete.</P
|
feature complete.</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
>Implement a simple serial driver (polled mode only). Make sure the
|
>Implement a simple serial driver (polled mode only). Make sure the
|
initialization function properly hooks the procedures up in the
|
initialization function properly hooks the procedures up in the
|
virtual vector IO channel tables. RedBoot will call the serial
|
virtual vector IO channel tables. RedBoot will call the serial
|
driver via these tables.</P
|
driver via these tables.</P
|
><P
|
><P
|
> By copying an existing platform HAL most of this code will be
|
> By copying an existing platform HAL most of this code will be
|
already done, and will only need the platform specific hardware
|
already done, and will only need the platform specific hardware
|
access code to be written.
|
access code to be written.
|
</P
|
</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
>Adjust/implement necessary platform
|
>Adjust/implement necessary platform
|
initialization. This can be found in
|
initialization. This can be found in
|
<TT
|
<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>platform.inc</TT
|
>platform.inc</TT
|
> and
|
> and
|
<TT
|
<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>platform.S</TT
|
>platform.S</TT
|
> files (ARM:
|
> files (ARM:
|
<TT
|
<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>hal_platform_setup.h</TT
|
>hal_platform_setup.h</TT
|
> and
|
> and
|
<TT
|
<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
><platform>_misc.c</TT
|
><platform>_misc.c</TT
|
>, PowerPC:
|
>, PowerPC:
|
<TT
|
<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
><platform>.S</TT
|
><platform>.S</TT
|
>). This step can be
|
>). This step can be
|
postponed if you are doing a RAM startup RedBoot first and the
|
postponed if you are doing a RAM startup RedBoot first and the
|
existing ROM monitor handles board initialization.</P
|
existing ROM monitor handles board initialization.</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
>Define <TT
|
>Define <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>HAL_STUB_PLATFORM_RESET</TT
|
>HAL_STUB_PLATFORM_RESET</TT
|
>
|
>
|
(optionally empty) and
|
(optionally empty) and
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>HAL_STUB_PLATFORM_RESET_ENTRY</TT
|
>HAL_STUB_PLATFORM_RESET_ENTRY</TT
|
> so that RedBoot
|
> so that RedBoot
|
can reset-on-detach - this is very handy, often removing the need
|
can reset-on-detach - this is very handy, often removing the need
|
for physically resetting the board between downloads.</P
|
for physically resetting the board between downloads.</P
|
></LI
|
></LI
|
></OL
|
></OL
|
><P
|
><P
|
>You should now be able to build RedBoot. For ROM startup:</P
|
>You should now be able to build RedBoot. For ROM startup:</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>% ecosconfig new <target_name> redboot
|
>% ecosconfig new <target_name> redboot
|
% ecosconfig import $(ECOS_REPOSITORY)/hal/<architecture>/<platform>/<version>/misc/redboot_ROM.ecm
|
% ecosconfig import $(ECOS_REPOSITORY)/hal/<architecture>/<platform>/<version>/misc/redboot_ROM.ecm
|
% ecosconfig tree
|
% ecosconfig tree
|
% make</PRE
|
% make</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>You may have to make further changes than suggested above to get
|
>You may have to make further changes than suggested above to get
|
the make command to succeed. But when it does, you should find a
|
the make command to succeed. But when it does, you should find a
|
RedBoot image in install/bin. To program this image into flash or
|
RedBoot image in install/bin. To program this image into flash or
|
EPROM, you may need to convert to some other file type, and possibly
|
EPROM, you may need to convert to some other file type, and possibly
|
adjust the start address. When you have the correct
|
adjust the start address. When you have the correct
|
<SPAN
|
<SPAN
|
CLASS="APPLICATION"
|
CLASS="APPLICATION"
|
>objcopy</SPAN
|
>objcopy</SPAN
|
> command to do this, add it to the
|
> command to do this, add it to the
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>CYGBLD_BUILD_GDB_STUBS</TT
|
>CYGBLD_BUILD_GDB_STUBS</TT
|
> custom build rule in the
|
> custom build rule in the
|
platform CDL file.</P
|
platform CDL file.</P
|
><P
|
><P
|
>Having updated the flash/EPROM on the board, you should see output
|
>Having updated the flash/EPROM on the board, you should see output
|
on the serial port looking like this when powering on the board:</P
|
on the serial port looking like this when powering on the board:</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>RedBoot(tm) bootstrap and debug environment [ROMRAM]
|
>RedBoot(tm) bootstrap and debug environment [ROMRAM]
|
Non-certified release, version UNKNOWN - built 15:42:24, Mar 14 2002
|
Non-certified release, version UNKNOWN - built 15:42:24, Mar 14 2002
|
|
|
Platform: <PLATFORM> (<ARCHITECTURE> <VARIANT>)
|
Platform: <PLATFORM> (<ARCHITECTURE> <VARIANT>)
|
Copyright (C) 2000, 2001, 2002, Red Hat, Inc.
|
Copyright (C) 2000, 2001, 2002, Red Hat, Inc.
|
|
|
RAM: 0x00000000-0x01000000, 0x000293e8-0x00ed1000 available
|
RAM: 0x00000000-0x01000000, 0x000293e8-0x00ed1000 available
|
FLASH: 0x24000000 - 0x26000000, 256 blocks of 0x00020000 bytes each.
|
FLASH: 0x24000000 - 0x26000000, 256 blocks of 0x00020000 bytes each.
|
RedBoot> </PRE
|
RedBoot> </PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>If you do not see this output, you need to go through all your
|
>If you do not see this output, you need to go through all your
|
changes and figure out what's wrong. If there's a user programmable
|
changes and figure out what's wrong. If there's a user programmable
|
LED or LCD on the board it may help you figure out how far RedBoot
|
LED or LCD on the board it may help you figure out how far RedBoot
|
gets before it hangs. Unfortunately there's no good way to describe
|
gets before it hangs. Unfortunately there's no good way to describe
|
what to do in this situation - other than that you have to play with
|
what to do in this situation - other than that you have to play with
|
the code and the board.</P
|
the code and the board.</P
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><H4
|
><H4
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><A
|
><A
|
NAME="AEN9484">Adding features</H4
|
NAME="AEN9484">Adding features</H4
|
><P
|
><P
|
>Now you should have a basic RedBoot running on the board. This
|
>Now you should have a basic RedBoot running on the board. This
|
means you have a the correct board initialization and a working serial
|
means you have a the correct board initialization and a working serial
|
driver. It's time to flesh out the remaining HAL features.</P
|
driver. It's time to flesh out the remaining HAL features.</P
|
><P
|
><P
|
></P
|
></P
|
><OL
|
><OL
|
TYPE="1"
|
TYPE="1"
|
><LI
|
><LI
|
><P
|
><P
|
>Reset. As mentioned above it is desirable to get the board to
|
>Reset. As mentioned above it is desirable to get the board to
|
reset when GDB disconnects. When GDB disconnects it sends RedBoot
|
reset when GDB disconnects. When GDB disconnects it sends RedBoot
|
a kill-packet, and RedBoot first calls <TT
|
a kill-packet, and RedBoot first calls <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>HAL_STUB_PLATFORM_RESET()</TT
|
>HAL_STUB_PLATFORM_RESET()</TT
|
>,
|
>,
|
attempting to perform a software-invoked reset. Most embedded
|
attempting to perform a software-invoked reset. Most embedded
|
CPUs/boards have a watchdog which is capable of triggering a reset.
|
CPUs/boards have a watchdog which is capable of triggering a reset.
|
If your target does not have a watchdog, leave
|
If your target does not have a watchdog, leave
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>HAL_STUB_PLATFORM_RESET()</TT
|
>HAL_STUB_PLATFORM_RESET()</TT
|
> empty and rely on the fallback approach.</P
|
> empty and rely on the fallback approach.</P
|
><P
|
><P
|
>If <TT
|
>If <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>HAL_STUB_PLATFORM_RESET()</TT
|
>HAL_STUB_PLATFORM_RESET()</TT
|
> did not cause a reset, RedBoot will
|
> did not cause a reset, RedBoot will
|
jump to <TT
|
jump to <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>HAL_STUB_PLATFORM_RESET_ENTRY</TT
|
>HAL_STUB_PLATFORM_RESET_ENTRY</TT
|
> - this should be the address
|
> - this should be the address
|
where the CPU will start execution after a reset. Re-initializing the
|
where the CPU will start execution after a reset. Re-initializing the
|
board and drivers will <SPAN
|
board and drivers will <SPAN
|
CLASS="emphasis"
|
CLASS="emphasis"
|
><I
|
><I
|
CLASS="EMPHASIS"
|
CLASS="EMPHASIS"
|
>usually</I
|
>usually</I
|
></SPAN
|
></SPAN
|
> be good enough to make a
|
> be good enough to make a
|
hardware reset unnecessary.</P
|
hardware reset unnecessary.</P
|
><P
|
><P
|
>After the reset caused by the kill-packet, the target will be ready
|
>After the reset caused by the kill-packet, the target will be ready
|
for GDB to connect again. During a days work, this will save you from
|
for GDB to connect again. During a days work, this will save you from
|
pressing the reset button many times.</P
|
pressing the reset button many times.</P
|
><P
|
><P
|
>Note that it is possible to disconnect from the board without
|
>Note that it is possible to disconnect from the board without
|
causing it to reset by using the GDB command "detach".</P
|
causing it to reset by using the GDB command "detach".</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
>Single-stepping is necessary for both instruction-level debugging
|
>Single-stepping is necessary for both instruction-level debugging
|
and for breakpoint support. Single-stepping support should already be
|
and for breakpoint support. Single-stepping support should already be
|
in place as part of the architecture/variant HAL, but you want to give
|
in place as part of the architecture/variant HAL, but you want to give
|
it a quick test since you will come to rely on it.</P
|
it a quick test since you will come to rely on it.</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
>Real-time clock interrupts drive the eCos scheduler clock. Many
|
>Real-time clock interrupts drive the eCos scheduler clock. Many
|
embedded CPUs have an on-core timer (e.g. SH) or decrementer
|
embedded CPUs have an on-core timer (e.g. SH) or decrementer
|
(e.g. MIPS, PPC) that can be used, and in this case it will already be
|
(e.g. MIPS, PPC) that can be used, and in this case it will already be
|
supported by the architecture/variant HAL. You only have to calculate
|
supported by the architecture/variant HAL. You only have to calculate
|
and enter the proper <TT
|
and enter the proper <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>CYGNUM_HAL_RTC_CONSTANTS</TT
|
>CYGNUM_HAL_RTC_CONSTANTS</TT
|
>
|
>
|
definitions in the platform CDL file.</P
|
definitions in the platform CDL file.</P
|
><P
|
><P
|
>On some targets it may be necessary to use a platform-specific
|
>On some targets it may be necessary to use a platform-specific
|
timer source for driving the real-time clock. In this case you also
|
timer source for driving the real-time clock. In this case you also
|
have to enter the proper CDL definitions, but must also define
|
have to enter the proper CDL definitions, but must also define
|
suitable versions of the <TT
|
suitable versions of the <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>HAL_CLOCK_XXXX</TT
|
>HAL_CLOCK_XXXX</TT
|
> macros.</P
|
> macros.</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
>Interrupt decoding usually differs between platforms because the
|
>Interrupt decoding usually differs between platforms because the
|
number and type of devices on the board differ. In
|
number and type of devices on the board differ. In
|
<TT
|
<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>plf_intr.h</TT
|
>plf_intr.h</TT
|
> (ARM:
|
> (ARM:
|
<TT
|
<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>hal_platform_ints.h</TT
|
>hal_platform_ints.h</TT
|
>) you must either extend or
|
>) you must either extend or
|
replace the default vector definitions provided by the architecture
|
replace the default vector definitions provided by the architecture
|
or variant interrupt headers. You may also have to define
|
or variant interrupt headers. You may also have to define
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>HAL_INTERRUPT_XXXX</TT
|
>HAL_INTERRUPT_XXXX</TT
|
> control macros.</P
|
> control macros.</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
>Caching may also differ from architecture/variant definitions.
|
>Caching may also differ from architecture/variant definitions.
|
This maybe just the cache sizes, but there can also be bigger
|
This maybe just the cache sizes, but there can also be bigger
|
differences for example if the platform supports 2nd level caches.</P
|
differences for example if the platform supports 2nd level caches.</P
|
><P
|
><P
|
>When cache definitions are in place, enable the caches on
|
>When cache definitions are in place, enable the caches on
|
startup. First verify that the system is stable for RAM startups, then
|
startup. First verify that the system is stable for RAM startups, then
|
build a new RedBoot and install it. This will test if caching, and in
|
build a new RedBoot and install it. This will test if caching, and in
|
particular the cache sync/flush operations, also work for ROM startup.</P
|
particular the cache sync/flush operations, also work for ROM startup.</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
>Asynchronous breakpoints allow you to stop application execution
|
>Asynchronous breakpoints allow you to stop application execution
|
and enter the debugger. Asynchronous breakpoint details are described
|
and enter the debugger. Asynchronous breakpoint details are described
|
in .</P
|
in .</P
|
></LI
|
></LI
|
></OL
|
></OL
|
><P
|
><P
|
>You should now have a completed platform HAL port. Verify its
|
>You should now have a completed platform HAL port. Verify its
|
stability and completeness by running all the eCos tests and fix any
|
stability and completeness by running all the eCos tests and fix any
|
problems that show up (you have a working RedBoot now, remember! That
|
problems that show up (you have a working RedBoot now, remember! That
|
means you can debug the code to see why it fails).</P
|
means you can debug the code to see why it fails).</P
|
><P
|
><P
|
>Given the many configuration options in eCos, there may be hidden
|
>Given the many configuration options in eCos, there may be hidden
|
bugs or missing features that do not show up even if you run all the
|
bugs or missing features that do not show up even if you run all the
|
tests successfully with a default configuration. A comprehensive test
|
tests successfully with a default configuration. A comprehensive test
|
of the entire system will take many configuration permutations and
|
of the entire system will take many configuration permutations and
|
many many thousands of tests executed.</P
|
many many thousands of tests executed.</P
|
></DIV
|
></DIV
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><H3
|
><H3
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><A
|
><A
|
NAME="AEN9517">Hints</H3
|
NAME="AEN9517">Hints</H3
|
><P
|
><P
|
></P
|
></P
|
><UL
|
><UL
|
><LI
|
><LI
|
><P
|
><P
|
>JTAG or similar CPU debugging hardware can greatly reduce the time
|
>JTAG or similar CPU debugging hardware can greatly reduce the time
|
it takes to write a HAL port since you always have full visibility
|
it takes to write a HAL port since you always have full visibility
|
of what the CPU is doing.
|
of what the CPU is doing.
|
</P
|
</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
>LEDs can be your friends if you don't have a JTAG
|
>LEDs can be your friends if you don't have a JTAG
|
device. Especially in the start of the porting effort if you don't
|
device. Especially in the start of the porting effort if you don't
|
already have a working ROM monitor on the target. Then you have to
|
already have a working ROM monitor on the target. Then you have to
|
get a basic RedBoot working while basically being blindfolded. The
|
get a basic RedBoot working while basically being blindfolded. The
|
LED can make it little easier, as you'll be able to do limited
|
LED can make it little easier, as you'll be able to do limited
|
tracking of program flow and behavior by switching the LED on and
|
tracking of program flow and behavior by switching the LED on and
|
off. If the board has multiple LEDs you can show a number (using
|
off. If the board has multiple LEDs you can show a number (using
|
binary notation with the LEDs) and sprinkle code which sets
|
binary notation with the LEDs) and sprinkle code which sets
|
different numbers throughout the code.</P
|
different numbers throughout the code.</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
>Debugging the interrupt processing is possible if you are
|
>Debugging the interrupt processing is possible if you are
|
careful with the way you program the very early interrupt entry
|
careful with the way you program the very early interrupt entry
|
handling. Write it so that as soon as possible in the interrupt
|
handling. Write it so that as soon as possible in the interrupt
|
path, taking a trap (exception) does not harm execution. See the
|
path, taking a trap (exception) does not harm execution. See the
|
SH vectors.S code for an example. Look for
|
SH vectors.S code for an example. Look for
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>cyg_hal_default_interrupt_vsr</TT
|
>cyg_hal_default_interrupt_vsr</TT
|
> and the label
|
> and the label
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>cyg_hal_default_interrupt_vsr_bp_safe</TT
|
>cyg_hal_default_interrupt_vsr_bp_safe</TT
|
>, which
|
>, which
|
marks the point after which traps/single-stepping is safe.
|
marks the point after which traps/single-stepping is safe.
|
</P
|
</P
|
><P
|
><P
|
>Being able to display memory content, CPU registers,
|
>Being able to display memory content, CPU registers,
|
interrupt controller details at the time of an interrupt can save
|
interrupt controller details at the time of an interrupt can save
|
a lot of time.</P
|
a lot of time.</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
>Using assertions is a good idea. They can sometimes reveal subtle
|
>Using assertions is a good idea. They can sometimes reveal subtle
|
bugs or missing features long before you would otherwise have
|
bugs or missing features long before you would otherwise have
|
found them, let alone notice them.
|
found them, let alone notice them.
|
</P
|
</P
|
><P
|
><P
|
>The default eCos configuration does not use assertions, so you
|
>The default eCos configuration does not use assertions, so you
|
have to enable them by switching on the option <TT
|
have to enable them by switching on the option <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>CYGPKG_INFRA_DEBUG</TT
|
>CYGPKG_INFRA_DEBUG</TT
|
>
|
>
|
in the infra package.</P
|
in the infra package.</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
>The idle loop can be used to help debug the system.
|
>The idle loop can be used to help debug the system.
|
</P
|
</P
|
><P
|
><P
|
>Triggering clock from the idle loop is a neat trick for
|
>Triggering clock from the idle loop is a neat trick for
|
examining system behavior either before interrupts are fully
|
examining system behavior either before interrupts are fully
|
working, or to speed up "the clock".
|
working, or to speed up "the clock".
|
</P
|
</P
|
><P
|
><P
|
>Use the idle loop to monitor and/or print out variables or
|
>Use the idle loop to monitor and/or print out variables or
|
hardware registers.</P
|
hardware registers.</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
><SPAN
|
><SPAN
|
CLASS="APPLICATION"
|
CLASS="APPLICATION"
|
>hal_mk_defs</SPAN
|
>hal_mk_defs</SPAN
|
> is used in some of the
|
> is used in some of the
|
HALs (ARM, SH) as a way to generate assembler symbol definitions from
|
HALs (ARM, SH) as a way to generate assembler symbol definitions from
|
C header files without imposing an assembler/C syntax separation in
|
C header files without imposing an assembler/C syntax separation in
|
the C header files.</P
|
the C header files.</P
|
></LI
|
></LI
|
></UL
|
></UL
|
></DIV
|
></DIV
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><H2
|
><H2
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><A
|
><A
|
NAME="HAL-PORTING-CDL-REQUIREMENTS">HAL Platform CDL</H2
|
NAME="HAL-PORTING-CDL-REQUIREMENTS">HAL Platform CDL</H2
|
><P
|
><P
|
>The platform CDL both contains details necessary for the building
|
>The platform CDL both contains details necessary for the building
|
of eCos, and platform-specific configuration options. For this reason
|
of eCos, and platform-specific configuration options. For this reason
|
the options differ between platforms, and the below is just a brief
|
the options differ between platforms, and the below is just a brief
|
description of the most common options.</P
|
description of the most common options.</P
|
><P
|
><P
|
> See Components Writers Guide
|
> See Components Writers Guide
|
for more details on CDL. Also have a quick look around in
|
for more details on CDL. Also have a quick look around in
|
existing platform CDL files to get an idea of what is possible and how
|
existing platform CDL files to get an idea of what is possible and how
|
various configuration issues can be represented with CDL.</P
|
various configuration issues can be represented with CDL.</P
|
><DIV
|
><DIV
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><H3
|
><H3
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><A
|
><A
|
NAME="HAL-PORTING-ECOS-DATABASE">eCos Database</H3
|
NAME="HAL-PORTING-ECOS-DATABASE">eCos Database</H3
|
><P
|
><P
|
>The eCos configuration system is made aware of a package by
|
>The eCos configuration system is made aware of a package by
|
adding a package description in <TT
|
adding a package description in <TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>ecos.db</TT
|
>ecos.db</TT
|
>. As an
|
>. As an
|
example we use the <TT
|
example we use the <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>TX39/JMR3904</TT
|
>TX39/JMR3904</TT
|
> platform:</P
|
> platform:</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>package CYGPKG_HAL_MIPS_TX39_JMR3904 {
|
>package CYGPKG_HAL_MIPS_TX39_JMR3904 {
|
alias { "Toshiba JMR-TX3904 board" hal_tx39_jmr3904 tx39_jmr3904_hal }
|
alias { "Toshiba JMR-TX3904 board" hal_tx39_jmr3904 tx39_jmr3904_hal }
|
directory hal/mips/jmr3904
|
directory hal/mips/jmr3904
|
script hal_mips_tx39_jmr3904.cdl
|
script hal_mips_tx39_jmr3904.cdl
|
hardware
|
hardware
|
description "
|
description "
|
The JMR3904 HAL package should be used when targeting the
|
The JMR3904 HAL package should be used when targeting the
|
actual hardware. The same package can also be used when
|
actual hardware. The same package can also be used when
|
running on the full simulator, since this provides an
|
running on the full simulator, since this provides an
|
accurate simulation of the hardware including I/O devices.
|
accurate simulation of the hardware including I/O devices.
|
To use the simulator in this mode the command
|
To use the simulator in this mode the command
|
`target sim --board=jmr3904' should be used from inside gdb."
|
`target sim --board=jmr3904' should be used from inside gdb."
|
}</PRE
|
}</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>This contains the title and description presented in the
|
>This contains the title and description presented in the
|
Configuration Tool when the package is selected. It also specifies
|
Configuration Tool when the package is selected. It also specifies
|
where in the tree the package files can be found (<TT
|
where in the tree the package files can be found (<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>directory</TT
|
>directory</TT
|
>)
|
>)
|
and the name of the CDL file which contains the package details
|
and the name of the CDL file which contains the package details
|
(<TT
|
(<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>script</TT
|
>script</TT
|
>).</P
|
>).</P
|
><P
|
><P
|
>To be able to build and test a configuration for the new target, there
|
>To be able to build and test a configuration for the new target, there
|
also needs to be a <TT
|
also needs to be a <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>target</TT
|
>target</TT
|
> entry in the
|
> entry in the
|
<TT
|
<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>ecos.db</TT
|
>ecos.db</TT
|
> file. </P
|
> file. </P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>target jmr3904 {
|
>target jmr3904 {
|
alias { "Toshiba JMR-TX3904 board" jmr tx39 }
|
alias { "Toshiba JMR-TX3904 board" jmr tx39 }
|
packages { CYGPKG_HAL_MIPS
|
packages { CYGPKG_HAL_MIPS
|
CYGPKG_HAL_MIPS_TX39
|
CYGPKG_HAL_MIPS_TX39
|
CYGPKG_HAL_MIPS_TX39_JMR3904
|
CYGPKG_HAL_MIPS_TX39_JMR3904
|
}
|
}
|
description "
|
description "
|
The jmr3904 target provides the packages needed to run
|
The jmr3904 target provides the packages needed to run
|
eCos on a Toshiba JMR-TX3904 board. This target can also
|
eCos on a Toshiba JMR-TX3904 board. This target can also
|
be used when running in the full simulator, since the simulator provides an
|
be used when running in the full simulator, since the simulator provides an
|
accurate simulation of the hardware including I/O devices.
|
accurate simulation of the hardware including I/O devices.
|
To use the simulator in this mode the command
|
To use the simulator in this mode the command
|
`target sim --board=jmr3904' should be used from inside gdb."
|
`target sim --board=jmr3904' should be used from inside gdb."
|
}</PRE
|
}</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>The important part here is the <TT
|
>The important part here is the <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>packages</TT
|
>packages</TT
|
> section
|
> section
|
which defines the various hardware specific packages that contribute
|
which defines the various hardware specific packages that contribute
|
to support for this target. In this case the MIPS architecture
|
to support for this target. In this case the MIPS architecture
|
package, the TX39 variant package, and the JMR-TX3904 platform
|
package, the TX39 variant package, and the JMR-TX3904 platform
|
packages are selected. Other packages, for serial drivers, ethernet
|
packages are selected. Other packages, for serial drivers, ethernet
|
drivers and FLASH memory drivers may also appear here.</P
|
drivers and FLASH memory drivers may also appear here.</P
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><H3
|
><H3
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><A
|
><A
|
NAME="AEN9559">CDL File Layout</H3
|
NAME="AEN9559">CDL File Layout</H3
|
><P
|
><P
|
>All the platform options are contained in a CDL package named
|
>All the platform options are contained in a CDL package named
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>CYGPKG_HAL_<architecture>_<variant>_<platform></TT
|
>CYGPKG_HAL_<architecture>_<variant>_<platform></TT
|
>.
|
>.
|
They all share more or less the same <TT
|
They all share more or less the same <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>cdl_package</TT
|
>cdl_package</TT
|
>
|
>
|
details:</P
|
details:</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>cdl_package CYGPKG_HAL_MIPS_TX39_JMR3904 {
|
>cdl_package CYGPKG_HAL_MIPS_TX39_JMR3904 {
|
display "JMR3904 evaluation board"
|
display "JMR3904 evaluation board"
|
parent CYGPKG_HAL_MIPS
|
parent CYGPKG_HAL_MIPS
|
requires CYGPKG_HAL_MIPS_TX39
|
requires CYGPKG_HAL_MIPS_TX39
|
define_header hal_mips_tx39_jmr3904.h
|
define_header hal_mips_tx39_jmr3904.h
|
include_dir cyg/hal
|
include_dir cyg/hal
|
description "
|
description "
|
The JMR3904 HAL package should be used when targeting the
|
The JMR3904 HAL package should be used when targeting the
|
actual hardware. The same package can also be used when
|
actual hardware. The same package can also be used when
|
running on the full simulator, since this provides an
|
running on the full simulator, since this provides an
|
accurate simulation of the hardware including I/O devices.
|
accurate simulation of the hardware including I/O devices.
|
To use the simulator in this mode the command
|
To use the simulator in this mode the command
|
`target sim --board=jmr3904' should be used from inside gdb."
|
`target sim --board=jmr3904' should be used from inside gdb."
|
|
|
compile platform.S plf_misc.c plf_stub.c
|
compile platform.S plf_misc.c plf_stub.c
|
|
|
define_proc {
|
define_proc {
|
puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H <pkgconf/hal_mips_tx39.h>"
|
puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H <pkgconf/hal_mips_tx39.h>"
|
puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H <pkgconf/hal_mips_tx39_jmr3904.h>"
|
puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H <pkgconf/hal_mips_tx39_jmr3904.h>"
|
}
|
}
|
|
|
...
|
...
|
}</PRE
|
}</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>This specifies that the platform package should be parented under
|
>This specifies that the platform package should be parented under
|
the MIPS packages, requires the TX39 variant HAL and all configuration
|
the MIPS packages, requires the TX39 variant HAL and all configuration
|
settings should be saved in
|
settings should be saved in
|
<TT
|
<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>cyg/hal/hal_mips_tx39_jmt3904.h</TT
|
>cyg/hal/hal_mips_tx39_jmt3904.h</TT
|
>.</P
|
>.</P
|
><P
|
><P
|
>The <TT
|
>The <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>compile</TT
|
>compile</TT
|
> line specifies which files should be built
|
> line specifies which files should be built
|
when this package is enabled, and the <TT
|
when this package is enabled, and the <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>define_proc</TT
|
>define_proc</TT
|
> defines
|
> defines
|
some macros that are used to access the variant or architecture (the
|
some macros that are used to access the variant or architecture (the
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>_TARGET_</TT
|
>_TARGET_</TT
|
> name is a bit of a misnomer) and platform
|
> name is a bit of a misnomer) and platform
|
configuration options. </P
|
configuration options. </P
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><H3
|
><H3
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><A
|
><A
|
NAME="AEN9571">Startup Type</H3
|
NAME="AEN9571">Startup Type</H3
|
><P
|
><P
|
>eCos uses an option to select between a set of valid startup
|
>eCos uses an option to select between a set of valid startup
|
configurations. These are normally RAM, ROM and possibly ROMRAM. This
|
configurations. These are normally RAM, ROM and possibly ROMRAM. This
|
setting is used to select which linker map to use (i.e., where to link
|
setting is used to select which linker map to use (i.e., where to link
|
eCos and the application in the memory space), and how the startup
|
eCos and the application in the memory space), and how the startup
|
code should behave.</P
|
code should behave.</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>cdl_component CYG_HAL_STARTUP {
|
>cdl_component CYG_HAL_STARTUP {
|
display "Startup type"
|
display "Startup type"
|
flavor data
|
flavor data
|
legal_values {"RAM" "ROM"}
|
legal_values {"RAM" "ROM"}
|
default_value {"RAM"}
|
default_value {"RAM"}
|
no_define
|
no_define
|
define -file system.h CYG_HAL_STARTUP
|
define -file system.h CYG_HAL_STARTUP
|
description "
|
description "
|
When targeting the JMR3904 board it is possible to build
|
When targeting the JMR3904 board it is possible to build
|
the system for either RAM bootstrap, ROM bootstrap, or STUB
|
the system for either RAM bootstrap, ROM bootstrap, or STUB
|
bootstrap. RAM bootstrap generally requires that the board
|
bootstrap. RAM bootstrap generally requires that the board
|
is equipped with ROMs containing a suitable ROM monitor or
|
is equipped with ROMs containing a suitable ROM monitor or
|
equivalent software that allows GDB to download the eCos
|
equivalent software that allows GDB to download the eCos
|
application on to the board. The ROM bootstrap typically
|
application on to the board. The ROM bootstrap typically
|
requires that the eCos application be blown into EPROMs or
|
requires that the eCos application be blown into EPROMs or
|
equivalent technology."
|
equivalent technology."
|
}</PRE
|
}</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>The <TT
|
>The <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>no_define</TT
|
>no_define</TT
|
> and <TT
|
> and <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>define</TT
|
>define</TT
|
>
|
>
|
pair is used to make the setting of this option appear in the file
|
pair is used to make the setting of this option appear in the file
|
<TT
|
<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>system.h</TT
|
>system.h</TT
|
> instead of the default specified in the
|
> instead of the default specified in the
|
header.</P
|
header.</P
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><H3
|
><H3
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><A
|
><A
|
NAME="AEN9579">Build options</H3
|
NAME="AEN9579">Build options</H3
|
><P
|
><P
|
>A set of options under the components
|
>A set of options under the components
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>CYGBLD_GLOBAL_OPTIONS</TT
|
>CYGBLD_GLOBAL_OPTIONS</TT
|
> and
|
> and
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>CYGHWR_MEMORY_LAYOUT</TT
|
>CYGHWR_MEMORY_LAYOUT</TT
|
> specify how eCos should be
|
> specify how eCos should be
|
built: what tools and compiler options should be used, and which
|
built: what tools and compiler options should be used, and which
|
linker fragments should be used.</P
|
linker fragments should be used.</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
> cdl_component CYGBLD_GLOBAL_OPTIONS {
|
> cdl_component CYGBLD_GLOBAL_OPTIONS {
|
display "Global build options"
|
display "Global build options"
|
flavor none
|
flavor none
|
parent CYGPKG_NONE
|
parent CYGPKG_NONE
|
description "
|
description "
|
Global build options including control over
|
Global build options including control over
|
compiler flags, linker flags and choice of toolchain."
|
compiler flags, linker flags and choice of toolchain."
|
|
|
|
|
cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX {
|
cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX {
|
display "Global command prefix"
|
display "Global command prefix"
|
flavor data
|
flavor data
|
no_define
|
no_define
|
default_value { "mips-tx39-elf" }
|
default_value { "mips-tx39-elf" }
|
description "
|
description "
|
This option specifies the command prefix used when
|
This option specifies the command prefix used when
|
invoking the build tools."
|
invoking the build tools."
|
}
|
}
|
|
|
cdl_option CYGBLD_GLOBAL_CFLAGS {
|
cdl_option CYGBLD_GLOBAL_CFLAGS {
|
display "Global compiler flags"
|
display "Global compiler flags"
|
flavor data
|
flavor data
|
no_define
|
no_define
|
default_value { "-Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" }
|
default_value { "-Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" }
|
description "
|
description "
|
This option controls the global compiler flags which
|
This option controls the global compiler flags which
|
are used to compile all packages by
|
are used to compile all packages by
|
default. Individual packages may define
|
default. Individual packages may define
|
options which override these global flags."
|
options which override these global flags."
|
}
|
}
|
|
|
cdl_option CYGBLD_GLOBAL_LDFLAGS {
|
cdl_option CYGBLD_GLOBAL_LDFLAGS {
|
display "Global linker flags"
|
display "Global linker flags"
|
flavor data
|
flavor data
|
no_define
|
no_define
|
default_value { "-g -nostdlib -Wl,--gc-sections -Wl,-static" }
|
default_value { "-g -nostdlib -Wl,--gc-sections -Wl,-static" }
|
description "
|
description "
|
This option controls the global linker flags. Individual
|
This option controls the global linker flags. Individual
|
packages may define options which override these global flags."
|
packages may define options which override these global flags."
|
}
|
}
|
}
|
}
|
|
|
cdl_component CYGHWR_MEMORY_LAYOUT {
|
cdl_component CYGHWR_MEMORY_LAYOUT {
|
display "Memory layout"
|
display "Memory layout"
|
flavor data
|
flavor data
|
no_define
|
no_define
|
calculated { CYG_HAL_STARTUP == "RAM" ? "mips_tx39_jmr3904_ram" : \
|
calculated { CYG_HAL_STARTUP == "RAM" ? "mips_tx39_jmr3904_ram" : \
|
"mips_tx39_jmr3904_rom" }
|
"mips_tx39_jmr3904_rom" }
|
|
|
cdl_option CYGHWR_MEMORY_LAYOUT_LDI {
|
cdl_option CYGHWR_MEMORY_LAYOUT_LDI {
|
display "Memory layout linker script fragment"
|
display "Memory layout linker script fragment"
|
flavor data
|
flavor data
|
no_define
|
no_define
|
define -file system.h CYGHWR_MEMORY_LAYOUT_LDI
|
define -file system.h CYGHWR_MEMORY_LAYOUT_LDI
|
calculated { CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_mips_tx39_jmr3904_ram.ldi>" : \
|
calculated { CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_mips_tx39_jmr3904_ram.ldi>" : \
|
"<pkgconf/mlt_mips_tx39_jmr3904_rom.ldi>" }
|
"<pkgconf/mlt_mips_tx39_jmr3904_rom.ldi>" }
|
}
|
}
|
|
|
cdl_option CYGHWR_MEMORY_LAYOUT_H {
|
cdl_option CYGHWR_MEMORY_LAYOUT_H {
|
display "Memory layout header file"
|
display "Memory layout header file"
|
flavor data
|
flavor data
|
no_define
|
no_define
|
define -file system.h CYGHWR_MEMORY_LAYOUT_H
|
define -file system.h CYGHWR_MEMORY_LAYOUT_H
|
calculated { CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_mips_tx39_jmr3904_ram.h>" : \
|
calculated { CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_mips_tx39_jmr3904_ram.h>" : \
|
"<pkgconf/mlt_mips_tx39_jmr3904_rom.h>" }
|
"<pkgconf/mlt_mips_tx39_jmr3904_rom.h>" }
|
}
|
}
|
} </PRE
|
} </PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><H3
|
><H3
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><A
|
><A
|
NAME="AEN9585">Common Target Options</H3
|
NAME="AEN9585">Common Target Options</H3
|
><P
|
><P
|
>All platforms also specify real-time clock details:</P
|
>All platforms also specify real-time clock details:</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
># Real-time clock/counter specifics
|
># Real-time clock/counter specifics
|
cdl_component CYGNUM_HAL_RTC_CONSTANTS {
|
cdl_component CYGNUM_HAL_RTC_CONSTANTS {
|
display "Real-time clock constants."
|
display "Real-time clock constants."
|
flavor none
|
flavor none
|
|
|
cdl_option CYGNUM_HAL_RTC_NUMERATOR {
|
cdl_option CYGNUM_HAL_RTC_NUMERATOR {
|
display "Real-time clock numerator"
|
display "Real-time clock numerator"
|
flavor data
|
flavor data
|
calculated 1000000000
|
calculated 1000000000
|
}
|
}
|
cdl_option CYGNUM_HAL_RTC_DENOMINATOR {
|
cdl_option CYGNUM_HAL_RTC_DENOMINATOR {
|
display "Real-time clock denominator"
|
display "Real-time clock denominator"
|
flavor data
|
flavor data
|
calculated 100
|
calculated 100
|
}
|
}
|
# Isn't a nice way to handle freq requirement!
|
# Isn't a nice way to handle freq requirement!
|
cdl_option CYGNUM_HAL_RTC_PERIOD {
|
cdl_option CYGNUM_HAL_RTC_PERIOD {
|
display "Real-time clock period"
|
display "Real-time clock period"
|
flavor data
|
flavor data
|
legal_values { 15360 20736 }
|
legal_values { 15360 20736 }
|
calculated { CYGHWR_HAL_MIPS_CPU_FREQ == 50 ? 15360 : \
|
calculated { CYGHWR_HAL_MIPS_CPU_FREQ == 50 ? 15360 : \
|
CYGHWR_HAL_MIPS_CPU_FREQ == 66 ? 20736 : 0 }
|
CYGHWR_HAL_MIPS_CPU_FREQ == 66 ? 20736 : 0 }
|
}
|
}
|
}</PRE
|
}</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
> The <TT
|
> The <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>NUMERATOR</TT
|
>NUMERATOR</TT
|
> divided by the
|
> divided by the
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>DENOMINATOR</TT
|
>DENOMINATOR</TT
|
> gives the number of nanoseconds per
|
> gives the number of nanoseconds per
|
tick. The <TT
|
tick. The <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>PERIOD</TT
|
>PERIOD</TT
|
> is the divider to be programmed
|
> is the divider to be programmed
|
into a hardware timer that is driven from an appropriate hardware
|
into a hardware timer that is driven from an appropriate hardware
|
clock, such that the timer overflows once per tick (normally
|
clock, such that the timer overflows once per tick (normally
|
generating a CPU interrupt to mark the end of a tick). The tick
|
generating a CPU interrupt to mark the end of a tick). The tick
|
default rate is typically 100Hz.</P
|
default rate is typically 100Hz.</P
|
><P
|
><P
|
>Platforms that make use of the virtual vector
|
>Platforms that make use of the virtual vector
|
ROM calling interface (see <A
|
ROM calling interface (see <A
|
HREF="hal-calling-if.html"
|
HREF="hal-calling-if.html"
|
>the Section called <I
|
>the Section called <I
|
>Virtual Vectors (eCos/ROM Monitor Calling Interface)</I
|
>Virtual Vectors (eCos/ROM Monitor Calling Interface)</I
|
></A
|
></A
|
>) will also
|
>) will also
|
specify details necessary to define configuration channels (these
|
specify details necessary to define configuration channels (these
|
options are from the SH/EDK7707 HAL) :</P
|
options are from the SH/EDK7707 HAL) :</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS {
|
>cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS {
|
display "Number of communication channels on the board"
|
display "Number of communication channels on the board"
|
flavor data
|
flavor data
|
calculated 1
|
calculated 1
|
}
|
}
|
|
|
cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL {
|
cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL {
|
display "Debug serial port"
|
display "Debug serial port"
|
flavor data
|
flavor data
|
legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1
|
legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1
|
default_value 0
|
default_value 0
|
description "
|
description "
|
The EDK/7708 board has only one serial port. This option
|
The EDK/7708 board has only one serial port. This option
|
chooses which port will be used to connect to a host
|
chooses which port will be used to connect to a host
|
running GDB."
|
running GDB."
|
}
|
}
|
|
|
cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL {
|
cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL {
|
display "Diagnostic serial port"
|
display "Diagnostic serial port"
|
flavor data
|
flavor data
|
legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1
|
legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1
|
default_value 0
|
default_value 0
|
description "
|
description "
|
The EDK/7708 board has only one serial port. This option
|
The EDK/7708 board has only one serial port. This option
|
chooses which port will be used for diagnostic output."
|
chooses which port will be used for diagnostic output."
|
}</PRE
|
}</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>The platform usually also specify an option controlling the ability
|
>The platform usually also specify an option controlling the ability
|
to co-exist with a ROM monitor:</P
|
to co-exist with a ROM monitor:</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>cdl_option CYGSEM_HAL_USE_ROM_MONITOR {
|
>cdl_option CYGSEM_HAL_USE_ROM_MONITOR {
|
display "Work with a ROM monitor"
|
display "Work with a ROM monitor"
|
flavor booldata
|
flavor booldata
|
legal_values { "Generic" "CygMon" "GDB_stubs" }
|
legal_values { "Generic" "CygMon" "GDB_stubs" }
|
default_value { CYG_HAL_STARTUP == "RAM" ? "CygMon" : 0 }
|
default_value { CYG_HAL_STARTUP == "RAM" ? "CygMon" : 0 }
|
parent CYGPKG_HAL_ROM_MONITOR
|
parent CYGPKG_HAL_ROM_MONITOR
|
requires { CYG_HAL_STARTUP == "RAM" }
|
requires { CYG_HAL_STARTUP == "RAM" }
|
description "
|
description "
|
Support can be enabled for three different varieties of ROM monitor.
|
Support can be enabled for three different varieties of ROM monitor.
|
This support changes various eCos semantics such as the encoding
|
This support changes various eCos semantics such as the encoding
|
of diagnostic output, or the overriding of hardware interrupt
|
of diagnostic output, or the overriding of hardware interrupt
|
vectors.
|
vectors.
|
Firstly there is \"Generic\" support which prevents the HAL
|
Firstly there is \"Generic\" support which prevents the HAL
|
from overriding the hardware vectors that it does not use, to
|
from overriding the hardware vectors that it does not use, to
|
instead allow an installed ROM monitor to handle them. This is
|
instead allow an installed ROM monitor to handle them. This is
|
the most basic support which is likely to be common to most
|
the most basic support which is likely to be common to most
|
implementations of ROM monitor.
|
implementations of ROM monitor.
|
\"CygMon\" provides support for the Cygnus ROM Monitor.
|
\"CygMon\" provides support for the Cygnus ROM Monitor.
|
And finally, \"GDB_stubs\" provides support when GDB stubs are
|
And finally, \"GDB_stubs\" provides support when GDB stubs are
|
included in the ROM monitor or boot ROM."
|
included in the ROM monitor or boot ROM."
|
}</PRE
|
}</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>Or the ability to be configured as a ROM monitor:</P
|
>Or the ability to be configured as a ROM monitor:</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>cdl_option CYGSEM_HAL_ROM_MONITOR {
|
>cdl_option CYGSEM_HAL_ROM_MONITOR {
|
display "Behave as a ROM monitor"
|
display "Behave as a ROM monitor"
|
flavor bool
|
flavor bool
|
default_value 0
|
default_value 0
|
parent CYGPKG_HAL_ROM_MONITOR
|
parent CYGPKG_HAL_ROM_MONITOR
|
requires { CYG_HAL_STARTUP == "ROM" }
|
requires { CYG_HAL_STARTUP == "ROM" }
|
description "
|
description "
|
Enable this option if this program is to be used as a ROM monitor,
|
Enable this option if this program is to be used as a ROM monitor,
|
i.e. applications will be loaded into RAM on the board, and this
|
i.e. applications will be loaded into RAM on the board, and this
|
ROM monitor may process exceptions or interrupts generated from the
|
ROM monitor may process exceptions or interrupts generated from the
|
application. This enables features such as utilizing a separate
|
application. This enables features such as utilizing a separate
|
interrupt stack when exceptions are generated."
|
interrupt stack when exceptions are generated."
|
}</PRE
|
}</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>The latter option is accompanied by a special build rule that
|
>The latter option is accompanied by a special build rule that
|
extends the generic ROM monitor build rule in the common HAL:</P
|
extends the generic ROM monitor build rule in the common HAL:</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>cdl_option CYGBLD_BUILD_GDB_STUBS {
|
>cdl_option CYGBLD_BUILD_GDB_STUBS {
|
display "Build GDB stub ROM image"
|
display "Build GDB stub ROM image"
|
default_value 0
|
default_value 0
|
requires { CYG_HAL_STARTUP == "ROM" }
|
requires { CYG_HAL_STARTUP == "ROM" }
|
requires CYGSEM_HAL_ROM_MONITOR
|
requires CYGSEM_HAL_ROM_MONITOR
|
requires CYGBLD_BUILD_COMMON_GDB_STUBS
|
requires CYGBLD_BUILD_COMMON_GDB_STUBS
|
requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
|
requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
|
requires ! CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT
|
requires ! CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT
|
requires ! CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT
|
requires ! CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT
|
requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT
|
requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT
|
requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM
|
requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM
|
no_define
|
no_define
|
description "
|
description "
|
This option enables the building of the GDB stubs for the
|
This option enables the building of the GDB stubs for the
|
board. The common HAL controls takes care of most of the
|
board. The common HAL controls takes care of most of the
|
build process, but the final conversion from ELF image to
|
build process, but the final conversion from ELF image to
|
binary data is handled by the platform CDL, allowing
|
binary data is handled by the platform CDL, allowing
|
relocation of the data if necessary."
|
relocation of the data if necessary."
|
|
|
make -priority 320 {
|
make -priority 320 {
|
<PREFIX>/bin/gdb_module.bin : <PREFIX>/bin/gdb_module.img
|
<PREFIX>/bin/gdb_module.bin : <PREFIX>/bin/gdb_module.img
|
$(OBJCOPY) -O binary $< $@
|
$(OBJCOPY) -O binary $< $@
|
}
|
}
|
}</PRE
|
}</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>Most platforms support RedBoot, and some options are needed to
|
>Most platforms support RedBoot, and some options are needed to
|
configure for RedBoot.</P
|
configure for RedBoot.</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
> cdl_component CYGPKG_REDBOOT_HAL_OPTIONS {
|
> cdl_component CYGPKG_REDBOOT_HAL_OPTIONS {
|
display "Redboot HAL options"
|
display "Redboot HAL options"
|
flavor none
|
flavor none
|
no_define
|
no_define
|
parent CYGPKG_REDBOOT
|
parent CYGPKG_REDBOOT
|
active_if CYGPKG_REDBOOT
|
active_if CYGPKG_REDBOOT
|
description "
|
description "
|
This option lists the target's requirements for a valid Redboot
|
This option lists the target's requirements for a valid Redboot
|
configuration."
|
configuration."
|
|
|
cdl_option CYGBLD_BUILD_REDBOOT_BIN {
|
cdl_option CYGBLD_BUILD_REDBOOT_BIN {
|
display "Build Redboot ROM binary image"
|
display "Build Redboot ROM binary image"
|
active_if CYGBLD_BUILD_REDBOOT
|
active_if CYGBLD_BUILD_REDBOOT
|
default_value 1
|
default_value 1
|
no_define
|
no_define
|
description "This option enables the conversion of the Redboot ELF
|
description "This option enables the conversion of the Redboot ELF
|
image to a binary image suitable for ROM programming."
|
image to a binary image suitable for ROM programming."
|
|
|
make -priority 325 {
|
make -priority 325 {
|
<PREFIX>/bin/redboot.bin : <PREFIX>/bin/redboot.elf
|
<PREFIX>/bin/redboot.bin : <PREFIX>/bin/redboot.elf
|
$(OBJCOPY) --strip-debug $< $(@:.bin=.img)
|
$(OBJCOPY) --strip-debug $< $(@:.bin=.img)
|
$(OBJCOPY) -O srec $< $(@:.bin=.srec)
|
$(OBJCOPY) -O srec $< $(@:.bin=.srec)
|
$(OBJCOPY) -O binary $< $@
|
$(OBJCOPY) -O binary $< $@
|
}
|
}
|
}
|
}
|
}</PRE
|
}</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>The important part here is the <TT
|
>The important part here is the <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>make</TT
|
>make</TT
|
> command in the
|
> command in the
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>CYGBLD_BUILD_REDBOOT_BIN</TT
|
>CYGBLD_BUILD_REDBOOT_BIN</TT
|
> option which emits
|
> option which emits
|
makefile commands to translate the <TT
|
makefile commands to translate the <TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>.elf</TT
|
>.elf</TT
|
> file
|
> file
|
generated by the link phase into both a binary file and an S-Record
|
generated by the link phase into both a binary file and an S-Record
|
file. If a different format is required by a PROM programmer or ROM
|
file. If a different format is required by a PROM programmer or ROM
|
monitor, then different output formats would need to be generated here.</P
|
monitor, then different output formats would need to be generated here.</P
|
></DIV
|
></DIV
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><H2
|
><H2
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><A
|
><A
|
NAME="HAL-PORTING-PLATFORM-MEMORY-LAYOUT">Platform Memory Layout</H2
|
NAME="HAL-PORTING-PLATFORM-MEMORY-LAYOUT">Platform Memory Layout</H2
|
><P
|
><P
|
>The platform memory layout is defined using the Memory
|
>The platform memory layout is defined using the Memory
|
Configuration Window in the Configuration Tool.</P
|
Configuration Window in the Configuration Tool.</P
|
><DIV
|
><DIV
|
CLASS="NOTE"
|
CLASS="NOTE"
|
><BLOCKQUOTE
|
><BLOCKQUOTE
|
CLASS="NOTE"
|
CLASS="NOTE"
|
><P
|
><P
|
><B
|
><B
|
>Note: </B
|
>Note: </B
|
>If you do not have access to a Windows machine, you can
|
>If you do not have access to a Windows machine, you can
|
hand edit the <TT
|
hand edit the <TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>.h</TT
|
>.h</TT
|
> and <TT
|
> and <TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>.ldi</TT
|
>.ldi</TT
|
> files to match the
|
> files to match the
|
properties of your platform. If you want to contribute your port back
|
properties of your platform. If you want to contribute your port back
|
to the eCos community, ask someone on the list to make proper memory
|
to the eCos community, ask someone on the list to make proper memory
|
map files for you.</P
|
map files for you.</P
|
></BLOCKQUOTE
|
></BLOCKQUOTE
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><H3
|
><H3
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><A
|
><A
|
NAME="AEN9615">Layout Files</H3
|
NAME="AEN9615">Layout Files</H3
|
><P
|
><P
|
>The memory configuration details are saved in three files:</P
|
>The memory configuration details are saved in three files:</P
|
><P
|
><P
|
></P
|
></P
|
><DIV
|
><DIV
|
CLASS="VARIABLELIST"
|
CLASS="VARIABLELIST"
|
><DL
|
><DL
|
><DT
|
><DT
|
><TT
|
><TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>.mlt</TT
|
>.mlt</TT
|
></DT
|
></DT
|
><DD
|
><DD
|
><P
|
><P
|
>This is the Configuration Tool save-file. It is only used
|
>This is the Configuration Tool save-file. It is only used
|
by the Configuration Tool.</P
|
by the Configuration Tool.</P
|
></DD
|
></DD
|
><DT
|
><DT
|
><TT
|
><TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>.ldi</TT
|
>.ldi</TT
|
></DT
|
></DT
|
><DD
|
><DD
|
><P
|
><P
|
>This is the linker script fragment. It defines the memory
|
>This is the linker script fragment. It defines the memory
|
and location of sections by way of macros defined in the
|
and location of sections by way of macros defined in the
|
architecture or variant linker script.</P
|
architecture or variant linker script.</P
|
></DD
|
></DD
|
><DT
|
><DT
|
><TT
|
><TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>.h</TT
|
>.h</TT
|
></DT
|
></DT
|
><DD
|
><DD
|
><P
|
><P
|
>This file describes some of the memory region details as C
|
>This file describes some of the memory region details as C
|
macros, allowing eCos or the application adapt the memory
|
macros, allowing eCos or the application adapt the memory
|
layout of a specific configuration.</P
|
layout of a specific configuration.</P
|
></DD
|
></DD
|
></DL
|
></DL
|
></DIV
|
></DIV
|
><P
|
><P
|
>These three files are generated for each startup-type, since the
|
>These three files are generated for each startup-type, since the
|
memory details usually differ.</P
|
memory details usually differ.</P
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><H3
|
><H3
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><A
|
><A
|
NAME="AEN9635">Reserved Regions</H3
|
NAME="AEN9635">Reserved Regions</H3
|
><P
|
><P
|
>Some areas of the memory space are reserved for specific
|
>Some areas of the memory space are reserved for specific
|
purposes, making room for exception vectors and various tables. RAM
|
purposes, making room for exception vectors and various tables. RAM
|
startup configurations also need to reserve some space at the bottom
|
startup configurations also need to reserve some space at the bottom
|
of the memory map for the ROM monitor.</P
|
of the memory map for the ROM monitor.</P
|
><P
|
><P
|
>These reserved areas are named with the prefix "reserved_" which is
|
>These reserved areas are named with the prefix "reserved_" which is
|
handled specially by the Configuration Tool: instead of referring to a
|
handled specially by the Configuration Tool: instead of referring to a
|
linker macro, the start of the area is labeled and a gap left in the
|
linker macro, the start of the area is labeled and a gap left in the
|
memory map.</P
|
memory map.</P
|
></DIV
|
></DIV
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><H2
|
><H2
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><A
|
><A
|
NAME="AEN9639">Platform Serial Device Support</H2
|
NAME="AEN9639">Platform Serial Device Support</H2
|
><P
|
><P
|
>The first step is to set up the CDL definitions. The configuration
|
>The first step is to set up the CDL definitions. The configuration
|
options that need to be set are the following:</P
|
options that need to be set are the following:</P
|
><P
|
><P
|
></P
|
></P
|
><DIV
|
><DIV
|
CLASS="VARIABLELIST"
|
CLASS="VARIABLELIST"
|
><DL
|
><DL
|
><DT
|
><DT
|
><TT
|
><TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS</TT
|
>CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS</TT
|
></DT
|
></DT
|
><DD
|
><DD
|
><P
|
><P
|
>The number of channels, usually 0, 1 or 2.</P
|
>The number of channels, usually 0, 1 or 2.</P
|
></DD
|
></DD
|
><DT
|
><DT
|
><TT
|
><TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL</TT
|
>CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL</TT
|
></DT
|
></DT
|
><DD
|
><DD
|
><P
|
><P
|
>The channel to use for GDB.</P
|
>The channel to use for GDB.</P
|
></DD
|
></DD
|
><DT
|
><DT
|
><TT
|
><TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_BAUD</TT
|
>CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_BAUD</TT
|
></DT
|
></DT
|
><DD
|
><DD
|
><P
|
><P
|
>Initial baud rate for debug channel.</P
|
>Initial baud rate for debug channel.</P
|
></DD
|
></DD
|
><DT
|
><DT
|
><TT
|
><TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL</TT
|
>CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL</TT
|
></DT
|
></DT
|
><DD
|
><DD
|
><P
|
><P
|
>The channel to use for the
|
>The channel to use for the
|
console.</P
|
console.</P
|
></DD
|
></DD
|
><DT
|
><DT
|
><TT
|
><TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD</TT
|
>CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD</TT
|
></DT
|
></DT
|
><DD
|
><DD
|
><P
|
><P
|
>The initial baud rate for the console
|
>The initial baud rate for the console
|
channel.</P
|
channel.</P
|
></DD
|
></DD
|
><DT
|
><DT
|
><TT
|
><TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT</TT
|
>CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT</TT
|
></DT
|
></DT
|
><DD
|
><DD
|
><P
|
><P
|
>The default console channel.</P
|
>The default console channel.</P
|
></DD
|
></DD
|
></DL
|
></DL
|
></DIV
|
></DIV
|
><P
|
><P
|
>The code in <TT
|
>The code in <TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>hal_diag.c</TT
|
>hal_diag.c</TT
|
> need to be converted to
|
> need to be converted to
|
support the new serial device.
|
support the new serial device.
|
If this the same as a device already supported, copy that.</P
|
If this the same as a device already supported, copy that.</P
|
><P
|
><P
|
>The following functions and types need to be rewritten to support a new serial
|
>The following functions and types need to be rewritten to support a new serial
|
device.</P
|
device.</P
|
><P
|
><P
|
></P
|
></P
|
><DIV
|
><DIV
|
CLASS="VARIABLELIST"
|
CLASS="VARIABLELIST"
|
><DL
|
><DL
|
><DT
|
><DT
|
><TT
|
><TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>struct channel_data_t;</TT
|
>struct channel_data_t;</TT
|
></DT
|
></DT
|
><DD
|
><DD
|
><P
|
><P
|
> Structure containing base address, timeout and ISR vector number
|
> Structure containing base address, timeout and ISR vector number
|
for each serial device supported. Extra fields my be added if
|
for each serial device supported. Extra fields my be added if
|
necessary for the device. For example some devices have
|
necessary for the device. For example some devices have
|
write-only control registers, so keeping a shadow of the last
|
write-only control registers, so keeping a shadow of the last
|
value written here can be useful.
|
value written here can be useful.
|
</P
|
</P
|
></DD
|
></DD
|
><DT
|
><DT
|
><TT
|
><TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>xxxx_ser_channels[];</TT
|
>xxxx_ser_channels[];</TT
|
></DT
|
></DT
|
><DD
|
><DD
|
><P
|
><P
|
> Array of <TT
|
> Array of <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>channel_data_t</TT
|
>channel_data_t</TT
|
>, initialized with parameters of each
|
>, initialized with parameters of each
|
channel. The index into this array is the channel number used
|
channel. The index into this array is the channel number used
|
in the CDL options above and is used by the virtual vector
|
in the CDL options above and is used by the virtual vector
|
mechanism to refer to each channel.
|
mechanism to refer to each channel.
|
</P
|
</P
|
></DD
|
></DD
|
><DT
|
><DT
|
><TT
|
><TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>void cyg_hal_plf_serial_init_channel(void
|
>void cyg_hal_plf_serial_init_channel(void
|
*__ch_data)</TT
|
*__ch_data)</TT
|
></DT
|
></DT
|
><DD
|
><DD
|
><P
|
><P
|
> Initialize the serial device. The parameter is actually a pointer to a
|
> Initialize the serial device. The parameter is actually a pointer to a
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>channel_data_t</TT
|
>channel_data_t</TT
|
> and should be cast back to
|
> and should be cast back to
|
this type before use. This function should use the CDL
|
this type before use. This function should use the CDL
|
definition for the baud rate for the channel it is initializing.
|
definition for the baud rate for the channel it is initializing.
|
</P
|
</P
|
></DD
|
></DD
|
><DT
|
><DT
|
><TT
|
><TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>void cyg_hal_plf_serial_putc(void * __ch_data,
|
>void cyg_hal_plf_serial_putc(void * __ch_data,
|
char *c)</TT
|
char *c)</TT
|
></DT
|
></DT
|
><DD
|
><DD
|
><P
|
><P
|
> Send a character to the serial device. This function should
|
> Send a character to the serial device. This function should
|
poll for the device being ready to send and then write the character.
|
poll for the device being ready to send and then write the character.
|
Since this is intended to be a diagnostic/debug channel, it is
|
Since this is intended to be a diagnostic/debug channel, it is
|
often also a good idea to poll for end of transmission
|
often also a good idea to poll for end of transmission
|
too. This ensures that as much data gets out of the system as
|
too. This ensures that as much data gets out of the system as
|
possible.
|
possible.
|
</P
|
</P
|
></DD
|
></DD
|
><DT
|
><DT
|
><TT
|
><TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>bool cyg_hal_plf_serial_getc_nonblock(void*
|
>bool cyg_hal_plf_serial_getc_nonblock(void*
|
__ch_data, cyg_uint8* ch)</TT
|
__ch_data, cyg_uint8* ch)</TT
|
></DT
|
></DT
|
><DD
|
><DD
|
><P
|
><P
|
> This function tests the device and if a character is
|
> This function tests the device and if a character is
|
available, places it in <TT
|
available, places it in <TT
|
CLASS="PARAMETER"
|
CLASS="PARAMETER"
|
><I
|
><I
|
>*ch</I
|
>*ch</I
|
></TT
|
></TT
|
> and returns
|
> and returns
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>TRUE</TT
|
>TRUE</TT
|
>. If no character is available, then
|
>. If no character is available, then
|
the function returns <TT
|
the function returns <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>FALSE</TT
|
>FALSE</TT
|
> immediately.
|
> immediately.
|
</P
|
</P
|
></DD
|
></DD
|
><DT
|
><DT
|
><TT
|
><TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>int cyg_hal_plf_serial_control(void *__ch_data,
|
>int cyg_hal_plf_serial_control(void *__ch_data,
|
__comm_control_cmd_t __func,
|
__comm_control_cmd_t __func,
|
...)</TT
|
...)</TT
|
></DT
|
></DT
|
><DD
|
><DD
|
><P
|
><P
|
> This is an IOCTL-like function for controlling various aspects
|
> This is an IOCTL-like function for controlling various aspects
|
of the serial device. The only part in which you may need to
|
of the serial device. The only part in which you may need to
|
do some work initially is in the
|
do some work initially is in the
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>__COMMCTL_IRQ_ENABLE</TT
|
>__COMMCTL_IRQ_ENABLE</TT
|
> and
|
> and
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>__COMMCTL_IRQ_DISABLE</TT
|
>__COMMCTL_IRQ_DISABLE</TT
|
> cases to
|
> cases to
|
enable/disable interrupts.
|
enable/disable interrupts.
|
</P
|
</P
|
></DD
|
></DD
|
><DT
|
><DT
|
><TT
|
><TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>int cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc,
|
>int cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc,
|
CYG_ADDRWORD __vector, CYG_ADDRWORD
|
CYG_ADDRWORD __vector, CYG_ADDRWORD
|
__data)</TT
|
__data)</TT
|
></DT
|
></DT
|
><DD
|
><DD
|
><P
|
><P
|
> This interrupt handler, called from the spurious interrupt
|
> This interrupt handler, called from the spurious interrupt
|
vector, is specifically for dealing with
|
vector, is specifically for dealing with
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>Ctrl-C</TT
|
>Ctrl-C</TT
|
> interrupts from GDB. When called
|
> interrupts from GDB. When called
|
this function should do the following:
|
this function should do the following:
|
<P
|
<P
|
></P
|
></P
|
><OL
|
><OL
|
TYPE="1"
|
TYPE="1"
|
><LI
|
><LI
|
><P
|
><P
|
>Check for an incoming character. The code here is very
|
>Check for an incoming character. The code here is very
|
similar to that in
|
similar to that in
|
<TT
|
<TT
|
CLASS="FUNCTION"
|
CLASS="FUNCTION"
|
>cyg_hal_plf_serial_getc_nonblock()</TT
|
>cyg_hal_plf_serial_getc_nonblock()</TT
|
>.
|
>.
|
</P
|
</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
> Read the character and call
|
> Read the character and call
|
<TT
|
<TT
|
CLASS="FUNCTION"
|
CLASS="FUNCTION"
|
>cyg_hal_is_break()</TT
|
>cyg_hal_is_break()</TT
|
>.
|
>.
|
</P
|
</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
> If result is true, set <TT
|
> If result is true, set <TT
|
CLASS="PARAMETER"
|
CLASS="PARAMETER"
|
><I
|
><I
|
>*__ctrlc</I
|
>*__ctrlc</I
|
></TT
|
></TT
|
> to
|
> to
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>1</TT
|
>1</TT
|
>.
|
>.
|
</P
|
</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
> Return <TT
|
> Return <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>CYG_ISR_HANDLED</TT
|
>CYG_ISR_HANDLED</TT
|
>.
|
>.
|
</P
|
</P
|
></LI
|
></LI
|
></OL
|
></OL
|
>
|
>
|
</P
|
</P
|
></DD
|
></DD
|
><DT
|
><DT
|
><TT
|
><TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>void cyg_hal_plf_serial_init()</TT
|
>void cyg_hal_plf_serial_init()</TT
|
></DT
|
></DT
|
><DD
|
><DD
|
><P
|
><P
|
> Initialize each of the serial channels.
|
> Initialize each of the serial channels.
|
First call <TT
|
First call <TT
|
CLASS="FUNCTION"
|
CLASS="FUNCTION"
|
>cyg_hal_plf_serial_init_channel()</TT
|
>cyg_hal_plf_serial_init_channel()</TT
|
> for each channel.
|
> for each channel.
|
Then call the <TT
|
Then call the <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>CYGACC_COMM_IF_*</TT
|
>CYGACC_COMM_IF_*</TT
|
> macros for
|
> macros for
|
each channel. This latter set of calls are identical for all
|
each channel. This latter set of calls are identical for all
|
channels, so the best way to do this is to copy and edit an
|
channels, so the best way to do this is to copy and edit an
|
existing example.
|
existing example.
|
</P
|
</P
|
></DD
|
></DD
|
></DL
|
></DL
|
></DIV
|
></DIV
|
></DIV
|
></DIV
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="NAVFOOTER"
|
CLASS="NAVFOOTER"
|
><HR
|
><HR
|
ALIGN="LEFT"
|
ALIGN="LEFT"
|
WIDTH="100%"><TABLE
|
WIDTH="100%"><TABLE
|
SUMMARY="Footer navigation table"
|
SUMMARY="Footer navigation table"
|
WIDTH="100%"
|
WIDTH="100%"
|
BORDER="0"
|
BORDER="0"
|
CELLPADDING="0"
|
CELLPADDING="0"
|
CELLSPACING="0"
|
CELLSPACING="0"
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="hal-porting-coding-conventions.html"
|
HREF="hal-porting-coding-conventions.html"
|
ACCESSKEY="P"
|
ACCESSKEY="P"
|
>Prev</A
|
>Prev</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="34%"
|
WIDTH="34%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="ecos-ref.html"
|
HREF="ecos-ref.html"
|
ACCESSKEY="H"
|
ACCESSKEY="H"
|
>Home</A
|
>Home</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="hal-porting-variant.html"
|
HREF="hal-porting-variant.html"
|
ACCESSKEY="N"
|
ACCESSKEY="N"
|
>Next</A
|
>Next</A
|
></TD
|
></TD
|
></TR
|
></TR
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="top"
|
VALIGN="top"
|
>HAL Coding Conventions</TD
|
>HAL Coding Conventions</TD
|
><TD
|
><TD
|
WIDTH="34%"
|
WIDTH="34%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="hal-porting-guide.html"
|
HREF="hal-porting-guide.html"
|
ACCESSKEY="U"
|
ACCESSKEY="U"
|
>Up</A
|
>Up</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="top"
|
VALIGN="top"
|
>Variant HAL Porting</TD
|
>Variant HAL Porting</TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
></BODY
|
></BODY
|
></HTML
|
></HTML
|
|
|