diff --git a/src/platforms/hosted/cmsis_dap.h b/src/platforms/hosted/cmsis_dap.h index 10b19697..6668ac3e 100644 --- a/src/platforms/hosted/cmsis_dap.h +++ b/src/platforms/hosted/cmsis_dap.h @@ -30,7 +30,12 @@ void dap_adiv5_dp_defaults(ADIv5_DP_t *dp); int cmsis_dap_jtagtap_init(jtag_proc_t *jtag_proc); int dap_jtag_dp_init(ADIv5_DP_t *dp); #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;} void dap_exit_function(void) {return;}; void dap_adiv5_dp_defaults(ADIv5_DP_t *dp) {(void)dp; return; } diff --git a/src/platforms/hosted/jlink_adiv5_swdp.c b/src/platforms/hosted/jlink_adiv5_swdp.c index 5e7ba3bc..b9deabb2 100644 --- a/src/platforms/hosted/jlink_adiv5_swdp.c +++ b/src/platforms/hosted/jlink_adiv5_swdp.c @@ -92,7 +92,7 @@ static int line_reset(bmp_info_t *info) data[13] = 0xa5; 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, NULL, 0, res, 1); diff --git a/src/platforms/hosted/platform.c b/src/platforms/hosted/platform.c index cd6fe65e..631fa49c 100644 --- a/src/platforms/hosted/platform.c +++ b/src/platforms/hosted/platform.c @@ -213,6 +213,8 @@ static int find_debuggers( BMP_CL_OPTIONS_t *cl_opts,bmp_info_t *info) report = true; goto rescan; } else { + if (found_debuggers > 0) + access_problems = false; found_debuggers = 0; } } diff --git a/src/platforms/hydrabus/Makefile.inc b/src/platforms/hydrabus/Makefile.inc index ac96637d..24d43fa1 100644 --- a/src/platforms/hydrabus/Makefile.inc +++ b/src/platforms/hydrabus/Makefile.inc @@ -23,7 +23,7 @@ SRC += cdcacm.c \ timing.c \ timing_stm32.c \ -all: blackmagic.bin blackmagic.hex blackmagic.dfu +all: blackmagic.bin blackmagic.hex blackmagic.dfu: blackmagic.hex @echo Creating $@ diff --git a/src/target/adiv5.c b/src/target/adiv5.c index 8b04f013..63e3c75d 100644 --- a/src/target/adiv5.c +++ b/src/target/adiv5.c @@ -468,14 +468,25 @@ void adiv5_dp_init(ADIv5_DP_t *dp) ctrlstat = adiv5_dp_read(dp, ADIV5_DP_CTRLSTAT); } + platform_timeout timeout; + platform_timeout_set(&timeout, 201); /* Write request for system and debug power up */ adiv5_dp_write(dp, ADIV5_DP_CTRLSTAT, ctrlstat |= ADIV5_DP_CTRLSTAT_CSYSPWRUPREQ | ADIV5_DP_CTRLSTAT_CDBGPWRUPREQ); /* Wait for acknowledge */ - while(((ctrlstat = adiv5_dp_read(dp, ADIV5_DP_CTRLSTAT)) & - (ADIV5_DP_CTRLSTAT_CSYSPWRUPACK | ADIV5_DP_CTRLSTAT_CDBGPWRUPACK)) != - (ADIV5_DP_CTRLSTAT_CSYSPWRUPACK | ADIV5_DP_CTRLSTAT_CDBGPWRUPACK)); + while(1) { + ctrlstat = adiv5_dp_read(dp, ADIV5_DP_CTRLSTAT); + 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 * 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, ctrlstat |= ADIV5_DP_CTRLSTAT_CDBGRSTREQ); - platform_timeout timeout; - platform_timeout_set(&timeout, 101); /* Write request for debug reset release */ adiv5_dp_write(dp, ADIV5_DP_CTRLSTAT, ctrlstat &= ~ADIV5_DP_CTRLSTAT_CDBGRSTREQ);