chg: from offical

This commit is contained in:
Chris 2018-06-17 12:55:09 +02:00
parent d9e8b63363
commit 3fd1854b8a

View file

@ -38,7 +38,7 @@ static const uint8_t elf_ident[] = {
// Turn PHDRs into flasher segments, checking for PHDR sanity and merging adjacent // Turn PHDRs into flasher segments, checking for PHDR sanity and merging adjacent
// unaligned segments if needed // unaligned segments if needed
static int build_segs_from_phdrs(flash_file_t *ctx, FILE *fd, Elf32_Phdr *phdrs, int num_phdrs) { static int build_segs_from_phdrs(flash_file_t *ctx, FILE *fd, Elf32_Phdr *phdrs, uint16_t num_phdrs) {
Elf32_Phdr *phdr = phdrs; Elf32_Phdr *phdr = phdrs;
flash_seg_t *seg; flash_seg_t *seg;
uint32_t last_end = 0; uint32_t last_end = 0;
@ -187,7 +187,7 @@ int flash_load(flash_file_t *ctx, const char *name, int can_write_bl) {
FILE *fd = NULL; FILE *fd = NULL;
Elf32_Ehdr ehdr; Elf32_Ehdr ehdr;
Elf32_Phdr *phdrs = NULL; Elf32_Phdr *phdrs = NULL;
int num_phdrs; uint16_t num_phdrs;
int res; int res;
fd = fopen(name, "rb"); fd = fopen(name, "rb");
@ -342,7 +342,10 @@ static int wait_for_ack(UsbCommand *ack) {
ReceiveCommand(ack); ReceiveCommand(ack);
if (ack->cmd != CMD_ACK) { if (ack->cmd != CMD_ACK) {
printf("Error: Unexpected reply 0x%04" PRIx64 " %s (expected ACK)\n", ack->cmd, (ack->cmd == CMD_NACK) ? "NACK" : ""); printf("Error: Unexpected reply 0x%04" PRIx64 " %s (expected ACK)\n",
ack->cmd,
(ack->cmd == CMD_NACK) ? "NACK" : ""
);
return -1; return -1;
} }
return 0; return 0;