link.icf 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /*******************************************************************************
  2. * \file xmc7200_x8384_cm7.icf
  3. * \version 1.0.0
  4. *
  5. * Linker file for the IAR compiler.
  6. *
  7. * The main purpose of the linker script is to describe how the sections in the
  8. * input files should be mapped into the output file, and to control the memory
  9. * layout of the output file.
  10. *
  11. * \note The entry point is fixed and starts at 0x10000000. The valid application
  12. * image should be placed there.
  13. *
  14. * \note The linker files included with the PDL template projects must be generic
  15. * and handle all common use cases. Your project may not use every section
  16. * defined in the linker files. In that case you may see warnings during the
  17. * build process. In your project, you can simply comment out or remove the
  18. * relevant code in the linker file.
  19. *
  20. ********************************************************************************
  21. * \copyright
  22. * Copyright 2021 Cypress Semiconductor Corporation
  23. * SPDX-License-Identifier: Apache-2.0
  24. *
  25. * Licensed under the Apache License, Version 2.0 (the "License");
  26. * you may not use this file except in compliance with the License.
  27. * You may obtain a copy of the License at
  28. *
  29. * http://www.apache.org/licenses/LICENSE-2.0
  30. *
  31. * Unless required by applicable law or agreed to in writing, software
  32. * distributed under the License is distributed on an "AS IS" BASIS,
  33. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  34. * See the License for the specific language governing permissions and
  35. * limitations under the License.
  36. *******************************************************************************/
  37. define symbol sram_start_reserve = 0;
  38. define symbol sram_total_size = 0x00100000;
  39. define symbol sram_private_for_srom = 0x00000800; /* Private SRAM for SROM (e.g. API processing) */
  40. define symbol sram_used_by_boot = 0x0; /* Used during boot by Cypress firmware (content will be overwritten on reset, so it should not be used for loadable sections in case of RAM build configurations) */
  41. define symbol cm0plus_sram_reserve = 0x00004000; /* 16K : cm0 sram size */
  42. define symbol cm7_0_sram_reserve = 0x000FC000; /* 1008K : cm7_0 sram size */
  43. define symbol code_flash_total_size = 0x00830000; /* 8384K: total flash size */
  44. define symbol cm0plus_code_flash_reserve = 0x00080000; /* 512K : cm0 flash size */
  45. define symbol cm7_0_code_flash_reserve = 0x007B0000; /* 7872K: cm7_0 flash size */
  46. define symbol code_flash_base_address = 0x10000000;
  47. define symbol sram_base_address = 0x28000000;
  48. define symbol ecc_init_width = 8; /* Most restrictive native ECC width of all "normal" memories (SRAM, DTCM, ITCM) in any Traveo II derivate is used to keep the code generic */
  49. define symbol cm7_heap_reserve = 0x00001000;
  50. define symbol cm7_stack_reserve = 0x00001000;
  51. /*###ICF### Section handled by ICF editor, don't touch! ****/
  52. /*-Editor annotation file-*/
  53. /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_4.xml" */
  54. /*-Specials-*/
  55. define symbol __ICFEDIT_intvec_start__ = 0x00000000;
  56. /* The symbols below define the location and size of blocks of memory in the target.
  57. * Use these symbols to specify the memory regions available for allocation.
  58. */
  59. /* The following symbols control RAM and flash memory allocation for the CM7 cores.
  60. * You can change the memory allocation by editing RAM and Flash values.
  61. * Your changes must be aligned with the corresponding symbols for CM0+ core in 'xx_cm0plus.icf',
  62. * where 'xx' is the device group; for example, 'xmc7100d_x4160_cm0plus.icf'.
  63. * any changes here must also be aligned in file 'xmc7xxx_partition.h'.
  64. * after which cm0p core aplication must be build and flashed again.
  65. */
  66. /* RAM */
  67. define symbol __ICFEDIT_region_IRAM1_start__ = 0x28004000; // sram_base_address + cm0plus_sram_reserve;
  68. define symbol __ICFEDIT_region_IRAM1_end__ = 0x280FFFFF; // cm7_0_sram_reserve;
  69. define symbol __ICFEDIT_region_IRAM2_start__ = 0x0;
  70. define symbol __ICFEDIT_region_IRAM2_end__ = 0x0;
  71. /* Flash */
  72. define symbol __ICFEDIT_region_IROM1_start__ = 0x10080000; // code_flash_base_address + cm0plus_code_flash_reserve
  73. define symbol __ICFEDIT_region_IROM1_end__ = 0x1082FFFF; // cm7_0_code_flash_reserve
  74. define symbol __ICFEDIT_region_IROM2_start__ = 0x0;
  75. define symbol __ICFEDIT_region_IROM2_end__ = 0x0;
  76. define symbol __ICFEDIT_region_EROM1_start__ = 0x0;
  77. define symbol __ICFEDIT_region_EROM1_end__ = 0x0;
  78. define symbol __ICFEDIT_region_EROM2_start__ = 0x0;
  79. define symbol __ICFEDIT_region_EROM2_end__ = 0x0;
  80. define symbol __ICFEDIT_region_EROM3_start__ = 0x0;
  81. define symbol __ICFEDIT_region_EROM3_end__ = 0x0;
  82. define symbol __ICFEDIT_region_ERAM1_start__ = 0x0;
  83. define symbol __ICFEDIT_region_ERAM1_end__ = 0x0;
  84. define symbol __ICFEDIT_region_ERAM2_start__ = 0x0;
  85. define symbol __ICFEDIT_region_ERAM2_end__ = 0x0;
  86. define symbol __ICFEDIT_region_ERAM3_start__ = 0x0;
  87. define symbol __ICFEDIT_region_ERAM3_end__ = 0x0;
  88. /*-Sizes-*/
  89. define symbol __ICFEDIT_size_cstack__ = 0x00001000; //cm7_stack_reserve
  90. define symbol __ICFEDIT_size_proc_stack__ = 0x0;
  91. /* Defines the minimum heap size. The actual heap size will be expanded to the end of the stack region */
  92. define symbol __ICFEDIT_size_heap__ = 0x00001000; //cm7_heap_reserve
  93. /**** End of ICF editor section. ###ICF###*/
  94. define symbol heap_reserve = __ICFEDIT_size_heap__;
  95. define symbol stack_reserve = (__ICFEDIT_size_cstack__ + (ecc_init_width - 1)) & (~((ecc_init_width - 1))); /* Ensure that stack size is an integer multiple of ECC init width (round up) */
  96. /* SRAM reservations */
  97. define symbol _base_SRAM_CM7_0 = __ICFEDIT_region_IRAM1_start__;
  98. define symbol _size_SRAM_CM7_0 = __ICFEDIT_region_IRAM1_end__ - __ICFEDIT_region_IRAM1_start__ + 1;
  99. /* Code flash reservations */
  100. define symbol _base_CODE_FLASH_CM0P = code_flash_base_address;
  101. define symbol _size_CODE_FLASH_CM0P = cm0plus_code_flash_reserve;
  102. define symbol _base_CODE_FLASH_CM7_0 = __ICFEDIT_region_IROM1_start__;
  103. define symbol _size_CODE_FLASH_CM7_0 = __ICFEDIT_region_IROM1_end__ - __ICFEDIT_region_IROM1_start__ + 1;
  104. define symbol _base_SRAM = _base_SRAM_CM7_0;
  105. define symbol _size_SRAM = _size_SRAM_CM7_0;
  106. define symbol _base_CODE_FLASH = _base_CODE_FLASH_CM7_0;
  107. define symbol _size_CODE_FLASH = _size_CODE_FLASH_CM7_0;
  108. /*============================================================
  109. * Memory definitions
  110. *============================================================
  111. */
  112. define memory mem with size = 4G;
  113. define region SRAM = mem:[from _base_SRAM size _size_SRAM ];
  114. define region CODE_FLASH = mem:[from _base_CODE_FLASH size _size_CODE_FLASH ];
  115. /*============================================================
  116. * Block definitions
  117. *============================================================
  118. */
  119. define block CSTACK with alignment = 8, size = stack_reserve { };
  120. define block HEAP with expanding size, alignment = 8, minimum size = heap_reserve { };
  121. define block HEAP_STACK { block HEAP, last block CSTACK };
  122. define block CM0P_RO with size = (_size_CODE_FLASH_CM0P) { readonly section .cy_m0p_image };
  123. define block CY_SHAREDMEM with alignment = 32 { section .cy_sharedmem };
  124. /*============================================================
  125. * Initialization
  126. *============================================================
  127. */
  128. initialize by copy { readwrite };
  129. do not initialize { section .noinit, section .intvec_ram };
  130. /*============================================================
  131. * Placement
  132. *============================================================
  133. */
  134. /* Flash - Cortex-M0+ application image */
  135. place at address (_base_CODE_FLASH_CM0P) { block CM0P_RO };
  136. /* Link location specific assignment of 'readonly' type sections to either SRAM or CODE_FLASH */
  137. /* Note: .intvec must be the first section in ROM in order for __cm7_vector_base_linker_symbol to be correctly calculated! */
  138. place at start of CODE_FLASH { section .intvec };
  139. place in CODE_FLASH { readonly };
  140. place in SRAM { readwrite };
  141. place in SRAM { block CY_SHAREDMEM };
  142. place at end of SRAM { block HEAP_STACK };
  143. keep { section .intvec };
  144. keep { section .cy_m0p_image };
  145. /* Following definitions ensure that SRAM will not be touched at all by startup ECC initialization when code is linked to SRAM,
  146. * use debugger script to initialize the SRAM before downloading the application or adjust below symbols to not include
  147. * the area of SRAM where "ROM type" sections are linked to
  148. */
  149. define exported symbol __ecc_init_sram_start_address = start(SRAM);
  150. define exported symbol __ecc_init_sram_end_address = end(SRAM);
  151. /* EOF */