|
|
@@ -21,46 +21,30 @@
|
|
|
|
|
|
#include "soc/cpu_caps.h"
|
|
|
|
|
|
+#if SOC_CPU_BREAKPOINTS_NUM > 0
|
|
|
esp_err_t cpu_hal_set_breakpoint(int id, const void* addr)
|
|
|
{
|
|
|
-#if SOC_CPU_BREAKPOINTS_NUM != 0
|
|
|
- if (id >= SOC_CPU_BREAKPOINTS_NUM || id < 0) {
|
|
|
- return ESP_ERR_INVALID_ARG;
|
|
|
- }
|
|
|
-
|
|
|
+ assert(id < SOC_CPU_BREAKPOINTS_NUM && id >= 0);
|
|
|
cpu_ll_set_breakpoint(id, cpu_ll_ptr_to_pc(addr));
|
|
|
-
|
|
|
return ESP_OK;
|
|
|
-#else
|
|
|
- return ESP_ERR_NOT_SUPPORTED;
|
|
|
-#endif
|
|
|
}
|
|
|
|
|
|
esp_err_t cpu_hal_clear_breakpoint(int id)
|
|
|
{
|
|
|
-#if SOC_CPU_BREAKPOINTS_NUM > 0
|
|
|
- if (id >= SOC_CPU_BREAKPOINTS_NUM || id < 0) {
|
|
|
- return ESP_ERR_INVALID_ARG;
|
|
|
- }
|
|
|
-
|
|
|
+ assert(id < SOC_CPU_BREAKPOINTS_NUM && id >= 0);
|
|
|
cpu_ll_clear_breakpoint(id);
|
|
|
-
|
|
|
return ESP_OK;
|
|
|
-#else
|
|
|
- return ESP_ERR_NOT_SUPPORTED;
|
|
|
-#endif
|
|
|
}
|
|
|
+#endif // SOC_CPU_BREAKPOINTS_NUM > 0
|
|
|
|
|
|
+#if SOC_CPU_WATCHPOINTS_NUM > 0
|
|
|
esp_err_t cpu_hal_set_watchpoint(int id, const void* addr, size_t size, watchpoint_trigger_t trigger)
|
|
|
{
|
|
|
-#if SOC_CPU_WATCHPOINTS_NUM > 0
|
|
|
- if (id >= SOC_CPU_WATCHPOINTS_NUM || id < 0) {
|
|
|
- return ESP_ERR_INVALID_ARG;
|
|
|
- }
|
|
|
-
|
|
|
- if (size > SOC_CPU_WATCHPOINT_SIZE) {
|
|
|
- return ESP_ERR_INVALID_ARG;
|
|
|
- }
|
|
|
+ assert(id < SOC_CPU_WATCHPOINTS_NUM && id >= 0);
|
|
|
+ assert(size <= SOC_CPU_WATCHPOINT_SIZE);
|
|
|
+ assert(trigger == WATCHPOINT_TRIGGER_ON_RO ||
|
|
|
+ trigger == WATCHPOINT_TRIGGER_ON_WO ||
|
|
|
+ trigger == WATCHPOINT_TRIGGER_ON_RW);
|
|
|
|
|
|
bool on_read = false, on_write = false;
|
|
|
|
|
|
@@ -75,22 +59,12 @@ esp_err_t cpu_hal_set_watchpoint(int id, const void* addr, size_t size, watchpoi
|
|
|
cpu_ll_set_watchpoint(id, addr, size, on_read, on_write);
|
|
|
|
|
|
return ESP_OK;
|
|
|
-#else
|
|
|
- return ESP_ERR_NOT_SUPPORTED;
|
|
|
-#endif
|
|
|
}
|
|
|
|
|
|
esp_err_t cpu_hal_clear_watchpoint(int id)
|
|
|
{
|
|
|
-#if SOC_CPU_WATCHPOINTS_NUM > 0
|
|
|
- if (id >= SOC_CPU_WATCHPOINTS_NUM || id < 0) {
|
|
|
- return ESP_ERR_INVALID_ARG;
|
|
|
- }
|
|
|
-
|
|
|
+ assert(id < SOC_CPU_WATCHPOINTS_NUM && id >= 0);
|
|
|
cpu_ll_clear_watchpoint(id);
|
|
|
-
|
|
|
return ESP_OK;
|
|
|
-#else
|
|
|
- return ESP_ERR_NOT_SUPPORTED;
|
|
|
-#endif
|
|
|
-}
|
|
|
+}
|
|
|
+#endif // SOC_CPU_WATCHPOINTS_NUM > 0
|