Single word (32 bit ) Flash programming STM32G0
I am trying to make UART boot loader and programming via Teraterm by sending HEX file.
some hex records have only 4 bytes. how to program only one word.
Reference manual RM0454 page no. 59 says only double word can be programmed.
How to program single word only ?
can I skip writing one word by modifying the below function ? in stm32g0xx_hal_flash.c
Sample Hex records
:1000000000900020690C0008C10B0008C70B000815
:100B60000000000000000000000000000000000085
:0C0B700000000000000000000000000079
:040B7C00E10000088C
:040B8000B9000008B0
:100B84001E00000064000000D007000064000000A4
/**
* @brief Program double-word (64-bit) at a specified address.
* @param Address Specifies the address to be programmed.
* @param Data Specifies the data to be programmed.
* @retval None
*/
static void FLASH_Program_DoubleWord(uint32_t Address, uint64_t Data)
{
/* Set PG bit */
SET_BIT(FLASH->CR, FLASH_CR_PG);
/* Program first word */
*(uint32_t *)Address = (uint32_t)Data;
/* Barrier to ensure programming is performed in 2 steps, in right order
(independently of compiler optimization behavior) */
__ISB();
/* Program second word */
*(uint32_t *)(Address + 4U) = (uint32_t)(Data >> 32U);
}