diff --git a/README.md b/README.md index c173e43..4cd9f49 100644 --- a/README.md +++ b/README.md @@ -261,6 +261,8 @@ python ./idf.py -p /dev/ttyS5 flash The following example shows a possible way to build: ```bash +# Set build target +idf.py set-target esp32 # Build idf.py build # Flash diff --git a/components/DAP/source/DAP.c b/components/DAP/source/DAP.c index 8feaf7a..a6daaee 100644 --- a/components/DAP/source/DAP.c +++ b/components/DAP/source/DAP.c @@ -412,10 +412,16 @@ static uint32_t DAP_SWJ_Clock(const uint8_t *request, uint8_t *response) { DAP_Data.fast_clock = 0U; 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) { delay -= IO_PORT_WRITE_CYCLES; delay = (delay + (DELAY_SLOW_CYCLES - 1U)) / DELAY_SLOW_CYCLES;