⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 coff.h

📁 TMS320F2808的完整驱动测试程序源码
💻 H
📖 第 1 页 / 共 2 页
字号:
#define TI_STYP_PAD    0x08  /* not used */                    
#define TI_STYP_COPY   0x10  /* "copy"    : used for C init tables - 
                                                not allocated, relocated,
                                                loaded;  reloc & lineno
                                                entries processed normally */
#define TI_STYP_TEXT   0x20   /* section contains text only */
#define TI_STYP_DATA   0x40   /* section contains data only */
#define TI_STYP_BSS    0x80   /* section contains bss only */

/*------------------------------------------------------------------------*/
/* Bits 8-11 specify an alignment.  The alignment is (2 ** x).            */
/*------------------------------------------------------------------------*/
#define TI_ALIGN_DEFAULT      0x100  /* default align flag - target dependent */
#define TI_ALIGN_MASK         0xF00  /* mask for alignment factor             */
#define TI_ALIGN_SIZE(s_flag) (1 << (((unsigned)s_flag & TI_ALIGN_MASK) >> 8))

#define TI_STYP_BLOCK  0x1000        /* use alignment as blocking factor */
#define TI_STYP_PASS   0x2000        /* Pass section through unchanged   */
#define TI_STYP_CLINK  0x4000        /* Conditionally link section       */

/*------------------------------------------------------------------------*/
/*  RELOCATION ENTRIES                                                    */
/*  WE SUPPORT TWO TYPES OF RELOCATION ENTRIES:                           */
/*     1) OLD STYLE, WITH 16 BIT SYMBOL TABLE INDEX.                      */
/*     2) NEW STYLE, WITH 32 BIT SYMBOL TABLE INDEX.                      */
/*  FOR ANY GIVEN INPUT FILE, THE FILE HEADER FLAG "F_RELOC_12" INDICATES */
/*  THE TYPE OF RELOCATION ENTRY IN THE FILE.                             */
/*  THE TARGET-SPECIFIC FLAG RELOC_ENTRY_12 DETERMINES WHETHER THE NEW    */
/*  STYLE IS SUPPORTED ON A GIVEN TARGET.                                 */
/*------------------------------------------------------------------------*/
typedef struct ti_reloc_old
{
   long            r_vaddr;       /* (virtual) address of reference */
   short           r_symndx;      /* index into symbol table */
   unsigned short  r_disp;        /* additional bits for address calculation */
   unsigned short  r_type;        /* relocation type */
} TI_RELOC_OLD; 


typedef struct ti_reloc
{
   long            r_vaddr;       /* (virtual) address of reference       */
#if TI_COFF_VERSION_0 
   short           r_symndx;      /* 16-bit index into symbol table       */
#else
   long            r_symndx;      /* 32-bit index into symbol table       */
#endif
   unsigned short  r_disp;        /* additional bits for addr calc        */
   unsigned short  r_type;        /* relocation type                      */
} TI_RELOC;


#define TI_RELSZ              (TI_COFF_VERSION_1 ? 12 : 10)
#define TI_RELSZ_IN(version)  ((version >= TI_COFF_MAGIC_1) ? 12 : 10)

/*--------------------------------------------------------------------------*/
/*   define all relocation types                                            */
/*--------------------------------------------------------------------------*/
#define TI_R_ABS           0         /* absolute address - no relocation       */
#define TI_R_DIR16         01        /* UNUSED                                 */
#define TI_R_REL16         02        /* UNUSED                                 */
#define TI_R_DIR24         04        /* UNUSED                                 */
#define TI_R_REL24         05        /* 24 bits, direct                        */
#define TI_R_DIR32         06        /* UNUSED                                 */
#define TI_R_RRRELREG     016        /* RR: 8 bit relocatable register         */
#define TI_R_RELBYTE      017        /* 8 bits, direct                         */
#define TI_R_RELWORD      020        /* 16 bits, direct                        */
#define TI_R_RELLONG      021        /* 32 bits, direct                        */
#define TI_R_PCRBYTE      022        /* 8 bits, PC-relative                    */
#define TI_R_PCRWORD      023        /* 16 bits, PC-relative                   */
#define TI_R_PCRLONG      024        /* 32 bits, PC-relative                   */
#define TI_R_PCR24        025        /* 24 bits, PC-relative                   */
#define TI_R_PCR23H       026        /* 23 bits, PC-relative in halfwords(x>>1)*/
#define TI_R_PCR24W       027        /* 24 bits, PC-relative in words (x >> 2) */
#define TI_R_OCRLONG      030        /* GSP: 32 bits, one's complement direct  */
#define TI_R_GSPPCR16     031        /* GSP: 16 bits, PC relative (in words)   */
#define TI_R_GSPOPR32     032        /* GSP: 32 bits, direct big-endian        */
#define TI_R_GSPPCA16     033        /* GSP: same as GSPPCR16, but PC constant */
#define TI_R_OCBD32       034        /* GSP: 32 bits, 1's complement,big-endian*/
#define TI_R_RRNREG       035        /* RR: 8 bit reloc. reg. w/ neg off       */
#define TI_R_PARTLS16     040        /* Brahma: 16 bit offset of 24 bit address*/
#define TI_R_PARTMS8      041        /* Brahma: 8 bit page of 24 bit address   */
#define TI_R_PARTLS7      050        /* DSP: 7 bit offset of 16 bit address    */
#define TI_R_PARTMS9      051        /* DSP: 9 bit page of 16 bit address      */
#define TI_R_REL13        052        /* DSP: 13 bits, direct                   */
#define TI_R_REL23        053        /* DSP,C54X: 23 bits, direct (ext addr) */
#define TI_R_RELXPC       054        /* DSP,C54X: 16 bits, relative to XPC   */
#define TI_R_HIEXT        055        /* C54X: Hi word of extended prog addr  */
#define TI_R_HIWORD       061    /* RR: 8 bit relocation. hi byte of word  */
#define TI_R_LABCOD       062        /* C16 16-bit code address relocation     */

