cortex_m: Do additional initialization during reset
SAM4L requires additional steps to be taken right after SYSRESETREQ is
issued in order to function robustly:
- CMSIS-DAP DAP driver needs to explicitly check for sticky bit
errors since it is possible for adapter to perform successful
write opration, report no errors and then, under the hood, do
some other things that will result in sticky bit being set.
- Debugger needs to wait for security system to finish
intialization and assert CDBGPWRUPACK before proceeding
This change is related to commit http://openocd.zylin.com/#/c/1995/
Change-Id: I741c95a809bfd60d930cec9482239e4796a62326
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2088
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
This commit is contained in:
committed by
Andreas Fritiofson
parent
d6fd5d0f9b
commit
ccf4d6d648
@@ -1069,6 +1069,19 @@ static int cortex_m_assert_reset(struct target *target)
|
||||
"handler to reset any peripherals or configure hardware srst support.");
|
||||
}
|
||||
|
||||
/*
|
||||
SAM4L needs to execute security initalization
|
||||
startup sequence before AP access would be enabled.
|
||||
During the intialization CDBGPWRUPACK is pulled low and we
|
||||
need to wait for it to be set to 1 again.
|
||||
*/
|
||||
retval = dap_dp_poll_register(swjdp, DP_CTRL_STAT,
|
||||
CDBGPWRUPACK, CDBGPWRUPACK, 100);
|
||||
if (retval != ERROR_OK) {
|
||||
LOG_ERROR("Failed waitnig for CDBGPWRUPACK");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
{
|
||||
/* I do not know why this is necessary, but it
|
||||
* fixes strange effects (step/resume cause NMI
|
||||
|
||||
Reference in New Issue
Block a user