tic80.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /* coff information for TI TMS320C80 (MVP)
  2. Copyright (C) 2001-2015 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  14. MA 02110-1301, USA. */
  15. #define DO_NOT_DEFINE_FILHDR
  16. #define DO_NOT_DEFINE_SCNHDR
  17. #define L_LNNO_SIZE 2
  18. #include "coff/external.h"
  19. /********************** FILE HEADER **********************/
  20. struct external_filehdr
  21. {
  22. char f_magic[2]; /* magic number */
  23. char f_nscns[2]; /* number of sections */
  24. char f_timdat[4]; /* time & date stamp */
  25. char f_symptr[4]; /* file pointer to symtab */
  26. char f_nsyms[4]; /* number of symtab entries */
  27. char f_opthdr[2]; /* sizeof(optional hdr) */
  28. char f_flags[2]; /* flags */
  29. char f_target_id[2];/* target id (TIc80 specific) */
  30. };
  31. #define TIC80_ARCH_MAGIC 0x0C1 /* Goes in the file header magic number field */
  32. #define TIC80_TARGET_ID 0x95 /* Goes in the target id field */
  33. #define TIC80BADMAG(x) ((x).f_magic != TIC80_ARCH_MAGIC)
  34. #define FILHDR struct external_filehdr
  35. #define FILHSZ 22
  36. #define TIC80_AOUTHDR_MAGIC 0x108 /* Goes in the optional file header magic number field */
  37. /********************** SECTION HEADER **********************/
  38. struct external_scnhdr
  39. {
  40. char s_name[8]; /* section name */
  41. char s_paddr[4]; /* physical address, aliased s_nlib */
  42. char s_vaddr[4]; /* virtual address */
  43. char s_size[4]; /* section size */
  44. char s_scnptr[4]; /* file ptr to raw data for section */
  45. char s_relptr[4]; /* file ptr to relocation */
  46. char s_lnnoptr[4]; /* file ptr to line numbers */
  47. char s_nreloc[2]; /* number of relocation entries */
  48. char s_nlnno[2]; /* number of line number entries*/
  49. char s_flags[2]; /* flags */
  50. char s_reserved[1]; /* reserved (TIc80 specific) */
  51. char s_mempage[1]; /* memory page number (TIc80) */
  52. };
  53. /* Names of "special" sections. */
  54. #define _TEXT ".text"
  55. #define _DATA ".data"
  56. #define _BSS ".bss"
  57. #define _CINIT ".cinit"
  58. #define _CONST ".const"
  59. #define _SWITCH ".switch"
  60. #define _STACK ".stack"
  61. #define _SYSMEM ".sysmem"
  62. #define SCNHDR struct external_scnhdr
  63. #define SCNHSZ 40
  64. /* FIXME - need to correlate external_auxent with
  65. TIc80 Code Generation Tools User's Guide, CG:A-25 */
  66. /********************** RELOCATION DIRECTIVES **********************/
  67. /* The external reloc has an offset field, because some of the reloc
  68. types on the h8 don't have room in the instruction for the entire
  69. offset - eg the strange jump and high page addressing modes. */
  70. struct external_reloc
  71. {
  72. char r_vaddr[4];
  73. char r_symndx[4];
  74. char r_reserved[2];
  75. char r_type[2];
  76. };
  77. #define RELOC struct external_reloc
  78. #define RELSZ 12
  79. /* TIc80 relocation types. */
  80. #define R_ABS 0x00 /* Absolute address - no relocation */
  81. #define R_RELLONGX 0x11 /* PP: 32 bits, direct */
  82. #define R_PPBASE 0x34 /* PP: Global base address type */
  83. #define R_PPLBASE 0x35 /* PP: Local base address type */
  84. #define R_PP15 0x38 /* PP: Global 15 bit offset */
  85. #define R_PP15W 0x39 /* PP: Global 15 bit offset divided by 4 */
  86. #define R_PP15H 0x3A /* PP: Global 15 bit offset divided by 2 */
  87. #define R_PP16B 0x3B /* PP: Global 16 bit offset for bytes */
  88. #define R_PPL15 0x3C /* PP: Local 15 bit offset */
  89. #define R_PPL15W 0x3D /* PP: Local 15 bit offset divided by 4 */
  90. #define R_PPL15H 0x3E /* PP: Local 15 bit offset divided by 2 */
  91. #define R_PPL16B 0x3F /* PP: Local 16 bit offset for bytes */
  92. #define R_PPN15 0x40 /* PP: Global 15 bit negative offset */
  93. #define R_PPN15W 0x41 /* PP: Global 15 bit negative offset divided by 4 */
  94. #define R_PPN15H 0x42 /* PP: Global 15 bit negative offset divided by 2 */
  95. #define R_PPN16B 0x43 /* PP: Global 16 bit negative byte offset */
  96. #define R_PPLN15 0x44 /* PP: Local 15 bit negative offset */
  97. #define R_PPLN15W 0x45 /* PP: Local 15 bit negative offset divided by 4 */
  98. #define R_PPLN15H 0x46 /* PP: Local 15 bit negative offset divided by 2 */
  99. #define R_PPLN16B 0x47 /* PP: Local 16 bit negative byte offset */
  100. #define R_MPPCR15W 0x4E /* MP: 15 bit PC-relative divided by 4 */
  101. #define R_MPPCR 0x4F /* MP: 32 bit PC-relative divided by 4 */