This is an automated email from Gerrit.

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

-- gerrit

commit 5bf58724411935f6e96d9b081d65878c6a2603af
Author: Doug Brunner <[email protected]>
Date:   Sat Nov 6 15:57:41 2021 -0700

    flash/nor/efm32: fixed LB+UD with page size != 2k
    
    User data and lockbits appear to be one flash page in length for all 
members of this device family,
    so specifying smallest page size in tcl for these banks and rounding up to 
device page size in the driver.
    
    Signed-off-by: Doug Brunner <[email protected]>
    Change-Id: Iff0e7ab50a438e152505c6dae2250f82e5861b35

diff --git a/src/flash/nor/efm32.c b/src/flash/nor/efm32.c
index f7154aeff..a6fc5f48a 100644
--- a/src/flash/nor/efm32.c
+++ b/src/flash/nor/efm32.c
@@ -963,12 +963,7 @@ static int efm32x_probe(struct flash_bank *bank)
                efm32_mcu_info.page_size;
 
        if (bank->size > 0) {
-               if (bank->size % efm32_mcu_info.page_size != 0) {
-                       LOG_ERROR("Flash banks must be a multiple of %d bytes",
-                               efm32_mcu_info.page_size);
-                       return ERROR_FAIL;
-               }
-               num_pages = bank->size / efm32_mcu_info.page_size;
+               num_pages = (bank->size + efm32_mcu_info.page_size - 1) / 
efm32_mcu_info.page_size;
        }
 
        assert(num_pages > 0);
diff --git a/tcl/target/efm32.cfg b/tcl/target/efm32.cfg
index e43bde120..ed70cd864 100644
--- a/tcl/target/efm32.cfg
+++ b/tcl/target/efm32.cfg
@@ -43,8 +43,8 @@ $_TARGETNAME configure -work-area-phys 0x10000000 
-work-area-size $_WORKAREASIZE
 
 set _FLASHNAME $_CHIPNAME.flash
 flash bank $_FLASHNAME efm32 0 0 0 0 $_TARGETNAME
-flash bank userdata.flash efm32 0x0FE00000 2048 0 0 $_TARGETNAME
-flash bank lockbits.flash efm32 0x0FE04000 2048 0 0 $_TARGETNAME
+flash bank userdata.flash efm32 0x0FE00000 512 0 0 $_TARGETNAME
+flash bank lockbits.flash efm32 0x0FE04000 512 0 0 $_TARGETNAME
 
 if {![using_hla]} {
    # if srst is not fitted use SYSRESETREQ to

-- 

Reply via email to