Merge commit 'a4cdd6b3103cdf6c1f8454fb81558ff98a8d912d' into sam-update

This commit is contained in:
Jason Kotzin 2022-08-10 17:36:48 -07:00
commit 09e45cea5b
5 changed files with 24 additions and 8 deletions

View File

@ -30,7 +30,12 @@ void dap_adiv5_dp_defaults(ADIv5_DP_t *dp);
int cmsis_dap_jtagtap_init(jtag_proc_t *jtag_proc); int cmsis_dap_jtagtap_init(jtag_proc_t *jtag_proc);
int dap_jtag_dp_init(ADIv5_DP_t *dp); int dap_jtag_dp_init(ADIv5_DP_t *dp);
#else #else
int dap_init(bmp_info_t *info) {(void)info; return -1;} int dap_init(bmp_info_t *info)
{
DEBUG_WARN("FATAL: Missing hidapi-libusb\n");
(void)info;
return -1;
}
int dap_enter_debug_swd(ADIv5_DP_t *dp) {(void)dp; return -1;} int dap_enter_debug_swd(ADIv5_DP_t *dp) {(void)dp; return -1;}
void dap_exit_function(void) {return;}; void dap_exit_function(void) {return;};
void dap_adiv5_dp_defaults(ADIv5_DP_t *dp) {(void)dp; return; } void dap_adiv5_dp_defaults(ADIv5_DP_t *dp) {(void)dp; return; }

View File

@ -92,7 +92,7 @@ static int line_reset(bmp_info_t *info)
data[13] = 0xa5; data[13] = 0xa5;
data[18] = 0; data[18] = 0;
uint8_t res[18]; uint8_t res[19];
send_recv(info->usb_link, cmd, 42, res, 19); send_recv(info->usb_link, cmd, 42, res, 19);
send_recv(info->usb_link, NULL, 0, res, 1); send_recv(info->usb_link, NULL, 0, res, 1);

View File

@ -213,6 +213,8 @@ static int find_debuggers( BMP_CL_OPTIONS_t *cl_opts,bmp_info_t *info)
report = true; report = true;
goto rescan; goto rescan;
} else { } else {
if (found_debuggers > 0)
access_problems = false;
found_debuggers = 0; found_debuggers = 0;
} }
} }

View File

@ -23,7 +23,7 @@ SRC += cdcacm.c \
timing.c \ timing.c \
timing_stm32.c \ timing_stm32.c \
all: blackmagic.bin blackmagic.hex blackmagic.dfu all: blackmagic.bin blackmagic.hex
blackmagic.dfu: blackmagic.hex blackmagic.dfu: blackmagic.hex
@echo Creating $@ @echo Creating $@

View File

@ -468,14 +468,25 @@ void adiv5_dp_init(ADIv5_DP_t *dp)
ctrlstat = adiv5_dp_read(dp, ADIV5_DP_CTRLSTAT); ctrlstat = adiv5_dp_read(dp, ADIV5_DP_CTRLSTAT);
} }
platform_timeout timeout;
platform_timeout_set(&timeout, 201);
/* Write request for system and debug power up */ /* Write request for system and debug power up */
adiv5_dp_write(dp, ADIV5_DP_CTRLSTAT, adiv5_dp_write(dp, ADIV5_DP_CTRLSTAT,
ctrlstat |= ADIV5_DP_CTRLSTAT_CSYSPWRUPREQ | ctrlstat |= ADIV5_DP_CTRLSTAT_CSYSPWRUPREQ |
ADIV5_DP_CTRLSTAT_CDBGPWRUPREQ); ADIV5_DP_CTRLSTAT_CDBGPWRUPREQ);
/* Wait for acknowledge */ /* Wait for acknowledge */
while(((ctrlstat = adiv5_dp_read(dp, ADIV5_DP_CTRLSTAT)) & while(1) {
(ADIV5_DP_CTRLSTAT_CSYSPWRUPACK | ADIV5_DP_CTRLSTAT_CDBGPWRUPACK)) != ctrlstat = adiv5_dp_read(dp, ADIV5_DP_CTRLSTAT);
(ADIV5_DP_CTRLSTAT_CSYSPWRUPACK | ADIV5_DP_CTRLSTAT_CDBGPWRUPACK)); uint32_t check = ctrlstat & (ADIV5_DP_CTRLSTAT_CSYSPWRUPACK |
ADIV5_DP_CTRLSTAT_CDBGPWRUPACK);
if (check == (ADIV5_DP_CTRLSTAT_CSYSPWRUPACK |
ADIV5_DP_CTRLSTAT_CDBGPWRUPACK))
break;
if (platform_timeout_is_expired(&timeout)) {
DEBUG_INFO("DEBUG Power-Up failed\n");
return;
}
}
/* This AP reset logic is described in ADIv5, but fails to work /* This AP reset logic is described in ADIv5, but fails to work
* correctly on STM32. CDBGRSTACK is never asserted, and we * correctly on STM32. CDBGRSTACK is never asserted, and we
@ -486,8 +497,6 @@ void adiv5_dp_init(ADIv5_DP_t *dp)
adiv5_dp_write(dp, ADIV5_DP_CTRLSTAT, adiv5_dp_write(dp, ADIV5_DP_CTRLSTAT,
ctrlstat |= ADIV5_DP_CTRLSTAT_CDBGRSTREQ); ctrlstat |= ADIV5_DP_CTRLSTAT_CDBGRSTREQ);
platform_timeout timeout;
platform_timeout_set(&timeout, 101);
/* Write request for debug reset release */ /* Write request for debug reset release */
adiv5_dp_write(dp, ADIV5_DP_CTRLSTAT, adiv5_dp_write(dp, ADIV5_DP_CTRLSTAT,
ctrlstat &= ~ADIV5_DP_CTRLSTAT_CDBGRSTREQ); ctrlstat &= ~ADIV5_DP_CTRLSTAT_CDBGRSTREQ);