Revisión | 3c7279492996a0bba0b98d175e6db6e3f1437ba0 (tree) |
---|---|
Tiempo | 2021-06-05 00:10:06 |
Autor | Yoshinori Sato <yo-satoh@sios...> |
Commiter | Yoshinori Sato |
fix some error.
@@ -550,12 +550,14 @@ static int skipcheck(unsigned char *data, unsigned short size) | ||
550 | 550 | static int write_rom(struct port_t *port, struct arealist_t *arealist, enum mat_t mat) |
551 | 551 | { |
552 | 552 | unsigned char *buf = NULL; |
553 | + unsigned char cmdbuf[32]; | |
553 | 554 | unsigned int romaddr; |
554 | 555 | int i; |
555 | 556 | struct area_t *area; |
556 | 557 | |
557 | 558 | puts("Erase flash..."); |
558 | 559 | /* enter writemode */ |
560 | + buf = cmdbuf; | |
559 | 561 | buf[0] = WRITEMODE; |
560 | 562 | send(port, buf, 1); |
561 | 563 | if (receive(port, buf) != 1) { |
@@ -625,6 +627,7 @@ static int write_rom(struct port_t *port, struct arealist_t *arealist, enum mat_ | ||
625 | 627 | } |
626 | 628 | } |
627 | 629 | /* write finish */ |
630 | + buf = cmdbuf; | |
628 | 631 | *(buf + 0) = WRITE; |
629 | 632 | memset(buf + 1, 0xff, 4); |
630 | 633 | send(port, buf, 5); |
@@ -635,9 +638,9 @@ static int write_rom(struct port_t *port, struct arealist_t *arealist, enum mat_ | ||
635 | 638 | if (!verbose) |
636 | 639 | putc('\n', stdout); |
637 | 640 | |
638 | - return 1; | |
639 | - error: | |
640 | 641 | return 0; |
642 | + error: | |
643 | + return 1; | |
641 | 644 | } |
642 | 645 | |
643 | 646 | /* connect to target chip */ |
@@ -1 +1 @@ | ||
1 | -/usr/share/automake-1.14/compile | |
\ No newline at end of file | ||
1 | +/usr/share/automake-1.16/compile | |
\ No newline at end of file |
@@ -21,6 +21,7 @@ | ||
21 | 21 | #include <errno.h> |
22 | 22 | #include <sys/mman.h> |
23 | 23 | #include <sys/stat.h> |
24 | +#include <unistd.h> | |
24 | 25 | #ifdef HAVE_GELF_H |
25 | 26 | #include <gelf.h> |
26 | 27 | #endif |
@@ -81,7 +82,7 @@ static int write_binary(FILE *fp, struct comm_t *com, | ||
81 | 82 | area = lookup_area(arealist, addr); |
82 | 83 | len = bin_len < (area->end - area->start)? |
83 | 84 | bin_len:(area->end - area->start); |
84 | - if (len > read(area->image, len, fno)) | |
85 | + if (len > read(fno, area->image, len)) | |
85 | 86 | goto error_perror; |
86 | 87 | bin_len -= len; |
87 | 88 | addr += len; |
@@ -188,7 +188,7 @@ struct port_t *open_serial(char *ser_port) | ||
188 | 188 | |
189 | 189 | ser_fd = open(ser_port, O_RDWR); |
190 | 190 | if (ser_fd == -1) { |
191 | - perror("PROGNAME: "); | |
191 | + perror(PROGNAME ": port open failed"); | |
192 | 192 | return NULL; |
193 | 193 | } |
194 | 194 |