8 #ifndef OPENOCD_TARGET_ESP_ALGORITHM_H
9 #define OPENOCD_TARGET_ESP_ALGORITHM_H
134 #define ESP_IMAGE_ELF_PHF_EXEC 0x1
335 va_start(ap, num_args);
383 va_start(ap, num_args);
398 assert(param->
size <= 64);
400 if (param->
size <= 32)
413 assert(param->
size <= 64);
415 if (param->
size <= 32)
Support functions to access arbitrary bits in a byte array.
static uint32_t buf_get_u32(const uint8_t *_buffer, unsigned int first, unsigned int num)
Retrieves num bits from _buffer, starting at the first bit, returning the bits in a 32-bit word.
static void buf_set_u32(uint8_t *_buffer, unsigned int first, unsigned int num, uint32_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
static uint64_t buf_get_u64(const uint8_t *_buffer, unsigned int first, unsigned int num)
Retrieves num bits from _buffer, starting at the first bit, returning the bits in a 64-bit word.
static void buf_set_u64(uint8_t *_buffer, unsigned int first, unsigned int num, uint64_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
static int esp_algorithm_run_onboard_func(struct target *target, struct esp_algorithm_run_data *run, target_addr_t func_addr, uint32_t num_args,...)
int esp_algorithm_exec_onboard_func_va(struct target *target, struct esp_algorithm_run_data *run, uint32_t num_args, va_list ap)
static uint64_t esp_algorithm_user_arg_get_uint(struct esp_algorithm_run_data *run, int arg_num)
Get the value of an argument passed via registers from the stub main function.
static int esp_algorithm_run_func_image_va(struct target *target, struct esp_algorithm_run_data *run, uint32_t num_args, va_list ap)
Loads and runs stub from specified image.
static int esp_algorithm_run_onboard_func_va(struct target *target, struct esp_algorithm_run_data *run, target_addr_t func_addr, uint32_t num_args, va_list ap)
Runs pre-compiled on-board function.
void(* esp_algorithm_usr_func_done_t)(struct target *target, struct esp_algorithm_run_data *run, void *usr_arg)
Algorithm's arguments cleanup function.
int esp_algorithm_load_func_image(struct target *target, struct esp_algorithm_run_data *run)
int(* esp_algorithm_usr_func_t)(struct target *target, void *usr_arg)
Host part of algorithm.
int esp_algorithm_unload_onboard_func(struct target *target, struct esp_algorithm_run_data *run)
int esp_algorithm_unload_func_image(struct target *target, struct esp_algorithm_run_data *run)
int(* esp_algorithm_func_t)(struct target *target, struct esp_algorithm_run_data *run, void *arg)
Algorithm run function.
int(* esp_algorithm_usr_func_init_t)(struct target *target, struct esp_algorithm_run_data *run, void *usr_arg)
Algorithm's arguments setup function.
static int esp_algorithm_run_func_image(struct target *target, struct esp_algorithm_run_data *run, uint32_t num_args,...)
int esp_algorithm_exec_func_image_va(struct target *target, struct esp_algorithm_run_data *run, uint32_t num_args, va_list ap)
int esp_algorithm_load_onboard_func(struct target *target, target_addr_t func_addr, struct esp_algorithm_run_data *run)
static void esp_algorithm_user_arg_set_uint(struct esp_algorithm_run_data *run, int arg_num, uint64_t val)
Set the value of an argument passed via registers to the stub main function.
size_t size
Size of the control block search area.
int(* algo_init)(struct target *target, struct esp_algorithm_run_data *run, uint32_t num_args, va_list ap)
int(* algo_cleanup)(struct target *target, struct esp_algorithm_run_data *run)
API defined below allows executing pieces of code on target without breaking the execution of the run...
uint32_t iram_len
Total reserved IRAM size.
bool reverse
IRAM DRAM address range reversed or not.
uint32_t bss_size
BSS section size.
uint32_t dram_len
Total reserved DRAM size.
uint32_t dram_org
DRAM start address in the linker script.
uint32_t iram_org
IRAM start address in the linker script.
Algorithm stub in-memory arguments.
uint32_t count
Number of memory params.
struct mem_param * params
Memory params.
Algorithm stub register arguments.
struct reg_param * params
Algorithm register params.
uint32_t first_user_param
The first several reg_params can be used by stub itself (e.g.
uint32_t count
Number of register params.
struct esp_algorithm_run_data::@96::@98 on_board
target_addr_t min_stack_addr
Pre-compiled target buffer's addr for stack.
struct esp_algorithm_reg_args reg_args
Algorithm register arguments.
struct esp_algorithm_mem_args mem_args
Algorithm memory arguments.
esp_algorithm_usr_func_init_t usr_func_init
Host side algorithm function setup routine.
esp_algorithm_usr_func_t usr_func
Host side algorithm function.
void * usr_func_arg
Host side algorithm function argument.
void * arch_info
Algorithm arch-specific info.
uint32_t timeout_ms
Algorithm completion timeout in ms.
const struct esp_algorithm_hw * hw
HW specific API.
esp_algorithm_usr_func_done_t usr_func_done
Host side algorithm function cleanup routine.
struct esp_algorithm_stub stub
Stub.
uint32_t min_stack_size
Size of the pre-alocated on-board buffer for stub's stack.
uint32_t stack_size
Algorithm stack size.
int32_t ret_code
Algorithm return code.
target_addr_t code_buf_addr
Address of pre-compiled target buffer for stub trampoline.
esp_algorithm_func_t algo_func
Algorithm run function: see algorithm_run_xxx for example.
uint32_t code_buf_size
Size of the pre-alocated on-board buffer for stub's code.
target_addr_t stack_addr
Address of the target buffer for stack.
target_addr_t tramp_addr
Address of the target buffer for stub trampoline.
void * ainfo
Algorithm's arch-specific info.
uint32_t log_buff_size
Size of the log buffer.
struct working_area * padding
Working area for padding between code and data area.
target_addr_t tramp_mapped_addr
Tramp code area will be filled from dbus.
struct working_area * data
Working area for data segment.
struct working_area * tramp
Working area for trampoline.
target_addr_t log_buff_addr
Address of the log buffer.
struct working_area * stack
Working area for stack.
target_addr_t entry
Entry addr.
struct working_area * code
Working area for code segment.