cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure project to use external flash vs internal flash for TouchGFX assets? I have 2 basic screens that work fine with internal flash but does not display with assets loaded into external flash.

PFlor.2
Senior

Here are the memory assets when I have the project configured for internal flash...


_legacyfs_online_stmicro_images_0693W00000bjYOyQAM.pngand here is how the linker script is configured of course..

/* Specify the memory areas */

MEMORY

{

 FLASH (rx)   : ORIGIN = 0x08020000, LENGTH = 2048K - 128K

 DTCMRAM (xrw)  : ORIGIN = 0x20000000, LENGTH = 128K

 RAM_D1 (xrw)  : ORIGIN = 0x24000000, LENGTH = 512K

 RAM_D2 (xrw)  : ORIGIN = 0x30000000, LENGTH = 288K

 RAM_D3 (xrw)  : ORIGIN = 0x38000000, LENGTH = 64K

 ITCMRAM (xrw)  : ORIGIN = 0x00000000, LENGTH = 64K

 EXTFLASH (r)  : ORIGIN = 0x90000000, LENGTH = 8M

}

  

 FontFlashSection :

 {

  *(FontFlashSection FontFlashSection.*)

  *(.gnu.linkonce.r.*)

  . = ALIGN(0x4);

 } >FLASH

 TextFlashSection :

 {

  *(TextFlashSection TextFlashSection.*)

  *(.gnu.linkonce.r.*)

  . = ALIGN(0x4);

 } >FLASH

 ExtFlashSection :

 {

  *(ExtFlashSection ExtFlashSection.*)

  *(.gnu.linkonce.r.*)

  . = ALIGN(0x4);

 } >FLASH

Now I just changed these sections to EXTFLASH, and added the code to enable memory mapped mode for the QSPI of the NORFlash that contains the assets.

 FontFlashSection :

 {

  *(FontFlashSection FontFlashSection.*)

  *(.gnu.linkonce.r.*)

  . = ALIGN(0x4);

 } >EXTFLASH

 TextFlashSection :

 {

  *(TextFlashSection TextFlashSection.*)

  *(.gnu.linkonce.r.*)

  . = ALIGN(0x4);

 } >EXTFLASH

 ExtFlashSection :

 {

  *(ExtFlashSection ExtFlashSection.*)

  *(.gnu.linkonce.r.*)

  . = ALIGN(0x4);

 } >EXTFLASH

In main.c after the STM generated initializations...

 /* USER CODE BEGIN 2 */

 if (CSP_QUADSPI_Init() != HAL_OK) {

  Error_Handler();

 }

 if (CSP_QSPI_EnableMemoryMappedMode() != HAL_OK) {

  Error_Handler();

 }

 HAL_NVIC_DisableIRQ(QUADSPI_IRQn);

Then I see the memory usage change to this as expected.


_legacyfs_online_stmicro_images_0693W00000bjYTZQA2.pngHowever, this does work...when I debug the application it seems to go to hard fault from the touchgfx_init....

Any ideas as to what may be going on here? Not aware of anything else that must be setup in TouchGFX when using external memory, the image configuration in TouchGFX is already set to ExtFlashSection.


_legacyfs_online_stmicro_images_0693W00000bjYYKQA2.png 

1 REPLY 1
PFlor.2
Senior

I think I understand that I wasn't initializing the QSPI and enabling memory mapped mode after the MX_TouchGFX_Init(), once moved inside MX_QUADSPI_Init() it does run ok.... However when I load the application it runs but I get garbage on the display, but if I run in the debugger it works fine!!

What would cause this to happen??