How to Create an External Loader (.stldr) for the MX25L1283x NOR Flash with STM32H573VTx?
I am using the STM32H573VTx chip and require an External Loader to access a 128Mbits NOR Flash via OctoSPI in memory-mapped I/O mode.
Firstly, regarding the STM32H573I_DK board sold by ST, it utilizes the Macronix MX25LM51245G in OctoSPI mode(8 data line), for which ST provides the external loader MX25LM51245G_STM32H573I-DK.stldr. The file is located at:
STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/ExternalLoader/MX25LM51245G_STM32H573I-DK.stldr.
In my product, I have designed it with Macronix MX25L1283x configured in Single Quad mode(4 data line) instead of MX25LM51245G. Therefore, I need an .stldr file compatible with the MX25L1283x and STM32H573VTx. Could you advise on how to generate such a loader file?
For reference, when using Zephyr OS, the application located at zephyr/samples/application_development/code_relocation_nocopy successfully enables memory-mapped functionality with the MX25LM51245G. Additionally, I utilize XIP (eXecute-In-Place) to execute images stored in external NOR Flash. The Zephyr KConfig options for this setup include:
CONFIG_XIP=y CONFIG_STM32_MEMMAP=y
Below is a log of the setup during initialization:
[ 0.000000] <dbg> flash_stm32: stm32_flash_init: Flash @0x8000000 initialized. BS: 16 [ 0.008000] <dbg> flash_stm32: stm32_flash_init: Block 0: bs: 8192 count: 256 [ 0.016000] <dbg> flash_stm32_xspi: flash_stm32_xspi_init: XSPI Init'd [ 0.024000] <dbg> flash_stm32_xspi: flash_stm32_xspi_init: Delay Block Init [ 0.132000] <dbg> flash_stm32_xspi: flash_stm32_xspi_init: Reset Mem (SPI/STR) [ 0.140000] <dbg> flash_stm32_xspi: HAL_XSPI_StatusMatchCallback: Status Match cb [ 0.148000] <dbg> flash_stm32_xspi: flash_stm32_xspi_init: Mem Ready (SPI/STR) [ 0.156000] <dbg> flash_stm32_xspi: stm32_xspi_config_mem: XSPI configuring Octo SPI mode [ 0.165000] <dbg> flash_stm32_xspi: HAL_XSPI_StatusMatchCallback: Status Match cb [ 0.174000] <dbg> flash_stm32_xspi: HAL_XSPI_StatusMatchCallback: Status Match cb [ 0.182000] <dbg> flash_stm32_xspi: HAL_XSPI_StatusMatchCallback: Status Match cb [ 0.231000] <dbg> flash_stm32_xspi: HAL_XSPI_StatusMatchCallback: Status Match cb [ 0.239000] <inf> flash_stm32_xspi: XSPI flash config is OCTO / DTR [ 0.246000] <inf> flash_stm32_xspi: Read SFDP from externalFlash [ 0.253000] <dbg> flash_stm32_xspi: flash_stm32_xspi_init: ospi-nor-flash@90000000: SFDP v 1.8 AP fd with 5 PH [ 0.264000] <dbg> flash_stm32_xspi: flash_stm32_xspi_init: PH0: ff00 rev 1.7: 20 DW @ 40 [ 0.273000] <inf> flash_stm32_xspi: Read SFDP from externalFlash [ 0.280000] <dbg> flash_stm32_xspi: spi_nor_process_bfp: ospi-nor-flash@90000000: 64 MiBy flash [ 0.290000] <dbg> flash_stm32_xspi: spi_nor_process_bfp: Erase 4096 with 20 [ 0.298000] <dbg> flash_stm32_xspi: spi_nor_process_bfp: Erase 65536 with d8 [ 0.306000] <dbg> flash_stm32_xspi: spi_nor_process_bfp: Address width: 4 Bytes [ 0.314000] <dbg> flash_stm32_xspi: spi_nor_process_bfp: Page size 256 bytes [ 0.322000] <dbg> flash_stm32_xspi: spi_nor_process_bfp: Flash size 67108864 bytes [ 0.330000] <dbg> flash_stm32_xspi: spi_nor_process_bfp: Using read mode: 0, instr: 0x0, dummy cycles: 0 [ 0.341000] <dbg> flash_stm32_xspi: spi_nor_process_bfp: Using write instr: 0x12ED [ 0.349000] <dbg> flash_stm32_xspi: flash_stm32_xspi_init: PH1: ff87 rev 1.1: 28 DW @ 90 [ 0.358000] <dbg> flash_stm32_xspi: setup_pages_layout: layout page 256 not compatible with erase size 4096 [ 0.369000] <dbg> flash_stm32_xspi: setup_pages_layout: erase size will be used as layout page size [ 0.379000] <dbg> flash_stm32_xspi: setup_pages_layout: layout 16384 x 4096 By pages [ 0.388000] <dbg> flash_stm32_xspi: stm32_xspi_set_memorymap: MemoryMap mode enabled [ 0.396000] <inf> flash_stm32_xspi: Memory-mapped NOR-flash at 0x90000000 (0x4000000 bytes) [ 0.406000] <dbg> fs: fs_register: fs register 1: 0 *** Booting Zephyr OS build v3.7.0-1157-g7e65299a7e91 *** Address of main function 0x8000ed9 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
How can I proceed to create an external loader file for MX25L1283x?
