2019-03-26 08:30:43 +00:00
|
|
|
#pragma once
|
2016-08-24 09:21:27 +00:00
|
|
|
|
2017-01-17 23:57:53 +00:00
|
|
|
#ifdef __cplusplus
|
2019-03-26 08:30:43 +00:00
|
|
|
extern "C" {
|
2017-01-17 23:57:53 +00:00
|
|
|
#endif
|
2016-10-25 09:05:13 +00:00
|
|
|
|
|
|
|
#ifndef __ASSEMBLER__
|
|
|
|
|
2017-01-09 08:42:45 +00:00
|
|
|
#include "esp_err.h"
|
|
|
|
|
2019-03-26 08:30:43 +00:00
|
|
|
#define ESP_WATCHPOINT_LOAD 0x40000000
|
|
|
|
#define ESP_WATCHPOINT_STORE 0x80000000
|
|
|
|
#define ESP_WATCHPOINT_ACCESS 0xC0000000
|
2017-01-10 05:05:19 +00:00
|
|
|
|
|
|
|
/**
|
2019-03-26 08:30:43 +00:00
|
|
|
* @brief If an OCD is connected over JTAG. set breakpoint 0 to the given function
|
2017-01-10 05:05:19 +00:00
|
|
|
* address. Do nothing otherwise.
|
2019-03-26 08:30:43 +00:00
|
|
|
* @param fn Pointer to the target breakpoint position
|
2017-01-10 05:05:19 +00:00
|
|
|
*/
|
2016-10-26 04:23:01 +00:00
|
|
|
void esp_set_breakpoint_if_jtag(void *fn);
|
2016-08-24 09:21:27 +00:00
|
|
|
|
2017-01-10 05:05:19 +00:00
|
|
|
/**
|
|
|
|
* @brief Set a watchpoint to break/panic when a certain memory range is accessed.
|
|
|
|
*
|
|
|
|
* @param no Watchpoint number. On the ESP32, this can be 0 or 1.
|
|
|
|
* @param adr Base address to watch
|
|
|
|
* @param size Size of the region, starting at the base address, to watch. Must
|
|
|
|
* be one of 2^n, with n in [0..6].
|
|
|
|
* @param flags One of ESP_WATCHPOINT_* flags
|
|
|
|
*
|
|
|
|
* @return ESP_ERR_INVALID_ARG on invalid arg, ESP_OK otherwise
|
|
|
|
*
|
2019-03-26 08:30:43 +00:00
|
|
|
* @warning The ESP32 watchpoint hardware watches a region of bytes by effectively
|
2017-01-10 05:05:19 +00:00
|
|
|
* masking away the lower n bits for a region with size 2^n. If adr does
|
|
|
|
* not have zero for these lower n bits, you may not be watching the
|
|
|
|
* region you intended.
|
|
|
|
*/
|
2017-01-09 08:42:45 +00:00
|
|
|
esp_err_t esp_set_watchpoint(int no, void *adr, int size, int flags);
|
2017-01-10 05:05:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Clear a watchpoint
|
|
|
|
*
|
|
|
|
* @param no Watchpoint to clear
|
|
|
|
*
|
|
|
|
*/
|
2017-01-09 08:42:45 +00:00
|
|
|
void esp_clear_watchpoint(int no);
|
|
|
|
|
2017-04-20 16:38:38 +00:00
|
|
|
/**
|
|
|
|
* @brief Checks stack pointer
|
|
|
|
*/
|
|
|
|
static inline bool esp_stack_ptr_is_sane(uint32_t sp)
|
|
|
|
{
|
|
|
|
return !(sp < 0x3ffae010UL || sp > 0x3ffffff0UL || ((sp & 0xf) != 0));
|
|
|
|
}
|
2016-08-24 09:21:27 +00:00
|
|
|
|
2019-03-26 08:30:43 +00:00
|
|
|
#endif
|
2017-01-17 23:57:53 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|