This is an automated email from Gerrit.

"Keith Packard <kei...@keithp.com>" just uploaded a new patch set to Gerrit, 
which you can find at https://review.openocd.org/c/openocd/+/7234

-- gerrit

commit c9a93b2b01d29cdcada09967ab72f2ba52a54129
Author: Keith Packard <kei...@keithp.com>
Date:   Wed Sep 28 14:02:52 2022 -0700

    flash/nor/at91samd: Use 32-bit register writes for ST-Link compat
    
    ST-Link v2 dongles can be used with many cortex-m parts, but they have
    one limitation -- they can only perform 8-bit and 32-bit writes to the
    target. 16-bit writes are done using a pair of 8-bit writes. While not
    usually an issue, in the case of the at91samd flash driver, the 16-bit
    'command' register must have both halves written in the same
    operation.
    
    Fortunately, this register has two pad bytes above it in the address
    space, making it safe to always access with 32-bit operations.
    
    Change-Id: I44b0db9406982a8db5818c0533d3101618741db2
    Signed-off-by: Keith Packard <kei...@keithp.com>

diff --git a/src/flash/nor/at91samd.c b/src/flash/nor/at91samd.c
index a0252a2767..3b8893252a 100644
--- a/src/flash/nor/at91samd.c
+++ b/src/flash/nor/at91samd.c
@@ -543,7 +543,7 @@ static int samd_issue_nvmctrl_command(struct target 
*target, uint16_t cmd)
        }
 
        /* Issue the NVM command */
-       res = target_write_u16(target,
+       res = target_write_u32(target,
                        SAMD_NVMCTRL + SAMD_NVMCTRL_CTRLA, SAMD_NVM_CMD(cmd));
        if (res != ERROR_OK)
                return res;

-- 

Reply via email to