34 const uint32_t *code,
unsigned code_size,
37 uint8_t code_buf[code_size];
39 unsigned size = code_size + additional;
60 4, code_size / 4, code_buf);
89 uint32_t exit_var = 0;
97 static const uint32_t code_armv4_5[] = {
114 static const uint32_t code_armv7m[] = {
121 int target_code_size = 0;
122 const uint32_t *target_code_src =
NULL;
128 arm_algo = &armv7m_algo;
129 target_code_size =
sizeof(code_armv7m);
130 target_code_src = code_armv7m;
135 arm_algo = &armv4_5_algo;
136 target_code_size =
sizeof(code_armv4_5);
137 target_code_src = code_armv4_5;
172 LOG_ERROR(
"error executing hosted NAND write");
199 uint32_t exit_var = 0;
207 static const uint32_t code_armv4_5[] = {
224 static const uint32_t code_armv7m[] = {
231 int target_code_size = 0;
232 const uint32_t *target_code_src =
NULL;
238 arm_algo = &armv7m_algo;
239 target_code_size =
sizeof(code_armv7m);
240 target_code_src = code_armv7m;
245 arm_algo = &armv4_5_algo;
246 target_code_size =
sizeof(code_armv4_5);
247 target_code_src = code_armv4_5;
278 LOG_ERROR(
"error executing hosted NAND read");
void init_reg_param(struct reg_param *param, char *reg_name, uint32_t size, enum param_direction direction)
void destroy_reg_param(struct reg_param *param)
Holds the interface to ARM cores.
static int arm_code_to_working_area(struct target *target, const uint32_t *code, unsigned code_size, unsigned additional, struct working_area **area)
Copies code to a working area.
int arm_nandwrite(struct arm_nand_data *nand, uint8_t *data, int size)
ARM-specific bulk write from buffer to address of 8-bit wide NAND.
int arm_nandread(struct arm_nand_data *nand, uint8_t *data, uint32_t size)
Uses an on-chip algorithm for an ARM device to read from a NAND device and store the data into the ho...
@ ARM_NAND_READ
Read operation performed.
@ ARM_NAND_WRITE
Write operation performed.
static struct armv7m_common * target_to_armv7m(struct target *target)
#define ARMV7M_COMMON_MAGIC
static bool is_armv7m(const struct armv7m_common *armv7m)
Support functions to access arbitrary bits in a byte array.
static void buf_set_u32(uint8_t *_buffer, unsigned first, unsigned num, uint32_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
#define LOG_ERROR(expr ...)
#define LOG_DEBUG(expr ...)
#define ERROR_NAND_NO_BUFFER
Upper level NOR flash interfaces.
size_t size
Size of the control block search area.
unsigned int common_magic
enum arm_state core_state
The arm_nand_data struct is used for defining NAND I/O operations on an ARM core.
struct target * target
Target is proxy for some ARM core.
struct working_area * copy_area
The copy area holds code loop and data for I/O operations.
unsigned chunk_size
The chunk size is the page size or ECC chunk.
enum arm_nand_op op
Last operation executed using this struct.
uint32_t data
Where data is read from or written to.
Represents a generic ARM core, with standard application registers.
enum arm_arch arch
ARM architecture version.
unsigned int common_magic
int target_write_buffer(struct target *target, target_addr_t address, uint32_t size, const uint8_t *buffer)
int target_read_buffer(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
int target_write_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
Write count items of size bytes to the memory of target at the address given.
int target_alloc_working_area(struct target *target, uint32_t size, struct working_area **area)
int target_run_algorithm(struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_param, target_addr_t entry_point, target_addr_t exit_point, int timeout_ms, void *arch_info)
Downloads a target-specific native code algorithm to the target, and executes it.
void target_buffer_set_u32_array(struct target *target, uint8_t *buffer, uint32_t count, const uint32_t *srcbuf)