1# SPDX-License-Identifier: Apache-2.0
2
3cmake_minimum_required(VERSION 3.20.0)
4
5find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
6project(code_relocation_nocopy)
7
8FILE(GLOB app_sources src/*.c)
9target_sources(app PRIVATE ${app_sources})
10
11# Run ext_code from the external flash (XIP). No need to copy.
12zephyr_code_relocate(FILES src/ext_code.c LOCATION EXTFLASH_TEXT NOCOPY)
13
14# But still relocate (copy) the data to RAM
15zephyr_code_relocate(FILES src/ext_code.c LOCATION RAM_DATA)
16
17# sram_code instead runs entirely from SRAM after being copied there.
18zephyr_code_relocate(FILES src/sram_code.c LOCATION RAM)
19