Dualbank Flash Programming
The ST STM32L5 series devices come with a dual-bank flash memory. The layout of the dual-bank flash memory can be configured by the user through the option byte DUALBANK. By default, the value of this option byte is DUALBANK == 1, which means that the flash is configured as dual bank memory while DUALBANK == 0 means that the flash is configured as single bank memory flash. In dual-bank mode, the flash boot source can be switched between bank 1 or bank 2. In single-bank mode, flash always boots from bank 1. The total flash size is exactly the same for both modes. Another advantage of using DUALBANK is that both banks can be accessed in parallel (e.g. reading bank 1 while programming bank 2).
The flash algorithm has to behave differently, depending on the active flash bank mode configuration as the flash controller expects different page indices for the same destination address.
When using the J-Link flash loader, make sure that the flash controller is configured for dual bank flash layout (DUALBANK == 1), which is the default.
STM32L5xx (Octa)SPI support
The ST STM32L5xxx device series comes with a OCTASPI controller which allows memory mapped read accesses to any (Octa)SPI flash, connected to the Octa-SPI interface of the MCU. This allows the J-Link DLL to support flash programming through the Octa-SPI interface. Unfortunately, there is no generic way how to implement flash programming because the pins used to connect the SPI flash are not defined. Different pins can be used for the same (Octa)SPI alternate function and therefore, for each configuration, a slightly different RAMCode (different pin initialization / flash size) is required. We have developed a flash algorithm based on the ST STM32L562E-DK evaluation board. This flash algorithm can be used to to program any common (Octa/QSPI)SPI flash, connected to the Octa-SPI interface of the ST STM32L5xx device. The flash algorithm is implemented within our JLinkARM.dll In case a pin configuration, different from the one used in the example flash algorithm, is required, please get in touch with SEGGER directly via our support system: https://www.segger.com/ticket/.
For further information regarding this as well as the flash algorithm, please refer to the following pages: