Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion doc/kernel/code-relocation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ for data copy operations from ROM to required memory type.

.. note::

The file argument supports limited regular expressions.
The file argument supports limited regular expressions. Files are searched
using the Python's glob function (with ``recursive=True``).
function zephyr_code_relocate() can be called as many times as required.
This step has to be performed before the inclusion of boilerplate.cmake.

Expand Down
2 changes: 1 addition & 1 deletion scripts/build/gen_relocate_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def create_dict_wrt_mem():

mem_region, copy_flag, file_name = line.split(':', 2)

file_name_list = glob.glob(file_name)
file_name_list = glob.glob(file_name, recursive=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not opposed to the change itself, but do we have risk of side-effects ?

What happens in systems that might be building Zephyr inside Zephyr, or re-using source code.
Here a candidate could be TF-M which can build MCUboot as a secure bootloader.

Before approving this change, I would really like you to describe what problem you're solving, rather than just It might be handy.

Especially because the feature is not widely used, the risk is that side-effects are not discovered, as well as they could be hard to debug.

Should the proposed solution be configurable through an argument to this script ?
which then can be enable in Kconfig, similar to CONFIG_CODE_DATA_RELOCATION.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will look at the comments next week or the week after, once I'm back from the mountains...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My main use case was this (the project runs on stm32h7x with plenty RAM free space and slow quadspi flash)

zephyr_code_relocate(${ZEPHYR_BASE}/subsys/**/*.c SRAM2_TEXT )
zephyr_code_relocate(${ZEPHYR_BASE}/drivers/**/*.c SRAM2_TEXT )

Relocating the zephyr system files lead to great speed up in my case. Specifying each subfolder in the example is definitely an option, but for me it increases complexity.

Original documentation of the zephyr_code_relocate macro is quite insufficient. When I read limited regexp support I had to go to the source and there I got the idea to add the recursive flag.

I agree it could possibly break some older code, but I have not found any usage now...

if not file_name_list:
warnings.warn("File: "+file_name+" Not found")
continue
Expand Down