mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-01 23:51:49 +01:00
semihosting: version 2
This commit is contained in:
@@ -19,7 +19,7 @@ extern "C" {
|
||||
* @param addr address of apptrace control data block
|
||||
* @return return 0 on sucess or non-zero error code
|
||||
*/
|
||||
#define ESP_SEMIHOSTING_SYS_APPTRACE_INIT 0x64
|
||||
#define ESP_SEMIHOSTING_SYS_APPTRACE_INIT 0x101
|
||||
|
||||
/**
|
||||
* @brief Initialize debug stubs table at host side
|
||||
@@ -27,7 +27,7 @@ extern "C" {
|
||||
* @param addr address of debug stubs table
|
||||
* @return return 0 on sucess or non-zero error code
|
||||
*/
|
||||
#define ESP_SEMIHOSTING_SYS_DBG_STUBS_INIT 0x65
|
||||
#define ESP_SEMIHOSTING_SYS_DBG_STUBS_INIT 0x102
|
||||
|
||||
/**
|
||||
* @brief Set/clear breakpoint
|
||||
@@ -37,7 +37,7 @@ extern "C" {
|
||||
* @param addr address to set breakpoint at. Ignored if `set` is false.
|
||||
* @return return 0 on sucess or non-zero error code
|
||||
*/
|
||||
#define ESP_SEMIHOSTING_SYS_BREAKPOINT_SET 0x66
|
||||
#define ESP_SEMIHOSTING_SYS_BREAKPOINT_SET 0x103
|
||||
|
||||
/**
|
||||
* @brief Set/clear watchpoint
|
||||
@@ -49,7 +49,7 @@ extern "C" {
|
||||
* @param flags watchpoint flags, see description below. Ignored if `set` is false.
|
||||
* @return return 0 on sucess or non-zero error code
|
||||
*/
|
||||
#define ESP_SEMIHOSTING_SYS_WATCHPOINT_SET 0x67
|
||||
#define ESP_SEMIHOSTING_SYS_WATCHPOINT_SET 0x104
|
||||
|
||||
/* bit values for `flags` argument of ESP_SEMIHOSTING_SYS_WATCHPOINT_SET call. Can be ORed. */
|
||||
/* watch for 'reads' at `addr` */
|
||||
@@ -85,31 +85,6 @@ static inline long semihosting_call_noerrno(long id, long *data)
|
||||
return a0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Perform semihosting call and retrieve errno
|
||||
*
|
||||
* @param id semihosting call number
|
||||
* @param data data block to pass to the host; number of items and their
|
||||
* meaning depends on the semihosting call. See the spec for
|
||||
* details.
|
||||
* @param[out] out_errno output, errno value from the host. Only set if
|
||||
* the return value is negative.
|
||||
* @return return value from the host
|
||||
*/
|
||||
static inline long semihosting_call(long id, long *data, int *out_errno)
|
||||
{
|
||||
long ret = semihosting_call_noerrno(id, data);
|
||||
if (ret < 0) {
|
||||
/* Constant also defined in openocd_semihosting.h,
|
||||
* which is common for RISC-V and Xtensa; it is not included here
|
||||
* to avoid a circular dependency.
|
||||
*/
|
||||
const int semihosting_sys_errno = 0x13;
|
||||
*out_errno = (int) semihosting_call_noerrno(semihosting_sys_errno, NULL);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user