u8* buf_cpy(u8 *from, u8 *to, int size)
{
- int num_bytes = CEIL(size, 8);
+ unsigned int num_bytes = CEIL(size, 8);
unsigned int i;
if (from == NULL)
int str_to_buf(const char *str, int str_len, u8 *buf, int buf_len, int radix)
{
char *charbuf;
- u32 tmp;
+ char tmp;
float factor;
u8 *b256_buf;
int b256_len;
jteap = tap->event_action;
/* replace existing? */
while (jteap) {
- if (jteap->event == n->value) {
+ if (jteap->event == (enum jtag_tap_event)n->value) {
break;
}
jteap = jteap->next;
USB_TIMEOUT_MS
);
- if(usb_ret < sizeof(usb_buffer)) {
+ if((size_t)usb_ret < sizeof(usb_buffer)) {
break;
}
buffer += sizeof(*header);
length -= sizeof(*header);
- if(length < header->length + 1) {
+ if(length < (size_t)header->length + 1) {
LOG_ERROR("Malformed DTC image\n");
exit(1);
}
struct {
dtc_reply_queue_entry_t *rq_head;
dtc_reply_queue_entry_t *rq_tail;
- int cmd_index;
- int reply_index;
+ u32 cmd_index;
+ u32 reply_index;
u8 cmd_buffer[USB_EP2BANK_SIZE];
} dtc_queue;
static
struct {
- int length;
+ u32 length;
u32 buffer;
} tap_state_queue;
virtex2_pld_device_t *virtex2_info = pld_device->driver_priv;
xilinx_bit_file_t bit_file;
int retval;
- int i;
+ unsigned int i;
scan_field_t field;
int read_section(FILE *input_file, int length_size, char section, u32 *buffer_length, u8 **buffer)
{
u8 length_buffer[4];
- u32 length;
+ int length;
char section_char;
int read_count;
char local_buffer[1024];
local_buffer[0] = '$';
- if (len+4 <= sizeof(local_buffer))
+ if ((size_t)len + 4 <= sizeof(local_buffer))
{
/* performance gain on smaller packets by only a single call to gdb_write() */
memcpy(local_buffer+1, buffer, len++);
{
hex_buffer = malloc(len * 2 + 1);
- int i;
+ u32 i;
for (i = 0; i < len; i++)
{
u8 t = buffer[i];
u8 *buffer;
- int i;
+ u32 i;
int retval;
/* skip command character */
int gdb_calc_blocksize(flash_bank_t *bank)
{
- int i;
- int block_size = 0xffffffff;
+ u32 i;
+ u32 block_size = 0xffffffff;
/* loop through all sectors and return smallest sector size */
- for (i = 0; i < bank->num_sectors; i++)
+ for (i = 0; i < (u32)bank->num_sectors; i++)
{
if (bank->sectors[i].size < block_size)
block_size = bank->sectors[i].size;
"ABSENT"
};
-char *svf_tap_state_name[16];
+char *svf_tap_state_name[TAP_NUM_STATES];
#define XXR_TDI (1 << 0)
#define XXR_TDO (1 << 1)
svf_buffer_size = 2 * SVF_MAX_BUFFER_SIZE_TO_COMMIT;
memcpy(&svf_para, &svf_para_init, sizeof(svf_para));
- for (i = 0; i < dimof(svf_tap_state_name); i++)
+ for (i = 0; i < (int)dimof(svf_tap_state_name); i++)
{
svf_tap_state_name[i] = (char *)tap_state_name(i);
}
static int svf_tap_state_is_valid(tap_state_t state)
{
- return ((state >= 0) && (state < sizeof(svf_tap_state_name)));
+ return state >= 0 && state < TAP_NUM_STATES;
}
static int svf_find_string_in_array(char *str, char **strs, int num_of_element)
typedef struct arm720t_common_s
{
- int common_magic;
+ u32 common_magic;
armv4_5_mmu_common_t armv4_5_mmu;
arm7tdmi_common_t arm7tdmi_common;
u32 cp15_control_reg;
arm7_9_common_t *arm7_9 = armv4_5->arch_info;
arm_jtag_t *jtag_info = &arm7_9->jtag_info;
u32 *data;
- int i, retval = ERROR_OK;
+ int retval = ERROR_OK;
+ u32 i;
data = malloc(size * (sizeof(u32)));
arm7_9_common_t *arm7_9 = armv4_5->arch_info;
u32 reg[16];
- int num_accesses = 0;
+ u32 num_accesses = 0;
int thisrun_accesses;
int i;
u32 cpsr;
reg_t *dbg_ctrl = &arm7_9->eice_cache->reg_list[EICE_DBG_CTRL];
u32 reg[16];
- int num_accesses = 0;
+ u32 num_accesses = 0;
int thisrun_accesses;
int i;
u32 cpsr;
0x04C11DB7 /* CRC32XOR: .word 0x04C11DB7 */
};
- int i;
+ u32 i;
if (target_alloc_working_area(target, sizeof(arm7_9_crc_code), &crc_algorithm) != ERROR_OK)
{
reg_param_t reg_params[3];
armv4_5_algorithm_t armv4_5_info;
int retval;
- int i;
+ u32 i;
u32 erase_check_code[] =
{
typedef struct arm7_9_common_s
{
- int common_magic;
+ u32 common_magic;
arm_jtag_t jtag_info;
reg_cache_t *eice_cache;
typedef struct arm920t_common_s
{
- int common_magic;
+ u32 common_magic;
armv4_5_mmu_common_t armv4_5_mmu;
arm9tdmi_common_t arm9tdmi_common;
u32 cp15_control_reg;
typedef struct arm926ejs_common_s
{
- int common_magic;
+ u32 common_magic;
armv4_5_mmu_common_t armv4_5_mmu;
arm9tdmi_common_t arm9tdmi_common;
int (*read_cp15)(target_t *target, u32 op1, u32 op2, u32 CRn, u32 CRm, u32 *value);
{
jtag_tap_t *tap;
- int scann_size;
+ u32 scann_size;
u32 scann_instr;
- int cur_scan_chain;
+ u32 cur_scan_chain;
u32 intest_instr;
} arm_jtag_t;
}
}
- if (armv4_5_target->core_mode != (value & 0x1f))
+ if (armv4_5_target->core_mode != (enum armv4_5_mode)(value & 0x1f))
{
LOG_DEBUG("changing ARM core mode to '%s'", armv4_5_mode_strings[armv4_5_mode_to_number(value & 0x1f)]);
armv4_5_target->core_mode = value & 0x1f;
0x1DB7, 0x04C1 /* CRC32XOR: .word 0x04C11DB7 */
};
- int i;
+ u32 i;
if (target_alloc_working_area(target, sizeof(cortex_m3_crc_code), &crc_algorithm) != ERROR_OK)
{
reg_param_t reg_params[3];
armv7m_algorithm_t armv7m_info;
int retval;
- int i;
+ u32 i;
u16 erase_check_code[] =
{
swjdp_common_t *swjdp = &cortex_m3->swjdp_info;
u8 data;
u8 ctrl;
- int i;
+ u32 i;
for (i = 0; i < (size * 4); i++)
{
u8 field1_out[1];
u8 field2_out[1];
int retval;
- int hsact;
+ u32 hsact;
struct timeval lap;
struct timeval now;
gettimeofday(&now, NULL);
}
- while ((now.tv_sec-lap.tv_sec)*1000 + (now.tv_usec-lap.tv_usec)/1000 <= timeout);
+ while ((u32)((now.tv_sec-lap.tv_sec)*1000 + (now.tv_usec-lap.tv_usec)/1000) <= timeout);
return ERROR_TARGET_TIMEOUT;
}
arm7_9->etm_ctx->capture_driver_priv = etb;
etb->tap = tap;
- etb->cur_scan_chain = -1;
+ etb->cur_scan_chain = ~0UL;
etb->reg_cache = NULL;
etb->ram_width = 0;
etb->ram_depth = 0;
{
etm_context_t *etm_ctx;
jtag_tap_t *tap;
- int cur_scan_chain;
+ u32 cur_scan_chain;
reg_cache_t *reg_cache;
/* ETB parameters */
- int ram_depth;
- int ram_width;
+ u32 ram_depth;
+ u32 ram_width;
} etb_t;
typedef struct etb_reg_s
{
- int addr;
+ u32 addr;
etb_t *etb;
} etb_reg_t;
u8 packet;
int shift = 0;
int apo;
- int i;
+ u32 i;
/* quit analysis if less than two cycles are left in the trace
* because we can't extract the APO */
if (((instruction.type == ARM_B) ||
(instruction.type == ARM_BL) ||
(instruction.type == ARM_BLX)) &&
- (instruction.info.b_bl_bx_blx.target_address != -1))
+ (instruction.info.b_bl_bx_blx.target_address != ~0UL))
{
next_pc = instruction.info.b_bl_bx_blx.target_address;
}
armv4_5_common_t *armv4_5;
arm7_9_common_t *arm7_9;
etm_context_t *etm_ctx;
- int i;
+ u32 i;
if (argc != 1)
{
armv4_5_common_t *armv4_5;
arm7_9_common_t *arm7_9;
etm_context_t *etm_ctx;
- int i;
+ u32 i;
if (argc != 1)
{
arm7_9_common_t *arm7_9 = armv4_5->arch_info;
enum armv4_5_state core_state = armv4_5->core_state;
u32 x, flip, shift, save[7];
- int i;
+ u32 i;
/*
* We can't use the dcc flow control bits, so let's transfer data
0xeafffff3, /* b 3b */
};
- int dcc_size = sizeof(dcc_code);
+ u32 dcc_size = sizeof(dcc_code);
if (!arm7_9->dcc_downloads)
return target->type->write_memory(target, address, 4, count, buffer);
typedef struct mips32_common_s
{
- int common_magic;
+ u32 common_magic;
void *arch_info;
reg_cache_t *core_cache;
mips_ejtag_t ejtag_info;
if (tap==NULL)
return ERROR_FAIL;
- if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) != new_instr)
+ if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) != (u32)new_instr)
{
scan_field_t field;
u8 t[4];
int oocd_trace_read_memory(oocd_trace_t *oocd_trace, u8 *data, u32 address, u32 size)
{
- size_t bytes_written, bytes_read, bytes_to_read;
+ size_t bytes_written, bytes_to_read;
+ ssize_t bytes_read;
u8 cmd;
oocd_trace_write_reg(oocd_trace, OOCD_TRACE_ADDRESS, address);
u32 first_frame = 0x0;
u32 num_frames = 1048576;
u8 *trace_data;
- int i;
+ u32 i;
oocd_trace_read_reg(oocd_trace, OOCD_TRACE_STATUS, &status);
oocd_trace_read_reg(oocd_trace, OOCD_TRACE_ADDRESS, &address);
u8 *value;
int dirty;
int valid;
- int size;
+ u32 size;
bitfield_desc_t *bitfield_desc;
int num_bitfields;
void *arch_info;
/* handle unaligned head bytes */
if (address % 4)
{
- int unaligned = 4 - (address % 4);
+ u32 unaligned = 4 - (address % 4);
if (unaligned > size)
unaligned = size;
/* handle unaligned head bytes */
if (address % 4)
{
- int unaligned = 4 - (address % 4);
+ u32 unaligned = 4 - (address % 4);
if (unaligned > size)
unaligned = size;
{
u8 *buffer;
int retval;
- int i;
+ u32 i;
u32 checksum = 0;
if (!target->type->examined)
{
retval = target->type->read_memory(target, image.sections[i].base_address, size, count, data);
if (retval == ERROR_OK)
{
- int t;
+ u32 t;
for (t = 0; t < buf_cnt; t++)
{
if (data[t] != buffer[t])
}
/* Dump a gmon.out histogram file. */
-static void writeGmon(u32 *samples, int sampleNum, char *filename)
+static void writeGmon(u32 *samples, u32 sampleNum, char *filename)
{
- int i;
+ u32 i;
FILE *f=fopen(filename, "w");
if (f==NULL)
return;
int addressSpace=(max-min+1);
- static int const maxBuckets=256*1024; /* maximum buckets. */
- int length=addressSpace;
+ static const u32 maxBuckets = 256 * 1024; /* maximum buckets. */
+ u32 length = addressSpace;
if (length > maxBuckets)
{
length=maxBuckets;
u32 v;
const char *varname;
u8 buffer[4096];
- int i, n, e, retval;
+ int n, e, retval;
+ u32 i;
/* argv[1] = name of array to receive the data
* argv[2] = desired width
u32 v;
const char *varname;
u8 buffer[4096];
- int i, n, e, retval;
+ int n, e, retval;
+ u32 i;
/* argv[1] = name of array to get the data
* argv[2] = desired width
teap = target->event_action;
/* replace existing? */
while( teap ){
- if( teap->event == n->value ){
+ if( teap->event == (enum target_event)n->value ){
break;
}
teap = teap->next;
char line[128];
int line_len;
debug_msg_receiver_t *c = target->dbgmsg;
- int i;
+ u32 i;
LOG_DEBUG("size: %i, length: %i", size, length);
#include <string.h>
#include <inttypes.h>
-int trace_point(target_t *target, int number)
+int trace_point(target_t *target, u32 number)
{
trace_t *trace = target->trace_info;
if (argc == 0)
{
- int i;
+ u32 i;
for (i = 0; i < trace->num_trace_points; i++)
{
}
else
{
- int i;
- int first = 0;
- int last = trace->trace_history_pos;
+ u32 i;
+ u32 first = 0;
+ u32 last = trace->trace_history_pos;
if ( !trace->trace_history_size ) {
command_print(cmd_ctx, "trace history buffer is not allocated");
typedef struct trace_s
{
- int num_trace_points;
- int trace_points_size;
+ u32 num_trace_points;
+ u32 trace_points_size;
trace_point_t *trace_points;
- int trace_history_size;
+ u32 trace_history_size;
u32 *trace_history;
- int trace_history_pos;
+ u32 trace_history_pos;
int trace_history_overflowed;
} trace_t;
TRACE_OVERFLOWED = 0x8,
} trace_status_t;
-extern int trace_point(struct target_s *target, int number);
+extern int trace_point(struct target_s *target, u32 number);
extern int trace_register_commands(struct command_context_s *cmd_ctx);
#define ERROR_TRACE_IMAGE_UNAVAILABLE -(1500)
u32 binary_size;
u32 buf_cnt;
- int i;
+ u32 i;
int retval;
breakpoint_t *breakpoint = target->breakpoints;
armv4_5_common_t *armv4_5 = target->arch_info;
xscale_common_t *xscale = armv4_5->arch_info;
u32 *buf32;
- int i;
+ u32 i;
int retval;
LOG_DEBUG("address: 0x%8.8x, size: 0x%8.8x, count: 0x%8.8x", address, size, count);
(((instruction.type == ARM_B) ||
(instruction.type == ARM_BL) ||
(instruction.type == ARM_BLX)) &&
- (instruction.info.b_bl_bx_blx.target_address != -1)))
+ (instruction.info.b_bl_bx_blx.target_address != ~0UL)))
{
xscale->trace.current_pc = instruction.info.b_bl_bx_blx.target_address;
}
case XCOMMENT:
{
- int ndx = 0;
+ unsigned int ndx = 0;
char comment[128];
do