cancel
Showing results for 
Search instead for 
Did you mean: 

How to Cache Bitmaps Stored on an SD Card with TouchGFX

Leo_Berna99
Associate III

Hello, everyone,

I am following the following youtube video posted by ST: https://www.youtube.com/watch?v=jE_nL1GObmA.

My intention is to use an SD card to go and insert images due to a lack of space in flash or external ram.

I followed the video, creating a bitmap cache in a portion of external RAM away from frame buffers and other important resources.

In the LD file, I then added a virtual section called SDCARD into which I went to place all the contents of the ExtFlashSection.

Then following the video I am right at the point where from the .elf file I should have created the .bin file through the command arm-none-eabi-objcopy.exe --dump-section ExtFlashSection=images.bin STM32H7S78-DK_24bpp_Appli.elf.

However, I unfortunately get the following error: STM32H7S78-DK_24bpp_Appli.elf[ExtFlashSection]: can't dump section - it has no contents: File in wrong format
C:\TouchGFX\4.24.1\env\MinGW\msys\1.0\gnu-arm-gcc\bin\arm-none-eabi-objcopy.exe: unable to rename 'STM32H7S78-DK_24bpp_Appli.elf'; reason: File exists

Has anyone been through this before and has a possible solution to the problem?

31 REPLIES 31

Hello,

I think something has changed since the video was made. But it is definitely the case that the data is present in the .elf even with the noload flag.

I have done some experimentation, which might lead somewhere. It is kin of weird, but try this:

arm-none-eabi-objcopy.exe --set-section-flags .ExtFlashSection=noload STM32H7S78-DK_Appli.elf

arm-none-eabi-objcopy.exe --dump-section .ExtFlashSection=images.bin STM32H7S78-DK_Appli.elf

That works for me. If that can be a solution to you, I guess you could call it a day, otherwise you might want to get into some comparisons of before and after setting the flag on the section.

I'm getting the same error again and again. Thanks for your try.

I believe my last chance is to try to exclude that section from the debugger. Do you know if that is possible?

The problem with your solution is that if you declare (NOLOAD) in your ld file (If I don't use (NOLOAD) I get an error from my debugger) the .elf file will not have any data in it and the binary will be empty.

I manage to create the binary using a temporary elf file but the result is a file with the desired dimension but filled with 0x00. And that makes sense because using (NOLOAD) will not load any data in that section.

You can try to build it without noload and set it to noload after the fact with objcopy. This result in a .bin with data in it for me, but I have not tried to flash it to a board:

arm-none-eabi-objcopy.exe --dump-section ExtFlashSection=images.bin STM32H7S78-DK_Appli.elf

arm-none-eabi-objcopy.exe --set-section-flags ExtFlashSection=noload STM32H7S78-DK_Appli.elf

Okay but doing that without the NOLOAD flag gets me a Degubber error “Error message from debugger back end:
Load failed
Failed to execute MI command:"

Is there any possibility to exclude the ExtFlashSection from the debugger?

can you remove the xection entirely afterwards like this?

arm-none-eabi-strip.exe --remove-section=ExtFlashSection STM32H7S78-DK_Appli.elf

Sorry, my fault, I wasn't clear enough. I get the error during the compilation in CubeIDE not in the CMD

I believe this is not during compilation, but during flashing. You can not flash your board with the section present with the load flag set.

Does it not build correctly if you press the build button (hammer)?

You can alter your debug and run configurations to not download a file with another name, not download code at all or maybe run some script before downloading code that removes the section beforehand.

mathiasmarkussen
ST Employee

Alternatively, you can flash your application with STM32CubeProgrammer after modifying your elf file.

If you need to debug, you can edit your debug configuration to not download the program before debugging by editing the entry in "Load Image and Symbols" under the startup tab in the debug configuration and disable download. You will then be able to debug, but you will have to flash your elf manually each time you make changes.

Thank you very much @mathiasmarkussen for your time to answer to my questions. I'll try all your suggestions. 

When you say "after modifying your elf file" you mean keeping the (NOLOAD) right?