From: Keith Packard Date: Sun, 6 Nov 2022 03:50:58 +0000 (-0700) Subject: Add a bunch of debug output for at91 flashing X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=d1feca1b18c6d482961839ac1a5fcd45cb775267;p=fw%2Fopenocd Add a bunch of debug output for at91 flashing Change-Id: I1818f70f1bd049f22a1366e76e539e3e760aba8a Signed-off-by: Keith Packard --- diff --git a/src/flash/nor/at91samd.c b/src/flash/nor/at91samd.c index da2cfbb7a..8c9bacc5b 100644 --- a/src/flash/nor/at91samd.c +++ b/src/flash/nor/at91samd.c @@ -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) {