linker: Generate snippets files for dtcm and itcm
This allows to link code and data blocks, e.g. the vector table, into tightly coupled memory using `zephyr_linker_sources`. Signed-off-by: Greter Raffael <rgreter@baumer.com>
This commit is contained in:
parent
acfb87dca3
commit
33ffe001f8
4 changed files with 43 additions and 2 deletions
|
@ -1170,6 +1170,8 @@ endfunction(zephyr_check_compiler_flag_hardcoded)
|
||||||
# DATA_SECTIONS Inside the RAMABLE_REGION GROUP, initialized.
|
# DATA_SECTIONS Inside the RAMABLE_REGION GROUP, initialized.
|
||||||
# RAMFUNC_SECTION Inside the RAMFUNC RAMABLE_REGION GROUP, not initialized.
|
# RAMFUNC_SECTION Inside the RAMFUNC RAMABLE_REGION GROUP, not initialized.
|
||||||
# NOCACHE_SECTION Inside the NOCACHE section
|
# NOCACHE_SECTION Inside the NOCACHE section
|
||||||
|
# ITCM_SECTION Inside the itcm section.
|
||||||
|
# DTCM_SECTION Inside the dtcm data section.
|
||||||
# SECTIONS Near the end of the file. Don't use this when linking into
|
# SECTIONS Near the end of the file. Don't use this when linking into
|
||||||
# RAMABLE_REGION, use RAM_SECTIONS instead.
|
# RAMABLE_REGION, use RAM_SECTIONS instead.
|
||||||
# PINNED_RODATA Similar to RODATA but pinned in memory.
|
# PINNED_RODATA Similar to RODATA but pinned in memory.
|
||||||
|
@ -1184,8 +1186,9 @@ endfunction(zephyr_check_compiler_flag_hardcoded)
|
||||||
# Use NOINIT, RWDATA, and RODATA unless they don't work for your use case.
|
# Use NOINIT, RWDATA, and RODATA unless they don't work for your use case.
|
||||||
#
|
#
|
||||||
# When placing into NOINIT, RWDATA, RODATA, ROM_START, RAMFUNC_SECTION,
|
# When placing into NOINIT, RWDATA, RODATA, ROM_START, RAMFUNC_SECTION,
|
||||||
# NOCACHE_SECTION the contents of the files will be placed inside
|
# NOCACHE_SECTION, DTCM_SECTION or ITCM_SECTION the contents of the files will
|
||||||
# an output section, so assume the section definition is already present, e.g.:
|
# be placed inside an output section, so assume the section definition is
|
||||||
|
# already present, e.g.:
|
||||||
# _mysection_start = .;
|
# _mysection_start = .;
|
||||||
# KEEP(*(.mysection));
|
# KEEP(*(.mysection));
|
||||||
# _mysection_end = .;
|
# _mysection_end = .;
|
||||||
|
@ -1220,6 +1223,8 @@ function(zephyr_linker_sources location)
|
||||||
set(rodata_path "${snippet_base}/snippets-rodata.ld")
|
set(rodata_path "${snippet_base}/snippets-rodata.ld")
|
||||||
set(ramfunc_path "${snippet_base}/snippets-ramfunc-section.ld")
|
set(ramfunc_path "${snippet_base}/snippets-ramfunc-section.ld")
|
||||||
set(nocache_path "${snippet_base}/snippets-nocache-section.ld")
|
set(nocache_path "${snippet_base}/snippets-nocache-section.ld")
|
||||||
|
set(itcm_path "${snippet_base}/snippets-itcm-section.ld")
|
||||||
|
set(dtcm_path "${snippet_base}/snippets-dtcm-section.ld")
|
||||||
|
|
||||||
set(pinned_ram_sections_path "${snippet_base}/snippets-pinned-ram-sections.ld")
|
set(pinned_ram_sections_path "${snippet_base}/snippets-pinned-ram-sections.ld")
|
||||||
set(pinned_data_sections_path "${snippet_base}/snippets-pinned-data-sections.ld")
|
set(pinned_data_sections_path "${snippet_base}/snippets-pinned-data-sections.ld")
|
||||||
|
@ -1237,6 +1242,8 @@ function(zephyr_linker_sources location)
|
||||||
file(WRITE ${rodata_path} "")
|
file(WRITE ${rodata_path} "")
|
||||||
file(WRITE ${ramfunc_path} "")
|
file(WRITE ${ramfunc_path} "")
|
||||||
file(WRITE ${nocache_path} "")
|
file(WRITE ${nocache_path} "")
|
||||||
|
file(WRITE ${itcm_path} "")
|
||||||
|
file(WRITE ${dtcm_path} "")
|
||||||
file(WRITE ${pinned_ram_sections_path} "")
|
file(WRITE ${pinned_ram_sections_path} "")
|
||||||
file(WRITE ${pinned_data_sections_path} "")
|
file(WRITE ${pinned_data_sections_path} "")
|
||||||
file(WRITE ${pinned_rodata_path} "")
|
file(WRITE ${pinned_rodata_path} "")
|
||||||
|
@ -1262,6 +1269,10 @@ function(zephyr_linker_sources location)
|
||||||
set(snippet_path "${ramfunc_path}")
|
set(snippet_path "${ramfunc_path}")
|
||||||
elseif("${location}" STREQUAL "NOCACHE_SECTION")
|
elseif("${location}" STREQUAL "NOCACHE_SECTION")
|
||||||
set(snippet_path "${nocache_path}")
|
set(snippet_path "${nocache_path}")
|
||||||
|
elseif("${location}" STREQUAL "ITCM_SECTION")
|
||||||
|
set(snippet_path "${itcm_path}")
|
||||||
|
elseif("${location}" STREQUAL "DTCM_SECTION")
|
||||||
|
set(snippet_path "${dtcm_path}")
|
||||||
elseif("${location}" STREQUAL "PINNED_RAM_SECTIONS")
|
elseif("${location}" STREQUAL "PINNED_RAM_SECTIONS")
|
||||||
set(snippet_path "${pinned_ram_sections_path}")
|
set(snippet_path "${pinned_ram_sections_path}")
|
||||||
elseif("${location}" STREQUAL "PINNED_DATA_SECTIONS")
|
elseif("${location}" STREQUAL "PINNED_DATA_SECTIONS")
|
||||||
|
|
|
@ -396,6 +396,11 @@ GROUP_START(ITCM)
|
||||||
__itcm_start = .;
|
__itcm_start = .;
|
||||||
*(.itcm)
|
*(.itcm)
|
||||||
*(".itcm.*")
|
*(".itcm.*")
|
||||||
|
|
||||||
|
/* Located in generated directory. This file is populated by the
|
||||||
|
* zephyr_linker_sources() Cmake function. */
|
||||||
|
#include <snippets-itcm-section.ld>
|
||||||
|
|
||||||
__itcm_end = .;
|
__itcm_end = .;
|
||||||
} GROUP_LINK_IN(ITCM AT> ROMABLE_REGION)
|
} GROUP_LINK_IN(ITCM AT> ROMABLE_REGION)
|
||||||
|
|
||||||
|
@ -430,6 +435,11 @@ GROUP_START(DTCM)
|
||||||
__dtcm_data_start = .;
|
__dtcm_data_start = .;
|
||||||
*(.dtcm_data)
|
*(.dtcm_data)
|
||||||
*(".dtcm_data.*")
|
*(".dtcm_data.*")
|
||||||
|
|
||||||
|
/* Located in generated directory. This file is populated by the
|
||||||
|
* zephyr_linker_sources() Cmake function. */
|
||||||
|
#include <snippets-dtcm-section.ld>
|
||||||
|
|
||||||
__dtcm_data_end = .;
|
__dtcm_data_end = .;
|
||||||
} GROUP_LINK_IN(DTCM AT> ROMABLE_REGION)
|
} GROUP_LINK_IN(DTCM AT> ROMABLE_REGION)
|
||||||
|
|
||||||
|
|
|
@ -327,6 +327,11 @@ GROUP_START(ITCM)
|
||||||
__itcm_start = .;
|
__itcm_start = .;
|
||||||
*(.itcm)
|
*(.itcm)
|
||||||
*(".itcm.*")
|
*(".itcm.*")
|
||||||
|
|
||||||
|
/* Located in generated directory. This file is populated by the
|
||||||
|
* zephyr_linker_sources() Cmake function. */
|
||||||
|
#include <snippets-itcm-section.ld>
|
||||||
|
|
||||||
__itcm_end = .;
|
__itcm_end = .;
|
||||||
} GROUP_LINK_IN(ITCM AT> ROMABLE_REGION)
|
} GROUP_LINK_IN(ITCM AT> ROMABLE_REGION)
|
||||||
|
|
||||||
|
@ -361,6 +366,11 @@ GROUP_START(DTCM)
|
||||||
__dtcm_data_start = .;
|
__dtcm_data_start = .;
|
||||||
*(.dtcm_data)
|
*(.dtcm_data)
|
||||||
*(".dtcm_data.*")
|
*(".dtcm_data.*")
|
||||||
|
|
||||||
|
/* Located in generated directory. This file is populated by the
|
||||||
|
* zephyr_linker_sources() Cmake function. */
|
||||||
|
#include <snippets-dtcm-section.ld>
|
||||||
|
|
||||||
__dtcm_data_end = .;
|
__dtcm_data_end = .;
|
||||||
} GROUP_LINK_IN(DTCM AT> ROMABLE_REGION)
|
} GROUP_LINK_IN(DTCM AT> ROMABLE_REGION)
|
||||||
|
|
||||||
|
|
|
@ -322,6 +322,11 @@ GROUP_START(ITCM)
|
||||||
__itcm_start = .;
|
__itcm_start = .;
|
||||||
*(.itcm)
|
*(.itcm)
|
||||||
*(".itcm.*")
|
*(".itcm.*")
|
||||||
|
|
||||||
|
/* Located in generated directory. This file is populated by the
|
||||||
|
* zephyr_linker_sources() Cmake function. */
|
||||||
|
#include <snippets-itcm-section.ld>
|
||||||
|
|
||||||
__itcm_end = .;
|
__itcm_end = .;
|
||||||
} GROUP_LINK_IN(ITCM AT> ROMABLE_REGION)
|
} GROUP_LINK_IN(ITCM AT> ROMABLE_REGION)
|
||||||
|
|
||||||
|
@ -356,6 +361,11 @@ GROUP_START(DTCM)
|
||||||
__dtcm_data_start = .;
|
__dtcm_data_start = .;
|
||||||
*(.dtcm_data)
|
*(.dtcm_data)
|
||||||
*(".dtcm_data.*")
|
*(".dtcm_data.*")
|
||||||
|
|
||||||
|
/* Located in generated directory. This file is populated by the
|
||||||
|
* zephyr_linker_sources() Cmake function. */
|
||||||
|
#include <snippets-dtcm-section.ld>
|
||||||
|
|
||||||
__dtcm_data_end = .;
|
__dtcm_data_end = .;
|
||||||
} GROUP_LINK_IN(DTCM AT> ROMABLE_REGION)
|
} GROUP_LINK_IN(DTCM AT> ROMABLE_REGION)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue