extensions.cmake: Replace TEXT_START with ROM_START
In zephyr_linker_sources(). This is done since the point of the location is to place things at given offsets. This can only be done consistenly if the linker code is placed into the _first_ section. All uses of TEXT_START are replaced with ROM_START. ROM_START is only supported in some arches, as some arches have several custom sections before text. These don't currently have ROM_START or TEXT_START available, but that could be added with a bit of refactoring in their linker script. No SORT_KEYs are changed. This also fixes an error introduced when TEXT_START was added, where TEXT_SECTION_OFFSET was applied to riscv's common linker.ld instead of to openisa_rv32m1's specific linker.ld. Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
This commit is contained in:
parent
5fcbe4e5d5
commit
05f0d85b6a
16 changed files with 39 additions and 42 deletions
|
@ -31,4 +31,4 @@ zephyr_library_sources_ifdef(CONFIG_ARC_CONNECT arc_smp.c)
|
|||
add_subdirectory_ifdef(CONFIG_ARC_CORE_MPU mpu)
|
||||
add_subdirectory_ifdef(CONFIG_ARC_SECURE_FIRMWARE secureshield)
|
||||
|
||||
zephyr_linker_sources(TEXT_START SORT_KEY 0x0vectors vector_table.ld)
|
||||
zephyr_linker_sources(ROM_START SORT_KEY 0x0vectors vector_table.ld)
|
||||
|
|
|
@ -34,4 +34,4 @@ add_subdirectory_ifdef(CONFIG_ARM_NONSECURE_FIRMWARE cortex_m/tz)
|
|||
|
||||
add_subdirectory_ifdef(CONFIG_CPU_CORTEX_R cortex_r)
|
||||
|
||||
zephyr_linker_sources(TEXT_START SORT_KEY 0x0vectors vector_table.ld)
|
||||
zephyr_linker_sources(ROM_START SORT_KEY 0x0vectors vector_table.ld)
|
||||
|
|
|
@ -12,7 +12,7 @@ zephyr_library_sources(
|
|||
)
|
||||
|
||||
zephyr_linker_sources_ifdef(CONFIG_SW_VECTOR_RELAY
|
||||
TEXT_START
|
||||
ROM_START
|
||||
SORT_KEY 0x0relay_vectors
|
||||
relay_vector_table.ld
|
||||
)
|
||||
|
|
|
@ -34,7 +34,8 @@ zephyr_linker_sources_ifdef(CONFIG_NOCACHE_MEMORY
|
|||
nocache.ld
|
||||
)
|
||||
|
||||
# Only ARM, X86 and RISCV use TEXT_SECTION_OFFSET
|
||||
if (DEFINED CONFIG_ARM OR DEFINED CONFIG_X86 OR DEFINED CONFIG_RISCV)
|
||||
zephyr_linker_sources(TEXT_START SORT_KEY 0x0 text_section_offset.ld)
|
||||
# Only ARM, X86 and OPENISA_RV32M1_RISCV32 use TEXT_SECTION_OFFSET.
|
||||
if (DEFINED CONFIG_ARM OR DEFINED CONFIG_X86
|
||||
OR DEFINED CONFIG_SOC_OPENISA_RV32M1_RISCV32)
|
||||
zephyr_linker_sources(ROM_START SORT_KEY 0x0 text_section_offset.ld)
|
||||
endif()
|
||||
|
|
|
@ -873,8 +873,9 @@ endfunction(zephyr_check_compiler_flag_hardcoded)
|
|||
# NOINIT Inside the noinit output section.
|
||||
# RWDATA Inside the data output section.
|
||||
# RODATA Inside the rodata output section.
|
||||
# TEXT_START At the beginning of the text section, i.e. the beginning of
|
||||
# the image.
|
||||
# ROM_START Inside the first output section of the image. This option is
|
||||
# currently only available on ARM Cortex-M, ARM Cortex-R,
|
||||
# x86, ARC, and openisa_rv32m1.
|
||||
# RAM_SECTIONS Inside the RAMABLE_REGION GROUP.
|
||||
# SECTIONS Near the end of the file. Don't use this when linking into
|
||||
# RAMABLE_REGION, use RAM_SECTIONS instead.
|
||||
|
@ -884,7 +885,7 @@ endfunction(zephyr_check_compiler_flag_hardcoded)
|
|||
#
|
||||
# Use NOINIT, RWDATA, and RODATA unless they don't work for your use case.
|
||||
#
|
||||
# When placing into NOINIT, RWDATA, RODATA, or TEXT_START the contents of the files
|
||||
# When placing into NOINIT, RWDATA, RODATA, ROM_START, the contents of the files
|
||||
# will be placed inside an output section, so assume the section definition is
|
||||
# already present, e.g.:
|
||||
# _mysection_start = .;
|
||||
|
@ -914,7 +915,7 @@ function(zephyr_linker_sources location)
|
|||
set(snippet_base "${__build_dir}/include/generated")
|
||||
set(sections_path "${snippet_base}/snippets-sections.ld")
|
||||
set(ram_sections_path "${snippet_base}/snippets-ram-sections.ld")
|
||||
set(text_start_path "${snippet_base}/snippets-text-start.ld")
|
||||
set(rom_start_path "${snippet_base}/snippets-rom-start.ld")
|
||||
set(noinit_path "${snippet_base}/snippets-noinit.ld")
|
||||
set(rwdata_path "${snippet_base}/snippets-rwdata.ld")
|
||||
set(rodata_path "${snippet_base}/snippets-rodata.ld")
|
||||
|
@ -924,7 +925,7 @@ function(zephyr_linker_sources location)
|
|||
if (NOT DEFINED cleared)
|
||||
file(WRITE ${sections_path} "")
|
||||
file(WRITE ${ram_sections_path} "")
|
||||
file(WRITE ${text_start_path} "")
|
||||
file(WRITE ${rom_start_path} "")
|
||||
file(WRITE ${noinit_path} "")
|
||||
file(WRITE ${rwdata_path} "")
|
||||
file(WRITE ${rodata_path} "")
|
||||
|
@ -936,8 +937,8 @@ function(zephyr_linker_sources location)
|
|||
set(snippet_path "${sections_path}")
|
||||
elseif("${location}" STREQUAL "RAM_SECTIONS")
|
||||
set(snippet_path "${ram_sections_path}")
|
||||
elseif("${location}" STREQUAL "TEXT_START")
|
||||
set(snippet_path "${text_start_path}")
|
||||
elseif("${location}" STREQUAL "ROM_START")
|
||||
set(snippet_path "${rom_start_path}")
|
||||
elseif("${location}" STREQUAL "NOINIT")
|
||||
set(snippet_path "${noinit_path}")
|
||||
elseif("${location}" STREQUAL "RWDATA")
|
||||
|
|
|
@ -87,10 +87,11 @@ SECTIONS {
|
|||
_image_rom_start = .;
|
||||
_image_text_start = .;
|
||||
|
||||
/* Located in generated directory. This file is populated by the
|
||||
* zephyr_linker_sources() Cmake function.
|
||||
/* Located in generated directory. This file is populated by calling
|
||||
* zephyr_linker_sources(ROM_START ...). This typically contains the vector
|
||||
* table and debug information.
|
||||
*/
|
||||
#include <snippets-text-start.ld>
|
||||
#include <snippets-rom-start.ld>
|
||||
|
||||
*(.text)
|
||||
*(".text.*")
|
||||
|
|
|
@ -138,10 +138,11 @@ SECTIONS
|
|||
SECTION_PROLOGUE(rom_start,,)
|
||||
{
|
||||
|
||||
/* Located in generated directory. This file is populated by the
|
||||
* zephyr_linker_sources() Cmake function.
|
||||
/* Located in generated directory. This file is populated by calling
|
||||
* zephyr_linker_sources(ROM_START ...). This typically contains the vector
|
||||
* table and debug information.
|
||||
*/
|
||||
#include <snippets-text-start.ld>
|
||||
#include <snippets-rom-start.ld>
|
||||
|
||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||
|
||||
|
|
|
@ -135,10 +135,11 @@ SECTIONS
|
|||
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,)
|
||||
{
|
||||
|
||||
/* Located in generated directory. This file is populated by the
|
||||
* zephyr_linker_sources() Cmake function.
|
||||
/* Located in generated directory. This file is populated by calling
|
||||
* zephyr_linker_sources(ROM_START ...). This typically contains the vector
|
||||
* table and debug information.
|
||||
*/
|
||||
#include <snippets-text-start.ld>
|
||||
#include <snippets-rom-start.ld>
|
||||
|
||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||
|
||||
|
|
|
@ -121,11 +121,6 @@ SECTIONS
|
|||
|
||||
_image_text_start = .;
|
||||
|
||||
/* Located in generated directory. This file is populated by the
|
||||
* zephyr_linker_sources() Cmake function.
|
||||
*/
|
||||
#include <snippets-text-start.ld>
|
||||
|
||||
*(.text)
|
||||
*(".text.*")
|
||||
*(.gnu.linkonce.t.*)
|
||||
|
|
|
@ -89,11 +89,6 @@ SECTIONS
|
|||
|
||||
_image_text_start = .;
|
||||
|
||||
/* Located in generated directory. This file is populated by the
|
||||
* zephyr_linker_sources() Cmake function.
|
||||
*/
|
||||
#include <snippets-text-start.ld>
|
||||
|
||||
*(.text)
|
||||
*(".text.*")
|
||||
*(.gnu.linkonce.t.*)
|
||||
|
|
|
@ -86,10 +86,11 @@ SECTIONS
|
|||
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,)
|
||||
{
|
||||
|
||||
/* Located in generated directory. This file is populated by the
|
||||
* zephyr_linker_sources() Cmake function.
|
||||
/* Located in generated directory. This file is populated by calling
|
||||
* zephyr_linker_sources(ROM_START ...). This typically contains the vector
|
||||
* table and debug information.
|
||||
*/
|
||||
#include <snippets-text-start.ld>
|
||||
#include <snippets-rom-start.ld>
|
||||
|
||||
*(.text_start)
|
||||
*(".text_start.*")
|
||||
|
|
|
@ -9,4 +9,4 @@ zephyr_sources(
|
|||
)
|
||||
|
||||
zephyr_linker_sources_ifdef(CONFIG_NXP_IMX_RT_BOOT_HEADER
|
||||
TEXT_START SORT_KEY 0 boot_header.ld)
|
||||
ROM_START SORT_KEY 0 boot_header.ld)
|
||||
|
|
|
@ -5,7 +5,7 @@ zephyr_sources_ifdef(CONFIG_KINETIS_FLASH_CONFIG flash_configuration.c)
|
|||
add_subdirectory(${SOC_SERIES})
|
||||
|
||||
zephyr_linker_sources_ifdef(CONFIG_KINETIS_FLASH_CONFIG
|
||||
TEXT_START
|
||||
ROM_START
|
||||
SORT_KEY ${CONFIG_KINETIS_FLASH_CONFIG_OFFSET}
|
||||
flash_config.ld
|
||||
)
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
zephyr_sources(soc.c)
|
||||
|
||||
if (DEFINED CONFIG_CC3220SF_DEBUG OR DEFINED CONFIG_CC3235SF_DEBUG)
|
||||
zephyr_linker_sources(TEXT_START SORT_KEY 0 cc32xx_debug.ld)
|
||||
zephyr_linker_sources(ROM_START SORT_KEY 0 cc32xx_debug.ld)
|
||||
endif()
|
||||
|
|
|
@ -19,4 +19,4 @@ zephyr_sources(
|
|||
soc.c
|
||||
)
|
||||
|
||||
zephyr_linker_sources(TEXT_START SORT_KEY 0x0vectors vector_table.ld)
|
||||
zephyr_linker_sources(ROM_START SORT_KEY 0x0vectors vector_table.ld)
|
||||
|
|
|
@ -104,10 +104,11 @@ SECTIONS
|
|||
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,)
|
||||
{
|
||||
|
||||
/* Located in generated directory. This file is populated by the
|
||||
* zephyr_linker_sources() Cmake function.
|
||||
/* Located in generated directory. This file is populated by calling
|
||||
* zephyr_linker_sources(ROM_START ...). This typically contains the vector
|
||||
* table and debug information.
|
||||
*/
|
||||
#include <snippets-text-start.ld>
|
||||
#include <snippets-rom-start.ld>
|
||||
|
||||
_image_text_start = .;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue