Adaptation/GUID-0DC908A1-6CF6-50B5-978F-AF6C8CE04F44.dita
changeset 15 307f4279f433
equal deleted inserted replaced
14:578be2adaf3e 15:307f4279f433
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-0DC908A1-6CF6-50B5-978F-AF6C8CE04F44" xml:lang="en"><title>Automatic
       
    13 Translation of Header Files From C++</title><shortdesc>Describes how C++ header files are translated into the assembler
       
    14 language that the bootstrap requires.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    15 <p>Some header files that the bootstrap uses are shared with the Kernel and
       
    16 are written in C++. The header files are shared to avoid duplicate definitions
       
    17 of, for example, super page layout in the kernel and in the bootstrap. Since
       
    18 the bootstrap is written in assembler, the C++ header files must be translated
       
    19 to assembler-syntax include files. </p>
       
    20 <p>This is done automatically under the control of the generic makefile. The
       
    21 translation tool can produce include files in ARMASM, GNU AS or Turbo Assembler
       
    22 (for X86) syntax; the examples will all be in ARMASM syntax. </p>
       
    23 <p>It should be noted that the translation tool does not process <codeph>#include</codeph> directives
       
    24 or any other preprocessor directives. Only the types listed below and types
       
    25 created from those (by typedef or class/struct declaration) will be recognised. </p>
       
    26 <p>The following elements of C++ header files are translated: </p>
       
    27 <section id="GUID-44615AE9-41CB-434E-B329-53A0B8F62AB0"><title>Compile time constants, both at file and class scope</title> <p>Constants
       
    28 at file scope have the same name in the assembler include file and constants
       
    29 at class scope have the name<codeph> &lt;class name&gt;_&lt;constant name&gt;</codeph> in
       
    30 the assembler include file. Initialiser values may be expressions and may
       
    31 involve previously-defined constants or enumerators as well as <codeph>sizeof</codeph> operations
       
    32 applied to previously-defined types. </p> <p>For example: </p><codeblock id="GUID-B865A222-D7DB-51EF-B371-2FE7EB167D00" xml:space="preserve">const TInt KBufferSize = 1024;
       
    33 class X { const TInt KClassConstant = 100; };
       
    34 </codeblock><p>translates to: </p><codeblock id="GUID-5D46D2A6-EA88-5350-8CBD-2FCA6E961CEE" xml:space="preserve">KBufferSize            EQU 0x00000400
       
    35 X_KClassConstant     EQU 0x00000064
       
    36 </codeblock> </section>
       
    37 <section id="GUID-7C0EF920-D60D-4215-B7C3-CEF51D6E027A"><title>Enumerators, both at file and class scope</title> <p>For example: </p><codeblock id="GUID-F9FEE61B-D409-53F4-A032-95667300A3C7" xml:space="preserve">enum T1 {E1=0, E2=8, E3};
       
    38 class X { enum {EE1=-1, EE2, EE3}; };
       
    39 </codeblock> <p>translates to: </p><codeblock id="GUID-6C3A4922-E67E-5020-B5AE-0C30C76428E0" xml:space="preserve">E1                    EQU    0x00000000
       
    40 E2                    EQU    0x00000008
       
    41 E3                    EQU    0x00000009
       
    42 X_EE1                EQU    0xFFFFFFFF
       
    43 X_EE2                EQU    0x00000000
       
    44 X_EE3                EQU    0x00000001
       
    45 </codeblock> </section>
       
    46 <section id="GUID-3D197845-41A1-4063-AA73-74058C13F56D"><title>Offset of a class member within the class</title> <p>For example: </p><codeblock id="GUID-84324D58-A2FC-592A-BA20-1986C51A6A4A" xml:space="preserve">class X { TInt iX; TInt iY; TInt iZ[16]; };</codeblock> <p>translates
       
    47 to:</p><codeblock id="GUID-8B86F0FC-8FF1-5CE5-8832-F692DAAF6478" xml:space="preserve">X_iX                EQU    0x00000000
       
    48 X_iY                EQU    0x00000004
       
    49 X_iZ                EQU    0x00000008
       
    50 X_iZ_spc            EQU    0x00000004
       
    51 X_sz                EQU    0x00000048</codeblock> <p>The offset of a class
       
    52 member within the class is given the assembler name<codeph> &lt;class&gt;_&lt;member&gt;</codeph>.
       
    53 For an array member, this offset is the offset of the first element of the
       
    54 array within the class and <codeph>&lt;class&gt;_&lt;member&gt;_spc</codeph> is
       
    55 the size of each array element. The overall size of the class is given the
       
    56 assembler name <codeph>&lt;class&gt;_sz</codeph>. </p> <p>When computing these
       
    57 offsets and sizes the following basic types are known to the translation tool: </p><codeblock id="GUID-5F7D5BB0-E679-54F2-AA40-79CE67F6663F" xml:space="preserve">TInt8, TUint8 = 1 byte</codeblock><codeblock id="GUID-B42C7375-C025-50CD-8E0D-F51D5CD06F22" xml:space="preserve">TInt16, TUint16 = 2 bytes aligned to 2 byte boundary</codeblock><codeblock id="GUID-D3138371-2EF3-5461-A45F-7C2F5B7EA789" xml:space="preserve">TInt32, TUint32, TInt, TUint, enum, TLinAddr, TPte, TPde = 4 bytes aligned to 4 byte boundary</codeblock><codeblock id="GUID-7043D61A-451E-57AE-8912-1A18C029F31E" xml:space="preserve">TInt64, TUint64 = 8 bytes aligned to 8 byte boundary</codeblock> <p>The
       
    58 tool will produce an error if an attempt is made to use a <xref href="GUID-AAE85115-A8AA-3F6C-BA8C-69F5A23B0D90.dita"><apiname>TInt64</apiname></xref> or <xref href="GUID-5944E314-0D03-37D7-AA37-D29E6F6E18B8.dita"><apiname>TUint64</apiname></xref> which
       
    59 is not aligned on an 8 byte boundary. This is done to avoid incompatibilities
       
    60 between GCC and EABI compilers since the tool is not aware which is being
       
    61 used to compile the kernel. </p></section>
       
    62 </conbody></concept>