2023-12-20 08:57 PM
Solved! Go to Solution.
2023-12-22 02:04 PM
Hello t-oka,
We are lacking a little of your context. What are you trying to do exactly with this bitmap ?
Do you intend to do data processing on the pixels and save the result file, or do you need to display it as is on a screen ?
As the others already said, it is not possible to read entirely such a big image in MCU memory.
Maybe you could start by reading the documentation file provided in the FW pack here:
STM32Cube_FW_F2_V1.9.4/Projects/NUCLEO-F207ZG/Demonstrations/readme.txt
This demonstration displays a 128x160 pixels BMP image on a Adafruit 1.8" TFT connected to the Nucleo board extension.
You will need also to store the image on a microSD card inserted in the slot.
If that does not fit your needs, you would have to switch to an EVAL board with more capabilities...
2023-12-21 12:01 AM
Welcome @t-oka, to the community!
You want to open a BMP of 225KB into the STM32F207ZGT6?
Even if I subtract the usual header of 54 bytes (may vary slightly), that still leaves 230484 bytes that have to fit into the RAM of the STM32F207ZGT6. However, it only has 132KB RAM in total, which is also divided into 112KB + 16KB + 4KB backup RAM.
What format uses the BMP exactly?
Regards
/Peter
2023-12-21 12:41 AM
Peter, thanks for watching!
■I will respond below.:
>>You want to open a BMP of 225KB into the STM32F207ZGT6?
→Yes, that's right.
>>Even if I subtract the usual header of 54 bytes (may vary slightly),
>>that still leaves 230484 bytes that have to fit into the RAM of the STM32F207ZGT6.
>>However, it only has 132KB RAM in total, which is also divided into 112KB + 16KB + 4KB backup RAM.
→I tried setting the BMP file size to 1KB for reference, but it still returned "Not enough space".
>>What format uses the BMP exactly?
→I would like to use it in binary format.
※I would like to open a file ⇒ Read binary ⇒ Display on STM32F207ZGT6.
If possible, please continue to cooperate.
2023-12-21 01:55 AM
As far as I remember, fopen allocates the object (in your case the file) in the heap, which must be selected accordingly large. Depending on the other use of the heap, a BMP with a payload of 1KB could already be too large for this.
2023-12-21 05:44 PM
Peter, thank you again.
>> fopen allocates the object (in your case the file) in the heap.
How do you respond specifically?
If the fopen () function cannot be used, is there a way to open a bitmap file in another way?
2023-12-21 06:59 PM
The author is trying to open a file on a Windows PC by calling fopen() on a microcontroller...
I am voting for this as the topic of the year! :face_with_tears_of_joy:
2023-12-21 10:24 PM
>>is there a way to open a bitmap file in another way?
Host the file locally rather than using semi-hosting?
2023-12-22 05:57 AM - edited 2023-12-22 05:58 AM
@t-oka So are you trying to open a file using semihosting? Then use low-level I/O (_open, _read, etc. ) instead of fopen because stdio functions do a lot of buffering. The names of low-level I/O functions are different in different toolchains (Keil/IAR/GNU).
2023-12-22 02:04 PM
Hello t-oka,
We are lacking a little of your context. What are you trying to do exactly with this bitmap ?
Do you intend to do data processing on the pixels and save the result file, or do you need to display it as is on a screen ?
As the others already said, it is not possible to read entirely such a big image in MCU memory.
Maybe you could start by reading the documentation file provided in the FW pack here:
STM32Cube_FW_F2_V1.9.4/Projects/NUCLEO-F207ZG/Demonstrations/readme.txt
This demonstration displays a 128x160 pixels BMP image on a Adafruit 1.8" TFT connected to the Nucleo board extension.
You will need also to store the image on a microSD card inserted in the slot.
If that does not fit your needs, you would have to switch to an EVAL board with more capabilities...
2023-12-22 03:47 PM
Hello Oskar_H, thanks for watchi
>>We are lacking a little of your context. What are you trying to do exactly with this bitmap ?
>>Do you intend to do data processing on the pixels and save the result file, or do you need to display it as is on a screen ?
⇒Thank you for pointing this out. I will process the data for the pixels and display them on the screen as they are.
>>As the others already said, it is not possible to read entirely such a big image in MCU memory.
>>Maybe you could start by reading the documentation file provided in the FW pack here:
>>STM32Cube_FW_F2_V1.9.4/Projects/NUCLEO-F207ZG/Demonstrations/readme.txt
>>This demonstration displays a 128x160 pixels BMP image on a Adafruit 1.8" TFT connected to the Nucleo board extension.
>>You will need also to store the image on a microSD card inserted in the slot.
>>If that does not fit your needs, you would have to switch to an EVAL board with more capabilities...
⇒Thank you, as others have mentioned, instead of preparing the image on the PC,
save it on an SD card or something and use it.
And I would like to read the demo you gave me and try again.
Thank you for your detailed explanation.