cancel
Showing results for 
Search instead for 
Did you mean: 

External vs. internal flash memory for touchGFX assets

HP
Senior III

When developing touchGFX applications you tend to get a pretty high memory need.

I'm working with the CubeIDE integration of TouchGFX and tried to add a third screen (with a third background image). I got an error saying that the application would not fit in my FLASH.

After a bit of digging it seems that the linker files don't mention the QSPI at all.

I can add that to the linker files but I would like to know if there is an official way of doing this?

I found some documentation on this but I'm not sure if this is the right way to go about it.

What goes where in the memory and how do I control it? if at all?

Thanks!

40 REPLIES 40
kjtl
Associate II

I will definately go through the videos and follow your suggestions. However, you mention one of the prerequisites are to have a working project in Cube IDE, which I don't. If you look at my error log, there are a number of "multiple definition" errors. Do you think these will be resolved by enabling QSPI?

Update: Editing the linker script solved the flash issue, but all the other osWrapper issues remain.

HP
Senior III

Just see my other video: https://www.youtube.com/watch?v=43qQhrXc3n4

this will show you how to set up a working project in CubeIDE. All the videos are made in succession so you can start at the first (the one i just linked) and continue to the others 🙂

kjtl
Associate II

Outstanding work on those videos! I was now able to build and run debugging on my project. I did however have to exclude an additional file to remove all the "multiple definitions" errors in the osWrappers.

There are two files under touchgfx/framework/os called "OSWrappers.cpp" and "OSWrappers_cmsis.cpp" that have functions defined with the same names/class. Excluding either one removed the errors, but I don't know if this could cause further problems down the line.

When the project buildt the first time and I was debugging, I got following error

Error in final launch sequence:
 
Failed to execute MI command:
-exec-continue
 
Error message from debugger back end:
Cannot execute this command while the selected thread is running.
Failed to execute MI command:
-exec-continue
 
Error message from debugger back end:
Cannot execute this command while the selected thread is running.
Cannot execute this command while the selected thread is running.

I was able to remove this by disabling the "set breakpoint at [main]" box in the debug configuration. The error is gone, but I have not tested if debuggin works properly yet.

Thank you so much for your videos. It took a while, but right now it feels worth it 🙂

K

HP
Senior III

I'm glad they helped you out!

thinking of it it most likely that break at main thing. I was trying to start the code before the verify command was done and got all sort of weird behavior. Trying to send the -exec-continue command while the thread is already running seems like asking for trouble 🙂

Oscar_Niño
Associate II

Hi everyone

I'm new on ST boards, I have followed all steps on this video https://www.youtube.com/watch?v=VOs2LYO7wSA&feature=youtu.be and this video to use quadspi https://www.youtube.com/watch?v=237lPdMsDZs&feature=youtu.be. When build my project it doesn't have problems but at debugging my board gets just a black screen. Any idea which I could doing wrong?

at the very least - you should have a white screen. If not, that could imply that you haven't configured the LCD_DISP pin properly in the MX configuration.

Thanks for Reply. Following the first video mentioned I created a new projet with default pin configuration as showed in video. I have tried with project in first video and it works fine (just two screen with a button each one). I copied MX_QUADSPI_Init code posted here to configure it. When enters in debug mode the screen is white but after run it get black. I checked Pins configuration with .ioc file and tried changing display type from RGB888 to RGB565 but still have back screen

Oscar_Niño
Associate II

I still have the problem, to give more details, I created a template project using TouchGFX copied code from .ld file about QUADSPI section as show you below and code in MX_QUADSPI_Init function.

MEMORY

{

RAM (xrw)   : ORIGIN = 0x20000000, LENGTH = 320K

FLASH (rx)   : ORIGIN = 0x8000000, LENGTH = 1024K

QUADSPI (r)  : ORIGIN = 0x90000000, LENGTH = 16M

}

and this

...

  libgcc.a ( * )

 }

 .ARM.attributes 0 : { *(.ARM.attributes) }

ExtFlashSection :

{

*(ExtFlashSection ExtFlashSection.*)

*(.gnu.linkonce.r.*)

    . = ALIGN(0x4);

} >QUADSPI

/* Un comment this section to place fonts and text in external flash*/

 FontFlashSection :

{

*(FontFlashSection FontFlashSection.*)

*(.gnu.linkonce.r.*)

    . = ALIGN(0x4);

} >QUADSPI

 TextFlashSection :

{

*(TextFlashSection TextFlashSection.*)

*(.gnu.linkonce.r.*)

    . = ALIGN(0x4);

} >QUADSPI

}

and

hqspi.Instance = QUADSPI;

hqspi.Init.ClockPrescaler = 1;

hqspi.Init.FifoThreshold = 4;

hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_HALFCYCLE;

hqspi.Init.FlashSize = 24;

hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_6_CYCLE;

hqspi.Init.ClockMode = QSPI_CLOCK_MODE_0;

hqspi.Init.FlashID = QSPI_FLASH_ID_1;

hqspi.Init.DualFlash = QSPI_DUALFLASH_DISABLE;

if (HAL_QSPI_Init(&hqspi) != HAL_OK)

{

Error_Handler();

}

/* USER CODE BEGIN QUADSPI_Init 2 */

BSP_QSPI_Init();

BSP_QSPI_MemoryMappedMode();

