flash/stm32fxx.c: do not read CPUID as this info is stored in cortex_m_common
[openocd.git] / src / flash / nor / stm32h7x.c
index ac7d7594810627a72548bde16a816b8b10ca9d02..4c503db381fefaac3ae8a21bad3af4c51635a6f5 100644 (file)
@@ -147,7 +147,11 @@ static const struct stm32h7x_rev stm32_480_revs[] = {
        { 0x1000, "A"},
 };
 
-static uint32_t stm32x_compute_flash_cr_450(uint32_t cmd, int snb)
+static const struct stm32h7x_rev stm32_483_revs[] = {
+       { 0x1000, "A" }, { 0x1001, "Z" },
+};
+
+static uint32_t stm32x_compute_flash_cr_450_483(uint32_t cmd, int snb)
 {
        return cmd | (snb << 8);
 }
@@ -177,7 +181,7 @@ static const struct stm32h7x_part_info stm32h7x_parts[] = {
        .fsize_addr                     = 0x1FF1E880,
        .wps_group_size         = 1,
        .wps_mask                       = 0xFF,
-       .compute_flash_cr       = stm32x_compute_flash_cr_450,
+       .compute_flash_cr       = stm32x_compute_flash_cr_450_483,
        },
        {
        .id                                     = 0x480,
@@ -194,6 +198,21 @@ static const struct stm32h7x_part_info stm32h7x_parts[] = {
        .wps_mask                       = 0xFFFFFFFF,
        .compute_flash_cr       = stm32x_compute_flash_cr_480,
        },
+       {
+       .id                                     = 0x483,
+       .revs                           = stm32_483_revs,
+       .num_revs                       = ARRAY_SIZE(stm32_483_revs),
+       .device_str                     = "STM32H72x/73x",
+       .page_size_kb           = 128,
+       .block_size                     = 32,
+       .max_flash_size_kb      = 1024,
+       .max_bank_size_kb       = 1024,
+       .has_dual_bank          = false,
+       .fsize_addr                     = 0x1FF1E880,
+       .wps_group_size         = 1,
+       .wps_mask                       = 0xFF,
+       .compute_flash_cr   = stm32x_compute_flash_cr_450_483,
+       },
 };
 
 /* flash bank stm32x <base> <size> 0 0 <target#> */
@@ -804,6 +823,8 @@ static int stm32x_probe(struct flash_bank *bank)
                        /* flash size is 2M or 1M */
                        flash_size_in_kb /= 2;
                break;
+       case 0x483:
+               break;
        default:
                LOG_ERROR("unsupported device");
                return ERROR_FAIL;
@@ -895,7 +916,7 @@ static int stm32x_auto_probe(struct flash_bank *bank)
 }
 
 /* This method must return a string displaying information about the bank */
-static int stm32x_get_info(struct flash_bank *bank, char *buf, int buf_size)
+static int stm32x_get_info(struct flash_bank *bank, struct command_invocation *cmd)
 {
        struct stm32h7x_flash_bank *stm32x_info = bank->driver_priv;
        const struct stm32h7x_part_info *info = stm32x_info->part_info;
@@ -903,7 +924,7 @@ static int stm32x_get_info(struct flash_bank *bank, char *buf, int buf_size)
        if (!stm32x_info->probed) {
                int retval = stm32x_probe(bank);
                if (retval != ERROR_OK) {
-                       snprintf(buf, buf_size, "Unable to find bank information.");
+                       command_print_sameline(cmd, "Unable to find bank information.");
                        return retval;
                }
        }
@@ -917,16 +938,16 @@ static int stm32x_get_info(struct flash_bank *bank, char *buf, int buf_size)
                                rev_str = info->revs[i].str;
 
                if (rev_str != NULL) {
-                       snprintf(buf, buf_size, "%s - Rev: %s",
+                       command_print_sameline(cmd, "%s - Rev: %s",
                                stm32x_info->part_info->device_str, rev_str);
                } else {
-                       snprintf(buf, buf_size,
+                       command_print_sameline(cmd,
                                 "%s - Rev: unknown (0x%04" PRIx16 ")",
                                stm32x_info->part_info->device_str, rev_id);
                }
        } else {
-         snprintf(buf, buf_size, "Cannot identify target as a STM32H7x");
-         return ERROR_FAIL;
+               command_print_sameline(cmd, "Cannot identify target as a STM32H7x");
+               return ERROR_FAIL;
        }
        return ERROR_OK;
 }

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)