@@ -54,14 +54,13 @@ for data copy operations from ROM to required memory type.
54
54
* Inside the ``CMakeLists.txt `` file in the project, mention
55
55
all the files that need relocation.
56
56
57
- ``zephyr_code_relocate(src/*.c SRAM2) ``
57
+ ``zephyr_code_relocate(FILES src/*.c LOCATION SRAM2) ``
58
58
59
59
Where the first argument is the file/files and the second
60
60
argument is the memory where it must be placed.
61
61
62
62
.. note ::
63
63
64
- The file argument supports limited regular expressions.
65
64
function zephyr_code_relocate() can be called as many times as required.
66
65
This step has to be performed before calling find_package(Zephyr ...)
67
66
in the application's CMakeLists.txt.
@@ -77,21 +76,30 @@ This section shows additional configuration options that can be set in
77
76
78
77
.. code-block :: none
79
78
80
- zephyr_code_relocate(src/file1.c SRAM2)
81
- zephyr_code_relocate(src/file2.c.c SRAM)
79
+ zephyr_code_relocate(FILES src/file1.c LOCATION SRAM2)
80
+ zephyr_code_relocate(FILES src/file2.c LOCATION SRAM)
82
81
83
82
* if the memory type is appended with _DATA, _TEXT, _RODATA or _BSS, only the
84
83
selected memory is placed in the required memory region.
85
84
for example:
86
85
87
86
.. code-block :: none
88
87
89
- zephyr_code_relocate(src/file1.c SRAM2_DATA)
90
- zephyr_code_relocate(src/file2.c.c SRAM2_TEXT)
88
+ zephyr_code_relocate(FILES src/file1.c LOCATION SRAM2_DATA)
89
+ zephyr_code_relocate(FILES src/file2.c LOCATION SRAM2_TEXT)
91
90
92
91
* Multiple regions can also be appended together such as: SRAM2_DATA_BSS.
93
92
This will place data and bss inside SRAM2.
94
93
94
+ * Multiple files can be passed to the FILES argument, or CMake generator
95
+ expressions can be used to relocate a comma-separated list of files
96
+
97
+ .. code-block :: none
98
+
99
+ file(GLOB sources "file*.c")
100
+ zephyr_code_relocate(FILES ${sources} LOCATION SRAM)
101
+ zephyr_code_relocate(FILES $<TARGET_PROPERTY:my_tgt,SOURCES> LOCATION SRAM)
102
+
95
103
NOCOPY flag
96
104
===========
97
105
@@ -106,8 +114,20 @@ to the ``EXTFLASH`` memory region where it will be executed from (XIP). The
106
114
107
115
.. code-block :: none
108
116
109
- zephyr_code_relocate(src/xip_external_flash.c EXTFLASH_TEXT NOCOPY)
110
- zephyr_code_relocate(src/xip_external_flash.c SRAM_DATA)
117
+ zephyr_code_relocate(FILES src/xip_external_flash.c LOCATION EXTFLASH_TEXT NOCOPY)
118
+ zephyr_code_relocate(FILES src/xip_external_flash.c LOCATION SRAM_DATA)
119
+
120
+ Relocating libraries
121
+ ====================
122
+
123
+ Libraries can be relocated using the LIBRARY argument to
124
+ ``zephyr_code_relocation() `` with the library name. For example, the following
125
+ snippet will relocate kernel code to ITCM and serial drivers to SRAM2:
126
+
127
+ .. code-block :: none
128
+
129
+ zephyr_code_relocate(LIBRARY kernel LOCATION ITCM_TEXT)
130
+ zephyr_code_relocate(LIBRARY drivers__serial LOCATION SRAM2)
111
131
112
132
Sample
113
133
======
0 commit comments