0
0
Fork 0

fix(dap): fix the debug clok of esp32/esp32c3 at low speed

This commit is contained in:
windowsair 2022-10-29 13:59:24 +08:00
parent ab95979ad8
commit 9d3f7efb40
2 changed files with 11 additions and 3 deletions

View File

@ -261,6 +261,8 @@ python ./idf.py -p /dev/ttyS5 flash
The following example shows a possible way to build: The following example shows a possible way to build:
```bash ```bash
# Set build target
idf.py set-target esp32
# Build # Build
idf.py build idf.py build
# Flash # Flash

View File

@ -412,10 +412,16 @@ static uint32_t DAP_SWJ_Clock(const uint8_t *request, uint8_t *response) {
DAP_Data.fast_clock = 0U; DAP_Data.fast_clock = 0U;
SWD_TransferSpeed = kTransfer_GPIO_normal; SWD_TransferSpeed = kTransfer_GPIO_normal;
////FIXME: esp32
#define CPU_CLOCK_FIXED 80000000
delay = ((CPU_CLOCK_FIXED/2U) + (clock - 1U)) / clock; #ifdef CONFIG_IDF_TARGET_ESP8266
#define BUS_CLOCK_FIXED 80000000
#elif defined CONFIG_IDF_TARGET_ESP32
#define BUS_CLOCK_FIXED 100000000
#elif defined CONFIG_IDF_TARGET_ESP32C3
#define BUS_CLOCK_FIXED 80000000
#endif
delay = ((BUS_CLOCK_FIXED/2U) + (clock - 1U)) / clock;
if (delay > IO_PORT_WRITE_CYCLES) { if (delay > IO_PORT_WRITE_CYCLES) {
delay -= IO_PORT_WRITE_CYCLES; delay -= IO_PORT_WRITE_CYCLES;
delay = (delay + (DELAY_SLOW_CYCLES - 1U)) / DELAY_SLOW_CYCLES; delay = (delay + (DELAY_SLOW_CYCLES - 1U)) / DELAY_SLOW_CYCLES;