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 qspi driver supports dual quad nor in Memorymapped mode #73027

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

Conversation

FRASTM
Copy link
Collaborator

@FRASTM FRASTM commented May 20, 2024

This PR is adding the support of the DFM (DualFlash Mode) to the stm32QSPI driver.
This mode activates two external quad-NOR memories simultaneously to double throughput and capacity
Especially on stm32h745i and stm32h747i disco kits where two MT25QL512 quad-NOR are mounted on 2 separated qspi IO banks.
Introducing a new property in the DTS of the "st,stm32-qspi" node.
Check the boolean property’s truth value (with DT_PROP) to set the DFM.

Requires #68377 to flash with STM32CubeProgrammer

Fixes #73025

@FRASTM
Copy link
Collaborator Author

FRASTM commented May 20, 2024

west build -p always -b stm32h745i_disco//m7 samples/application_development/code_relocation_nocopy/
west flash hex file on internal and external memories

*** Booting Zephyr OS build v3.6.0-4153-gb1647f830c0b ***                               
Address of main function 0x800066d                                                      
Address of function_in_ext_flash 0x90000001                                             
Address of var_ext_sram_data 0x240000e0 (10)                                            
Address of function_in_sram 0x24000001                                                  
Address of var_sram_data 0x240000e4 (10)                                                
Hello World! stm32h745i_disco  

@toonst
Copy link
Contributor

toonst commented May 21, 2024

Tried this on the stm32h750b_dk, got a fault:

*** Booting Zephyr OS build v3.6.0-4155-ge863717bd6e4 ***
Address of main function 0x800066d
[00:00:00.000,000] <err> os: ***** BUS FAULT *****
[00:00:00.000,000] <err> os:   Instruction bus error
[00:00:00.000,000] <err> os: r0/a1:  0x080064de  r1/a2:  0x08006516  r2/a3:  0x00007001
[00:00:00.000,000] <err> os: r3/a4:  0x00000000 r12/ip:  0x00000000 r14/lr:  0x0000700d
[00:00:00.000,000] <err> os:  xpsr:  0x60000000
[00:00:00.000,000] <err> os: Faulting instruction address (r15/pc): 0x8d56a448
[00:00:00.000,000] <err> os: >>> ZEPHYR FATAL ERROR 27: Unknown error on CPU 0
[00:00:00.000,000] <err> os: Current thread: 0x24000720 (unknown)
[00:00:00.000,000] <err> os: Halting system

Tried flashing with
west flash --runner stm32cubeprogrammer --extload MT25TL01G_STM32H750B-DISCO.stldr --tool-opt=0x90000000
using the mentioned PR.

@FRASTM
Copy link
Collaborator Author

FRASTM commented May 22, 2024

Tried this on the stm32h750b_dk, got a fault:

*** Booting Zephyr OS build v3.6.0-4155-ge863717bd6e4 ***
Address of main function 0x800066d
[00:00:00.000,000] <err> os: ***** BUS FAULT *****
[00:00:00.000,000] <err> os:   Instruction bus error
[00:00:00.000,000] <err> os: r0/a1:  0x080064de  r1/a2:  0x08006516  r2/a3:  0x00007001
[00:00:00.000,000] <err> os: r3/a4:  0x00000000 r12/ip:  0x00000000 r14/lr:  0x0000700d
[00:00:00.000,000] <err> os:  xpsr:  0x60000000
[00:00:00.000,000] <err> os: Faulting instruction address (r15/pc): 0x8d56a448
[00:00:00.000,000] <err> os: >>> ZEPHYR FATAL ERROR 27: Unknown error on CPU 0
[00:00:00.000,000] <err> os: Current thread: 0x24000720 (unknown)
[00:00:00.000,000] <err> os: Halting system

Tried flashing with west flash --runner stm32cubeprogrammer --extload MT25TL01G_STM32H750B-DISCO.stldr --tool-opt=0x90000000 using the mentioned PR.

To Pass the samples/application_development/code_relocation_nocopy/ on the stm32h750b_dk disco kit, you need

  • CONFIG_STM32_MEMMAP=y in a ./boards/stm32h750b_dk.conf
  • a redefinition of the EXTMEM MPU region with ATTR_MPU_IO attributes
*** Booting Zephyr OS build v3.6.0-4153-g81aedfe06d29 ***
Address of main function 0x800066d
Address of function_in_ext_flash 0x90000001
Address of var_ext_sram_data 0x240000e0 (10)
Address of function_in_sram 0x24000001                                                                                                                                       
Address of var_sram_data 0x240000e4 (10)                                                                                                                                     
Hello World! stm32h750b_dk     

@FRASTM
Copy link
Collaborator Author

FRASTM commented May 22, 2024

adding the support of the stm32h750b_dk (dual quad-flash) for the samples/application_development/code_relocation_nocopy/

@FRASTM FRASTM changed the title stm32 qspi driver supports dual quad nor in Memorymapped mode for stm32 qspi driver supports dual quad nor in Memorymapped mode May 23, 2024
@FRASTM
Copy link
Collaborator Author

FRASTM commented May 29, 2024

  • Rebase on c140053
  • Tested with the stm32h745i_disco//m7 or stm32h750b_dk dual-flash NOR
    (also valid with the stm32f746g_disco (single quad-NOR), whenMPU definition of the external memory region for XiP and the STM32CubeProgrammer runner is adapted for external loader))

Restrictions : ---> Refer to #56221

  1. cannot run after powering off/on the board
  2. not available on the stm32h747i_disco//m7

The stm32CubeProgrammer (> v2.16.0) is used as a runner to flash zephyr.hex file

@FRASTM FRASTM force-pushed the xip_qspi_dual branch 3 times, most recently from 94226a5 to 10200d9 Compare May 30, 2024 13:23
Configure the quad-spi in DualFlash Mode
This property of the stm32 boards will access simultaneously
two identical quad-flash external memories connected to
2 quad-spi banks (pins).
DUAL flash mode is possible on stm32 series with QUADSPI_CR_DFM

Signed-off-by: Francois Ramu <francois.ramu@st.com>
Configure the quad-spi in DualFlash Mode when enabling the MemoryMapped
then reading is possible with memcopy.
DUAL flash mode is possible on stm32 series with QUADSPI_CR_DFM

Signed-off-by: Francois Ramu <francois.ramu@st.com>
Change the board.cmake to add the external loader option
to the STM32CubeProgrammer to flash the external NOR
flash and internal memory
The address of the external flash is not needed
when flashing a hex file.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
Change the board.cmake to add the external loader option
to the STM32CubeProgrammer to flash the external NOR
flash and internal memory
The address of the external flash is not needed
when flashing a hex file.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
Define the configuration to run the code_relocation
application on the external memory dual quad flash
of the stm32h745i/stm32h750b disco kits in XIP

Signed-off-by: Francois Ramu <francois.ramu@st.com>
@FRASTM FRASTM marked this pull request as ready for review May 31, 2024 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Devicetree Binding PR modifies or adds a Device Tree binding area: Flash area: Samples Samples platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

stm32H7 cannot XiP from dual quad nor in Memorymapped mode
5 participants