Merge commit '8fb3b7b1a8d1cb2ac8b54204f452106939eb2ab7' into sam-update

# Conflicts:
#	src/target/adiv5_swdp.c
This commit is contained in:
Jason Kotzin 2022-08-10 22:17:33 -07:00
commit 7bd7c3d0f5
2 changed files with 10 additions and 11 deletions

View File

@ -160,7 +160,6 @@ void gdb_putpacket2(const char *packet1, int size1,const char *packet2, int size
{ {
int i; int i;
unsigned char csum; unsigned char csum;
unsigned char c;
char xmit_csum[3]; char xmit_csum[3];
int tries = 0; int tries = 0;
@ -185,7 +184,6 @@ void gdb_putpacket(const char *packet, int size)
{ {
int i; int i;
unsigned char csum; unsigned char csum;
unsigned char c;
char xmit_csum[3]; char xmit_csum[3];
int tries = 0; int tries = 0;
@ -219,7 +217,6 @@ void gdb_putpacket_f(const char *fmt, ...)
void gdb_out(const char *buf) void gdb_out(const char *buf)
{ {
char *hexdata; char *hexdata;
int i;
int l=strlen(buf); int l=strlen(buf);
hexdata = alloca(2*l+1); hexdata = alloca(2*l+1);

View File

@ -67,9 +67,8 @@ bool firmware_dp_low_write(ADIv5_DP_t *dp, uint16_t addr, const uint32_t data)
*/ */
int adiv5_swdp_scan(uint32_t targetid) int adiv5_swdp_scan(uint32_t targetid)
{ {
volatile struct exception e;
static bool scan_multidrop = true; static bool scan_multidrop = true;
uint32_t idcode = 0;
volatile uint32_t target_id;
ADIv5_DP_t idp = { ADIv5_DP_t idp = {
.dp_low_write = firmware_dp_low_write, .dp_low_write = firmware_dp_low_write,
.error = firmware_swdp_error, .error = firmware_swdp_error,
@ -93,11 +92,13 @@ int adiv5_swdp_scan(uint32_t targetid)
* 0x1a Arm CoreSight SW-DP activation sequence * 0x1a Arm CoreSight SW-DP activation sequence
* 20 bits start of reset another reset sequence*/ * 20 bits start of reset another reset sequence*/
initial_dp->seq_out(0x1a0, 12); initial_dp->seq_out(0x1a0, 12);
uint32_t idcode = 0;
volatile uint32_t target_id = 0;
if (!targetid || !initial_dp->dp_low_write) { if (!targetid || !initial_dp->dp_low_write) {
/* No targetID given on the command line or probe can not /* No targetID given on the command line or probe can not
* handle multi-drop. Try to read ID */ * handle multi-drop. Try to read ID */
dp_line_reset(initial_dp); dp_line_reset(initial_dp);
volatile struct exception e;
TRY_CATCH (e, EXCEPTION_ALL) { TRY_CATCH (e, EXCEPTION_ALL) {
idcode = initial_dp->dp_read(initial_dp, ADIV5_DP_IDCODE); idcode = initial_dp->dp_read(initial_dp, ADIV5_DP_IDCODE);
} }
@ -109,11 +110,11 @@ int adiv5_swdp_scan(uint32_t targetid)
initial_dp->seq_out(0xE79E, 16); /* 0b0111100111100111 */ initial_dp->seq_out(0xE79E, 16); /* 0b0111100111100111 */
dp_line_reset(initial_dp); dp_line_reset(initial_dp);
initial_dp->fault = 0; initial_dp->fault = 0;
volatile struct exception e2;
TRY_CATCH (e2, EXCEPTION_ALL) { TRY_CATCH (e, EXCEPTION_ALL) {
idcode = initial_dp->dp_read(initial_dp, ADIV5_DP_IDCODE); idcode = initial_dp->dp_read(initial_dp, ADIV5_DP_IDCODE);
} }
if (e2.type || initial_dp->fault) { if (e.type || initial_dp->fault) {
DEBUG_WARN("No usable DP found\n"); DEBUG_WARN("No usable DP found\n");
return -1; return -1;
} }
@ -150,7 +151,6 @@ int adiv5_swdp_scan(uint32_t targetid)
dp_targetid = (i << 28) | (target_id & 0x0fffffff); dp_targetid = (i << 28) | (target_id & 0x0fffffff);
initial_dp->dp_low_write(initial_dp, ADIV5_DP_TARGETSEL, initial_dp->dp_low_write(initial_dp, ADIV5_DP_TARGETSEL,
dp_targetid); dp_targetid);
volatile struct exception e;
TRY_CATCH (e, EXCEPTION_ALL) { TRY_CATCH (e, EXCEPTION_ALL) {
idcode = initial_dp->dp_read(initial_dp, ADIV5_DP_IDCODE); idcode = initial_dp->dp_read(initial_dp, ADIV5_DP_IDCODE);
} }
@ -252,8 +252,10 @@ uint32_t firmware_swdp_low_access(ADIv5_DP_t *dp, uint8_t RnW,
raise_exception(EXCEPTION_ERROR, "SWDP invalid ACK"); raise_exception(EXCEPTION_ERROR, "SWDP invalid ACK");
if(RnW) { if(RnW) {
if(dp->seq_in_parity(&response, 32)) /* Give up on parity error */ if (dp->seq_in_parity(&response, 32)) { /* Give up on parity error */
dp->fault = 1;
raise_exception(EXCEPTION_ERROR, "SWDP Parity error"); raise_exception(EXCEPTION_ERROR, "SWDP Parity error");
}
} else { } else {
dp->seq_out_parity(value, 32); dp->seq_out_parity(value, 32);
/* ARM Debug Interface Architecture Specification ADIv5.0 to ADIv5.2 /* ARM Debug Interface Architecture Specification ADIv5.0 to ADIv5.2