#define TI_R_PPBASE       064        /* PP: Global Base address type           */
#define TI_R_PPLBASE      065        /* PP: Local Base address type            */
#define TI_R_PP15         070        /* PP: Global 15 bit offset               */
#define TI_R_PP15W        071        /* PP: Global 15 bit offset divided by 4  */
#define TI_R_PP15H        072        /* PP: Global 15 bit offset divided by 2  */
#define TI_R_PP16B        073        /* PP: Global 16 bit offset for bytes     */
#define TI_R_PPL15        074        /* PP: Local 15 bit offset                */
#define TI_R_PPL15W       075        /* PP: Local 15 bit offset divided by 4   */
#define TI_R_PPL15H       076        /* PP: Local 15 bit offset divided by 2   */
#define TI_R_PPL16B       077        /* PP: Local 16 bit offset for bytes      */
#define TI_R_PPN15        0100       /* PP: Global 15 bit negative offset      */
#define TI_R_PPN15W       0101       /* PP: Global 15 bit negative offset / 4  */
#define TI_R_PPN15H       0102       /* PP: Global 15 bit negative offset / 2  */
#define TI_R_PPN16B       0103       /* PP: Global 16 bit negative byte offset */
#define TI_R_PPLN15       0104       /* PP: Local 15 bit negative offset       */
#define TI_R_PPLN15W      0105       /* PP: Local 15 bit negative offset / 4   */
#define TI_R_PPLN15H      0106       /* PP: Local 15 bit negative offset / 2   */
#define TI_R_PPLN16B      0107       /* PP: Local 16 bit negative byte offset  */

#define TI_R_MPPCR        0117       /* MP: 32-bit PC-relative / 4             */

#define TI_R_C60BASE      0120   /* C60: Data Page Pointer Based Offset    */
#define TI_R_C60DIR15     0121       /* C60: LD/ST long Displacement           */
#define TI_R_C60PCR16     0122       /* C60: 16-bit Packet PC Relative         */
#define TI_R_C60PCR24     0123       /* C60: 24-bit Packet PC Relative         */
#define TI_R_C60LO16      0124       /* C60: MVK Low Half Register             */
#define TI_R_C60HI16      0125       /* C60: MVKH/MVKLH High Half Register     */

#define TI_R_C8PHIBYTE    0130	  /* C8+: High byte of 24-bit address.    */
#define TI_R_C8PMIDBYTE   0131	  /* C8+: Middle byte of 24-bit address.  */
#define TI_R_C8PVECADR    0132	  /* C8+: Vector address (0xFFnnnn)       */
#define TI_R_C8PADR24     0133	  /* C8+: 24-bit address (rev byte order) */

#define TI_R_PARTLS6      0135       /* ANKOOR: 6 bit offset of 22 bit addr  */
#define TI_R_PARTMID10    0136       /* ANKOOR: Middle 10 bits of 22 bit addr*/ 
#define TI_R_REL22        0137       /* ANKOOR: 22 bits, direct              */
#define TI_R_PARTMS6      0140       /* ANKOOR: Upper 6 bits of 22 bit addr  */
#define TI_R_PARTMS16     0141       /* ANKOOR: Upper 16 bits of 22 bit addr */
#define TI_R_ANKPCR16     0142       /* ANKOOR: PC relative 16 bit           */
#define TI_R_ANKPCR8      0143       /* ANKOOR: PC relatvie 8 bit            */

/*------------------------------------------------------------------------*/
/*  LINE NUMBER ENTRIES                                                   */
/*------------------------------------------------------------------------*/
struct ti_lineno
{
   union
   {
      long         l_symndx; /* sym index of function name iff l_lnno == 0  */
      long         l_paddr;  /* (physical) address of line number */
   }  l_addr;
   unsigned short  l_lnno;   /* line number */
};

#define TI_LINENO  struct ti_lineno
#define TI_LINESZ  6       /* sizeof(LINENO) */


