This is an automated email from Gerrit.

Christopher Head ([email protected]) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/5388

-- gerrit

commit 7e6fc4cf904be84b3934303b9f3ad2e8db8e5eda
Author: Christopher Head <[email protected]>
Date:   Fri Jan 3 14:49:16 2020 -0800

    flash/stm32h: use alignment infrastructure
    
    Report the 32-byte alignemnt requirement via the bank structure rather
    than enforcing it ad-hoc in the write routine. This allows people to do
    non-32-byte-aligned writes if they want, with the infrastructure fixing
    up the addresses passed to the low-level driver.
    
    Change-Id: I2c4f532f2000435954a900224dbc9f2c30d1cc94
    Signed-off-by: Christopher Head <[email protected]>

diff --git a/src/flash/nor/stm32h7x.c b/src/flash/nor/stm32h7x.c
index 0085729..48582ef 100644
--- a/src/flash/nor/stm32h7x.c
+++ b/src/flash/nor/stm32h7x.c
@@ -169,6 +169,8 @@ FLASH_BANK_COMMAND_HANDLER(stm32x_flash_bank_command)
        stm32x_info->probed = 0;
        stm32x_info->user_bank_size = bank->size;
 
+       bank->write_start_alignment = FLASH_BLOCK_SIZE;
+
        return ERROR_OK;
 }
 
@@ -603,10 +605,8 @@ static int stm32x_write(struct flash_bank *bank, const 
uint8_t *buffer,
                return ERROR_TARGET_NOT_HALTED;
        }
 
-       if (offset % FLASH_BLOCK_SIZE) {
-               LOG_WARNING("offset 0x%" PRIx32 " breaks required 32-byte 
alignment", offset);
-               return ERROR_FLASH_DST_BREAKS_ALIGNMENT;
-       }
+       /* should be enforced via bank->write_start_alignment */
+       assert(!(offset % FLASH_BLOCK_SIZE));
 
        retval = stm32x_unlock_reg(bank);
        if (retval != ERROR_OK)

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to