-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add a common function to read partition address from CMake #24792
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
base: main
Are you sure you want to change the base?
Add a common function to read partition address from CMake #24792
Conversation
The following west manifest projects have changed revision in this Pull Request:
✅ All manifest checks OK Note: This message is automatically posted and updated by the Manifest GitHub Action. |
CI InformationTo view the history of this post, clich the 'edited' button above Inputs:Sources:sdk-nrf: PR head: 07dc5a391549067609605a97e537341f14fd3c23 more detailssdk-nrf:
zephyr:
Github labels
List of changed files detected by CI (6)
Outputs:ToolchainVersion: a7529a11f4 Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped;
|
You can find the documentation preview for this PR here. |
859c70b
to
0474ea0
Compare
0474ea0
to
a913cc8
Compare
Scope reduced: There is no point in adding multiple overrides if they are about to be removed once the support for subpartitions will be introduced.. |
Memory footprint analysis revealed the following potential issuesapplications.hpf.gpio.icmsg[nrf54l15dk/nrf54l15/cpuflpr]: High RAM usage: 9102[B] - link (cc: @nrfconnect/ncs-ll-ursus) Note: This message is automatically posted and updated by the CI (latest/sdk-nrf/PR-24792/7) |
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 round revierw.
Please note that line length limit is 100 chars, so some lines is not required to wrap.
I've only pointed out a few.
if(NOT DEFINED DT_PARTITION_PATH) | ||
if(DT_PARTITION_REQUIRED) | ||
message(FATAL_ERROR | ||
"dt_partition_addr: Unable to find node with label: ${DT_PARTITION_LABEL}") |
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.
can we provide some more info to the developer on how to fix this issue ?
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.
Not really. This is a helper/utility function and it is hard to guess, in which context it is called. Basically, if it fails, it means that some sort of script expects a node in your DTS, but it is not there. I will add a target name to the message to help at least a bit.
_dt_get_parent(dt_partition_parent) | ||
if("${dt_partition_parent}" STREQUAL "") |
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 pattern in CMake is to use, <var>-NOTFOUND
and then simply do the test like this:
if(NOT dt_partition_parent)
but in which cases can the dt_partition_parent
be an empty string ?
Because is seems that either there is a parent, or a CMake error is raised if there is no parent.
Ref:
sdk-nrf/cmake/sysbuild/bootloader_dts_utils.cmake
Lines 11 to 13 in a913cc8
if(pos EQUAL -1) | |
message(FATAL_ERROR "Unable to get parent of node: ${${node}}") | |
endif() |
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've redesigned this section, based on the recent fix: nrfconnect/sdk-zephyr#3353
a913cc8
to
98e4353
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.
Much better.
Mostly minor nits, and some observations.
Please checkup regarding line length and line wrapping.
Take a look at the CMake Style Guidelines
cmake_parse_arguments(DT_PARTITION "ABSOLUTE;REQUIRED" "LABEL;PATH;TARGET" "" | ||
${ARGN}) |
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.
Proposed change is still <100 chars.
cmake_parse_arguments(DT_PARTITION "ABSOLUTE;REQUIRED" "LABEL;PATH;TARGET" "" | |
${ARGN}) | |
cmake_parse_arguments(arg_DT_PARTITION "ABSOLUTE;REQUIRED" "LABEL;PATH;TARGET" "" ${ARGN}) |
Also, please prefix with lower case arg_
or simply arg
to avoid name clashing as recommended by CMake.
Choose a carefully to avoid clashing with existing variable names. When used inside a function, it is usually suitable to use the prefix arg. There is a very strong convention that all keywords are fully uppercase, so this prefix results in variables of the form arg_SOME_KEYWORD. This makes the code more readable, and it minimizes the chance of clashing with cache variables, which also have a strong convention of being all uppercase.
https://cmake.org/cmake/help/latest/command/cmake_parse_arguments.html
See also: https://gitlab.kitware.com/cmake/cmake/-/issues/25773
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.
Prepended with the arg_
prefix.
c804096
to
5419a9b
Compare
5419a9b
to
4fd1e90
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.
Minor suggestion regarding a variable name
4fd1e90
to
f7d7e2a
Compare
Add a common bootloader_dts_util to read both the relative and absolute address of a fixed sub/partition from DTS. Signed-off-by: Tomasz Chyrowicz <[email protected]>
f7d7e2a
to
07dc5a3
Compare
No description provided.