Fix warnings exposed by GCC8
gcc (GCC) 8.1.0 generates new warnings and thus fails the build. The ARM disassembler warnings actually exposed a bug in SMALW, SMULW and SMUL instructions decoding. Reported by Eimers on IRC. Change-Id: I200c70f75a9e07a1f13a592addc1c5fb37714440 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/4526 Tested-by: jenkins Reviewed-by: Jiri Kastner <cz172638@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
This commit is contained in:
parent
dae1ec1278
commit
b50fa9a19d
|
@ -937,7 +937,7 @@ static int kinetis_create_missing_banks(struct kinetis_chip *k_chip)
|
||||||
unsigned num_blocks;
|
unsigned num_blocks;
|
||||||
struct kinetis_flash_bank *k_bank;
|
struct kinetis_flash_bank *k_bank;
|
||||||
struct flash_bank *bank;
|
struct flash_bank *bank;
|
||||||
char base_name[80], name[80], num[4];
|
char base_name[69], name[80], num[4];
|
||||||
char *class, *p;
|
char *class, *p;
|
||||||
|
|
||||||
num_blocks = k_chip->num_pflash_blocks + k_chip->num_nvm_blocks;
|
num_blocks = k_chip->num_pflash_blocks + k_chip->num_nvm_blocks;
|
||||||
|
@ -948,7 +948,8 @@ static int kinetis_create_missing_banks(struct kinetis_chip *k_chip)
|
||||||
|
|
||||||
bank = k_chip->banks[0].bank;
|
bank = k_chip->banks[0].bank;
|
||||||
if (bank && bank->name) {
|
if (bank && bank->name) {
|
||||||
strncpy(base_name, bank->name, sizeof(base_name));
|
strncpy(base_name, bank->name, sizeof(base_name) - 1);
|
||||||
|
base_name[sizeof(base_name) - 1] = '\0';
|
||||||
p = strstr(base_name, ".pflash");
|
p = strstr(base_name, ".pflash");
|
||||||
if (p) {
|
if (p) {
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
@ -960,7 +961,8 @@ static int kinetis_create_missing_banks(struct kinetis_chip *k_chip)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
strncpy(base_name, target_name(k_chip->target), sizeof(base_name));
|
strncpy(base_name, target_name(k_chip->target), sizeof(base_name) - 1);
|
||||||
|
base_name[sizeof(base_name) - 1] = '\0';
|
||||||
p = strstr(base_name, ".cpu");
|
p = strstr(base_name, ".cpu");
|
||||||
if (p)
|
if (p)
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
@ -2012,7 +2014,7 @@ static int kinetis_probe_chip(struct kinetis_chip *k_chip)
|
||||||
unsigned cpu_mhz = 120;
|
unsigned cpu_mhz = 120;
|
||||||
unsigned idx;
|
unsigned idx;
|
||||||
bool use_nvm_marking = false;
|
bool use_nvm_marking = false;
|
||||||
char flash_marking[11], nvm_marking[2];
|
char flash_marking[12], nvm_marking[2];
|
||||||
char name[40];
|
char name[40];
|
||||||
|
|
||||||
k_chip->probed = false;
|
k_chip->probed = false;
|
||||||
|
|
|
@ -888,13 +888,11 @@ COMMAND_HANDLER(kitprog_handle_acquire_psoc_command)
|
||||||
COMMAND_HANDLER(kitprog_handle_serial_command)
|
COMMAND_HANDLER(kitprog_handle_serial_command)
|
||||||
{
|
{
|
||||||
if (CMD_ARGC == 1) {
|
if (CMD_ARGC == 1) {
|
||||||
size_t len = strlen(CMD_ARGV[0]);
|
kitprog_serial = strdup(CMD_ARGV[0]);
|
||||||
kitprog_serial = calloc(len + 1, sizeof(char));
|
|
||||||
if (kitprog_serial == NULL) {
|
if (kitprog_serial == NULL) {
|
||||||
LOG_ERROR("Failed to allocate memory for the serial number");
|
LOG_ERROR("Failed to allocate memory for the serial number");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
strncpy(kitprog_serial, CMD_ARGV[0], len + 1);
|
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR("expected exactly one argument to kitprog_serial <serial-number>");
|
LOG_ERROR("expected exactly one argument to kitprog_serial <serial-number>");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
|
|
|
@ -152,6 +152,8 @@ static uint32_t mem_ap_get_tar_increment(struct adiv5_ap *ap)
|
||||||
return 2;
|
return 2;
|
||||||
case CSW_32BIT:
|
case CSW_32BIT:
|
||||||
return 4;
|
return 4;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
case CSW_ADDRINC_PACKED:
|
case CSW_ADDRINC_PACKED:
|
||||||
return 4;
|
return 4;
|
||||||
|
|
|
@ -1549,7 +1549,7 @@ static int evaluate_misc_instr(uint32_t opcode,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SMLAW < y> */
|
/* SMLAW < y> */
|
||||||
if (((opcode & 0x00600000) == 0x00100000) && (x == 0)) {
|
if (((opcode & 0x00600000) == 0x00200000) && (x == 0)) {
|
||||||
uint8_t Rd, Rm, Rs, Rn;
|
uint8_t Rd, Rm, Rs, Rn;
|
||||||
instruction->type = ARM_SMLAWy;
|
instruction->type = ARM_SMLAWy;
|
||||||
Rd = (opcode & 0xf0000) >> 16;
|
Rd = (opcode & 0xf0000) >> 16;
|
||||||
|
@ -1571,7 +1571,7 @@ static int evaluate_misc_instr(uint32_t opcode,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SMUL < x><y> */
|
/* SMUL < x><y> */
|
||||||
if ((opcode & 0x00600000) == 0x00300000) {
|
if ((opcode & 0x00600000) == 0x00600000) {
|
||||||
uint8_t Rd, Rm, Rs;
|
uint8_t Rd, Rm, Rs;
|
||||||
instruction->type = ARM_SMULxy;
|
instruction->type = ARM_SMULxy;
|
||||||
Rd = (opcode & 0xf0000) >> 16;
|
Rd = (opcode & 0xf0000) >> 16;
|
||||||
|
@ -1592,7 +1592,7 @@ static int evaluate_misc_instr(uint32_t opcode,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SMULW < y> */
|
/* SMULW < y> */
|
||||||
if (((opcode & 0x00600000) == 0x00100000) && (x == 1)) {
|
if (((opcode & 0x00600000) == 0x00200000) && (x == 1)) {
|
||||||
uint8_t Rd, Rm, Rs;
|
uint8_t Rd, Rm, Rs;
|
||||||
instruction->type = ARM_SMULWy;
|
instruction->type = ARM_SMULWy;
|
||||||
Rd = (opcode & 0xf0000) >> 16;
|
Rd = (opcode & 0xf0000) >> 16;
|
||||||
|
|
Loading…
Reference in New Issue