flash/nor/kinetis: prevent segfaulting with an HLA

HLAs do not provide direct DAP access, so the best we can do about it
is skipping it.

Change-Id: I877ef8fd2d86e40e7442a637cdba182cfd60e05a
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2173
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
This commit is contained in:
Paul Fertser 2014-06-15 18:33:30 +04:00 committed by Spencer Oliver
parent bbc2f13f33
commit 3aee451f27
1 changed files with 10 additions and 0 deletions

View File

@ -298,6 +298,11 @@ COMMAND_HANDLER(kinetis_mdm_mass_erase)
struct cortex_m_common *cortex_m = target_to_cm(target); struct cortex_m_common *cortex_m = target_to_cm(target);
struct adiv5_dap *dap = cortex_m->armv7m.arm.dap; struct adiv5_dap *dap = cortex_m->armv7m.arm.dap;
if (!dap) {
LOG_ERROR("Cannot perform mass erase with a high-level adapter");
return ERROR_FAIL;
}
int retval; int retval;
const uint8_t original_ap = dap->ap_current; const uint8_t original_ap = dap->ap_current;
@ -379,6 +384,11 @@ COMMAND_HANDLER(kinetis_check_flash_security_status)
struct cortex_m_common *cortex_m = target_to_cm(target); struct cortex_m_common *cortex_m = target_to_cm(target);
struct adiv5_dap *dap = cortex_m->armv7m.arm.dap; struct adiv5_dap *dap = cortex_m->armv7m.arm.dap;
if (!dap) {
LOG_WARNING("Cannot check flash security status with a high-level adapter");
return ERROR_OK;
}
uint32_t val; uint32_t val;
int retval; int retval;
const uint8_t origninal_ap = dap->ap_current; const uint8_t origninal_ap = dap->ap_current;