-
Notifications
You must be signed in to change notification settings - Fork 7k
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 with external NOR ospi flash in MemoryMapped mode #61082
Conversation
reading flash of the b_u585i_iot02a in memory mapped mode (@ 0x70000000) :
|
eb0bd14
to
317d714
Compare
79e0958
to
93b0493
Compare
The following west manifest projects have been modified in this Pull Request:
Note: This message is automatically posted and updated by the Manifest GitHub Action. |
974a6a0
to
b8a77b6
Compare
rebase on e9dd938 |
b8a77b6
to
9dae609
Compare
New version where the HAL is not changed thanks to direct access to the hospi instance in the flash_stm32_ospi driver Using a sample to demonstrate (adapted from samples/drivers/spi_flash) to read operation in memorymapped mode (no erase sector). Tested with the b_u585i_iot02a disco board ;
|
5b11367
to
66e6a1b
Compare
Maybe this could be useful here #62228. |
@FRASTM, thanks for the PR. Is my conclusion correct that when using XIP and memory mapped mode there is no part of the flash device that can be used by a fs (that always need an erase) ? |
Nice, if write works with memcpy that is OK. Is it not needed to disable irq's when memory mapped mode is aborted (would there be irq code that is not available during the erase) ? |
c39d778
to
4397fa5
Compare
e877694
to
bea3951
Compare
Rebase on d7873e2 Requires MCUboot PR mcu-tools/mcuboot#1891 where the mcuboot is built/linked/stored at the boot_partition in internal mcu flash ( 0x8000000) Add an example samples/subsys/fs/littlefs/ where the application is running in external NOR memory (XiP) and where the lfs1 partition is in internal MCU memory. The slot0 where to execute the application is located in external flash memory and chosen as
|
bea3951
to
fb86e36
Compare
|
Write is not really guaranteed. in memorymapped mode : with stm32u585, the data written (with memcopy) and read back (in memcopy) are correct but do not seem persistent in flash !? |
@FRASTM, your commit comments are still showing that erase and write is not supported, is this still the case ? If erase works, can't you use the same methodology (go out of memmap, do erase, return to memmap) for the write ? |
RM0456 Rev 5 1061/3637 "It is not recommended to program the flash memory using the memory-mapped writes: Page 1064 explains more. Reads/writes to OSPI connected, memory-mapped, device will be probably cached, so unless you invalidate cache and force OQSPI to re-read the area then you will not know whether data has been written correctly, as it seems that there is no auto-erase on writes, writes are probably not verified. The reservations are only for flash, so I guess that SRAM connected device will work fine, but that kind device changes bits in any to any transition, while flash in any to 0 only. |
fb86e36
to
5e5ed7d
Compare
Yes it works : erasing/writing the NOR octo-flash after aborting the mem map mode. |
5e5ed7d
to
a25327c
Compare
adding a commit to abort the memorymapped mode before erasing or writing to the external NOR octoflash |
a25327c
to
47b0269
Compare
For the flash driver, the base address is the MCU internal flash address (usualyy 0x8000000). This PR gets the that address from the device tree node "st,stm32-nv-flash" instead of relying on the CONFIG_FLASH_BASE_ADDRESS which might differ when building for another flash memory. Signed-off-by: Francois Ramu <francois.ramu@st.com>
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>
Enable the MemoryMapped Mode for the stm32 octoFlash driver Configure the Flash in MemoryMapped to use in XiP mode. With this mode the erase and write are not supported. Address and size are given by the DTS register property. Signed-off-by: Francois Ramu <francois.ramu@st.com>
This change is aborting the memoryMapped mode of the octo-flash before erasing or writing the NOR. Operations are performed in command mode. Reading is always performed in MemoryMapped mode (memcopy) Signed-off-by: Francois Ramu <francois.ramu@st.com>
Enable the DCACHE1 in INCR burt mode to allow writing to the external NOR octoFlash when in MemoryMapped mode Signed-off-by: Francois Ramu <francois.ramu@st.com>
Define the Device tree of the b_u585i_iot02a disco kit to access the external NOR octo-flash in MemoryMapped mode for XiP Signed-off-by: Francois Ramu <francois.ramu@st.com>
Gives a sample to execute the little fs on external memory map (XiP) where the lfs1 partition is in internal mcu flash The application is built/linked/stored in the external NOR flash on slot1 partition. Signed-off-by: Francois Ramu <francois.ramu@st.com>
47b0269
to
2d582f4
Compare
The PR #68597 is now replacing this PR |
This PR is enabling the MemoryMapped to access the octo NOR flash at the end of the initialization.
With this configuration, the NOR flash access is done with memcopy in read or write
Note that the erase is not supported but writing is possible in MemoryMapped mode.
(It is not recommended to fill the memory with 0xFFFFFFFF)
The drivers detects the CONFIG_STM32_MEMMAP flag to enable the MemoryMapped mode.