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

stm32 xspi driver supports Memory mapped mode for XiP #73860

Merged
merged 4 commits into from
Jun 24, 2024

Conversation

FRASTM
Copy link
Collaborator

@FRASTM FRASTM commented Jun 6, 2024

Like the flash_stm32_qspi or flash_stm32_ospi drivers, this PR adds the Memory Mapped mode
so that code can eXecute In Place from the external NOR flash
This is validated on the stm32H5 serie and demonstrated on the stm32h573i_dk disco kit (Macronix MX25LM51245 octo-NOR ).

Running the samples/application_development/code_relocation_nocopy/ with CONFIG_STM32_MEMMAP=y

*** Booting Zephyr OS build v3.6.0-5497-g1db55c1f8901 ***                       
Address of main function 0x80005e1                                              
Address of function_in_ext_flash 0x90000001                                     
Address of var_ext_sram_data 0x200000a0 (10)                                    
Address of function_in_sram 0x20000001                                          
Address of var_sram_data 0x200000a4 (10)                                        
Hello World! stm32h573i_dk

Requires #73220

@FRASTM
Copy link
Collaborator Author

FRASTM commented Jun 6, 2024

CI failure : west build -p auto -b nrf54h20dk/nrf54h20/cpuapp samples/drivers/spi_flash due to #73005

@FRASTM
Copy link
Collaborator Author

FRASTM commented Jun 13, 2024

rebase on df788d0

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.

Otherwise LGTM

drivers/flash/flash_stm32_xspi.c Outdated Show resolved Hide resolved
erwango
erwango previously approved these changes Jun 14, 2024
@kartben kartben assigned erwango and unassigned kartben Jun 14, 2024
Adding the support of the memoryMapped mode
to the flash_stm32_xspi driver through the CONFIG_STM32_MEMMAP
That will allow XiP from the external octo_flash
Erase and Write operation must Abort operations.

Signed-off-by: Francois Ramu <[email protected]>
Configure the external NOR flash memory to be executable.
Change the board.cmake to add the external loader for
flashing (version that do not mass-erase the external flash).
The address of the external flash is not needed
when flashing a hex file.

Signed-off-by: Francois Ramu <[email protected]>
Define the configuration to run the code_relocation
application on the external memory xspi flash
of the stm32h573i_dk disco kit in XIP

Signed-off-by: Francois Ramu <[email protected]>
Define the configuration to run the test on the external memory
xspi flash of the stm32h573i_dk disco kit in MemoryMapped Mode
Reading is done with memcopy and erase/write are aborting operation
to send the appropriate command

Signed-off-by: Francois Ramu <[email protected]>
@FRASTM
Copy link
Collaborator Author

FRASTM commented Jun 14, 2024

adding the configuration to execute the samples/drivers/spi_flash/ on the stm32h573i_dk with the external NOR in MemoryMapped mode

ospi-nor-flash@90000000 SPI flash testing
==========================

Perform test on single sector
Test 1: Flash erase
[00:00:00.140,000] <inf> flash_stm32_xspi: XSPI flash config is OCTO / DTR
[00:00:00.140,000] <inf> flash_stm32_xspi: Read SFDP from externalFlash
[00:00:00.140,000] <inf> flash_stm32_xspi: Read SFDP from externalFlash
[00:00:00.140,000] lash erase succeeded!

Test 2: Flash write
Attempting to write 4 bytes
Data read matches data written. Good!!

Perform test on multiple consecutive sectors                                                                                         
Test 1: Flash erase                                                                                                                  
0m<inf> flash_stm32_xspi: Memory-mapped NOR-flash at 0x90000000 (0x4000000 bytes)                                                    
*** Booting Zephyr OS build v3.6.0-6155-g39b3ff9c1958 ***                                                                            
Flash erase succeeded!                                                                                                               
                                                                                                                                     
Test 2: Flash write                                                                                                                  
Attempting to write 4 bytes at offset 0xff000                                                                                        
Data read matches data written. Good!!                                                                                               
Attempting to write 4 bytes at offset 0x100000                                                                                       
Data read matches data written. Good!!   

@nashif nashif merged commit e0c2508 into zephyrproject-rtos:main Jun 24, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants