2023-12-19 12:32 AM
Hi there,
I'm developing my own bootloader for a stm32H755 MCU and I would like to b able to write just a single 32 bit word (or even also a single 64 bit double word) to the flash.
Using standards HAL API and theHAL_FLASH_Program function, I'm able to choose only the entire flash word programming (there is only the FLASH_TYPEPROGRAM_FLASHWORD define).
I discovered that in the legacy hal header (stm32_hal_legacy.h) there are also other programming types definitions...
Is there any limitation/risk using programming types other than entire flash word?
Thanks!
iTTy
2023-12-19 01:06 AM - edited 2024-01-10 12:45 AM
Hi,
why not reading in the rm ?
here from H743/H750 manual:
2023-12-19 06:18 AM
Due to the presence and nature of the ECC bits, you cannot write less than the full flash page.
Some other chip families do not have the ECC bits and thus do not have this limitation. That is the reason other programming types are in the HAL library.
2024-01-10 12:29 AM
Hi everyone, and sorry for my ghosting!
Coming back from seasonal flu and Christmass holidays:
@AScha.3, reading rm399 and others documents about H7 family I understood that reading/writing even a single byte in a flash word was possible... limitations well explained by @TDK wasn't reported in so clear form.
Anyway, I'm facing up with a new doubt given by such constraints: developing a custom bootloader I discovered that the code "dimension" don't fit an entire number of 32-bit words; therefore, wht is the common/best practice when just some bytes (not multiple of 4) shall be written in a flash word?
2024-01-10 12:57 AM - edited 2024-01-10 12:58 AM
Hi,
>just some bytes (not multiple of 4) shall be written in a flash word
So fill up with 00 ( or FF) , "padding" , to a full flash word size and write this.
Anyway always 256bit+ecc is written.
+
2024-08-22 01:46 AM - edited 2024-08-22 02:02 AM
I'm in a similar situation.
I am building a bootloader which receives a .hex file line by line, and immediately writes it. Each line is 16 bytes long, so you can easily write it using two double word flashes. However, at the end of the file, things start to get annoying. Instead of one line of 16 bytes, it's split up in a line of 8 bytes (no problem), and two lines of 4 bytes. I can't write those 4 bytes, because the only TYPEPROGRAM that is supported uses the DOUBLEWORD, thus writes 8 bytes.
Can I fix this by writing data of 0x12345678 as 0x12345678 00000000 and then when the next frame is located at the 00000000 portion, with for example data 9ABCDEF0 I read back 0x12345678 00000000, then add the received data, and write 0x12345678 9ABCDEF0?
Or any other suggestions?
Edit: in the HAL file, the doubleword program is actually split up in two writes of a single word. Why? Can't I just only program a single word then?
2024-08-22 02:37 AM - edited 2024-08-22 03:50 AM
@RBT-ES Which STM32? If not STMH7, can you start a new question?
2024-08-22 02:38 AM
STM32L471RG