flash/nor/nrf5: unify size of HWID 89/5589/2
authorTomas Vanek <vanekt@fbl.cz>
Mon, 13 Apr 2020 18:19:41 +0000 (20:19 +0200)
committerTomas Vanek <vanekt@fbl.cz>
Wed, 28 Oct 2020 10:51:57 +0000 (10:51 +0000)
HWID is a part of 32 bit CONFIGID register. hwid member of struct nrf5_info
was typed uint32_t to enable direct CONFIGID read and masked afterwards.

Change to uint16_t to unify with hwid in struct nrf5_device_spec
and RM description.

Change-Id: Ib720d3ce23c301aee41d074ea78a6f00a23aed68
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5589
Tested-by: jenkins
src/flash/nor/nrf5.c

index 02c144810608ab5a66a22e5cde10e490ba69e89d..1784bcde5a0d52597cbaa486707e4291886a4f7a 100644 (file)
@@ -158,7 +158,7 @@ struct nrf5_info {
        bool ficr_info_valid;
        struct nrf52_ficr_info ficr_info;
        const struct nrf5_device_spec *spec;
-       uint32_t hwid;
+       uint16_t hwid;
        enum nrf5_features features;
        unsigned int flash_size_kb;
        unsigned int ram_size_kb;
@@ -648,7 +648,7 @@ static int nrf5_info(struct flash_bank *bank, char *buf, int buf_size)
                                variant, &variant[2]);
 
        } else {
-               res = snprintf(buf, buf_size, "nRF51xxx (HWID 0x%08" PRIx32 ")",
+               res = snprintf(buf, buf_size, "nRF51xxx (HWID 0x%04" PRIx16 ")",
                                chip->hwid);
        }
        if (res <= 0)
@@ -765,14 +765,15 @@ static int nrf5_probe(struct flash_bank *bank)
        struct nrf5_info *chip = nbank->chip;
        struct target *target = chip->target;
 
-       res = target_read_u32(target, NRF5_FICR_CONFIGID, &chip->hwid);
+       uint32_t configid;
+       res = target_read_u32(target, NRF5_FICR_CONFIGID, &configid);
        if (res != ERROR_OK) {
                LOG_ERROR("Couldn't read CONFIGID register");
                return res;
        }
 
-       chip->hwid &= 0xFFFF;   /* HWID is stored in the lower two
-                        * bytes of the CONFIGID register */
+       /* HWID is stored in the lower two bytes of the CONFIGID register */
+       chip->hwid = configid & 0xFFFF;
 
        /* guess a nRF51 series if the device has no FICR INFO and we don't know HWID */
        chip->features = NRF5_FEATURE_SERIES_51;

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)