-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Nrfx 6388 assembly mgmt west build #18018
Nrfx 6388 assembly mgmt west build #18018
Conversation
CI InformationTo view the history of this post, clich the 'edited' button above Inputs:Sources:sdk-nrf: PR head: b4b3ec1a3ff321bf9d965e0c6010fd41e160aa1d more detailssdk-nrf:
Github labels
List of changed files detected by CI (4)
Outputs:ToolchainVersion: add720b6d9 Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped;
|
You can find the documentation preview for this PR at this link. It will be updated about 10 minutes after the documentation build succeeds. Note: This comment is automatically posted by the Documentation Publishing GitHub Action. |
e737c06
to
b00d36d
Compare
a468a22
to
7204983
Compare
@nrfconnect/ncs-co-build-system @nrfconnect/ncs-code-owners @nrfconnect/ncs-ll-ursus please, review, PR is already rebased on main |
7204983
to
02a7fb2
Compare
please rebase against main,
|
cmake/sdp.cmake
Outdated
add_custom_target(asm_check | ||
COMMAND ${CMAKE_COMMAND} -D hrt_srcs=${hrt_srcs} -P ${ZEPHYR_NRF_MODULE_DIR}/cmake/sdp_asm_check.cmake | ||
COMMAND_EXPAND_LISTS | ||
COMMENT ${asm_check_msg} | ||
) |
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.
please ensure that this check has is only carried out when there are actually changes to check.
With the current approach, then the asm_check
is always considered out-of-date, and thus the target is always invoked.
For example doing an incremental build on main after a successful build gives:
$ ninja
...
-- Zephyr version: 3.7.99 (/projects/github/review/zephyr), build: v3.7.0-4866-ge516ad354c34
[96/96] Linking C executable zephyr/zephyr.elf
Memory region Used Size Region Size %age Used
RAM: 7080 B 12 KB 57.62%
IDT_LIST: 0 GB 2 KB 0.00%
Generating files from /projects/github/review/nrf/applications/sdp/gpio/build/zephyr/zephyr.elf for board: nrf54l15dk
$ ninja
ninja: no work to do.
however, with this PR, the following is seen:
$ ninja
...
[98/98] Linking C executable zephyr/zephyr.elf
Memory region Used Size Region Size %age Used
RAM: 7080 B 12 KB 57.62%
IDT_LIST: 0 GB 2 KB 0.00%
Generating files from /projects/github/review/nrf/applications/sdp/gpio/build/zephyr/zephyr.elf for board: nrf54l15dk
$ ninja
[1/2] Running utility command for asm_gen
File hrt-temp.s has been cleaned of comments.
[2/2] Checking if ASM files for Hard Real Time have changed.
File hrt.s has not changed.
$ ninja
[1/2] Running utility command for asm_gen
File hrt-temp.s has been cleaned of comments.
[2/2] Checking if ASM files for Hard Real Time have changed.
File hrt.s has not changed.
Feel free to make dm on how to fix this.
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.
@tejlmand is this something that can also be fixed later, after NCS release? I think this is just a minor issue, and I cannot find a solution for it. Unless you have some quick fix in mind.
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.
Created ticket: https://nordicsemi.atlassian.net/browse/NRFX-6664
cmake/sdp_asm_check.cmake
Outdated
get_filename_component(asm_filename ${hrt_src} NAME_WE) # filename without extension | ||
get_filename_component(src_dir ${hrt_src} DIRECTORY) | ||
|
||
execute_process(COMMAND ${CMAKE_COMMAND} -E compare_files ${src_dir}/${asm_filename}.s ${asm_filename}-temp.s |
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.
has it been verified that the hrt.s
(and future friends) which are committed to git has the same line endings on windows when generated by gcc on windows ?
If it has been verified, then everything is fine, else please verify.
And if line endings differs, then compare_files
supports an --ignore-eol
flag.
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.
this comment covers both this file and sdp_asm_update.cmake
.
As you have already made functions in each script, then I think t would be nice to combine the two scripts into a single one.
You can then call the CMake script as: cmake -Dcompare-files=${hrt_srcs} -P sdp_asm.cmake
or cmake -Dinstall-files=${hrt_srcs} -P sdp_asm.cmake
and based on the argument then call te respective internal script function.
Note, this would be nice for this PR, but is not blocking. If not refactoring during PR. then please create a followup ticket.
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.
Created ticket: https://nordicsemi.atlassian.net/browse/NRFX-6658
applications/sdp/gpio/CMakeLists.txt
Outdated
@@ -10,8 +10,12 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | |||
project(emulated_gpio) | |||
|
|||
sdp_assembly_generate("${CMAKE_SOURCE_DIR}/src/hrt/hrt.c") | |||
sdp_assembly_check("${CMAKE_SOURCE_DIR}/src/hrt/hrt.c") | |||
sdp_assembly_update("${CMAKE_SOURCE_DIR}/src/hrt/hrt.c") |
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.
First, this call is misleading / bad naming.
It gives the impression that the newly generated assembly file will actually be updated, which is not the case.
This call will only create a build target which can be called by the user to update the assembly files.
Another problem with the approach is that all files will be updated, and not only those which differs.
Or the user cannot choose to update only a single file.
This is not a big issue when only a single file is in use, but will become a problem in future.
For now, please improve the naming.
For future, please create a ticket to addre
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.
I changed sdp_assembly_update
to sdp_assembly_prepare_install
.
Also, I created a ticket for modifying asm_update (asm_install now): https://nordicsemi.atlassian.net/browse/NRFX-6657
cmake/sdp.cmake
Outdated
COMMAND ${CMAKE_COMMAND} -D hrt_srcs=${hrt_srcs} -P ${ZEPHYR_NRF_MODULE_DIR}/cmake/sdp_asm_check.cmake | ||
COMMAND_EXPAND_LISTS |
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.
this does not work with lists.
First thing is that ;
will be replaced with <space>
, thus resulting in: -D hrt_srcs=foo.c bar.c
, and not -D hrt_srcs="foo.c;bar.c"
.
To fix this, then first COMMAND_EXPAND_LISTS
must be removed.
Secondly, ;
must be replaced by the $<SEMICOLON>
generator expression.
and finally, the argument list must be quoted using "
.
cmake/sdp.cmake
Outdated
function(sdp_assembly_update hrt_srcs) | ||
set(asm_update_msg "Updating ASM files for Hard Real Time.") | ||
|
||
if(TARGET asm_update) |
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.
A common naming convention for such targets is install-<something>
, not update, so perhaps: install-sdp-asm
/ install-hrt-asm
are better names.
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.
I changed it to asm_install
to stay consistent with other target names.
cmake/sdp.cmake
Outdated
endif() | ||
|
||
add_custom_target(asm_update | ||
COMMAND ${CMAKE_COMMAND} -D hrt_srcs=${hrt_srcs} -P ${ZEPHYR_NRF_MODULE_DIR}/cmake/sdp_asm_update.cmake |
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.
see other comment regarding this code not working with lists.
02a7fb2
to
874f156
Compare
874f156
to
1e37564
Compare
Add two new targets regarding ASM code for SDP: asm_check that checks if ASM file has changed, and asm_update that updates ASM files in source directory with the new generated. Signed-off-by: Magdalena Pastula <[email protected]>
Add asm_check target as a depency for flpr_egpio application. This will generate new ASM file for every source file in hrt folder and check if the new ones are the same as the one saved in git. For every file that differs a warning is printed. By making asm_check a dependency of flpr_egpio application asm_check will be run both for sysbuild application including eGPIO and for stand-alone SDP application before the main build starts. Signed-off-by: Magdalena Pastula <[email protected]>
1e37564
to
b4b3ec1
Compare
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.
approved, as there are issues to track followup work
Add two new CMake targets:
asm_check
andasm_update
.asm_check
will check if content of the already existing ASM file and the new generated byasm_gen
are the same. If they are the same, the newly generated is removed. If they are different, a warning is printed to update ASM file, if the new one should be included in build.asm_update
will replace the already existing ASM file with the new one generated byasm_gen
. If the new ASM file does not exist, a warning is printed.I created two new CMake scripts (
sdp_asm_check
andsdp_asm_update
) for these targets because I could not find a way to pass the logic toadd_custom_target
directly/in line. If there is a way of doing that without creating new CMake scripts, please let me know.In the last commit
asm_check
is added as a dependency forflpr_egpio
application. It is done in order to check ASM files automatically at the start of the build, no matter if a sysbuild application including eGPIO is build or eGPIO firmware only.Based on #17638Rebased on main