]> git.gag.com Git - fw/openocd/commitdiff
Add a bunch of debug output for at91 flashing
authorKeith Packard <keithp@keithp.com>
Sun, 6 Nov 2022 03:50:58 +0000 (20:50 -0700)
committerKeith Packard <keithp@keithp.com>
Sun, 6 Nov 2022 03:50:58 +0000 (20:50 -0700)
Change-Id: I1818f70f1bd049f22a1366e76e539e3e760aba8a
Signed-off-by: Keith Packard <keithp@keithp.com>
src/flash/nor/at91samd.c

index da2cfbb7a13e89e6b7828c5a374e62193b9d73dd..8c9bacc5bb513daa22cebcb3dfd22f6604151bc3 100644 (file)
@@ -853,6 +853,19 @@ static int samd_write(struct flash_bank *bank, const uint8_t *buffer,
        } else
                LOG_WARNING("automatic write mode detected");
 
+       uint32_t nvm_param;
+
+       res = target_read_u32(bank->target, SAMD_NVMCTRL + SAMD_NVMCTRL_PARAM, &nvm_param);
+
+       if (res != ERROR_OK)
+               return res;
+
+       unsigned nvm_psz = (unsigned) ((nvm_param >> 16) & 0x7);
+       unsigned nvm_nvmp = (unsigned) (nvm_param & 0xffff);
+       LOG_INFO("NVM parameter 0x%08" PRIx32 " PSZ %u NVMP %u", nvm_param, nvm_psz, nvm_nvmp);
+
+       LOG_INFO("page size %d num_pages %d", chip->page_size, chip->num_pages);
+
        while (count) {
 
                res = samd_issue_nvmctrl_command(bank->target, SAMD_NVM_CMD_PBC);
@@ -868,6 +881,9 @@ static int samd_write(struct flash_bank *bank, const uint8_t *buffer,
                address = bank->base + offset;
                pg_offset = offset % chip->page_size;
 
+               LOG_INFO("writing address 0x%08" PRIx32 " pg_offset 0x%08" PRIx32 " nb %d",
+                        address, pg_offset, nb);
+
                if (offset % 4 || (offset + nb) % 4) {
                        /* Either start or end of write is not word aligned */
                        if (!pb) {