This is an automated email from Gerrit.

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

-- gerrit

commit 36e7d1aac2ae138ef3bff159a09a775d52a46344
Author: Spencer Oliver <[email protected]>
Date:   Mon Nov 19 11:35:12 2012 +0000

    stm32f1x: preserve user option byte data
    
    The user is able to use 2bytes of the options byte data for whatever
    purpose they wish. Make sure we preserve this during an option erase/write.
    
    Change-Id: Ibf951b11c59a148e671b1eb47fdc9b4f49ccae15
    Signed-off-by: Spencer Oliver <[email protected]>

diff --git a/src/flash/nor/stm32f1x.c b/src/flash/nor/stm32f1x.c
index 58b7ba1..3ee5526 100644
--- a/src/flash/nor/stm32f1x.c
+++ b/src/flash/nor/stm32f1x.c
@@ -110,6 +110,7 @@
 struct stm32x_options {
        uint16_t RDP;
        uint16_t user_options;
+       uint16_t user_data;
        uint16_t protection[4];
 };
 
@@ -229,6 +230,7 @@ static int stm32x_read_options(struct flash_bank *bank)
                return retval;
 
        stm32x_info->option_bytes.user_options = (uint16_t)0xFFF8 | 
((optiondata >> 2) & 0x07);
+       stm32x_info->option_bytes.user_data = (optiondata >> 10) & 0xffff;
        stm32x_info->option_bytes.RDP = (optiondata & (1 << OPT_READOUT)) ? 
0xFFFF : 0x5AA5;
 
        if (optiondata & (1 << OPT_READOUT))
@@ -325,8 +327,8 @@ static int stm32x_write_options(struct flash_bank *bank)
 
        target_buffer_set_u16(target, opt_bytes, stm32x_info->option_bytes.RDP);
        target_buffer_set_u16(target, opt_bytes + 2, 
stm32x_info->option_bytes.user_options);
-       target_buffer_set_u16(target, opt_bytes + 4, 0x00FF);
-       target_buffer_set_u16(target, opt_bytes + 6, 0x00FF);
+       target_buffer_set_u16(target, opt_bytes + 4, 
stm32x_info->option_bytes.user_data & 0xff);
+       target_buffer_set_u16(target, opt_bytes + 6, 
(stm32x_info->option_bytes.user_data >> 8) & 0xff);
        target_buffer_set_u16(target, opt_bytes + 8, 
stm32x_info->option_bytes.protection[0]);
        target_buffer_set_u16(target, opt_bytes + 10, 
stm32x_info->option_bytes.protection[1]);
        target_buffer_set_u16(target, opt_bytes + 12, 
stm32x_info->option_bytes.protection[2]);
@@ -1338,6 +1340,9 @@ COMMAND_HANDLER(stm32x_handle_options_read_command)
                        command_print(CMD_CTX, "Boot: Bank 1");
        }
 
+       command_print(CMD_CTX, "User Option0: 0x%02" PRIx8, (optionbyte >> 10) 
& 0xff);
+       command_print(CMD_CTX, "User Option1: 0x%02" PRIx8, (optionbyte >> 18) 
& 0xff);
+
        return ERROR_OK;
 }
 

-- 

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to