This is an automated email from Gerrit.

Kevlar (softw...@klystron.com) just uploaded a new patch set to Gerrit, which 
you can find at http://openocd.zylin.com/3806

-- gerrit

commit 31fc085a157dacb7e29fc7688ecd8a54efbd9170
Author: kevin <softw...@klystron.com>
Date:   Mon Oct 17 12:46:26 2016 +0100

    Ensure that at least one word of lock bits is always read in order to 
support devices with less than 32k of flash.
    
    Signed-off-by: Kevin Hornett <softw...@klystron.com>
    Change-Id: I59febe2cb690c893a5057a5f72918e146cf2afe4

diff --git a/src/flash/nor/efm32.c b/src/flash/nor/efm32.c
index 0b33829..81c1a37 100644
--- a/src/flash/nor/efm32.c
+++ b/src/flash/nor/efm32.c
@@ -456,10 +456,10 @@ static int efm32x_read_lock_data(struct flash_bank *bank)
        uint32_t *ptr = NULL;
        int ret = 0;
 
-       assert(!(bank->num_sectors & 0x1f));
+       assert(bank->num_sectors > 0);
 
-       data_size = bank->num_sectors / 8; /* number of data bytes */
-       data_size /= 4; /* ...and data dwords */
+       /* calculate the number of 32-bit words to read (one lock bit per 
sector) */
+       data_size = (bank->num_sectors + 31) / 32;
 
        ptr = efm32x_info->lb_page;
 

-- 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to