Skip to content

Commit

Permalink
nrf: Done a little cleanup in the nRF54L support and removed the "Nor…
Browse files Browse the repository at this point in the history
…dic " part of the part strings as other target implementations do not include the MFR in the identifier for space reasons
  • Loading branch information
dragonmux committed Dec 9, 2024
1 parent e56e624 commit bf9dd5c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
10 changes: 5 additions & 5 deletions src/target/nrf51.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down
20 changes: 7 additions & 13 deletions src/target/nrf54l.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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;

Expand All @@ -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;
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/target/nrf91.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit bf9dd5c

Please sign in to comment.