/*------------------------------------------------------------------------*/
/*  SYMBOL TABLE ENTRIES                                                  */
/*------------------------------------------------------------------------*/

#define  TI_FILNMLEN   14     /*  Number of characters in a file name */
#define  TI_DIMNUM     4      /*  Number of array dimensions in auxiliary entry */

typedef unsigned short TI_STYPE;

struct ti_syment
{
    union
    {
       char            _n_name[TI_SYMNMLEN];   /* old COFF version */
       struct
       {
          long    _n_zeroes;                /* new == 0 */
          long    _n_offset;                /* offset into string table */
       } _n_n;
       char      *_n_nptr[2];               /* allows for overlaying */
    } _n;

    long                    n_value;        /* value of symbol */
    short                   n_scnum;        /* section number */
    TI_STYPE                n_type;         /* type and derived type */
    char                    n_sclass;       /* storage class */
    char                    n_numaux;       /* number of aux. entries */
};

#define n_name          _n._n_name
#define n_nptr          _n._n_nptr[1]
#define n_zeroes        _n._n_n._n_zeroes
#define n_offset        _n._n_n._n_offset

/*------------------------------------------------------------------------*/
/* Relocatable symbols have a section number of the                       */
/* section in which they are defined.  Otherwise, section                 */
/* numbers have the following meanings:                                   */
/*------------------------------------------------------------------------*/
#define  TI_N_UNDEF  0                     /* undefined symbol */
#define  TI_N_ABS    -1                    /* value of symbol is absolute */
#define  TI_N_DEBUG  -2                    /* special debugging symbol  */


/*------------------------------------------------------------------------*/
/*  AUXILIARY SYMBOL ENTRY                                                */
/*------------------------------------------------------------------------*/
#define TI_SPACE(len, name)    char  name[len]

union ti_auxent
{
        struct
    {
        TI_SPACE(4, _0_3);
            long    x_fsize;        /* size of struct in bits.     */
        TI_SPACE(4, _8_11);
            long    x_endndx;       /* ptr to next sym beyond .eos */
        TI_SPACE(2, _16_17);
    } x_tag;

        struct
    {
        long    x_tagndx;       /* ptr to beginning of struct  */
        long    x_fsize;        /* size of struct in bits.     */
        TI_SPACE(10, _8_17);
        } x_eos;

    struct 
    {
        long    x_tagndx;       /* ptr to tag for function     */
        long    x_fsize;        /* size of function in bits    */
        long    x_lnnoptr;      /* file ptr to fcn line #      */
        long    x_endndx;       /* ptr to next sym beyond .ef  */
        TI_SPACE(2, _16_17);
        } x_func;

        struct
    {
            long    x_regmask;      /* Mask of regs use by func    */
        unsigned short  x_lnno; /* line number of block begin  */
        unsigned short  x_lcnt; /* # line number entries in func */
        long    x_framesize;    /* size of func local vars     */
        long    x_endndx;       /* ptr to next sym beyond .eb  */
        TI_SPACE(2, _16_17);
    } x_block;

        struct
    {
        long    x_tagndx;       /* ptr to tag for array type   */
        long    x_fsize;        /* Size of array in bits.      */
            unsigned short  x_dimen[TI_DIMNUM];
        TI_SPACE(2, _16_17);
    } x_array;

    struct
    {
            long    x_tagndx;       /* str, un, or enum tag indx   */
        long    x_fsize;        /* Size of symbol              */
        TI_SPACE(10, _10_17);
    } x_sym;

        struct
        {
        char    x_fname[TI_FILNMLEN];
        } x_file;

        struct
        {
            long            x_scnlen;  /* section length           */
            unsigned short  x_nreloc;  /* number of reloc entries  */
            unsigned short  x_nlinno;  /* number of line numbers   */
        TI_SPACE(8, _10_17);
        } x_scn;
};

#define TI_SYMENT  struct ti_syment
#define TI_SYMESZ  18      /* sizeof(SYMENT) */

#define TI_AUXENT  union ti_auxent
#define TI_AUXESZ  18      /* sizeof(AUXENT) */

/*------------------------------------------------------------------------*/
/*  NAMES OF "SPECIAL" SYMBOLS                                            */
/*------------------------------------------------------------------------*/
#define TI_BF            ".bf"
#define TI_EF            ".ef"
#define TI_STEXT          ".text"
#define TI_ETEXT          "etext"
#define TI_SDATA          ".data"
#define TI_EDATA          "edata"
#define TI_SBSS           ".bss"
#define TI_END            "end"
#define TI_CINITPTR       "cinit"
#define TI_ASM_SRC_NAME   "$ASM$"        /* SPECIAL SYMBOL FOR ASSY SRC DEBUG */

/*--------------------------------------------------------------------------*/
/*  ENTRY POINT SYMBOLS                                                     */
/*--------------------------------------------------------------------------*/
#define TI_START          "_start"
#define TI_MAIN           "_main"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -