1 /*---------------------------------------------------------------------------* 2 Project: TwlSDK - include - dsp 3 File: dsp_coff.h 4 5 Copyright 2007-2008 Nintendo. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Date:: 2008-11-21#$ 14 $Rev: 9387 $ 15 $Author: kitase_hirotake $ 16 *---------------------------------------------------------------------------*/ 17 18 #ifndef TWL_DSP_COFF_H_ 19 #define TWL_DSP_COFF_H_ 20 21 #include <twl/dsp.h> 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /*===========================================================================*/ 28 29 /* COFF-related constant definitions */ 30 31 //#define COFF_SECTION_ATTR_DATA_SECTION 0x00000000 32 #define COFF_SECTION_ATTR_CODE_SECTION 0x00000001 33 #define COFF_SECTION_ATTR_MAPPED_IN_CODE_MEMORY 0x00000008 34 #define COFF_SECTION_ATTR_MAPPED_IN_DATA_MEMORY 0x00000010 35 #define COFF_SECTION_ATTR_NOLOAD_FOR_CODE_MEMORY 0x00000020 36 #define COFF_SECTION_ATTR_NOLOAD_FOR_DATA_MEMORY 0x00000040 37 #define COFF_SECTION_ATTR_BLOCK_HEADER 0x00000080 38 #define COFF_SECTION_ATTR_CONTAINS_C_C++_LINE_INFO 0x00000200 39 40 #define COFF_SYMBOL_NUMBER_UNDEFINEND 0x0000 41 #define COFF_SYMBOL_NUMBER_ABSOLUTE 0xFFFF 42 #define COFF_SYMBOL_NUMBER_DEBUG 0xFFFE 43 44 #define COFF_SYMBOL_TYPE_NULL 0x00 45 #define COFF_SYMBOL_TYPE_VOID 0x01 46 #define COFF_SYMBOL_TYPE_CHAR 0x02 47 #define COFF_SYMBOL_TYPE_SHORT 0x03 48 #define COFF_SYMBOL_TYPE_INT 0x04 49 #define COFF_SYMBOL_TYPE_LONG 0x05 50 #define COFF_SYMBOL_TYPE_FLOAT 0x06 51 #define COFF_SYMBOL_TYPE_DOUBLE 0x07 52 #define COFF_SYMBOL_TYPE_STRUCT 0x08 53 #define COFF_SYMBOL_TYPE_UNION 0x09 54 #define COFF_SYMBOL_TYPE_ENUM 0x0A 55 #define COFF_SYMBOL_TYPE_MOE 0x0B 56 #define COFF_SYMBOL_TYPE_BYTE 0x0C 57 #define COFF_SYMBOL_TYPE_WORD 0x0D 58 #define COFF_SYMBOL_TYPE_UINT 0x0E 59 #define COFF_SYMBOL_TYPE_DWORD 0x0F 60 61 #define COFF_SYMBOL_DTYPE_NULL 0x00 62 #define COFF_SYMBOL_DTYPE_POINTER 0x01 63 #define COFF_SYMBOL_DTYPE_FUNCTION 0x02 64 #define COFF_SYMBOL_DTYPE_ARRAY 0x03 65 66 /*---------------------------------------------------------------------------*/ 67 /* Declarations */ 68 69 /* COFF header structure */ 70 typedef struct COFFFileHeader 71 { 72 u16 Machine; 73 u16 NumberOfSections; 74 u32 TimeDateStamp; 75 u32 PointerToSymbolTable; 76 u32 NumberOfSymbols; 77 u16 SizeOfOptionalHeader; 78 u16 Characteristics; 79 } 80 COFFFileHeader; 81 82 /* COFF section information */ 83 typedef struct COFFSectionTable 84 { 85 u8 Name[8]; 86 u32 s_paddr; 87 u32 s_vaddr; 88 u32 s_size; 89 u32 s_scnptr; 90 u32 s_relptr; 91 u32 s_lnnoptr; 92 u16 s_nreloc; 93 u16 s_nlnno; 94 u32 s_flags; 95 } 96 COFFSectionTable; 97 98 /* COFF symbol information */ 99 100 typedef struct COFFSymbolTable 101 { 102 union 103 { 104 u8 shortname[8]; 105 struct 106 { 107 u32 zero; 108 u32 offset; 109 } 110 longname; 111 } 112 namefield; 113 u32 Value; 114 u16 SectionNumber; 115 u16 Type; 116 u8 StorageClass; 117 u8 NumberOfFollowingEntries; 118 u8 padding[2]; 119 } 120 COFFSymbolTable; 121 122 #define SIZEOF_COFFSymbolTable 18 123 124 /*===========================================================================*/ 125 126 #ifdef __cplusplus 127 } /* extern "C" */ 128 #endif 129 130 #endif /* TWL_DSP_COFF_H_ */ 131