2024-11-25 08:00 AM - last edited on 2024-11-26 01:44 AM by SofLit
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?
Solved! Go to Solution.
2024-12-06 07:37 AM
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.
2024-12-10 06:24 AM
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?
2024-12-11 07:59 AM
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.
2024-12-12 02:47 AM
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
2024-12-12 04:45 AM
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?
2024-12-12 06:00 AM
can you remove the xection entirely afterwards like this?
arm-none-eabi-strip.exe --remove-section=ExtFlashSection STM32H7S78-DK_Appli.elf
2024-12-12 06:23 AM
Sorry, my fault, I wasn't clear enough. I get the error during the compilation in CubeIDE not in the CMD
2024-12-12 07:25 AM
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.
2024-12-16 08:56 AM
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.
2024-12-17 11:16 PM
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?