semihosting: improve semihosting opcode debug messages

This patch introduces function semihosting_opcode_to_str() which
converts semihosting opcodes to strings. This function is then
used in debug messages to improve log analysis and troubleshooting.

Change-Id: Iffea49dae13d6a626ae0db40d379cba3c9ea5bd3
Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7726
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
This commit is contained in:
Marek Vrbka
2023-05-30 15:36:12 +02:00
committed by Antonio Borneo
parent eebcf3cff1
commit 6ef75352f1
2 changed files with 75 additions and 4 deletions

View File

@@ -65,6 +65,8 @@ enum semihosting_operation_numbers {
SEMIHOSTING_SYS_WRITE = 0x05,
SEMIHOSTING_SYS_WRITEC = 0x03,
SEMIHOSTING_SYS_WRITE0 = 0x04,
SEMIHOSTING_ARM_RESERVED_START = 0x32,
SEMIHOSTING_ARM_RESERVED_END = 0xFF,
SEMIHOSTING_USER_CMD_0X100 = 0x100, /* First user cmd op code */
SEMIHOSTING_USER_CMD_0X107 = 0x107, /* Last supported user cmd op code */
SEMIHOSTING_USER_CMD_0X1FF = 0x1FF, /* Last user cmd op code */
@@ -186,6 +188,13 @@ struct semihosting {
int (*post_result)(struct target *target);
};
/**
* @brief Convert the syscall opcode to a human-readable string
* @param[in] opcode Syscall opcode
* @return String representation of syscall opcode
*/
const char *semihosting_opcode_to_str(uint64_t opcode);
int semihosting_common_init(struct target *target, void *setup,
void *post_result);
int semihosting_common(struct target *target);