nrf51: Add command to enable flash protection

Add braces for the while loop
This commit is contained in:
Giovanni Santana 2022-07-15 12:54:01 -03:00 committed by Rachel Mant
parent 6ae846ae24
commit 1b8e522e87
1 changed files with 4 additions and 2 deletions

View File

@ -288,16 +288,18 @@ static bool nrf51_cmd_protect_flash(target *t, int argc, const char **argv)
target_mem_write32(t, NRF51_NVMC_CONFIG, NRF51_NVMC_CONFIG_WEN);
/* Poll for NVMC_READY */
while (target_mem_read32(t, NRF51_NVMC_READY) == 0)
while (target_mem_read32(t, NRF51_NVMC_READY) == 0) {
if(target_check_error(t))
return false;
}
target_mem_write32(t, NRF51_APPROTECT, 0xFFFFFF00);
/* Poll for NVMC_READY */
while (target_mem_read32(t, NRF51_NVMC_READY) == 0)
while (target_mem_read32(t, NRF51_NVMC_READY) == 0) {
if(target_check_error(t))
return false;
}
return true;
}