cancel
Showing results for 
Search instead for 
Did you mean: 

stm32H755 single word programming to the FLASH

iTTy
Associate III

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

7 REPLIES 7
AScha.3
Chief II

Hi,

why not reading in the rm ?

here from H743/H750 manual:

AScha3_0-1702976650405.png

 

If you feel a post has answered your question, please click "Accept as Solution".
TDK
Guru

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.

If you feel a post has answered your question, please click "Accept as Solution".
iTTy
Associate III

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?

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.

+

AScha3_0-1704877051847.png

 

If you feel a post has answered your question, please click "Accept as Solution".

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?

@RBT-ES  Which STM32? If not STMH7, can you start a new question?

STM32L471RG