-
Notifications
You must be signed in to change notification settings - Fork 23
add custom linker script #103
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
Conversation
a custom linker script can be applied by adding the .ld filepath as 2nd argument to mbed_set_post_build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking pretty good! Just a few minor changes.
Also, I made another MR to fix the CI failure issue. Feel free to approve that when you get a chance.
The only thing I do not understand why I don't get the comment output from the custom command add_custom_command(
TARGET
${target}
PRE_LINK
COMMAND
${CMAKE_C_COMPILER} @${linker_defs_response_file}
COMMENT
"Preprocess custom linker script: ${RAW_LINKER_SCRIPT_NAME} -> ${LINKER_SCRIPT_NAME}"
VERBATIM
) The difference to the other custom command is OUTPUT/TARGET: add_custom_command(
OUTPUT
${LINKER_SCRIPT_PATH}
PRE_LINK
COMMAND
${CMAKE_C_COMPILER} @${linker_defs_response_file}
-E -x assembler-with-cpp
COMMENT
"Preprocess linker script: ${RAW_LINKER_SCRIPT_NAME} -> ${LINKER_SCRIPT_NAME}"
VERBATIM
) The command is executed, the linker script is preprocessed and written to the target build dir. What is the reason that the comment "Preprocess custom linker script: ' is not shown? edit: |
COMMENT is not reliable printed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
I am going to go ahead and merge this in spite of the CI failure, because that CI failure was fixed by #104 . |
This is a PR for an additional feature:
a custom linker script can be applied by adding the .ld filepath as 2nd argument to mbed_set_post_build.
This PR replaces the draft #93
E.g. in CMakeLists.txt for an executable:
In this case, the .ld file must exist in the source dir of the project. The linker script is processed by the linker, so defines like in the mbed-os linkerscript templates can used in the same way.
The custom linker script is not applied to mbed built-in tests.
Summary of changes
adding a custom linker script is supported now.
It is necessary to map variables or code to linker supplied sections. Especially for M4 or M7 MCUs with serveral busses and DMA constraints makes it mandatory to specify memory addresses.
Impact of changes
This feature is optional and existing linker script is not changed unless a custom linker script is set.
Migration actions required
Documentation
Will be updated when this feature is merged.
Pull request type
Test results
Reviewers
@multiplemonomials