ip2k.sc 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. # Copyright (C) 2014-2015 Free Software Foundation, Inc.
  2. #
  3. # Copying and distribution of this file, with or without modification,
  4. # are permitted in any medium without royalty provided the copyright
  5. # notice and this notice are preserved.
  6. cat << EOF
  7. /* Copyright (C) 2014-2015 Free Software Foundation, Inc.
  8. Copying and distribution of this script, with or without modification,
  9. are permitted in any medium without royalty provided the copyright
  10. notice and this notice are preserved. */
  11. OUTPUT_FORMAT("elf32-ip2k", "elf32-ip2k", "elf32-ip2k")
  12. OUTPUT_ARCH(ip2k)
  13. ${RELOCATING+ENTRY(_start)}
  14. SEARCH_DIR(.);
  15. /* IP2022 default linker script. */
  16. MEMORY
  17. {
  18. D_GPR : org = 0x01000080, len = 128
  19. D_RAM : org = 0x01000100, len = 4K - 256
  20. P_RAM : org = 0x02000000, len = 16K
  21. P_ROM : org = 0x02010000, len = 64K - 32
  22. P_RESET : org = 0x0201FFE0, len = 32
  23. P_CONFIG : org = 0x02020000, len = 128
  24. }
  25. SECTIONS
  26. {
  27. /* Allocated memory end markers
  28. (initialized to start of appropiate memory address). */
  29. __data_end = 0x01000100;
  30. __pram_end = 0x02000000;
  31. __flash_end = 0x02010000;
  32. /* Global general purpose registers in direct addressing range. */
  33. .gpr 0x01000080 :
  34. {
  35. *(.gpr)
  36. } >D_GPR
  37. /* Pre-allocated, pre-initialized data memory. */
  38. __data_run_begin = __data_end;
  39. __data_load_begin = (__flash_end + 1) & 0xFFFFFFFE;
  40. .data __data_run_begin : AT (__data_load_begin)
  41. {
  42. * (.data);
  43. * (.rodata)
  44. } >D_RAM
  45. __data_run_end = __data_run_begin + SIZEOF(.data);
  46. __data_load_end = __data_load_begin + SIZEOF(.data);
  47. __data_end = __data_run_end;
  48. __flash_end = __data_load_end;
  49. /* Pre-allocated, uninitialized data memory. */
  50. __bss_begin = __data_end;
  51. .bss __bss_begin :
  52. {
  53. * (.bss)
  54. } >D_RAM
  55. __bss_end = __bss_begin + SIZEOF(.bss);
  56. __data_end = __bss_end;
  57. /* Pre-allocated PRAM data memory. */
  58. __pram_data_begin = (__pram_end + 1) & 0xFFFFFFFE;
  59. .pram_data __pram_data_begin :
  60. {
  61. * (.pram_data)
  62. } >P_RAM
  63. __pram_data_end = __pram_data_begin + SIZEOF(.pram_data);
  64. __pram_end = __pram_data_end;
  65. /* PRAM code. */
  66. __pram_run_begin = (__pram_end + 1) & 0xFFFFFFFE;
  67. __pram_load_begin = (__flash_end + 1) & 0xFFFFFFFE;
  68. .pram __pram_run_begin : AT (__pram_load_begin)
  69. {
  70. * (.pram)
  71. } >P_RAM
  72. __pram_run_end = __pram_run_begin + SIZEOF(.pram);
  73. __pram_load_end = __pram_load_begin + SIZEOF(.pram);
  74. __pram_load_shift = ((__pram_run_begin - __pram_load_begin) & 0x1FFFF) | 0x02000000;
  75. __pram_end = __pram_run_end;
  76. __flash_end = __pram_load_end;
  77. /* PRAM overlay code. */
  78. __pram_overlay_run_start = (__pram_end + 1) & 0xFFFFFFFE;
  79. __pram_overlay_load_start = (__flash_end + 1) & 0xFFFFFFFE;
  80. OVERLAY __pram_overlay_run_start : AT (__pram_overlay_load_start)
  81. {
  82. .pram1 { */overlay1/* (.pram); * (.pram1) }
  83. .pram2 { */overlay2/* (.pram); * (.pram2) }
  84. } >P_RAM
  85. __pram_overlay_run_end = .;
  86. __pram_overlay_load_end = __pram_overlay_load_start + SIZEOF(.pram1) + SIZEOF(.pram2);
  87. __pram_end = __pram_overlay_run_end;
  88. __flash_end = __pram_overlay_load_end;
  89. /* Flash code. */
  90. __text_begin = (__flash_end + 1) & 0xFFFFFFFE;
  91. .text __text_begin :
  92. {
  93. * (.text);
  94. * (.text.libgcc)
  95. } >P_ROM = 0xffff
  96. __text_end = __text_begin + SIZEOF(.text);
  97. __flash_end = __text_end;
  98. /* Strings. */
  99. __strings_begin = (__flash_end + 1) & 0xFFFFFFFE;
  100. .strings __strings_begin :
  101. {
  102. * (strings);
  103. * (.progmem.data)
  104. } >P_ROM = 0xffff
  105. __strings_end = __strings_begin + SIZEOF (.strings);
  106. __flash_end = __strings_end;
  107. .ctors : { * (.ctors) } > P_ROM
  108. .dtors : { * (.dtors) } > P_ROM
  109. /* Reset code. */
  110. .reset : { * (.reset) } >P_RESET = 0xffff
  111. /* Configuration block. */
  112. .config : { * (.config) } >P_CONFIG = 0xffff
  113. /* Stack. */
  114. PROVIDE (__stack = 0x01000FFF);
  115. /* Stabs debugging sections. */
  116. .stab 0 : { *(.stab) }
  117. .stabstr 0 : { *(.stabstr) }
  118. .stab.excl 0 : { *(.stab.excl) }
  119. .stab.exclstr 0 : { *(.stab.exclstr) }
  120. .stab.index 0 : { *(.stab.index) }
  121. .stab.indexstr 0 : { *(.stab.indexstr) }
  122. .comment 0 : { *(.comment) }
  123. EOF
  124. . $srcdir/scripttempl/DWARF.sc
  125. cat <<EOF
  126. }
  127. EOF