flash: nor: use 'ULL' suffix for long constants 93/7593/2
authorAntonio Borneo <borneo.antonio@gmail.com>
Sat, 8 Apr 2023 21:50:00 +0000 (23:50 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Fri, 5 May 2023 22:08:01 +0000 (22:08 +0000)
On 32 bit hosts, gcc should consider constants without suffix as
32 bits values. Adding a cast to convert it to 64 bits should not
be enough.

Use the suffix 'ULL' to guarantee it is a 64 bit.

Detected through 'sparse' tool.

Change-Id: If6be35bd3cbbc7c3a83e0da1407e611f07ff6e06
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7593
Tested-by: jenkins
src/flash/nor/at91samd.c
src/flash/nor/atsame5.c

index 416f077783453abd7625c22130c09d001e215946..36298f19d0ac54062467050ef76b4c20af2ed68d 100644 (file)
@@ -78,7 +78,7 @@
 #define SAMD_GET_DEVSEL(id) (id & 0xFF)
 
 /* Bits to mask out lockbits in user row */
-#define NVMUSERROW_LOCKBIT_MASK ((uint64_t)0x0000FFFFFFFFFFFF)
+#define NVMUSERROW_LOCKBIT_MASK 0x0000FFFFFFFFFFFFULL
 
 struct samd_part {
        uint8_t id;
@@ -316,31 +316,31 @@ struct samd_family {
 static const struct samd_family samd_families[] = {
        { SAMD_PROCESSOR_M0, SAMD_FAMILY_D, SAMD_SERIES_20,
                samd20_parts, ARRAY_SIZE(samd20_parts),
-               (uint64_t)0xFFFF01FFFE01FF77 },
+               0xFFFF01FFFE01FF77ULL },
        { SAMD_PROCESSOR_M0, SAMD_FAMILY_D, SAMD_SERIES_21,
                samd21_parts, ARRAY_SIZE(samd21_parts),
-               (uint64_t)0xFFFF01FFFE01FF77 },
+               0xFFFF01FFFE01FF77ULL },
        { SAMD_PROCESSOR_M0, SAMD_FAMILY_D, SAMD_SERIES_09,
                samd09_parts, ARRAY_SIZE(samd09_parts),
-               (uint64_t)0xFFFF01FFFE01FF77 },
+               0xFFFF01FFFE01FF77ULL },
        { SAMD_PROCESSOR_M0, SAMD_FAMILY_D, SAMD_SERIES_10,
                samd10_parts, ARRAY_SIZE(samd10_parts),
-               (uint64_t)0xFFFF01FFFE01FF77 },
+               0xFFFF01FFFE01FF77ULL },
        { SAMD_PROCESSOR_M0, SAMD_FAMILY_D, SAMD_SERIES_11,
                samd11_parts, ARRAY_SIZE(samd11_parts),
-               (uint64_t)0xFFFF01FFFE01FF77 },
+               0xFFFF01FFFE01FF77ULL },
        { SAMD_PROCESSOR_M0, SAMD_FAMILY_L, SAMD_SERIES_21,
                saml21_parts, ARRAY_SIZE(saml21_parts),
-               (uint64_t)0xFFFF03FFFC01FF77 },
+               0xFFFF03FFFC01FF77ULL },
        { SAMD_PROCESSOR_M0, SAMD_FAMILY_L, SAMD_SERIES_22,
                saml22_parts, ARRAY_SIZE(saml22_parts),
-               (uint64_t)0xFFFF03FFFC01FF77 },
+               0xFFFF03FFFC01FF77ULL },
        { SAMD_PROCESSOR_M0, SAMD_FAMILY_C, SAMD_SERIES_20,
                samc20_parts, ARRAY_SIZE(samc20_parts),
-               (uint64_t)0xFFFF03FFFC01FF77 },
+               0xFFFF03FFFC01FF77ULL },
        { SAMD_PROCESSOR_M0, SAMD_FAMILY_C, SAMD_SERIES_21,
                samc21_parts, ARRAY_SIZE(samc21_parts),
-               (uint64_t)0xFFFF03FFFC01FF77 },
+               0xFFFF03FFFC01FF77ULL },
 };
 
 struct samd_info {
index fdd610f5f38bcbeddd3131105f046c7b67f30381..c590081fcc7f575814f882cff9ada7e3a5158197 100644 (file)
@@ -93,7 +93,7 @@
 #define SAMD_GET_DEVSEL(id) (id & 0xFF)
 
 /* Bits to mask user row */
-#define NVMUSERROW_SAM_E5_D5_MASK      ((uint64_t)0x7FFF00FF3C007FFF)
+#define NVMUSERROW_SAM_E5_D5_MASK      0x7FFF00FF3C007FFFULL
 
 struct samd_part {
        uint8_t id;

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)