From bf9dd5c2918ab1c1af5303f8b4b26f2869d69efd Mon Sep 17 00:00:00 2001 From: dragonmux Date: Mon, 9 Dec 2024 17:15:11 +0000 Subject: [PATCH] nrf: Done a little cleanup in the nRF54L support and removed the "Nordic " part of the part strings as other target implementations do not include the MFR in the identifier for space reasons --- src/target/nrf51.c | 10 +++++----- src/target/nrf54l.c | 20 +++++++------------- src/target/nrf91.c | 2 +- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/target/nrf51.c b/src/target/nrf51.c index ecf448f35e5..d133d778762 100644 --- a/src/target/nrf51.c +++ b/src/target/nrf51.c @@ -142,14 +142,14 @@ bool nrf51_probe(target_s *t) uint32_t info_part = target_mem32_read32(t, NRF52_PART_INFO); if (info_part != 0xffffffffU && info_part != 0 && (info_part & 0x00ff000U) == 0x52000U) { uint32_t ram_size = target_mem32_read32(t, NRF52_INFO_RAM); - t->driver = "Nordic nRF52"; + t->driver = "nRF52"; t->target_options |= TOPT_INHIBIT_NRST; target_add_ram32(t, 0x20000000U, ram_size * 1024U); nrf51_add_flash(t, 0, page_size * code_size, page_size); nrf51_add_flash(t, NRF51_UICR, page_size, page_size); target_add_commands(t, nrf51_cmd_list, "nRF52"); } else { - t->driver = "Nordic nRF51"; + t->driver = "nRF51"; /* * Use the biggest RAM size seen in NRF51 fammily. * IDCODE is kept as '0', as deciphering is hard and there is later no usage. @@ -429,12 +429,12 @@ bool nrf51_ctrl_ap_probe(adiv5_access_port_s *ap) t->priv = ap; t->priv_free = (void *)adiv5_ap_unref; - uint32_t status = adiv5_ap_read(ap, CTRL_AP_PROT_EN); + const uint32_t status = adiv5_ap_read(ap, CTRL_AP_PROT_EN); status = adiv5_ap_read(ap, CTRL_AP_PROT_EN); if (status) - t->driver = "Nordic nRF52 Access Port"; + t->driver = "nRF52 Access Port"; else - t->driver = "Nordic nRF52 Access Port (protected)"; + t->driver = "nRF52 Access Port (protected)"; t->regs_size = 0; return true; diff --git a/src/target/nrf54l.c b/src/target/nrf54l.c index 099fcb6dce4..283b5b1bd38 100644 --- a/src/target/nrf54l.c +++ b/src/target/nrf54l.c @@ -81,11 +81,8 @@ static bool rram_mass_erase(target_s *const target, platform_timeout_s *const pr { target_mem32_write32(target, NRF54L_RRAMC_ERASE_ERASEALL, NRF54L_RRAMC_ERASE_ERASEALL_ERASE); - uint32_t ready; - do { - ready = target_mem32_read32(target, NRF54L_RRAMC_READY); + while (target_mem32_read32(target, NRF54L_RRAMC_READY) == NRF54L_RRAMC_READY_BUSY) target_print_progress(print_progess); - } while (ready == NRF54L_RRAMC_READY_BUSY); return true; } @@ -119,7 +116,7 @@ bool nrf54l_probe(target_s *target) switch (ap->dp->target_partno) { case NRF54L_PARTNO: - target->driver = "Nordic nRF54L"; + target->driver = "nRF54L"; target->target_options |= TOPT_INHIBIT_NRST; break; default: @@ -149,7 +146,7 @@ bool nrf54l_ctrl_ap_probe(adiv5_access_port_s *ap) return false; } - target_s *target = target_new(); + target_s *const target = target_new(); if (!target) return false; @@ -158,14 +155,14 @@ bool nrf54l_ctrl_ap_probe(adiv5_access_port_s *ap) target->priv = ap; target->priv_free = (void *)adiv5_ap_unref; - uint32_t status = adiv5_ap_read(ap, NRF54L_CTRL_AP_APPROTECT_STATUS); + const uint32_t status = adiv5_ap_read(ap, NRF54L_CTRL_AP_APPROTECT_STATUS); if (!(status & (NRF54L_CTRL_AP_APPROTECT_STATUS_APPROTECT_ENABLED | NRF54L_CTRL_AP_APPROTECT_STATUS_SECUREAPPROTECT_ENABLED))) - target->driver = "Nordic nRF54L Access Port"; + target->driver = "nRF54L Access Port"; else - target->driver = "Nordic nRF54L Access Port (protected)"; + target->driver = "nRF54L Access Port (protected)"; target->regs_size = 0U; return true; @@ -180,11 +177,8 @@ static bool nrf54l_ctrl_ap_mass_erase(target_s *const target, platform_timeout_s adiv5_ap_write(ap, NRF54L_CTRL_AP_ERASEALL, NRF54L_CTRL_AP_ERASEALL_ERASE); - uint32_t status; - do { - status = adiv5_ap_read(ap, NRF54L_CTRL_AP_ERASEALLSTATUS); + while (adiv5_ap_read(ap, NRF54L_CTRL_AP_ERASEALLSTATUS) == NRF54L_CTRL_AP_ERASEALLSTATUS_BUSY) target_print_progress(print_progess); - } while (status == NRF54L_CTRL_AP_ERASEALLSTATUS_BUSY); // Assert reset. adiv5_ap_write(ap, NRF54L_CTRL_AP_RESET, NRF54L_CTRL_AP_RESET_HARDRESET); diff --git a/src/target/nrf91.c b/src/target/nrf91.c index 170d81571a8..7d6f501827f 100644 --- a/src/target/nrf91.c +++ b/src/target/nrf91.c @@ -92,7 +92,7 @@ bool nrf91_probe(target_s *target) switch (ap->dp->target_partno) { case 0x90: - target->driver = "Nordic nRF9160"; + target->driver = "nRF9160"; target->target_options |= TOPT_INHIBIT_NRST; target_add_ram32(target, 0x20000000, 256U * 1024U); nrf91_add_flash(target, 0, 4096U * 256U, 4096U);