-
Notifications
You must be signed in to change notification settings - Fork 8.2k
DT_FLASH_AREA replacement with new dts macros #25056
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
|
All checks are passing now. checkpatch (informational only, not a failure)Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages. |
|
This is based off of #24522. There's a known issue with samples/subsys/fs/littlefs on nrf52840dk_nrf52840 failing. This is because the nrf52840dk_nrf52840 has 2 fixed-partition nodes. We need to decide if partitions should be seen as per flash device or more global. |
I wasn't aware of that issue. That's a very ugly failure message.
Aha. Now I finally see what may be underlying the discussion at #24522 (comment) Flash partitions identified by Edit: The upstream binding seems to support my requirement above. |
I have seen that in original PR for FLASH_AREA. I have posted workaround PR here: |
Setup node.compats right after we create the Node. This allows access to the compats information in _bus_node. Signed-off-by: Kumar Gala <[email protected]>
If we have a fixed-partition on a flash device that is for example on a spi controller we will not get a binding match currently. This is because we expect a match between both the compatible and the fact that fixed-partition node is a decendant of the spi bus. To address this we treat fixed-partitions as if they are on no bus. This has the effect of causing a binding match as well as ensuring that when we process the fixed-partition node we will do anything special to it because of the bus it happens to be under (for example SPI CS_GPIO processing). Signed-off-by: Kumar Gala <[email protected]>
allow the old generator to act as it did. Signed-off-by: Kumar Gala <[email protected]>
Rework how write_child_functions to match how we do the code for DT_FOREACH_OKAY_INST. Signed-off-by: Kumar Gala <[email protected]>
Add DT_NODE_BY_FIXED_PARTITION_LABEL that given a "label" in any fixed-partitions map will return the node_id for that partition node. Add DT_NODE_HAS_FIXED_PARTITION_LABEL that will test if a given fixed-partitions "label" is valid. Add DT_FIXED_PARTITION_ID that will return an unique ordinal value for the partition give a node_id to the partition. Signed-off-by: Kumar Gala <[email protected]>
Add macros that we'll utilize instead of DT_FLASH_AREA_ Signed-off-by: Kumar Gala <[email protected]>
Convert to use new DTS macros to populate default flash map Signed-off-by: Kumar Gala <[email protected]>
Convert with a combo of scripts and by hand fixups: git grep -l DT_FLASH_AREA_.*_ID | \ xargs sed -i -r 's/DT_FLASH_AREA_(.*)_ID/FLASH_AREA_ID(\L\1)/' git grep -l DT_FLASH_AREA_.*_OFFSET | \ xargs sed -i -r 's/DT_FLASH_AREA_(.*)_OFFSET/FLASH_AREA_OFFSET(\L\1)/' git grep -l DT_FLASH_AREA_.*_SIZE | \ xargs sed -i -r 's/DT_FLASH_AREA_(.*)_SIZE/FLASH_AREA_SIZE(\L\1)/' Signed-off-by: Kumar Gala <[email protected]>
include/storage/flash_map.h
Outdated
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.
We should allow users to provide their own definition of these symbols. This could be the default definition included, but (like with flash_map_default.c) it should be possible to override this through a kconfig value.
Currently any dowstream with their own partition definitions is required to maintain a patch of this file.
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.
My initial thoughts for solving this were to in the future extend this macro to take a second parameter identifying the provider of partition information. The default behavior would be as if that parameter were fixed_partition which would through magic pass to the current solution, but if it were say partition_mgr would route to a different macro or possibly ultimately a function.
The thought is that we do need label uniqueness within a given provider of flash region managers. Attempting to enforce it across all region managers isn't reasonable IMO, and limiting applications to a single region manager (devicetree or other) is also not reasonable.
A way to resolve the conflict is to pair the label with a provider, using the existing devicetree provider as the default.
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 was consulted with me. @mbolivar-nordic This is the simple way we can inject our partitions info.
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, then there must be something like a kconfig option passed in as the second argument to avoid having to patch the file.
I'm fine with this as long as it allows us to not need patches in any of the upstream source files.
west.yml
Outdated
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.
upgrade sha
Update mcumgr/mcuboot for changes to DT_FLASH_AREA -> FLASH_AREA macros. Signed-off-by: Kumar Gala <[email protected]>
Set LEGACY_DEVICETREE_MACROS to default to no since we are deprecating the old macro style and all in tree users are now converted. Signed-off-by: Kumar Gala <[email protected]>
This this covers two small aspects of DTS functionality: first ensuring the legacy generation script continues to generally function and second that FLASH_AREA id's are the same between the old and new generator. This test will be removed when the legacy generator is removed. Signed-off-by: Kumar Gala <[email protected]>
No description provided.