ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Четверг
25 апреля
695465
VVB (25.08.2016 08:11 - 09:34, просмотров: 1325)
Подскажите, как можно автоматически разместить код в разных регионах в gcc? ARMLINK, например, может обработать следующий скрипт:
; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************

LR_IROM1 0x1A000000 0x00080000  {    ; load region size_region
  ER_IROM1 0x1A000000 0x00080000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
  }
  RW_IRAM1 0x10000000 0x00008000  {  ; RW data
   .ANY (+RW +ZI)
  }
}

LR_IROM2 0x1B000000 0x00080000  {
  ER_IROM2 0x1B000000 0x00080000  {  ; load address = execution address
   .ANY (+RO)
  }
}
Здесь всё, что находится в ROM, будет размещаться сначала в ER_IROM1, затем, если не влезет, линкер автоматически разместит в ER_IROM2. Это позволит иметь разрывы в адресном пространстве (например, исключить несколько зарезервированных для каких-то целей секторов flash памяти) и вообще забыть о проблеме размещения. Как добиться такого же в gcc? Использую GNU Tools ARM Embedded. Такое ощущение, что требуемые мне действия являются одной из причин покупок платных средств разработок (даже на gcc другой платный инструментарий, скорее всего, умеет автоматически размещать код в разных регионах). Кстати, вот что по этому поводу говорят в TI, оригинал http://www.ti.com/ …/spraa46a/spraa46a.pdf 3 Automatic Section Splitting 3.1 Problem Description The C/C++ compiler places all code in the section .text by default. The simplest way to place such code in memory is to create a single output section, also named .text, and allocate it to an appropriate area in target memory. It might look like this in the SECTIONS directive
...
.text > M1
This statement instructs the linker to collect all of the input sections with the name .text into an output section also named .text, and allocate the .text output section into the memory range M1. Such a statement requires M1 to be large enough to contain .text. Suppose M1 is not large enough to contain .text. But there are other memory ranges M2 and M3 that, when combined together with M1, are large enough to hold .text. Suppose further that M1, M2, and M3 are not contiguous. What is the best way to allocate the .text section into the memory ranges M1, M2, and M3? 3.2 Overview The simplest solution is to use the linker feature for automatically splitting sections.
.text >> M1|M2|M3 /* splitting */
.no_split > M4 /* not splitting */
This statement instructs the linker to create the output section .text as before. Note the split operator >> is different from the usual memory placement operator >. The output section .text is split into pieces that are allocated into the different memory ranges M1, M2, and M3. Отмечаю, что в GCC MSP такая фишка должна быть уже реализована https://e2e.ti.com …f/166/p/369708/1307705 А вот NXP (LPCXpresso), несмотря на платность, отстаёт. https://www.lpcwar …atic-splitting-section Вслух размышляю: может, перейти на бесплатный TI armlnk.exe? Придётся указывать все пути к библиотекам GNU Tools ARM Embedded и переписать скрипты линкера... В общем, из обсуждения https://answers.la …edded/+question/223976 я понял, что в принципе никак не сделать того что я хочу. Вопрос снят.