Skip to main content
MMerc.1
Associate III
February 11, 2020
Solved

Image takes up a lot of FLASH space

  • February 11, 2020
  • 8 replies
  • 2714 views

Hi,

I want to use an image but it takes up a lot of space in FLASH memory when I add it.

Example:

Image size ------ (no image) ---- 7.55 KB -------- 2.38 KB (same picture but compressed)

FLASH (free) ---- 811.97KB ----- 385.55 KB ----- 385.55 KB

(Instead of) -------------------------- 804.42 KB ----- 809.59 KB

I don't understand why...

Do you have the same problem?

Best Regards

This topic has been closed for replies.
Best answer by chaaalyy

Hi :)

It´s very hard to believe for me, that 16MBytes of space are not enough for a GUI, but on the other side i don´t know, what you´re planning to do ;)

If it HAS to be uSD-storage, there´s a document, i found...

https://touchgfx.zendesk.com/hc/en-us/articles/207460605

But anyway: This approach needs definitely very good knowledge about hardwareconfiguration... Just to bring the uSD to life is a task, which can drive you insane (just my experience with ST´s HAL-drivers and many other bugs...). Step by step Tutorials about this are just not existent :(

If you want to give the qspi-approach a quick try: watch this Video (and maybe also the whole channel of that guy :) )

https://www.youtube.com/watch?v=12KXreXaLp0

Since CubeIDE 1.3 and FW 1.16 (the blank UI is based on FW 1.15), at some point it´ll ask to migrate... Just answer "Yes" at that point...

A little bit deeper below the surface is this channel:

https://www.youtube.com/channel/UCS1CM3mQiwlDU2nIVXroEtQ

He also has a very good video, what describes the manual qspi-setup via CubeMX and linkerscript...

8 replies

Ozone
Principal
February 11, 2020

Check the linker-generated map file.

MMerc.1
MMerc.1Author
Associate III
February 11, 2020

Where is this file?

Could you explain me?

Ozone
Principal
February 12, 2020

Read the documentation/tutorials of your unnamed toolchain.

Map file generation is an optional linker feature. Often set (enabled) with the project setting.

Know your tools.

MMerc.1
MMerc.1Author
Associate III
February 12, 2020

UP ! :smirking_face:

Martin KJELDSEN
Principal III
February 17, 2020

Did you do what @Ozone​ asked you to do? Find your map file and check the size of the object for that image. Or just post it here and we can tell you.

Images contain pixels and depending on the quality of your image, the image will take up a pre-defined amount of space in flash. It's unrelated to TouchGFX. We simply read the image and write the value for each pixel.

/Martin

MMerc.1
MMerc.1Author
Associate III
February 19, 2020

Hi,

Here is the map file :

"FLASH";"0x08000000";"";"1024 KB"

".isr_vector";"0x08000000";"0x08000000";"456 B"

".text";"0x080001d0";"0x080001d0";"131,02 KB"

".rodata";"0x08020de4";"0x08020de4";"14,42 KB"

"FontFlashSection";"0x08024794";"0x08024794";"2,24 KB"

"ExtFlashSection";"0x0802508c";"0x0802508c";"518,43 KB"

"_bassin";"0x0802508c";"0x0802508c";"177,25 KB"

"_bidon_base";"0x08051588";"0x08051588";"4,6 KB"

"_bonde_fond";"0x080527f0";"0x080527f0";"2,64 KB"

"_bouton_retour";"0x08053280";"0x08053280";"21,97 KB"

"_filtre";"0x08058a64";"0x08058a64";"94,06 KB"

"_helice";"0x080702a4";"0x080702a4";"33,79 KB"

"_pac_inactif";"0x080789c8";"0x080789c8";"77,44 KB"

"_pompe_filtration_inactif";"0x0808bf88";"0x0808bf88";"53,16 KB"

"_pomperegulation_inactif";"0x08099428";"0x08099428";"12,63 KB"

"_refoulements";"0x0809c6ac";"0x0809c6ac";"2,52 KB"

"_sonde_inactif";"0x0809d0bc";"0x0809d0bc";"3,39 KB"

"_tuyau_3_12_inactif";"0x0809de48";"0x0809de48";"2,64 KB"

