This is an automated email from Gerrit.

"Tomas Vanek <[email protected]>" just uploaded a new patch set to Gerrit, which 
you can find at https://review.openocd.org/c/openocd/+/6705

-- gerrit

commit 38090c10fc4530de69988df4951842d0af6ea994
Author: Tomas Vanek <[email protected]>
Date:   Tue Nov 16 17:10:12 2021 +0100

    flash/stm32f1x,f2x: fix endianess in slow fallback flash write
    
    Use target_write_memory() instead of target_write_u16()
    
    Change-Id: I2389fe7a5fa18c9bc9c1aad8b8ddd64608bf2566
    Signed-off-by: Tomas Vanek <[email protected]>

diff --git a/src/flash/nor/stm32f1x.c b/src/flash/nor/stm32f1x.c
index 6744779e9..6aa3b147c 100644
--- a/src/flash/nor/stm32f1x.c
+++ b/src/flash/nor/stm32f1x.c
@@ -592,10 +592,7 @@ static int stm32x_write(struct flash_bank *bank, const 
uint8_t *buffer,
                LOG_WARNING("couldn't use block writes, falling back to single 
memory accesses");
 
                while (words_remaining > 0) {
-                       uint16_t value;
-                       memcpy(&value, buffer, sizeof(uint16_t));
-
-                       retval = target_write_u16(target, bank->base + offset, 
value);
+                       retval = target_write_u16(target, bank->base + offset, 
2, 1, buffer);
                        if (retval != ERROR_OK)
                                goto reset_pg_and_lock;
 
diff --git a/src/flash/nor/stm32f2x.c b/src/flash/nor/stm32f2x.c
index e80928ddf..ed3fddf42 100644
--- a/src/flash/nor/stm32f2x.c
+++ b/src/flash/nor/stm32f2x.c
@@ -856,15 +856,12 @@ static int stm32x_write(struct flash_bank *bank, const 
uint8_t *buffer,
        Wait for the BSY bit to be cleared
        */
        while (words_remaining > 0) {
-               uint16_t value;
-               memcpy(&value, buffer + bytes_written, sizeof(uint16_t));
-
                retval = target_write_u32(target, stm32x_get_flash_reg(bank, 
STM32_FLASH_CR),
                                FLASH_PG | FLASH_PSIZE_16);
                if (retval != ERROR_OK)
                        return retval;
 
-               retval = target_write_u16(target, address, value);
+               retval = target_write_memory(target, address, 2, 1, buffer + 
bytes_written);
                if (retval != ERROR_OK)
                        return retval;
 

-- 

Reply via email to