Skip to content
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

boot: zephyr: Add check for unexpected flash sector size #2059

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

nordicjm
Copy link
Collaborator

Prints a debug log message if the device has a write block size for a flash device in DTS that is not the same as what the flash driver reports at run-time, this can be used to see if there is a faulty configuration as these compile-time values are used for various calculations

@butok

@butok
Copy link
Contributor

butok commented Sep 18, 2024

It should also check the program size (not only the sector size).

@nordicjm
Copy link
Collaborator Author

It should also check the program size (not only the sector size).

That's already done at runtime

Prints a debug log message if the device has a write block size
for a flash device in DTS that is not the same as what the flash
driver reports at run-time, this can be used to see if there is
a faulty configuration as these compile-time values are used for
various calculations

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
@nordicjm
Copy link
Collaborator Author

It should also check the program size (not only the sector size).

Right I see what you mean, have added it

Adds write block size checking functionality and includes a
zephyr implementation, this will not throw an error or prevent
upgrade but will emit a debug log with a discrepency message

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Adds notes on these new features

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
@de-nordic
Copy link
Collaborator

This does not support configurations with external mem, right? Because with external mem there is no write-block-size/erase-block-size.

@nordicjm
Copy link
Collaborator Author

This does not support configurations with external mem, right? Because with external mem there is no write-block-size/erase-block-size.

It does, but it is driver dependent, for example one of the nxp ones had a write block size of 8 in dts which was wrong, and something like spi-nor might have a value in dts if it uses static configuration or nothing if it uses sfdp

@de-nordic
Copy link
Collaborator

This does not support configurations with external mem, right? Because with external mem there is no write-block-size/erase-block-size.

It does, but it is driver dependent, for example one of the nxp ones had a write block size of 8 in dts which was wrong, and something like spi-nor might have a value in dts if it uses static configuration or nothing if it uses sfdp

Bindings for spi-nor and qspi-nor does not provide definition of write-block-size, it is provided via Kconfig option, so only via simplified or run-time sfdp. There is though CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE that specifies erase page size for SPI... does not pair well with multi-instance spi-nor driver.

@nordicjm
Copy link
Collaborator Author

This does not support configurations with external mem, right? Because with external mem there is no write-block-size/erase-block-size.

It does, but it is driver dependent, for example one of the nxp ones had a write block size of 8 in dts which was wrong, and something like spi-nor might have a value in dts if it uses static configuration or nothing if it uses sfdp

Bindings for spi-nor and qspi-nor does not provide definition of write-block-size, it is provided via Kconfig option, so only via simplified or run-time sfdp. There is though CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE that specifies erase page size for SPI... does not pair well with multi-instance spi-nor driver.

Bad name, but this spi nor driver is what I mean: https://github.com/zephyrproject-rtos/zephyr/blob/main/boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts#L104

@de-nordic
Copy link
Collaborator

Bad name, but this spi nor driver is what I mean: https://github.com/zephyrproject-rtos/zephyr/blob/main/boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts#L104

OK, that is new to me as there is not such definition in dts bindings for the compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants