33 lines
915 B
CMake
33 lines
915 B
CMake
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
cmake_minimum_required(VERSION 3.20.0)
|
|
|
|
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
|
project(code_relocation)
|
|
|
|
FILE(GLOB app_sources src/*.c)
|
|
target_sources(app PRIVATE ${app_sources})
|
|
|
|
if (CONFIG_BOARD_QEMU_XTENSA)
|
|
set(RAM_PHDR :sram0_phdr)
|
|
set(SRAM2_PHDR :sram2_phdr)
|
|
endif()
|
|
|
|
# Code relocation feature
|
|
zephyr_code_relocate(src/test_file1.c "SRAM2 ${SRAM2_PHDR}")
|
|
|
|
zephyr_code_relocate(src/test_file2.c "RAM ${RAM_PHDR}")
|
|
|
|
zephyr_code_relocate(src/test_file3.c SRAM2_LITERAL)
|
|
zephyr_code_relocate(src/test_file3.c SRAM2_TEXT)
|
|
zephyr_code_relocate(src/test_file3.c RAM_DATA)
|
|
zephyr_code_relocate(src/test_file3.c SRAM2_BSS)
|
|
|
|
zephyr_code_relocate(../../../kernel/sem.c "RAM ${RAM_PHDR}")
|
|
|
|
if (CONFIG_RELOCATE_TO_ITCM)
|
|
zephyr_code_relocate(../../../lib/libc/minimal/source/string/string.c ITCM_TEXT)
|
|
endif()
|
|
|
|
zephyr_linker_sources(SECTIONS custom-sections.ld)
|