-
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
samples: bluetooth: fast_pair: input_device: Improve nRF54H20 memory map #19174
samples: bluetooth: fast_pair: input_device: Improve nRF54H20 memory map #19174
Conversation
CI InformationTo view the history of this post, clich the 'edited' button above Inputs:Sources:sdk-nrf: PR head: 9b49a91695a74d56ac89a9fe02059ff95520c376 more detailssdk-nrf:
Github labels
List of changed files detected by CI (1)
Outputs:ToolchainVersion: Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped;
|
dce371e
to
c3508e4
Compare
label = "bt_fast_pair"; | ||
reg = <0x1e8fb8 0x48>; | ||
storage_partition: partition@1e3080 { | ||
reg = <0x1e3080 0x5f80>; |
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 check how the storage subsys will behave when there will be such partition that is not divisable by the 0x1000 (i think it was default sector size)
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.
So, it says that I have five sectors of 4096 bytes which is 0x5000 in hex. The extra 0xf80 is unused and should be removed I guess. However, if I set the reg to: reg = <0x1e3080 0x5000>;
, the sample fails to boot. It only works if I set it to reg = <0x1e4000 0x5000>;
(or reg = <0x1e3080 0x5f80>;
as it's done now, but then we're wasting the extra 0xf80). @rghaddab, could you expand more on that? Anyway, it seems that we should start from the address divisible by 0x1000. I will set the storage partition to reg = <0x1e4000 0x5000>;
and the Fast Pair partition to reg = <0x1e3f80 0x80>;
so that it precedes the storage partition. We will leave the gap between the DFU partition and Fast Pair partition, but I think it's the best we can do.
c3508e4
to
6096480
Compare
Spotted that the write block size is actually equal to 16 (0x10) and thus aligned all sizes and addresses to be divisible by 0x10. Also moved the storage partition to start at address divisible by 0x1000 as this is the storage sector size. |
samples/bluetooth/fast_pair/input_device/boards/nrf54h20dk_nrf54h20_cpuapp.overlay
Outdated
Show resolved
Hide resolved
/* Leaving here an empty gap from 0x1e3000 to 0x1e3fb0. | ||
* We want to have a bt_fast_pair_partition preceding the | ||
* storage_partition. We also need a storage partition to | ||
* start at address divisible by 0x1000, because this is the | ||
* storage sector size. What is more, we want to have all | ||
* partition sizes and addresses divisible by 0x10 which is | ||
* the write block size for MRAM. | ||
*/ |
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.
Consider: TBH I personaly would leave only the information that there is the gap between this and that address.
I do not think that it is requirement to have bt_fast_pair_partition before the settings partition and it is only our "style" i guess to be aligned with other apps, right?
And the rest is just how the storage / MRAM works.
If needed we could add it in commit message i guess :D
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 think it has educational value to have it here and explain what is happening.
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.
Maybe we could set bt_fast_pair_partition
size to 0x1000
(to avoid having unassigned memory). That would simplify configuration a bit.
samples/bluetooth/fast_pair/input_device/boards/nrf54h20dk_nrf54h20_cpuapp.overlay
Show resolved
Hide resolved
/* Leaving here an empty gap from 0x1e3000 to 0x1e3fb0. | ||
* We want to have a bt_fast_pair_partition preceding the | ||
* storage_partition. We also need a storage partition to | ||
* start at address divisible by 0x1000, because this is the | ||
* storage sector size. What is more, we want to have all | ||
* partition sizes and addresses divisible by 0x10 which is | ||
* the write block size for MRAM. | ||
*/ |
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.
Maybe we could set bt_fast_pair_partition
size to 0x1000
(to avoid having unassigned memory). That would simplify configuration a bit.
samples/bluetooth/fast_pair/input_device/boards/nrf54h20dk_nrf54h20_cpuapp.overlay
Outdated
Show resolved
Hide resolved
samples/bluetooth/fast_pair/input_device/boards/nrf54h20dk_nrf54h20_cpuapp.overlay
Show resolved
Hide resolved
6096480
to
2755e2f
Compare
2755e2f
to
4649cfc
Compare
Rebased on main to fix compliance. |
samples/bluetooth/fast_pair/input_device/boards/nrf54h20dk_nrf54h20_cpuapp.overlay
Outdated
Show resolved
Hide resolved
samples/bluetooth/fast_pair/input_device/boards/nrf54h20dk_nrf54h20_cpuapp.overlay
Show resolved
Hide resolved
label = "bt_fast_pair"; | ||
reg = <0x1e8fb8 0x48>; | ||
/* The storage partition needs to start at address divisible | ||
* by 4096 (0x1000), because this is the storage sector size. |
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.
Actually the storage sector size is not a fix value and can be set by the app, I don't know where you got the information that the storage sector size should be 4096 bytes for the nrf54h20.
For NVS this size should be a multiple of the erase-block-size value that is set in the device tree
For ZMS this size should be a multiple of the write-block-size (I think it is 16 bytes for the nrf54h20).
I am not arguing about the alignment here, as this is necessary for NVS, but the comment is kind of misleading
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 know it can be set by application, but in our sample it's 4096 so that's what I'm referring to. Also, from what I see the alignment is also needed for ZMS - when I set the storage partition to reg = <0x1e3080 0x5000>;
, the sample fails to boot. I guess it would be nice to have some build assert for asserting that the storage partition starts at address divisible by storage sector size (from what I experience this is the silent requirement)
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.
ZMS do not need the alignment of the start address to the sector size. It should be aligned only to the write-block-size
If the sample fails to boot, then there is a bug that needs to be reported.
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.
So in that case there's bug here. I set start address to 0x1e3080 so it was aligned to write-block-size which is 16 bytes (0x10), but it failed to boot. What is more when I increased the size (reg = <0x1e3080 0x5000>;
-> reg = <0x1e3080 0x5f80>;
) it started working.
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.
So @rghaddab, what do you want the comment to look like?
4649cfc
to
29d3c41
Compare
#address-cells = <1>; | ||
#size-cells = <1>; | ||
|
||
dfu_partition: partition@100000 { | ||
reg = <0x100000 DT_SIZE_K(908)>; | ||
}; | ||
|
||
storage_partition: partition@1e3000 { | ||
reg = <0x1e3000 DT_SIZE_K(20)>; | ||
/* Align the partition size to 4096 B to avoid gaps. */ |
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 also update the commit message
bt_fast_pair_partition: partition@1e8fb8 { | ||
label = "bt_fast_pair"; | ||
reg = <0x1e8fb8 0x48>; | ||
/* The storage partition needs to start at address divisible |
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 might need to be aligned with @rghaddab to ensure correctness
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.
@alstrzebonski I don't think you need here to justify why the address starts at 0x1e4000 as this is where the previous partition stops.
- The justification is misleading. Currently the storage system doesn't require an alignment of the start address to the sector size. There might be a bug there that needs to be fixed 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.
I don't agree. There's a bug here so currently the storage system does require an alignment. If the bug is fixed then it will no longer require it, but for now it does.
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 can rephrase it to:
/* Due to a bug, the storage partition needs to start at address divisible
* by 4096 (0x1000), because this is the storage sector size
* in this sample.
*/
Do you approve?
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 simpler : remove the comment in the device tree, but keep it in the commit message.
Why do you need to justify in the device tree that the address starts at 4K boundary if the previous one stops there ?
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.
Previous one stops there to not leave gaps.
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, I will remove the comment. Will you take over the bug or do I need to open issue in Zephyr?
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.
@alstrzebonski I will take over the bug
98ddf1c
to
92d2460
Compare
@alstrzebonski in the commit message you can write up to 75 chars in a line. |
92d2460
to
d6a9a46
Compare
Addressed, @rghaddab please rereview. |
d6a9a46
to
cff0d41
Compare
Sorry @alstrzebonski for insisting on the form of the commit message, but this is still not Ok. |
Never before heard about this new line after each sentence. Also, the limit is 72 char. Anyway, I addressed it. Please rereview. |
cff0d41
to
dc6ca06
Compare
https://docs.zephyrproject.org/latest/contribute/guidelines.html#commit-message-guidelines |
|
Puts fast pair provisioning partition right before the storage partition and sets its size to 4 KiB to avoid gaps. Align the storage partition to a 4KiB boundary as this is the sector size. This alignment is needed due to a bug in the storage subsystem. Fixes the cpuapp_rw_partitions node deletion (earlier it was done incorrectly). Jira: NCSDK-30269 Signed-off-by: Aleksander Strzebonski <[email protected]>
dc6ca06
to
9b49a91
Compare
makes sense when all the sentences are related to the same thing. |
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 Ok now
|
Puts Fast Pair provisioning partition right before the storage
partition.
Aligns partition sizes and addresses to be a multiple of 0x10, which is
the write block size for MRAM.
Keeps the storage partition at address divisible by 0x1000, as this is
the storage sector size.
Fixes the cpuapp_rw_partitions node deletion (earlier it was done
incorrectly).
Jira: NCSDK-30269