Skip to content

Commit b1b0673

Browse files
authored
Merge pull request #12086 from ABOSTM/FLASH_API_64B_ALIGNMENT
TARGET_STM: fix flash api 64bit address alignment on L4 and WB
2 parents 81d4a72 + 9e3ad13 commit b1b0673

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

targets/TARGET_STM/TARGET_STM32L4/flash_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ int32_t flash_program_page(flash_t *obj, uint32_t address,
205205

206206
/* HW needs an aligned address to program flash, which data
207207
* parameters doesn't ensure */
208-
if ((uint32_t) data % 4 != 0) {
208+
if ((uint32_t) data % 8 != 0) {
209209
volatile uint64_t data64;
210210
while ((address < (StartAddress + size)) && (status == 0)) {
211211
for (uint8_t i = 0; i < 8; i++) {

targets/TARGET_STM/TARGET_STM32WB/flash_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data,
154154
StartAddress = address;
155155

156156
/* HW needs an aligned address to program flash, which data parameters doesn't ensure */
157-
if ((uint32_t) data % 4 != 0) { // Data is not aligned, copy data in a temp buffer before programming it
157+
if ((uint32_t) data % 8 != 0) { // Data is not aligned, copy data in a temp buffer before programming it
158158
volatile uint64_t data64;
159159
while ((address < (StartAddress + size)) && (status == 0)) {
160160
for (uint8_t i = 0; i < 8; i++) {

0 commit comments

Comments
 (0)