Accessing external QSPI memory in C-SPY

Technical Note 200211



3/16/2020 1:30 PM


This is a description of how to make C-SPY access external QSPI flash memory. It applies when using the flash loader for external QSPI memory that we deliver for some boards, for example the IAR-STM32F746xx-SK board. In these setups, memory mapping is needed to make download verification and the C-SPY memory window work as expected.


With the IAR-STM32F746xx-SK board, you can use the flash loader $TOOLKIT_DIR$\config\flashloader\ST\FlashSTM32F7xx_STM32F746xx-SK.board.

The complete source code for this flash loader can be found in $TOOLKIT_DIR$\ src\flashloader\ST\FlashSTM32F7xx_QSPI.

This flash loader works as intended, but after the flash loading process is done there is a final CPU reset, as described in the C-SPY Debugging Guide, chapter Debugging code in flash. After the reset, the QSPI memory is no longer accessible, because it is not memory mapped.

Enabling the Project > Options > Debugger > Download > Verify Download option may cause errors in the Debug log, similar to:

Verify error at address 0x90000000, target byte: 0x00, byte in file: 0x01

Also, the C-SPY Memory window may not show the correct contents inside the QSPI memory range.

Memory mapping QSPI memory

To make it possible for C-SPY to access the external QSPI memory, it needs to be memory mapped. An example on how to do this for STM32F746xx can be found in the C-SPY macro file enable_qspi.mac in the following example project:

ST > STM32F7xx > IAR-STM32F746xx-SK > Audio Demo

When enable_qspi.mac is selected in Project > Options > Debugger > Setup > Setup macros, download verification will work as expected, and the Memory window will show the correct contents inside the QSPI memory range.

Note that the enable_qspi.mac file implements the execUserPreload C-SPY macro. See the C-SPY Debugging Guide, chapter Debugging code in flash, for information on how this works.


For the C-SPY debugger to be able to verify or read external QSPI memory, it has to be memory mapped. This can be done with C-SPY macros, as demonstrated in our example projects.


© IAR Systems 1995-2020 - All rights reserved.

We use cookies on this website to provide you with a better experience. You need to accept cookies to continue using this site. Cookies