"_tuyau_3_6_12_inactif";"0x0809e8d8";"0x0809e8d8";"3,66 KB"

"_tuyau_3_6_9_12_inactif";"0x0809f778";"0x0809f778";"5,06 KB"

"_tuyau_3_6_9_inactif";"0x080a0bb8";"0x080a0bb8";"3,66 KB"

"_tuyau_3_6_inactif";"0x080a1a58";"0x080a1a58";"2,64 KB"

"_tuyau_3_9_12_inactif";"0x080a24e8";"0x080a24e8";"3,66 KB"

"_tuyau_6_9_12_inactif";"0x080a3388";"0x080a3388";"3,66 KB"

"_tuyau_6_9_inactif";"0x080a4228";"0x080a4228";"2,64 KB"

"_tuyau_9_12_inactif";"0x080a4cb8";"0x080a4cb8";"2,64 KB"

"_tuyau_horizontal_inactif";"0x080a5748";"0x080a5748";"588 B"

"_tuyau_vertical_inactif";"0x080a5994";"0x080a5994";"588 B"

"_vanne_horizontal_actif";"0x080a5be0";"0x080a5be0";"1,8 KB"

"_vanne_vertical_actif";"0x080a6310";"0x080a6310";"1,8 KB"

"TextFlashSection";"0x080a6a40";"0x080a6a40";"164 B"

".ARM";"0x080a6ae4";"0x080a6ae4";"8 B"

".preinit_array";"0x080a6aec";"0x080a6aec";"0 B"

".init_array";"0x080a6aec";"0x080a6aec";"20 B"

".fini_array";"0x080a6b00";"0x080a6b00";"8 B"

".data";"0x20000000";"0x080a6b08";"268 B"

"RAM";"0x20000000";"";"320 KB"

".data";"0x20000000";"0x080a6b08";"268 B"

".bss";"0x2000010c";"";"42,65 KB"

"._user_heap_stack";"0x2000aba4";"";"1,5 KB"

The size of the "_bassin" file is 177,25 KB but on my computer it is 26,5 Ko...

The problem is the same for all files.

MMerc.1
MMerc.1Author
Associate III
March 5, 2020

HI,

I have attached an image file. The size of this image is 157,8KB in the linker (Build Analyzer - Memory Details - FLASH - ExtFlashSection) but the size is 4.46KB on my computer.

Could you explain to me how can I have the same size between flash memory and my computer?

chaaalyy
Senior II
March 5, 2020

203x199 Pixels with 24 bit/Pixel + Alpha = how many Bytes ? ... Images in TouchGFX are not compressed, they are just simple Bitmap Arrays ;) Maybe there´s a way to use some kind of JPEG-compression, but i fear, this will have heavy impact on performance ...

MMerc.1
MMerc.1Author
Associate III
March 5, 2020

Hi chaaalyy,

Thank you for your advice.

I created another subject where I want to use a µSD to store all my images : https://community.st.com/s/feed/0D50X0000CAuoHJ

Do you have any ideas ?

chaaalyy
Senior II
March 5, 2020

Maybe not from uSD, but as far, as i could see, you use the f746 discovery board ... It has 16MB QSPI flash, you can use ... There are some good videos and tuts out there, i can check them out and provide links later (i´m at work atm and don´t have my toolchain here...)

MMerc.1
MMerc.1Author
Associate III
March 10, 2020

Hi,

Thanks to @Karl Hönemann for giving me explanations on QSPI : I can store all my images there.

But the end goal is to use the uSD. So if you have information about it, you can send me a message.

I have a few questions about QSPI : is it a component ? Where is it ?

An off topic question : how can I update the program with a USB device ?

See my subject : https://community.st.com/s/question/0D50X0000C9f4YmSQI/how-can-i-load-the-binary-file-via-usb

AndrewM
Associate III
March 13, 2020

FWIW I faced a somewhat similar situation recently and found I couldn't use all the png's supplied by the graphical artist because the space required was too large. Luckily the images contain lots of similarity and large portions of identically coloured areas (as I see your image does as well). So I was able to use gimp to eg snip the corners from the image and use these as the graphical assets then programatically fill in the internal areas using touchgfx::Box etc.