cancel
Showing results for 
Search instead for 
Did you mean: 

SVG with TouchGFX

ikendal
Associate

Is there any way to store SVG images in external flash, similiar to how PNGs can be stored there?

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @ikendal ,

If you want to put PNGs in external flash, you can do specify it from TouchGFX designer here :

OsmanSOYKURT_0-1696321072156.png

How much your SVGDatabase takes in memory? (You can check that from the map file)
Do you have a lot of SVGs in your project?

The trick to put SVGs in external flash is to write this in the linker script :

 ExtFlashSection :
  {
    */SVGDatabase.o(.rodata.*)
    
  } >EXT_FLASH

 you have to put these lines before the .rodata section (which goes to flash by default)

  /* 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

Hope it helps :)

Osman SOYKURT
ST Software Developer | TouchGFX

View solution in original post

3 REPLIES 3
Osman SOYKURT
ST Employee

Hello @ikendal ,

I think it's doable, but SVG images are supposed to take very little memory so that's why we keep them in internal flash normally. Is there any specific reason you want to have them in external flash?

Osman SOYKURT
ST Software Developer | TouchGFX

We have a TouchGFX project that has blown way past our internal flash limits and, while looking for places to save, we noticed that one large user of internal flash is the SVGDatabase.

We're considering switching over to exclusively use PNGs to get better use of the external flash and to remove the need for the vector rendering code, but if we can get the SVGs in there, it would save our designer some conversion work.

Hello @ikendal ,

If you want to put PNGs in external flash, you can do specify it from TouchGFX designer here :

OsmanSOYKURT_0-1696321072156.png

How much your SVGDatabase takes in memory? (You can check that from the map file)
Do you have a lot of SVGs in your project?

The trick to put SVGs in external flash is to write this in the linker script :

 ExtFlashSection :
  {
    */SVGDatabase.o(.rodata.*)
    
  } >EXT_FLASH

 you have to put these lines before the .rodata section (which goes to flash by default)

  /* 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

Hope it helps :)

Osman SOYKURT
ST Software Developer | TouchGFX