-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
stm32: add memory-mapped mode for QUADSPI #72339
stm32: add memory-mapped mode for QUADSPI #72339
Conversation
This CONFIG_STM32_MEMMAP is for enabling the MemoryMapped mode on external octo or quad spi memory. In this case, the flash_stm32_read is done in mem map mode the flash_stm32_erase is not available. Signed-off-by: Francois Ramu <francois.ramu@st.com>
Thanks for implementing the memorymapped mode with the stm32 quadspi flash driver
|
Yes, it works fine here after fixing the
I can't imagine a firmware that requires continuous memory-mapping in order to boot, but then later also uses the
I initially developed it for a custom stm32l452 board, it works fine there. I don't have an h7 board with QSPI flash to test. |
if (ret != 0) { | ||
LOG_ERR("Failed to abort memory-mapped access before write"); | ||
goto end; | ||
} |
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.
suggestion : LOG_DBG("Abort Memory-mapped before write");
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.
That feels much less clear to me. For one it doesn't even mention that something went wrong, and it's also not the memory-mapping that's being aborted, just a latent read access, if any.
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 the suggestion was to put it after, once abort is completed.
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 the suggestion was to put it after, once abort is completed.
@arbrauns Can you check this 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.
Ah, that makes sense, but then that LOG_DBG()
would trigger on every single flash write/erase - would that make sense?
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.
There's already a LOG_DBG on flash_stm32_qspi_read so, that would be coherent.
if (ret != 0) { | ||
LOG_ERR("Failed to abort memory-mapped access before write"); | ||
goto end; | ||
} |
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.
suggestion : LOG_DBG("Abort Memory-mapped before erase");
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.
Cannot pass the samples/application_development/code_relocation_nocopy/ on stm32h747_disco or stm32h750b_dk.
Succesfully Tested with samples/drivers/spi_flash on stm32f746g_disco (single quad-flash) in memory mapped mode.
As I said, I don't have h7 hardware, could you give some more information about the failures? A good candidate is the |
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.
Thanks for putting this all together, some non blocking comments.
Otherwise LGTM once comments from @FRASTM are implemented.
@@ -74,6 +74,13 @@ | |||
sw0 = &user_button; | |||
spi-flash0 = &mx25l51245g; | |||
}; | |||
|
|||
quadspi_memory_avail: memory-avail@90000000 { |
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.
It would be nice to update board documentation to provide some details on how this could be used.
samples/application_development/code_relocation_nocopy/linker_arm_nocopy.ld
Show resolved
Hide resolved
Not blocking for the current PR. Let's document clearly what ia available and enter a GH issue on the known issues. |
Building west build -p auto -b stm32h750b_dk samples/application_development/code_relocation_nocopy/
and
gives the following error:
And the STM32CubeProgrammer shows 0xFF (blank sector) at 0x90000000 |
69d57d0
to
3b43d4f
Compare
Since I didn't see any complaints, I've also removed the hack in |
Are you sure the external flash programming worked then? |
Yes, with the STM32CubeProgrammer from #68377 Then
Refer to #72429 |
This puts the QSPI peripheral into memory-mapped mode when CONFIG_STM32_MEMMAP is set. Writes and erase put it back into indirect write mode. Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
According to the datasheet, fRSCLK (Clock Frequency for READ instructions) is 66MHz; it doesn't mention 72MHz anywhere. Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
…alt" The init script is required for QSPI flash setup. Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
By default, the QSPI region is marked as EXTMEM and inaccessible (see zephyrproject-rtos#57467), mark the first 64MB as IO on stm32f769i_disco. Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
This board has memory-mapped QSPI flash. Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
3b43d4f
to
d46b248
Compare
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.
Approved on my side as the latest discussion on logging doesn't feel blocking to me.
Inspired by #68597, cc @FRASTM.