HAL_NVIC_DisableIRQ(QUADSPI_IRQn);

MPU_Region_InitTypeDef MPU_InitStruct;

MPU_InitStruct.Enable = MPU_REGION_ENABLE;

MPU_InitStruct.BaseAddress = 0x90000000;

MPU_InitStruct.Size = MPU_REGION_SIZE_256MB;

MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;

MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;

MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;

MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;

MPU_InitStruct.Number = MPU_REGION_NUMBER2;

MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;

MPU_InitStruct.SubRegionDisable = 0x00;

MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;

HAL_MPU_ConfigRegion(&MPU_InitStruct);

/* Configure the MPU attributes as WT for QSPI (used 16Mbytes) */

MPU_InitStruct.Enable = MPU_REGION_ENABLE;

MPU_InitStruct.BaseAddress = 0x90000000;

MPU_InitStruct.Size = MPU_REGION_SIZE_16MB; /* NOTE! Change this if you change QSPI flash size! */

MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;

MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;

MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;

MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;

MPU_InitStruct.Number = MPU_REGION_NUMBER3;

MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;

MPU_InitStruct.SubRegionDisable = 0x00;

MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;

HAL_MPU_ConfigRegion(&MPU_InitStruct);

HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);

But checking memory on "Memory details", FontFlashSection and TextFlashSection are still on internal flash.

This is my pin configuration

0690X00000AqeX9QAJ.png

And the pin mentioned on video "PI12"

And Still having black screen on debug.

A pair of things I have saw

* debug gets stuck for a long time on 93% after gets to main waiting for press button run.

* If something is modified and then genereded code; the first lines of configuration on QUADSPI init function are showed.

I hope this information give you a clue of what is wrong with my example project.

Finally I use four images as background some animated images buttons and texts

Hi everyone

Thanks for support, I have a working project. I did everything again and know my prototype is working. The only thing I could think is "some days ago my ide was updated and my project was been created by old version" so maybe this could be the error.

Yugenthar
Senior

Hai bro Still I am working in QSPI concept in stm32f746 disco board

I tried to write the data for QSPI flash memory but I can't able to write and read the QSPI flash memory i need your help bro i have attached my code and snap pls find and give any sollution are example code
_legacyfs_online_stmicro_images_0693W00000bjmI1QAI.png

/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "quadspi.h"
#include "gpio.h"
 
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
 
/* USER CODE END Includes */
 
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
uint8_t *writebuf = "Hello world from QSPI !";
 
uint8_t readbuf[100];
 
uint16_t number = 1234;
uint8_t buf[5];
/* USER CODE END PTD */
 
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE END PD */
 
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
typedef  void (*pFunction)(void);
pFunction JumpToApplication;
 
#define APPLICATION_ADDRESS 0x90000000
/* USER CODE END PM */
 
/* Private variables ---------------------------------------------------------*/
 
/* USER CODE BEGIN PV */
 
/* USER CODE END PV */
 
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
/* USER CODE BEGIN PFP */
 
/* USER CODE END PFP */
 
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
 
/* USER CODE END 0 */
 
/**
  * @brief  The application entry point.
  * @retval int
  */
int main(void)
{
  /* USER CODE BEGIN 1 */
 
  /* USER CODE END 1 */
 
  /* Enable I-Cache---------------------------------------------------------*/
  SCB_EnableICache();
 
  /* Enable D-Cache---------------------------------------------------------*/
  SCB_EnableDCache();
 
  /* MCU Configuration--------------------------------------------------------*/
 
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();
 
  /* USER CODE BEGIN Init */
 
  /* USER CODE END Init */
 
  /* Configure the system clock */
  SystemClock_Config();
 
  /* USER CODE BEGIN SysInit */
 
  /* USER CODE END SysInit */
 
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_QUADSPI_Init();
  /* USER CODE BEGIN 2 */
 
   if (CSP_QUADSPI_Init() != HAL_OK)
   {
 	  Error_Handler();
   }
 
 
 /****************** FOR SIMPLE WRITE READ ********************/
 	// Comment out these if you are using the EXT MEM BOOT
 
   if (CSP_QSPI_Erase_Chip() != HAL_OK)
   {
 	  Error_Handler();
   }
 
 
   sprintf (buf, "%u", number);
   if (CSP_QSPI_Write(buf, 0, strlen (buf)) != HAL_OK)
   {
 	  Error_Handler();
   }
 
 
   if (CSP_QSPI_Read(readbuf, 0, 100) != HAL_OK)
   {
 	  Error_Handler();
   }
 
 /*************************************************/
 
 
 /***********************  FOR EXT MEM BOOT *************************/
 	// Comment out these if you are using the simple Read Write
 
   if (CSP_QSPI_EnableMemoryMappedMode() != HAL_OK)
    {
 	  Error_Handler();
    }
 
 
   // Disable the cache
   SCB_DisableDCache();
   SCB_DisableICache();
 
 
   // Disable the systick interrupt
   SysTick->CTRL = 0;
 
 
   /* Initialize user application's Stack Pointer & Jump to user application */
   JumpToApplication = (pFunction) (*(__IO uint32_t*) (APPLICATION_ADDRESS + 4));  // Reset Handler
   __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);   // stack pointer
   JumpToApplication();	  // make the jump