Skip to main content
Associate
September 29, 2023
Solved

SVG with TouchGFX

  • September 29, 2023
  • 1 reply
  • 1933 views

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

This topic has been closed for replies.
Best answer by Osman SOYKURT

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 :)

1 reply

Osman SOYKURT
Technical Moderator
October 2, 2023

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 SOYKURTST Software Developer | TouchGFX
ikendalAuthor
Associate
October 2, 2023

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.

Osman SOYKURT
Osman SOYKURTBest answer
Technical Moderator
October 3, 2023

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 SOYKURTST Software Developer | TouchGFX