Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code_relocation: Add option to specify load memory segment #76513

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dennisgr102
Copy link
Contributor

Currently there is no way to select a load memory segment other than ROMABLE_REGION. This introduces an optional argument (LMEM) to zephyr_code_relocate(). An example usecase is provided.

Currently there is no way to select a load memory segment
other than ROMABLE_REGION. This introduces an optional
argument to zephyr_code_relocate()

Signed-off-by: Dennis Grijalva <dennisgrijalva@meta.com>
Provide an example of loading code from a region other than ROMABLE_REGION

Signed-off-by: Dennis Grijalva <dennisgrijalva@meta.com>
@dennisgr102 dennisgr102 changed the title Add mechanism to load from segment other then ROMABLE_REGION code_relocation: Add option to specify load memory segment Jul 30, 2024
@MaureenHelm MaureenHelm assigned tejlmand and unassigned kartben Sep 26, 2024
Copy link
Collaborator

@tejlmand tejlmand left a comment

Choose a reason for hiding this comment

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

afaict this PR breaks windows support.

# <mem_region>[\ :program_header]:<flag_1>[;<flag_2>...]:<file_1>[;<file_2>...]
# Returns a 4-tuple with them: (mem_region, program_header, flags, files)
# <mem_region>[:PHDR=program_header][:LMEM=load_memory]:FLAGS=<flag_1>[;<flag_2>...]:FILES=<file_1>[;<file_2>...]
# Returns a 5-tuple with them: (mem_region, program_header, load_mem, flags, files)
# If no `program_header` is defined, returns an empty string
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess a line similar If no program_header is needed for `load_memory.

Comment on lines +514 to +515
line_split = line.split(':')
arg_dict = {i.split('=')[0]: i.split('=')[1] for i in line_split[1:]}
Copy link
Collaborator

Choose a reason for hiding this comment

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

afaict this breaks on Windows where paths contains :, such as c:/.

Please also take a look at this comment: #74402 (comment)

Perhaps you didn't notice the comment you removed here:

# Be careful when splitting by : to avoid breaking absolute paths on Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants