From 779dcf0f69e6f1a8327365d606c7771c915e4205 Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Sun, 29 Mar 2015 16:47:55 -0700 Subject: [PATCH] stm32l0: use cortexm_run_stub. --- src/stm32l0.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/stm32l0.c b/src/stm32l0.c index 695bd22..8193b12 100644 --- a/src/stm32l0.c +++ b/src/stm32l0.c @@ -372,12 +372,7 @@ static int stm32lx_nvm_prog_erase_stubbed(target *t, target_mem_write(t, STM32Lx_STUB_INFO_PHYS, &info, sizeof(info)); /* Execute stub */ - cortexm_pc_write(t, STM32Lx_STUB_PHYS); - if (target_check_error(t)) - return -1; - target_halt_resume(t, 0); - while (!target_halt_wait(t)) - ; + cortexm_run_stub(t, STM32Lx_STUB_PHYS, 0, 0, 0, 0); if (target_mem_read32(t, STM32Lx_NVM_SR(nvm)) & STM32Lx_NVM_SR_ERR_M) @@ -448,12 +443,7 @@ static int stm32lx_nvm_prog_write_stubbed(target *t, &info, sizeof(info)); /* Execute stub */ - cortexm_pc_write(t, STM32Lx_STUB_PHYS); - if (target_check_error(t)) - return -1; - target_halt_resume(t, 0); - while (!target_halt_wait(t)) - ; + cortexm_run_stub(t, STM32Lx_STUB_PHYS, 0, 0, 0, 0); if (target_mem_read32(t, STM32Lx_NVM_SR(nvm)) & STM32Lx_NVM_SR_ERR_M)