cancel
Showing results for 
Search instead for 
Did you mean: 

bitmaps incorrectly rendered when flash is used >30% (using online demo STM32G071 NUCLEO)

AAnis.1
Associate II

Hello ,

Im currently exploring Touch gfx capabilities on low cost hardware (STM32G071  + SPI LCD shield) , and i comme across a bug .

steps to reproduce :

  • Start a fresh new project on Touch GFX using online demo , choose STM32G071 demo
  • Load a few additional image to project (a series of 40 png issued from a splitted .gif file total size : 150kb
  • Connect board
  • generate code and flash target

Results : some images of GUI gets missed up ( black lines ) like : navigation arrow , touch gfx logo and some texts disappear .

I suppose this is due to low ram available , can you please explain ow touchgfx is allocating cache for bitmaps in demo project? since the board has a NOR non mapped flash chip for assets storage does it mean that all assets are being cached on startup ? if yes why touchgfx still call for SPI data reader each time i switch screen ?

Sorry for long post but i'm quit confused : / , many thanks in advance

Ps : please find attached te additional images i'm using

Ps2: The additional images are just loaded into project but never used or referenced , so i find it quit awkward that they are being loaded into cache since there is no call for them

1 ACCEPTED SOLUTION

Accepted Solutions
N. SANTINI
ST Employee

Hi,

I just checked the source code of the external loader and you are fully right, it contained 64 sectors instead of 128 in the description.

This was not noticed since the demo had enough room for its assets.

Please find attached a corrected version of the external loader, just unzip it in the following folder :

c:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\ExternalLoader\

(adapt to your CubeProgrammer installation folder)

or, if you are using CubeIDE :

c:\ST\STM32CubeIDE_1.5.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_1.5.0.202011040924\tools\bin\ExternalLoader\

then close and re-open CubeProgrammer.

Sorry for the inconvenience,

 Best regards, 

 Nicolas SANTINI

 STMicroelectronics

 T.O.M.A.S. - Technically Oriented Microcontroller Application Services

View solution in original post

11 REPLIES 11
AAnis.1
Associate II

Update : it seems that i can no longer debug the target when this bug occurs , here is gdb server log :

[250.346] spawnCubeProgrammer(): 10:39:11:128 w ap 0 reg 10 R10 0x00000000

[250.346] spawnCubeProgrammer(): 10:39:11:129 w ap 0 reg 11 R11 0x00000000

[250.346] spawnCubeProgrammer(): 10:39:11:129 w ap 0 reg 12 R12 0x00000000

[250.346] spawnCubeProgrammer(): 10:39:11:130 w ap 0 reg 13 SP  0x00000000

[250.346] spawnCubeProgrammer(): 10:39:11:131 w ap 0 reg 14 LR  0x20000001

[250.346] spawnCubeProgrammer(): 10:39:11:131 w ap 0 reg 15 PC  0x2000069B

[250.346] spawnCubeProgrammer(): 10:39:11:132 w ap 0 reg 16 xPSR 0x01000000

[250.346] spawnCubeProgrammer(): 10:39:11:132 w ap 0 reg 17 MSP 0x20004100

[250.346] spawnCubeProgrammer(): 10:39:11:133 w ap 0 reg 18 PSP 0x00000000

[250.346] spawnCubeProgrammer(): 10:39:11:133 run ap 0 

[250.346] spawnCubeProgrammer(): 10:39:11:136 halt ap 0 

[250.346] spawnCubeProgrammer(): 10:39:11:136 r ap 0 reg 0 R0  0x00000001

[250.346] spawnCubeProgrammer(): 10:39:11:143 r ap 0 @0x20004140 0x00000400 bytes Data 0x01001000

[250.346] spawnCubeProgrammer(): 10:39:11:143 

[250.346] spawnCubeProgrammer():  

[250.346] spawnCubeProgrammer(): 10:39:11:143 Error: Data mismatch found at address 0x90400000 (byte = 0x00 instead of 0xBF)

[250.346] spawnCubeProgrammer(): 10:39:11:143 

[250.346] spawnCubeProgrammer():  

[250.346] spawnCubeProgrammer(): 10:39:11:143 Error: Download verification failed

[250.346] spawnCubeProgrammer(): 10:39:11:143 

[250.346] spawnCubeProgrammer():  

[250.348] spawnCubeProgrammer():  ------ Switching context ----- 

[250.351] handleFlashPacket(): Error in STM32CubeProgrammer

i tried this on several other boards and same results , so it's not related to a hardware failure , please any help ?

MM..1
Chief II

Maybe you misunderstand storing of images in code, you have 43 png with sum 150kB, but in windows, in Touch MCU is png converted to defined format in your config, normaly 3 bytes per pixel or L8 one byte per pixel. This result all your images in L8 format ocupied 1.8MB and in RGB888 this size x3 or with transparency x4.

For storing you then need use external memory in your example QSPI flash, and need change LD scripts and loader for this data .

Try read documentation for this example...

AAnis.1
Associate II

Hello MM , Thanks for your reply

Let me reformulate the problem :

if the compiled extflash.bin is over a certain size (typically over 4MB) the external flash loader provided by ST for this demo board (GFX01M1 + STM32G071 Nucleo board ) fails to load this file to external flash .

Actually i tried several times using different boards and it always fails at verification step @ address 0x90400000, according to linker script this is in ext flash area and it correspond to a size of 4,194,304 byte which should still fit in that flash chip used (MX25L6433FM2I-08G 64-Mbit SPI NOR Flash ) so there is plenty of space left ...

 i tried different ALIGN options in linker script for ExtFlashSection & FontFlashSection : 2 , 4 , 8 , 16 , 32 but no effect is observed . for some raison the flashing process of external memory always fails @ 0x90400000 this is quit frustrating.

ps : i'm using GFX01M1 + STM32G071 Nucleo so all BSP drivers are provided by st (lcd , ext flash , buttons ....)

0693W000007DYrcQAG.jpg 

/**
 ******************************************************************************
 * @file      LinkerScript.ld
 * @author    Auto-generated by STM32CubeIDE
 * @brief     Linker script for STM32G071RBTx Device from STM32G0 series
 *                      128Kbytes FLASH
 *                      36Kbytes RAM
 *
 *            Set heap size, stack size and stack location according
 *            to application requirements.
 *
 *            Set memory bank area and size if external memory is used
 ******************************************************************************
 * @attention
 *
 * <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
 * All rights reserved.</center></h2>
 *
 * This software component is licensed by ST under BSD 3-Clause license,
 * the "License"; You may not use this file except in compliance with the
 * License. You may obtain a copy of the License at:
 *                        opensource.org/licenses/BSD-3-Clause
 *
 ******************************************************************************
 */
 
/* Entry Point */
ENTRY(Reset_Handler)
 
/* Highest address of the user mode stack */
_estack = ORIGIN(RAM) + LENGTH(RAM);	/* end of "RAM" Ram type memory */
 
_Min_Heap_Size = 0x200 ;	/* required amount of heap  */
_Min_Stack_Size = 0x800 ;	/* required amount of stack */
 
/* Memories definition */
MEMORY
{
  RAM        (xrw)    : ORIGIN = 0x20000000,   LENGTH = 36K
  FLASH      (rx)     : ORIGIN = 0x8000000,    LENGTH = 128K
  SPI_FLASH  (r)      : ORIGIN = 0x90000000,   LENGTH = 8M
}
 
/* Sections */
SECTIONS
{
  /* The startup code into "FLASH" Rom type memory */
  .isr_vector :
  {
    . = ALIGN(4);
    KEEP(*(.isr_vector)) /* Startup code */
    . = ALIGN(4);
  } >FLASH
 
  /* The program code and other data into "FLASH" Rom type memory */
  .text :
  {
    . = ALIGN(4);
    *(.text)           /* .text sections (code) */
    *(.text*)          /* .text* sections (code) */
    *(.glue_7)         /* glue arm to thumb code */
    *(.glue_7t)        /* glue thumb to arm code */
    *(.eh_frame)
 
    KEEP (*(.init))
    KEEP (*(.fini))
 
    . = ALIGN(4);
    _etext = .;        /* define a global symbols at end of code */
  } >FLASH
 
  /* Constant data into "FLASH" Rom type memory */
  .rodata :
  {
    . = ALIGN(4);
    *(.rodata)         /* .rodata sections (constants, strings, etc.) */
    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
    . = ALIGN(4);
  } >FLASH
 
  .ARM.extab   : {
    . = ALIGN(4);
    *(.ARM.extab* .gnu.linkonce.armextab.*)
    . = ALIGN(4);
  } >FLASH
 
  .ARM : {
    . = ALIGN(4);
    __exidx_start = .;
    *(.ARM.exidx*)
    __exidx_end = .;
    . = ALIGN(4);
  } >FLASH
 
  .preinit_array     :
  {
    . = ALIGN(4);
    PROVIDE_HIDDEN (__preinit_array_start = .);
    KEEP (*(.preinit_array*))
    PROVIDE_HIDDEN (__preinit_array_end = .);
    . = ALIGN(4);
  } >FLASH
 
  .init_array :
  {
    . = ALIGN(4);
    PROVIDE_HIDDEN (__init_array_start = .);
    KEEP (*(SORT(.init_array.*)))
    KEEP (*(.init_array*))
    PROVIDE_HIDDEN (__init_array_end = .);
    . = ALIGN(4);
  } >FLASH
 
  .fini_array :
  {
    . = ALIGN(4);
    PROVIDE_HIDDEN (__fini_array_start = .);
    KEEP (*(SORT(.fini_array.*)))
    KEEP (*(.fini_array*))
    PROVIDE_HIDDEN (__fini_array_end = .);
    . = ALIGN(4);
  } >FLASH
 
  /* Used by the startup to initialize data */
  _sidata = LOADADDR(.data);
 
  /* Initialized data sections into "RAM" Ram type memory */
  .data :
  {
    . = ALIGN(4);
    _sdata = .;        /* create a global symbol at data start */
    *(.data)           /* .data sections */
    *(.data*)          /* .data* sections */
 
    . = ALIGN(4);
    _edata = .;        /* define a global symbol at data end */
 
  } >RAM AT> FLASH
 
  /* Uninitialized data section into "RAM" Ram type memory */
  . = ALIGN(4);
  .bss :
  {
    /* This is used by the startup in order to initialize the .bss section */
    _sbss = .;         /* define a global symbol at bss start */
    __bss_start__ = _sbss;
    *(.bss)
    *(.bss*)
    *(COMMON)
 
    . = ALIGN(4);
    _ebss = .;         /* define a global symbol at bss end */
    __bss_end__ = _ebss;
  } >RAM
 
  /* User_heap_stack section, used to check that there is enough "RAM" Ram  type memory left */
  ._user_heap_stack :
  {
    . = ALIGN(8);
    PROVIDE ( end = . );
    PROVIDE ( _end = . );
    . = . + _Min_Heap_Size;
    . = . + _Min_Stack_Size;
    . = ALIGN(8);
  } >RAM
 
  /* Remove information from the compiler libraries */
  /DISCARD/ :
  {
    libc.a ( * )
    libm.a ( * )
    libgcc.a ( * )
  }
 
  .ARM.attributes 0 : { *(.ARM.attributes) }
 
  ExtFlashSection :
  {
    *(ExtFlashSection ExtFlashSection.*)
    *(.gnu.linkonce.r.*)
    . = ALIGN(0x4);
  } >SPI_FLASH
 
  FontFlashSection :
  {
    *(FontFlashSection FontFlashSection.*)
    *(.gnu.linkonce.r.*)
    . = ALIGN(0x4);
  } >SPI_FLASH
}
 

MM..1
Chief II

How way you flash target? From touchGFX or STMCubeIDE?

AAnis.1
Associate II

the usual way through Cube IDE , I've also tried flashing the extflash.bin through Stlink utility using external flash loader provided by ST but no progress so far

MM..1
Chief II

When you have in CubeIDE dropdown selected external loader for your SPI chip , then maybe is bug in Cubeprogrammer, but you can try change type of file from bin to hex, this speed up building, because now your file ext.bin i mean is over 2GB size file Ahhh ST

AAnis.1
Associate II

I'm using MX25L6433F_STM32G071B_NUCLEO.stldr which is the appropriate flash loader for this demo board , it's not about .bin or .hex it's a bug in the flash loader itself and since we don't have access to source code this require someone from ST to intervein which i would highly appreciate since this post has over 2 days !!!.

BTW : compiled extflash.bin is around 4.8MB so its not an overflow problem .

#[STM32 MCUs]​ 

#STM32CubeIDE​ 

#STM32G0​ 

#TouchGFX​ 

AAnis.1
Associate II

UPDATE:

when using STlink utility allong with the appropriate flash loader , when it come to sectors erase it only shows 64 sectors of 64KB each or this is just half of NOR chip capacity (8MB) , datasheet says it has 128 sectors of 64kB each , hmmm i guess that the flash loader is bugged0693W000007DfuYQAS.png0693W000007DfuJQAS.png 

ANY suggestions STM team ???

MM..1
Chief II

You can build own loader examples c:\Program Files (x86)\STMicroelectronics\STM32 ST-LINK Utility\ST-LINK Utility\ExternalLoader\