From 8e99e8ec4d262d08cf6211d5dd7251b5ee2f34ad Mon Sep 17 00:00:00 2001 From: dragonmux Date: Sat, 6 Aug 2022 02:46:20 +0100 Subject: [PATCH] rp: Added some debugging to the SFDP read routine to aid with SFDP failures --- src/target/rp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/target/rp.c b/src/target/rp.c index f7717de..16ba0fe 100644 --- a/src/target/rp.c +++ b/src/target/rp.c @@ -157,6 +157,14 @@ static bool rp_mass_erase(target *t); static void rp_spi_read_sfdp(target *const t, const uint32_t address, void *const buffer, const size_t length) { rp_spi_read(t, SPI_FLASH_CMD_READ_SFDP, address, buffer, length); +#if ENABLE_DEBUG + DEBUG_INFO("%" PRIu32 " byte SFDP read at 0x%" PRIx32 ":\n", (uint32_t)length, address); + const uint8_t *const data = buffer; + for (size_t i = 0; i < length; i += 8U) { + DEBUG_INFO("\t%02x %02x %02x %02x %02x %02x %02x %02x\n", data[i + 0], data[i + 1], data[i + 2], data[i + 3], + data[i + 4], data[i + 5], data[i + 6], data[i + 7]); + } +#endif } static void rp_add_flash(target *t, uint32_t addr, size_t length)