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

drivers: flash: stm32h7x: Fix wrong flash write offset #45639

Conversation

chrihell
Copy link
Contributor

This PR fixes issue #45568

Changes:

  • Add specific configuration and DTS overlay files for NUCLEO-H7A3ZI-Q
    board to the littlefs example project. The second half of the SOC flash
    is used as flash partition for littlefs.

  • The flash_stm32_write_range() function of the STM32H7x flash
    driver partially uses a wrong flash program word size for certain
    SOC types when calculating the flash write offset. If the used
    SOC is not having a flash program word size of 256 bits / 32 bytes
    the written data might get corrupted, as the flash write offset
    value does not match the number of bytes that were actually
    written.

The fix was verified by executing the littlefs example application on a nucleo_h7a3zi_q board (uses SOC: STM32H7A3).
See issue for more details.

@chrihell chrihell requested review from nashif and nvlsianpu as code owners May 13, 2022 19:03
@github-actions github-actions bot added area: Samples Samples platform: STM32 ST Micro STM32 labels May 13, 2022
@chrihell chrihell force-pushed the issue_45568_fix_stm32h7x_flash_driver branch from 76ebb65 to 06f7968 Compare May 15, 2022 09:49
@erwango erwango added the bug The issue is a bug, or the PR is fixing a bug label May 16, 2022
@erwango erwango added this to the v3.1.0 milestone May 16, 2022
@erwango erwango requested review from erwango, ABOSTM and FRASTM May 16, 2022 07:32
erwango
erwango previously approved these changes May 16, 2022
Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

FRASTM
FRASTM previously approved these changes May 16, 2022
@erwango
Copy link
Member

erwango commented May 16, 2022

@chrihell PR looks fine but please fix issues reported by the CI compliance check:

-:27: ERROR:TRAILING_WHITESPACE: trailing whitespace
#27: FILE: samples/subsys/fs/littlefs/boards/nucleo_h7a3zi_q.conf:8:
+# This is required by the flash driver to be able $

-:53: ERROR:TRAILING_WHITESPACE: trailing whitespace
#53: FILE: samples/subsys/fs/littlefs/boards/nucleo_h7a3zi_q.overlay:18:
+^I^I^Imount-point = "/lfs1";      $

chrihell added 2 commits May 16, 2022 16:26
Add specific configuration and DTS overlay files for NUCLEO-H7A3ZI-Q
board to the littlefs example project. The second half of the SOC flash
is used as flash partition for littlefs.

Signed-off-by: Christoph Heller <[email protected]>
The flash_stm32_write_range() function of the STM32H7x flash
driver partially uses a wrong flash program word size for certain
SOC types when calculating the flash write offset. If the used
SOC is not having a flash program word size of 256 bits / 32 bytes
the written data might get corrupted, as the flash write offset
value does not match the number of bytes that were actually
written.

Fixes zephyrproject-rtos#45568

Signed-off-by: Christoph Heller <[email protected]>
@chrihell chrihell dismissed stale reviews from FRASTM and erwango via 1ab18bd May 16, 2022 14:32
@chrihell chrihell force-pushed the issue_45568_fix_stm32h7x_flash_driver branch from 06f7968 to 1ab18bd Compare May 16, 2022 14:32
@Laczen Laczen removed their request for review May 16, 2022 14:43
@chrihell
Copy link
Contributor Author

Fixed CI compliance check errors. Hope it's fine now.
Couldn't directly fix it, as the check was only finished hours after my push.

Did I force push too much or was it ok like that?
I'm all new to this, so any feedback is appreciated.

@carlescufi
Copy link
Member

Fixed CI compliance check errors. Hope it's fine now. Couldn't directly fix it, as the check was only finished hours after my push.

Did I force push too much or was it ok like that? I'm all new to this, so any feedback is appreciated.

It's all good now, thank you!

@carlescufi carlescufi merged commit 382ee01 into zephyrproject-rtos:main May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: File System area: Flash area: Samples Samples bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants