summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/target/arm_adi_v5.c22
-rw-r--r--src/transport/swd_core.c6
-rw-r--r--src/transport/swd_libswd_drv_openocd.c2
3 files changed, 23 insertions, 7 deletions
diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c
index b7a8d514..88a5d3b8 100644
--- a/src/target/arm_adi_v5.c
+++ b/src/target/arm_adi_v5.c
@@ -1096,9 +1096,21 @@ int ahbap_debugport_init(struct adiv5_dap *dap)
if (retval != ERROR_OK)
return retval;
- retval = dap_queue_dp_write(dap, DP_CTRL_STAT, SSTICKYERR);
- if (retval != ERROR_OK)
- return retval;
+ //Sticky Flags handling is different for JTAG and SWD.
+ //TODO: Create one function that will take care of error handling based on transport type.
+ if ((strncmp(jtag_interface->transport->name, "swd", 3)==0)) {
+ //Clear error flags on SW-DP
+ retval = dap_queue_dp_write(dap, DP_ABORT, \
+ SWD_DP_ABORT_ORUNERRCLR|SWD_DP_ABORT_WDERRCLR \
+ |SWD_DP_ABORT_STKERRCLR|SWD_DP_ABORT_STKCMPCLR);
+ if (retval != ERROR_OK)
+ return retval;
+ } else {
+ //Clear error flags on JTAG-DP
+ retval = dap_queue_dp_write(dap, DP_CTRL_STAT, SSTICKYERR);
+ if (retval != ERROR_OK)
+ return retval;
+ }
retval = dap_queue_dp_read(dap, DP_CTRL_STAT, NULL);
if (retval != ERROR_OK)
@@ -1138,6 +1150,10 @@ int ahbap_debugport_init(struct adiv5_dap *dap)
alive_sleep(10);
}
+ //TC: Here CDBGPWRUPACK|CSYSPWRUPACK still may not be set!
+ //TODO: Should we proceed anyway?
+ if (cnt>=10) LOG_ERROR("CDBGPWRUPACK|CSYSPWRUPACK FLAGS NOT SET IN RESPONSE!");
+
retval = dap_queue_dp_read(dap, DP_CTRL_STAT, NULL);
if (retval != ERROR_OK)
return retval;
diff --git a/src/transport/swd_core.c b/src/transport/swd_core.c
index f1d4168d..cc9109d6 100644
--- a/src/transport/swd_core.c
+++ b/src/transport/swd_core.c
@@ -53,7 +53,7 @@ extern struct jtag_interface *jtag_interface;
int oocd_swd_queue_idcode_read(struct adiv5_dap *dap, uint8_t *ack, uint32_t *data){
int retval;
- retval=swd_dp_read_idcode(dap->ctx, SWD_OPERATION_ENQUEUE, (int **)&data);
+ retval=swd_dp_read_idcode(dap->ctx, SWD_OPERATION_EXECUTE, (int**) &data);
if (retval<0) {
LOG_ERROR("swd_dp_read_idcode() error: %s ", swd_error_string(retval));
return ERROR_FAIL;
@@ -62,7 +62,7 @@ int oocd_swd_queue_idcode_read(struct adiv5_dap *dap, uint8_t *ack, uint32_t *da
int oocd_swd_queue_dp_read(struct adiv5_dap *dap, unsigned reg, uint32_t *data){
int retval;
- retval=swd_dp_read((swd_ctx_t *)dap->ctx, SWD_OPERATION_ENQUEUE, reg, (int **)&data);
+ retval=swd_dp_read((swd_ctx_t *)dap->ctx, SWD_OPERATION_EXECUTE, reg, (int**) &data);
if (retval<0){
LOG_ERROR("swd_dp_read() error: %s ", swd_error_string(retval));
return ERROR_FAIL;
@@ -82,7 +82,7 @@ int oocd_swd_queue_dp_write(struct adiv5_dap *dap, unsigned reg, uint32_t data){
int oocd_swd_queue_ap_read(struct adiv5_dap *dap, unsigned reg, uint32_t *data){
int retval;
- retval=swd_ap_read((swd_ctx_t *)dap->ctx, SWD_OPERATION_ENQUEUE, (char) reg, (int **) &data);
+ retval=swd_ap_read((swd_ctx_t *)dap->ctx, SWD_OPERATION_EXECUTE, (char) reg, (int**) &data);
if (retval<0){
LOG_ERROR("swd_ap_read() error: %s ", swd_error_string(retval));
return ERROR_FAIL;
diff --git a/src/transport/swd_libswd_drv_openocd.c b/src/transport/swd_libswd_drv_openocd.c
index a357bad3..2066d5b3 100644
--- a/src/transport/swd_libswd_drv_openocd.c
+++ b/src/transport/swd_libswd_drv_openocd.c
@@ -227,7 +227,7 @@ int swd_log_level_inherit(swd_ctx_t *swdctx, int loglevel){
swd_loglevel_t new_swdlevel;
switch ((loglevel==-1)?debug_level:loglevel){
case LOG_LVL_DEBUG:
- new_swdlevel=SWD_LOGLEVEL_DEBUG;
+ new_swdlevel=SWD_LOGLEVEL_PAYLOAD;
break;
case LOG_LVL_INFO:
new_swdlevel=SWD_LOGLEVEL_INFO;