feat(esp_system): allow .bss to spill over into L2MEM above 0x4ff40000

This commit introduce SOC_MEM_NON_CONTIGUOUS_SRAM flag (that enebled for
esp32p4). If SOC_MEM_NON_CONTIGUOUS_SRAM is enabled:

- LDFLAGS+=--enable-non-contiguous-regions
- ldgen.py replaces "arrays[*]" from sections.ld.in with objects under
  SURROUND keyword. (e.g. from linker.lf: data -> dram0_data SURROUND(foo))
- "mapping[*]" - refers to all other data

If SOC_MEM_NON_CONTIGUOUS_SRAM, sections.ld.in file should contain at
least one block of code like this (otherwise it does not make sense):

  .dram0.bss (NOLOAD) :
  {
    arrays[dram0_bss]
    mapping[dram0_bss]
  } > sram_low

  .dram1.bss (NOLOAD) :
  {
    /* do not place here arrays[dram0_bss] because it may be splited
     * between segments */
    mapping[dram0_bss]
  } > sram_high
This commit is contained in:
Alexey Lapshin
2024-02-12 09:51:25 +04:00
parent 4b5b064caf
commit 824c8e0593
47 changed files with 604 additions and 554 deletions
@@ -532,26 +532,53 @@
如需引用一个 ``目标`` 标记下的所有存放规则,请使用以下语法:
.. code-block:: none
.. only:: SOC_MEM_NON_CONTIGUOUS_SRAM
mapping[target]
.. code-block:: none
arrays[target]
mapping[target]
.. only:: not SOC_MEM_NON_CONTIGUOUS_SRAM
.. code-block:: none
mapping[target]
示例:
以下示例是某个链接器脚本模板的摘录,定义了输出段 ``.iram0.text``,该输出段包含一个引用目标 ``iram0_text`` 的标记。
.. code-block:: none
.. only:: SOC_MEM_NON_CONTIGUOUS_SRAM
.iram0.text :
{
/* 标记 IRAM 空间不足 */
_iram_text_start = ABSOLUTE(.);
.. code-block:: none
/* 引用 iram0_text */
mapping[iram0_text]
.iram0.text :
{
/* 标记 IRAM 空间不足 */
_iram_text_start = ABSOLUTE(.);
_iram_text_end = ABSOLUTE(.);
} > iram0_0_seg
/* 引用 iram0_text */
arrays[iram0_text]
mapping[iram0_text]
_iram_text_end = ABSOLUTE(.);
} > iram0_0_seg
.. only:: not SOC_MEM_NON_CONTIGUOUS_SRAM
.. code-block:: none
.iram0.text :
{
/* 标记 IRAM 空间不足 */
_iram_text_start = ABSOLUTE(.);
/* 引用 iram0_text */
mapping[iram0_text]
_iram_text_end = ABSOLUTE(.);
} > iram0_0_seg
假设链接器脚本生成器收集到了以下片段定义: