📄 porting.sgml
字号:
<entry><filename>include/hal_cache.h</filename></entry> <entry>Cache definitions and cache control macros.</entry></row><row><entry><filename>include/hal_intr.h</filename></entry> <entry>Exception and interrupt definitions. Macros for configuring and controlling interrupts. eCos real-time clock control macros.</entry></row><row><entry><filename>include/hal_io.h</filename></entry> <entry>Macros for accessing IO devices.</entry></row><row><entry><filename>include/<arch>_regs.h</filename></entry> <entry>Architecture register definitions.</entry></row><row><entry><filename>include/<arch>_stub.h</filename></entry> <entry>Architecture stub definitions. In particular the register frame layout used by GDB. This may differ from the one used by eCos.</entry></row><row><entry><filename>include/<arch>.inc</filename></entry> <entry>Architecture convenience assembly macros.</entry></row><row><entry><filename>src/<arch>.ld</filename></entry> <entry>Linker macros.</entry></row><row><entry><filename>src/context.S</filename></entry> <entry>Functions handling context switching and setjmp/longjmp.</entry></row><row><entry><filename>src/hal_misc.c</filename></entry> <entry>Exception and interrupt handlers in C. Various other utility functions.</entry></row><row><entry><filename>src/hal_mk_defs.c</filename></entry> <entry>Used to export definitions from C header files to assembler header files.</entry></row><row><entry><filename>src/hal_intr.c</filename></entry> <entry>Any necessary interrupt handling functions.</entry></row><row><entry><filename>src/<arch>stub.c</filename></entry> <entry>Architecture stub code. Contains functions for translating eCos exceptions to UNIX signals and functions for single-stepping.</entry></row><row><entry><filename>src/vectors.S</filename></entry> <entry>Exception, interrupt and early initialization code.</entry></row></tbody></tgroup></informaltable></section><!-- }}} --><!-- {{{ Variant HAL --><section><title>Variant HAL</title><para>Some variant HALs may add extra files for variant specific serialdrivers, or for handling interrupts/exceptions if it makes sense.</para><para>Note that these files may be mostly empty if the CPU variant can becontrolled by the generic architecture macros. The definitions presentare only conditionally defined - if the equivalent platform headersprovide the definitions, those override the variant definitions.</para><informaltable frame=all><tgroup cols=2 align=left colsep=1 rowsep=1><thead><row><entry>File</entry><entry>Description</entry></row></thead><tbody><row><entry><filename>include/var_arch.h</filename></entry> <entry>Saved register frame format, various thread, register and stack related macros.</entry></row><row><entry><filename>include/var_cache.h</filename></entry> <entry>Cache related macros.</entry></row><row><entry><filename>include/var_intr.h</filename></entry> <entry>Interrupt related macros.</entry></row><row><entry><filename>include/var_regs.h</filename></entry> <entry>Extra register definitions for the CPU variant.</entry></row><row><entry><filename>include/variant.inc</filename></entry> <entry>Various assembly macros used during system initialization.</entry></row><row><entry><filename>src/var_intr.c</filename></entry> <entry>Interrupt functions if necessary.</entry></row><row><entry><filename>src/var_misc.c</filename></entry> <entry>hal_variant_init function and any necessary extra functions.</entry></row><row><entry><filename>src/variant.S</filename></entry> <entry>Interrupt handler table definition.</entry></row><row><entry><filename>src/<arch>_<variant>.ld</filename></entry> <entry>Linker macros.</entry></row></tbody></tgroup></informaltable></section><!-- }}} --><!-- {{{ Platform HAL --><section><title>Platform HAL</title><para>Extras files may be added for platform specific serialdrivers. Extra files for handling interrupts and exceptions will bepresent if it makes sense.</para><informaltable frame=all><tgroup cols=2 align=left colsep=1 rowsep=1><thead><row><entry>File</entry><entry>Description</entry></row></thead><tbody><row><entry><filename>include/hal_diag.h</filename></entry> <entry>Defines functions used for HAL diagnostics output. This would normally be the ROM calling interface wrappers, but may also be the low-level IO functions themselves, saving a little overhead.</entry></row><row><entry><filename>include/platform.inc</filename></entry> <entry>Platform initialization code. This includes memory controller, vectors, and monitor initialization. Depending on the architecture, other things may need defining here as well: interrupt decoding, status register initialization value, etc.</entry></row><row><entry><filename>include/plf_cache.h</filename></entry> <entry>Platform specific cache handling.</entry></row><row><entry><filename>include/plf_intr.h</filename></entry> <entry>Platform specific interrupt handling.</entry></row><row><entry><filename>include/plf_io.h</filename></entry> <entry>PCI IO definitions and macros. May also be used to override generic HAL IO macros if the platform endianness differs from that of the CPU.</entry></row><row><entry><filename>include/plf_stub.h</filename></entry> <entry>Defines stub initializer and board reset details.</entry></row><row><entry><filename>src/hal_diag.c</filename></entry> <entry>May contain the low-level device drivers. But these may also reside in plf_stub.c</entry></row><row><entry><filename>src/platform.S</filename></entry> <entry>Memory controller setup macro, and if necessary interrupt springboard code.</entry></row><row><entry><filename>src/plf_misc.c</filename></entry> <entry>Platform initialization code.</entry></row><row><entry><filename>src/plf_mk_defs.c</filename></entry> <entry>Used to export definitions from C header files to assembler header files.</entry></row><row><entry><filename>src/plf_stub.c</filename></entry> <entry>Platform specific stub initialization and possibly the low-level device driver.</entry></row></tbody></tgroup></informaltable><para>The platform HAL also contains files specifying the platform'smemory layout. These files are located in<filename>include/pkgconf</filename>.</para></section><!-- }}} --><!-- {{{ Auxiliary HAL --><section><title>Auxiliary HAL</title><para>Auxiliary HALs contain whatever files are necessary to provide therequired functionality. There are no predefined set of files requiredin an auxiliary HAL.</para></section><!-- }}} --></section><!-- }}} --></section><!-- }}} --><!-- {{{ ROM Monitor Calling Interface --><section id="hal-calling-if"><TITLE>Virtual Vectors (eCos/ROM Monitor Calling Interface)</TITLE><para>Some eCos platforms have supported full debugging capabilities viaCygMon since day one. Platforms of the architectures PowerPC, ARM, andSH do not provide those features unless a GDB stub is included in theapplication.</para><para>This is going to change. All platforms will (eventually) supportall the debugging features by relying on a ROM/RAM calling interface(also referred to as virtual vector table) provided by the ROMmonitor. This calling interface is based on the tables used by libbspand is thus backwards compatible with the existing CygMon supportedplatforms.</para><!-- {{{ Virtual Vectors --><section id="hal-porting-virtual-vectors"><title>Virtual Vectors</title><para>What are virtual vectors, what do they do, and why are theyneeded?</para><para>"Virtual vectors" is the name of a table located at a staticlocation in the target address space. This table contains 64 vectorsthat point to <emphasis>service</emphasis> functions or data.</para><para>The fact that the vectors are always placed at the same location inthe address space means that both ROM and RAM startup configurationscan access these and thus the services pointed to.</para><para>The primary goal is to allow services to be provided by ROMconfigurations (ROM monitors such as RedBoot in particular) with<emphasis>clients</emphasis> in RAM configurations being able to use theseservices.</para><para>Without the table of pointers this would be impossible since theROM and RAM applications would be linked separately - in effect havingseparate name spaces - preventing direct references from one to theother.</para><para>This decoupling of service from client is needed by RedBoot,allowing among other things debugging of applications which do notcontain debugging client code (stubs).</para><!-- {{{ Initialization --><section><title>Initialization (or Mechanism vs. Policy)</title><para>Virtual vectors are a <emphasis>mechanism</emphasis> for decoupling servicesfrom clients in the address space.</para><para>The mechanism allows services to be implemented by a ROMmonitor, a RAM application, to be switched out at run-time, to bedisabled by installing pointers to dummy functions, etc.</para><para>The appropriate use of the mechanism is specified loosely by a<emphasis>policy</emphasis>. The general policy dictates that the vectors areinitialized in whole by ROM monitors (built for ROM or RAM), or bystand-alone applications.</para><para>For configurations relying on a ROM monitor environment, the policyis to allow initialization on a service by service basis. The defaultis to initialize all services, except COMMS services since these arepresumed to already be carrying a communication session to thedebugger / console which was used for launching the application. Thismeans that the bulk of the code gets tested in normal builds, and notjust once in a blue moon when building new stubs or a ROMconfiguration.</para><para>The configuration options are written to comply with this policy bydefault, but can be overridden by the user if desired. Defaultsare:</para><itemizedlist><listitem><para>For application development: the ROM monitor providesdebugging and diagnostic IO services, the RAM application relieson these by default.</para></listitem><listitem><para>For production systems: the application contains all thenecessary services.</para></listitem></itemizedlist></section><!-- }}} --><!-- {{{ Pros and Cons --><section><title>Pros and Cons of Virtual Vectors</title><para>There are pros and cons associated with the use of virtualvectors. We do believe that the pros generally outweigh the cons by agreat margin, but there may be situations where the opposite istrue.</para><para>The use of the services are implemented by way of macros, meaningthat it is possible to circumvent the virtual vectors ifdesired. There is (as yet) no implementation for doing this, but it ispossible.</para><para>Here is a list of pros and cons:</para><variablelist><varlistentry><term>Pro: Allows debugging without including stubs</term> <listitem><para>This is the primary reason for using virtual vectors. It
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -