-
Notifications
You must be signed in to change notification settings - Fork 8.3k
drivers: flash: spi-nor: add write-block-size for mcuboot #95152
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?
drivers: flash: spi-nor: add write-block-size for mcuboot #95152
Conversation
add write-block-size in dt for spi-nor. The cmake functions related to mcuboot in the build system want this prop to be set. Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
|
de-nordic
left a 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.
Nack. Software configuration does not go into hardware description.
|
@de-nordic where to put it instead? in the mcuboot.cmake, but there the default is already 4 for some options and we get a warning there. |
We have this thing for spi nor zephyr/drivers/flash/Kconfig.nor Line 80 in c7086c7
This ain't perfect, because you have to have other for qspi. Flash DTS nodes should only contain flash parameters; they belong to flash drivers and nothing else should use them. I know this is already abused by various subsystems picking directly into DTS nodes, but that is wrong and completely breaks modularity of the system; such approach increases coupling and takes away control over that parameter from the device driver - which should be sole user of it, as it is parameter defined under node it owns. So it is not even about adding the param, but rather reading it from DTS: because it will be not something you should read directly. It is very hard to move things around, within modules, once people are used to just peeking whatever they want, because they will oppose taking "works for me" away from them; that is at a cost of freedom of improving driver, as changes will lead to breaking implicit interface, created by bypassing barriers between software modules, even though the improvement would not break the commonly defined interface. |
|
@de-nordic I understand you, the thing with the Kconfig unfortunately is, that we don't easily know which one to use, as we could have multiple different flashes and drivers on one board and we need it of the one that contains the code partition. Doing that via Kconfigs is going to get ugly soon. |
cfriedt
left a 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.
I would maybe not make it const and remove the default.
I have a similar pr for erase block size.
Both of those are fine, IMHO, but I might have missed something.
|
@cfriedt the spi_nor driver expect it to be 1: zephyr/drivers/flash/spi_nor.c Lines 293 to 296 in 9d10d67
|
Yet you still do not care, because it fixes your problem, and it is my things that get ugly and entangled. What we are missing is dedicated way to configure instances of software subsystems that could be shared with run-time and compile time. Something like this #80262, or maybe the other thing that was proposed around generating Settings (which I do not remember what happened with it). I do not have anything against adding the parameter, I am opposing you using it bypassing the API and picking it directly. You are breaking modularity, information hiding and increasing coupling between external scripts and parameters that belong to drivers. write-block-size is flash parameter, MCUboot does not have such parameter, it has own thing. I have worked through several instance where change to Flash API Kconfig required a lot of work, because somehow these Kconfigs have been used to control how other subsystems worked directly - like I could not turn on pages layout where I needed it, because suddenly one of subsystems compiled other way, even though I did not wanted it to use it. But it relied on the same Kconfigs that controlled Flash API directly in code. I know that there is no name-spacing in Kconfig and that may be a problem to clearly show where boundaries are. Probably what should really happen, because we do not have the zml thing yet, is same approach as with Disk instances in DTS: Now you have MCUboot object that defines how MCUboot is visible by anything that uses it out of dts; this becomes de-facto API for MCUboot configuration and can be used by run-time and compile time, because it is dedicated for it. The node consists only of things that belong to mcuboot and its behaviour, so it also belongs to imgtool. |
|
The proposed property already exists in a generic flash binding zephyr/dts/bindings/mtd/soc-nv-flash.yaml Line 12 in 169cf86
In my opinion, the external Flash nodes that need the property in order to work with MCUboot should just add the |
yeah, fair enough |



add write-block-size in dt for spi-nor. The cmake
functions related to mcuboot in the build system
want this prop to be set. It's not meant to be changed.