This is an automated email from Gerrit.

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

-- gerrit

commit e1f53a8f2fdb0f479ebeaa563de72577f2859f9a
Author: Dominik Peklo <[email protected]>
Date:   Sun Jun 24 10:21:48 2018 +1000

    flash/nor/stm32f1x: Fix protect sector boundary alignment
    
    Existing logic is flawed and contradicting documentation. Expected
    behavior is to grow the set of sectors to encompass first and last.
    
    Change-Id: I5969884e98df723efc591e97f634099a417bcebc
    Signed-off-by: Dominik Peklo <[email protected]>

diff --git a/src/flash/nor/stm32f1x.c b/src/flash/nor/stm32f1x.c
index 015988a..a0dd1a1 100644
--- a/src/flash/nor/stm32f1x.c
+++ b/src/flash/nor/stm32f1x.c
@@ -488,13 +488,13 @@ static int stm32x_protect(struct flash_bank *bank, int 
set, int first, int last)
        if ((first % stm32x_info->ppage_size) != 0) {
                LOG_WARNING("aligned start protect sector to a %d sector 
boundary",
                                stm32x_info->ppage_size);
-               first = first - (first % stm32x_info->ppage_size);
+               first -= first % stm32x_info->ppage_size;
        }
        if (((last + 1) % stm32x_info->ppage_size) != 0) {
                LOG_WARNING("aligned end protect sector to a %d sector 
boundary",
                                stm32x_info->ppage_size);
-               last++;
-               last = last - (last % stm32x_info->ppage_size);
+               last += stm32x_info->ppage_size;
+               last -= last % stm32x_info->ppage_size;
                last--;
        }
 

-- 

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to