xmc4xxx: Integrate build of erase check code
[openocd.git] / src / flash / nor / xmc4xxx.c
index f47995079923b2b4d58c8fc4e15dba402ff34b5c..f676e8cdeb7fc038ab2254a3f6f4070f06fdfe3b 100644 (file)
 
 /* Flash controller configuration values */
 #define FLASH_ID_XMC4500        0xA2
+#define FLASH_ID_XMC4700_4800   0x92
 #define FLASH_ID_XMC4100_4200   0x9C
 #define FLASH_ID_XMC4400        0x9F
 
@@ -239,18 +240,22 @@ struct xmc4xxx_command_seq {
 };
 
 /* Sector capacities.  See section 8 of xmc4x00_rm */
-static unsigned int sector_capacity_8[] = {
+static const unsigned int sector_capacity_8[8] = {
        16, 16, 16, 16, 16, 16, 16, 128
 };
 
-static unsigned int sector_capacity_9[] = {
+static const unsigned int sector_capacity_9[9] = {
        16, 16, 16, 16, 16, 16, 16, 128, 256
 };
 
-static unsigned int sector_capacity_12[] = {
+static const unsigned int sector_capacity_12[12] = {
        16, 16, 16, 16, 16, 16, 16, 16, 128, 256, 256, 256
 };
 
+static const unsigned int sector_capacity_16[16] = {
+       16, 16, 16, 16, 16, 16, 16, 16, 128, 256, 256, 256, 256, 256, 256, 256
+};
+
 static int xmc4xxx_write_command_sequence(struct flash_bank *bank,
                                         struct xmc4xxx_command_seq *seq,
                                         int seq_len)
@@ -269,7 +274,7 @@ static int xmc4xxx_write_command_sequence(struct flash_bank *bank,
 
 static int xmc4xxx_load_bank_layout(struct flash_bank *bank)
 {
-       unsigned int *capacity = NULL;
+       const unsigned int *capacity = NULL;
 
        /* At this point, we know which flash controller ID we're
         * talking to and simply need to fill out the bank structure accordingly */
@@ -285,6 +290,9 @@ static int xmc4xxx_load_bank_layout(struct flash_bank *bank)
        case 12:
                capacity = sector_capacity_12;
                break;
+       case 16:
+               capacity = sector_capacity_16;
+               break;
        default:
                LOG_ERROR("Unexpected number of sectors, %d\n",
                          bank->num_sectors);
@@ -373,6 +381,10 @@ static int xmc4xxx_probe(struct flash_bank *bank)
                bank->num_sectors = 12;
                LOG_DEBUG("XMC4xxx: XMC4500 detected.");
                break;
+       case FLASH_ID_XMC4700_4800:
+               bank->num_sectors = 16;
+               LOG_DEBUG("XMC4xxx: XMC4700/4800 detected.");
+               break;
        default:
                LOG_ERROR("XMC4xxx: Unexpected flash ID. got %02" PRIx8,
                          flash_id);
@@ -616,16 +628,8 @@ int xmc4xxx_blank_check_memory(struct target *target,
        struct armv7m_algorithm armv7m_info;
        int retval;
 
-       /* see contrib/loaders/erase_check/armv7m_0_erase_check.s for src */
-
        static const uint8_t erase_check_code[] = {
-               /* loop: */
-               0x03, 0x78,             /* ldrb r3, [r0] */
-               0x01, 0x30,             /* adds r0, #1 */
-               0x1A, 0x43,             /* orrs r2, r2, r3 */
-               0x01, 0x39,             /* subs r1, r1, #1 */
-               0xFA, 0xD1,             /* bne  loop */
-               0x00, 0xBE              /* bkpt #0 */
+#include "../../../contrib/loaders/erase_check/armv7m_0_erase_check.inc"
        };
 
        /* make sure we have a working area */
@@ -971,6 +975,24 @@ static int xmc4xxx_get_info_command(struct flash_bank *bank, char *buf, int buf_
                        break;
                }
                break;
+       case 0x700:
+               dev_str = "XMC4700";
+
+               switch (rev_id) {
+               case 0x1:
+                       rev_str = "EES-AA";
+                       break;
+               }
+               break;
+       case 0x800:
+               dev_str = "XMC4800";
+
+               switch (rev_id) {
+               case 0x1:
+                       rev_str = "EES-AA";
+                       break;
+               }
+               break;
 
        default:
                snprintf(buf, buf_size,

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)