Search and destroy lingering cases where the ARRAY_SIZE macro should
be used to convey more intrinsic meaning in the OpenOCD code.
LOG_ERROR("0x%" PRIx32 " is invalid Manufacturer for avr, 0x%X is expected", EXTRACT_MFG(device_id), 0x1F);
}
LOG_ERROR("0x%" PRIx32 " is invalid Manufacturer for avr, 0x%X is expected", EXTRACT_MFG(device_id), 0x1F);
}
- for (i = 0; i < (int)(sizeof(avft_chips_info) / sizeof(avft_chips_info[0])); i++)
+ for (i = 0; i < (int)ARRAY_SIZE(avft_chips_info); i++)
{
if (avft_chips_info[i].chip_id == EXTRACT_PART(device_id))
{
{
if (avft_chips_info[i].chip_id == EXTRACT_PART(device_id))
{
LOG_ERROR("0x%" PRIx32 " is invalid Manufacturer for avr, 0x%X is expected", EXTRACT_MFG(device_id), 0x1F);
}
LOG_ERROR("0x%" PRIx32 " is invalid Manufacturer for avr, 0x%X is expected", EXTRACT_MFG(device_id), 0x1F);
}
- for (i = 0; i < (int)(sizeof(avft_chips_info) / sizeof(avft_chips_info[0])); i++)
+ for (i = 0; i < (int)ARRAY_SIZE(avft_chips_info); i++)
{
if (avft_chips_info[i].chip_id == EXTRACT_PART(device_id))
{
{
if (avft_chips_info[i].chip_id == EXTRACT_PART(device_id))
{
};
#define TMS470R1A256_NUM_SECTORS \
};
#define TMS470R1A256_NUM_SECTORS \
- (sizeof(TMS470R1A256_SECTORS)/sizeof(TMS470R1A256_SECTORS[0]))
+ ARRAY_SIZE(TMS470R1A256_SECTORS)
const struct flash_sector TMS470R1A288_BANK0_SECTORS[] = {
{0x00000000, 0x00002000, -1, -1},
const struct flash_sector TMS470R1A288_BANK0_SECTORS[] = {
{0x00000000, 0x00002000, -1, -1},
};
#define TMS470R1A288_BANK0_NUM_SECTORS \
};
#define TMS470R1A288_BANK0_NUM_SECTORS \
- (sizeof(TMS470R1A288_BANK0_SECTORS)/sizeof(TMS470R1A288_BANK0_SECTORS[0]))
+ ARRAY_SIZE(TMS470R1A288_BANK0_SECTORS)
const struct flash_sector TMS470R1A288_BANK1_SECTORS[] = {
{0x00040000, 0x00010000, -1, -1},
const struct flash_sector TMS470R1A288_BANK1_SECTORS[] = {
{0x00040000, 0x00010000, -1, -1},
};
#define TMS470R1A288_BANK1_NUM_SECTORS \
};
#define TMS470R1A288_BANK1_NUM_SECTORS \
- (sizeof(TMS470R1A288_BANK1_SECTORS)/sizeof(TMS470R1A288_BANK1_SECTORS[0]))
+ ARRAY_SIZE(TMS470R1A288_BANK1_SECTORS)
const struct flash_sector TMS470R1A384_BANK0_SECTORS[] = {
{0x00000000, 0x00002000, -1, -1},
const struct flash_sector TMS470R1A384_BANK0_SECTORS[] = {
{0x00000000, 0x00002000, -1, -1},
};
#define TMS470R1A384_BANK0_NUM_SECTORS \
};
#define TMS470R1A384_BANK0_NUM_SECTORS \
- (sizeof(TMS470R1A384_BANK0_SECTORS)/sizeof(TMS470R1A384_BANK0_SECTORS[0]))
+ ARRAY_SIZE(TMS470R1A384_BANK0_SECTORS)
const struct flash_sector TMS470R1A384_BANK1_SECTORS[] = {
{0x00020000, 0x00008000, -1, -1},
const struct flash_sector TMS470R1A384_BANK1_SECTORS[] = {
{0x00020000, 0x00008000, -1, -1},
};
#define TMS470R1A384_BANK1_NUM_SECTORS \
};
#define TMS470R1A384_BANK1_NUM_SECTORS \
- (sizeof(TMS470R1A384_BANK1_SECTORS)/sizeof(TMS470R1A384_BANK1_SECTORS[0]))
+ ARRAY_SIZE(TMS470R1A384_BANK1_SECTORS)
const struct flash_sector TMS470R1A384_BANK2_SECTORS[] = {
{0x00040000, 0x00008000, -1, -1},
const struct flash_sector TMS470R1A384_BANK2_SECTORS[] = {
{0x00040000, 0x00008000, -1, -1},
};
#define TMS470R1A384_BANK2_NUM_SECTORS \
};
#define TMS470R1A384_BANK2_NUM_SECTORS \
- (sizeof(TMS470R1A384_BANK2_SECTORS)/sizeof(TMS470R1A384_BANK2_SECTORS[0]))
+ ARRAY_SIZE(TMS470R1A384_BANK2_SECTORS)
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- */
{
static const char* type_str[] =
{"BM", "AM", "100AX", "UNKNOWN", "2232C", "232R", "2232H", "4232H"};
{
static const char* type_str[] =
{"BM", "AM", "100AX", "UNKNOWN", "2232C", "232R", "2232H", "4232H"};
- unsigned no_of_known_types = sizeof(type_str) / sizeof(type_str[0]) - 1;
+ unsigned no_of_known_types = ARRAY_SIZE(type_str) - 1;
unsigned type_index = ((unsigned)ftdi_device <= no_of_known_types)
? ftdi_device : FT_DEVICE_UNKNOWN;
LOG_INFO("device: %lu \"%s\"", ftdi_device, type_str[type_index]);
unsigned type_index = ((unsigned)ftdi_device <= no_of_known_types)
? ftdi_device : FT_DEVICE_UNKNOWN;
LOG_INFO("device: %lu \"%s\"", ftdi_device, type_str[type_index]);
ftdi_device = ftdic.type;
static const char* type_str[] =
{"AM", "BM", "2232C", "R", "2232H", "4232H", "Unknown"};
ftdi_device = ftdic.type;
static const char* type_str[] =
{"AM", "BM", "2232C", "R", "2232H", "4232H", "Unknown"};
- unsigned no_of_known_types = sizeof(type_str) / sizeof(type_str[0]) - 1;
+ unsigned no_of_known_types = ARRAY_SIZE(type_str) - 1;
unsigned type_index = ((unsigned)ftdi_device < no_of_known_types)
? ftdi_device : no_of_known_types;
LOG_DEBUG("FTDI chip type: %i \"%s\"", (int)ftdi_device, type_str[type_index]);
unsigned type_index = ((unsigned)ftdi_device < no_of_known_types)
? ftdi_device : no_of_known_types;
LOG_DEBUG("FTDI chip type: %i \"%s\"", (int)ftdi_device, type_str[type_index]);
dtc_2, sizeof(dtc_2), (ST7_FOSC * 2) / (1000 * 2), 2
}};
dtc_2, sizeof(dtc_2), (ST7_FOSC * 2) / (1000 * 2), 2
}};
-const size_t rlink_speed_table_size = sizeof(rlink_speed_table) / sizeof(*rlink_speed_table);
+const size_t rlink_speed_table_size = ARRAY_SIZE(rlink_speed_table);
- if ((argc < 2) || ((size_t)argc > (sizeof(states)/sizeof(*states) + 1)))
+ if ((argc < 2) || ((size_t)argc > (ARRAY_SIZE(states) + 1)))
{
Jim_WrongNumArgs(interp, 1, args, "wrong arguments");
return JIM_ERR;
{
Jim_WrongNumArgs(interp, 1, args, "wrong arguments");
return JIM_ERR;
}
/* convert flash writing code into a buffer in target endianness */
}
/* convert flash writing code into a buffer in target endianness */
- for (i = 0; i < (sizeof(cortex_m3_crc_code)/sizeof(uint16_t)); i++)
+ for (i = 0; i < ARRAY_SIZE(cortex_m3_crc_code); i++)
if ((retval = target_write_u16(target, crc_algorithm->address + i*sizeof(uint16_t), cortex_m3_crc_code[i])) != ERROR_OK)
{
return retval;
if ((retval = target_write_u16(target, crc_algorithm->address + i*sizeof(uint16_t), cortex_m3_crc_code[i])) != ERROR_OK)
{
return retval;
}
/* convert flash writing code into a buffer in target endianness */
}
/* convert flash writing code into a buffer in target endianness */
- for (i = 0; i < (sizeof(erase_check_code)/sizeof(uint16_t)); i++)
+ for (i = 0; i < ARRAY_SIZE(erase_check_code); i++)
target_write_u16(target, erase_check_algorithm->address + i*sizeof(uint16_t), erase_check_code[i]);
armv7m_info.common_magic = ARMV7M_COMMON_MAGIC;
target_write_u16(target, erase_check_algorithm->address + i*sizeof(uint16_t), erase_check_code[i]);
armv7m_info.common_magic = ARMV7M_COMMON_MAGIC;
field[0].num_bits = tap->ir_length;
field[0].out_value = ir_out;
field[0].in_value = ir_in;
field[0].num_bits = tap->ir_length;
field[0].out_value = ir_out;
field[0].in_value = ir_in;
- jtag_add_plain_ir_scan(sizeof(field) / sizeof(field[0]), field, jtag_set_end_state(TAP_IDLE));
+ jtag_add_plain_ir_scan(ARRAY_SIZE(field), field, jtag_set_end_state(TAP_IDLE));
field[0].num_bits = dr_len;
field[0].out_value = dr_out;
field[0].in_value = dr_in;
field[0].num_bits = dr_len;
field[0].out_value = dr_out;
field[0].in_value = dr_in;
- jtag_add_plain_dr_scan(sizeof(field) / sizeof(field[0]), field, jtag_set_end_state(TAP_IDLE));
+ jtag_add_plain_dr_scan(ARRAY_SIZE(field), field, jtag_set_end_state(TAP_IDLE));
param_in[0] = addr;
param_in[1] = blocksize;
param_in[0] = addr;
param_in[1] = blocksize;
- if ((retval = mips32_pracc_exec(ejtag_info, sizeof(code)/sizeof(code[0]), code,
- sizeof(param_in)/sizeof(param_in[0]), param_in, blocksize, &buf[bytesread], 1)) != ERROR_OK)
+ if ((retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code,
+ ARRAY_SIZE(param_in), param_in, blocksize, &buf[bytesread], 1)) != ERROR_OK)
- if ((retval = mips32_pracc_exec(ejtag_info, sizeof(code)/sizeof(code[0]), code,
- sizeof(param_in)/sizeof(param_in[0]), param_in, sizeof(uint32_t), buf, 1)) != ERROR_OK)
+ if ((retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code,
+ ARRAY_SIZE(param_in), param_in, sizeof(uint32_t), buf, 1)) != ERROR_OK)
param_in[0] = addr;
param_in[1] = blocksize;
param_in[0] = addr;
param_in[1] = blocksize;
- mips32_pracc_exec(ejtag_info, sizeof(code)/sizeof(code[0]), code, \
- sizeof(param_in)/sizeof(param_in[0]), param_in, count, param_out, 1);
+ mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
+ ARRAY_SIZE(param_in), param_in, count, param_out, 1);
// count -= blocksize;
// addr += blocksize;
// count -= blocksize;
// addr += blocksize;
param_in[0] = addr;
param_in[1] = blocksize;
param_in[0] = addr;
param_in[1] = blocksize;
- mips32_pracc_exec(ejtag_info, sizeof(code)/sizeof(code[0]), code, \
- sizeof(param_in)/sizeof(param_in[0]), param_in, count, param_out, 1);
+ mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
+ ARRAY_SIZE(param_in), param_in, count, param_out, 1);
// count -= blocksize;
// addr += blocksize;
// count -= blocksize;
// addr += blocksize;
memcpy(¶m_in[2], buf, count * sizeof(uint32_t));
memcpy(¶m_in[2], buf, count * sizeof(uint32_t));
- mips32_pracc_exec(ejtag_info, sizeof(code)/sizeof(code[0]), code, \
+ mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
count + 2, param_in, 0, NULL, 1);
free(param_in);
count + 2, param_in, 0, NULL, 1);
free(param_in);
param_in[0] = addr;
param_in[1] = *buf;
param_in[0] = addr;
param_in[1] = *buf;
- mips32_pracc_exec(ejtag_info, sizeof(code)/sizeof(code[0]), code, \
- sizeof(param_in)/sizeof(param_in[0]),param_in, 0, NULL, 1);
+ mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
+ ARRAY_SIZE(param_in),param_in, 0, NULL, 1);
param_in[i + 2] = buf[i];
}
param_in[i + 2] = buf[i];
}
- mips32_pracc_exec(ejtag_info, sizeof(code)/sizeof(code[0]), code, \
+ mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
count + 2, param_in, 0, NULL, 1);
free(param_in);
count + 2, param_in, 0, NULL, 1);
free(param_in);
param_in[i + 2] = buf[i];
}
param_in[i + 2] = buf[i];
}
- retval = mips32_pracc_exec(ejtag_info, sizeof(code)/sizeof(code[0]), code, \
+ retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
count +2, param_in, 0, NULL, 1);
free(param_in);
count +2, param_in, 0, NULL, 1);
free(param_in);
- retval = mips32_pracc_exec(ejtag_info, sizeof(code)/sizeof(code[0]), code, \
+ retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
38, regs, 0, NULL, 1);
return retval;
38, regs, 0, NULL, 1);
return retval;
- retval = mips32_pracc_exec(ejtag_info, sizeof(code)/sizeof(code[0]), code, \
+ retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
0, NULL, 38, regs, 1);
return retval;
0, NULL, 38, regs, 1);
return retval;
- mips32_pracc_exec(ejtag_info, sizeof(code)/sizeof(code[0]), code, \
+ mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
0, NULL, 0, NULL, 1);
return ERROR_OK;
0, NULL, 0, NULL, 1);
return ERROR_OK;
- mips32_pracc_exec(ejtag_info, sizeof(code)/sizeof(code[0]), code, \
+ mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
0, NULL, 0, NULL, 1);
return ERROR_OK;
0, NULL, 0, NULL, 1);
return ERROR_OK;
- mips32_pracc_exec(ejtag_info, sizeof(code)/sizeof(code[0]), code, \
+ mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
0, NULL, 1, debug_reg, 1);
return ERROR_OK;
0, NULL, 1, debug_reg, 1);
return ERROR_OK;
jtag_add_pathmove(3, path);
else
{
jtag_add_pathmove(3, path);
else
{
- jtag_add_pathmove(sizeof(noconsume_path)/sizeof(*noconsume_path), noconsume_path);
+ jtag_add_pathmove(ARRAY_SIZE(noconsume_path), noconsume_path);
}
jtag_add_dr_scan(3, fields, jtag_set_end_state(TAP_IDLE));
}
jtag_add_dr_scan(3, fields, jtag_set_end_state(TAP_IDLE));
struct reg_cache **cache_p = register_get_last_cache_p(&target->reg_cache);
struct xscale_reg *arch_info = malloc(sizeof(xscale_reg_arch_info));
int i;
struct reg_cache **cache_p = register_get_last_cache_p(&target->reg_cache);
struct xscale_reg *arch_info = malloc(sizeof(xscale_reg_arch_info));
int i;
- int num_regs = sizeof(xscale_reg_arch_info) / sizeof(struct xscale_reg);
+ int num_regs = ARRAY_SIZE(xscale_reg_arch_info);
(*cache_p) = armv4_5_build_reg_cache(target, armv4_5);
(*cache_p) = armv4_5_build_reg_cache(target, armv4_5);
Linking to existing account procedure
If you already have an account and want to add another login method
you
MUST first sign in with your existing account and
then change URL to read
https://review.openocd.org/login/?link
to get to this page again but this time it'll work for linking. Thank you.
SSH host keys fingerprints
1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=.. |
|+o.. . |
|*.o . . |
|+B . . . |
|Bo. = o S |
|Oo.+ + = |
|oB=.* = . o |
| =+=.+ + E |
|. .=o . o |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)