-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
sdp: cmake: soc-specific files #19095
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a423bee
cmake: sdp: add common wrapper for all assembly related cmake
masz-nordic 4b34360
cmake: sdp: generate and check separate files for each SoC
masz-nordic c6fd911
cmake: sdp: docs for CMake functions
masz-nordic 4285be9
applications: sdp: gpio: align to cmake wrapper
masz-nordic 91550c8
applications: sdp: mspi: align to cmake wrapper
masz-nordic 859691c
tests: drivers: sdp_asm: align to cmake wrapper
masz-nordic 2fcb2b8
applications: sdp: gpio: align to per-SoC assembly file
masz-nordic 24a9627
applications: sdp: mspi: align to per-SoC assembly file
masz-nordic d2fa56c
tests: drivers: align to per-SoC assembly file
masz-nordic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,35 @@ | |
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
function(sdp_assembly_generate hrt_srcs) | ||
# This function takes as an argument target to be built and path to .c source file(s) | ||
# whose .s output must be verified against .s file tracked in repository. It then: | ||
# - adds a pre-build dependency that generates .s files in build directory | ||
# - adds a dependency on specified target to call sdp_asm_check.cmake with appropriate arguments | ||
# - adds a custom target that calls sdp_asm_install.cmake with appropriate arguments | ||
# - adds .s files from build directory to target sources | ||
# | ||
# Arguments: | ||
# target - target to which the dependencies are to be applied | ||
# hrt_srcs - path to the .c source file(s) to verify | ||
function(sdp_assembly_install target hrt_srcs) | ||
sdp_assembly_generate(${CONFIG_SOC} "${hrt_srcs}") | ||
sdp_assembly_check(${CONFIG_SOC} "${hrt_srcs}") | ||
sdp_assembly_prepare_install(${CONFIG_SOC} "${hrt_srcs}") | ||
sdp_assembly_target_sources(${CONFIG_SOC} ${target} "${hrt_srcs}") | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the empty line here, and before other functions ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just my formatting preference, removed. |
||
add_dependencies(${target} asm_check) | ||
endfunction() | ||
|
||
function(sdp_assembly_target_sources soc target hrt_srcs) | ||
foreach(hrt_src ${hrt_srcs}) | ||
get_filename_component(hrt_dir ${hrt_src} DIRECTORY) # directory | ||
get_filename_component(hrt_src_file ${hrt_src} NAME_WE) # filename without extension | ||
set(hrt_s_file "${hrt_dir}/${hrt_src_file}-${soc}.s") | ||
target_sources(${target} PRIVATE ${hrt_s_file}) | ||
endforeach() | ||
endfunction() | ||
|
||
function(sdp_assembly_generate soc hrt_srcs) | ||
set(hrt_msg "Generating ASM files for Hard Real Time files.") | ||
set(hrt_opts -g0 -fno-ident -fno-verbose-asm) | ||
|
||
|
@@ -38,9 +66,9 @@ function(sdp_assembly_generate hrt_srcs) | |
get_filename_component(src_filename ${hrt_src} NAME_WE) # filename without extension | ||
add_custom_command(TARGET asm_gen | ||
PRE_BUILD | ||
BYPRODUCTS ${src_filename}-temp.s | ||
COMMAND ${CMAKE_C_COMPILER} ${compiler_options} ${hrt_opts} -S ${hrt_src} -o ${src_filename}-temp.s | ||
COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_NRF_MODULE_DIR}/scripts/sdp/remove_comments.py ${src_filename}-temp.s | ||
BYPRODUCTS ${src_filename}-${soc}-temp.s | ||
COMMAND ${CMAKE_C_COMPILER} ${compiler_options} ${hrt_opts} -S ${hrt_src} -o ${src_filename}-${soc}-temp.s | ||
COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_NRF_MODULE_DIR}/scripts/sdp/remove_comments.py ${src_filename}-${soc}-temp.s | ||
COMMAND_EXPAND_LISTS | ||
COMMENT "Generating ASM file for ${hrt_src}" | ||
) | ||
|
@@ -50,7 +78,7 @@ function(sdp_assembly_generate hrt_srcs) | |
|
||
endfunction() | ||
|
||
function(sdp_assembly_check hrt_srcs) | ||
function(sdp_assembly_check soc hrt_srcs) | ||
set(asm_check_msg "Checking if ASM files for Hard Real Time have changed.") | ||
|
||
if(TARGET asm_check) | ||
|
@@ -62,15 +90,15 @@ function(sdp_assembly_check hrt_srcs) | |
string(REPLACE ";" "$<SEMICOLON>" hrt_srcs_semi "${hrt_srcs}") | ||
|
||
add_custom_target(asm_check | ||
COMMAND ${CMAKE_COMMAND} -D hrt_srcs="${hrt_srcs_semi}" -P ${ZEPHYR_NRF_MODULE_DIR}/cmake/sdp_asm_check.cmake | ||
COMMAND ${CMAKE_COMMAND} -D hrt_srcs="${hrt_srcs_semi}" -D soc="${soc}" -P ${ZEPHYR_NRF_MODULE_DIR}/cmake/sdp_asm_check.cmake | ||
COMMENT ${asm_check_msg} | ||
) | ||
|
||
add_dependencies(asm_check asm_gen) | ||
|
||
endfunction() | ||
|
||
function(sdp_assembly_prepare_install hrt_srcs) | ||
function(sdp_assembly_prepare_install soc hrt_srcs) | ||
set(asm_install_msg "Updating ASM files for Hard Real Time.") | ||
|
||
if(TARGET asm_install) | ||
|
@@ -82,7 +110,7 @@ function(sdp_assembly_prepare_install hrt_srcs) | |
string(REPLACE ";" "$<SEMICOLON>" hrt_srcs_semi "${hrt_srcs}") | ||
|
||
add_custom_target(asm_install | ||
COMMAND ${CMAKE_COMMAND} -D hrt_srcs="${hrt_srcs_semi}" -P ${ZEPHYR_NRF_MODULE_DIR}/cmake/sdp_asm_install.cmake | ||
COMMAND ${CMAKE_COMMAND} -D hrt_srcs="${hrt_srcs_semi}" -D soc="${soc}" -P ${ZEPHYR_NRF_MODULE_DIR}/cmake/sdp_asm_install.cmake | ||
COMMENT ${asm_install_msg} | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
When addressing review comments, then please squash the changes into the commit which originally introduced the code that was commented.
For example, the commit:
0d52442 still has:
function(sdp_assembly_install hrt_srcs)
but later commit: 05afd9a changes this to:
function(sdp_assembly_install target hrt_srcs)
This makes reviewing PRs commit-by-commit harder because I don't know if the code in commit A which i'm currently reviewing and commenting will be modified later at commit Z.
Not mentioning that making two commits in a PR (introduce function + changes the same function) instead of a single commit makes reviewing slower. (Multiple commit are good when they have different kind of changes, that is not touching the same codelines).
Note: Non blocking comment.
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.
Ok, my intention was to make separate commits for each functional change. Will squash them.