2023-05-07 07:31 PM - edited 2023-11-20 06:11 AM
Here are the memory assets when I have the project configured for internal flash...
and 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.
However, 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.
2023-05-07 08:28 PM
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??