]> git.sur5r.net Git - openocd/blobdiff - src/target/image.c
switch to jtag_add_callback() - USB performance fix
[openocd] / src / target / image.c
index 2b6d0d11def83ebd35cac5bca16f6ebeaddaf19d..71939e79b92e6cb73bae40a7e8d3df44396e848b 100644 (file)
 #include "config.h"
 #endif
 
-#include <stdlib.h>
-#include <string.h>
-#ifdef HAVE_ELF_H
-#include <elf.h>
-#endif
-
 #include "image.h"
-
-#include "types.h"
-#include "replacements.h"
+#include "target.h"
 #include "log.h"
 
-#include "fileio.h"
-#include "target.h"
 
 /* convert ELF header field to host endianness */
 #define field16(elf,field)\
@@ -217,7 +207,9 @@ static int image_ihex_buffer_complete(image_t *image)
 
                        while (count-- > 0)
                        {
-                               sscanf(&lpszLine[bytes_read], "%2x", (u32*)&ihex->buffer[cooked_bytes]);
+                               unsigned value;
+                               sscanf(&lpszLine[bytes_read], "%2x", &value);
+                               ihex->buffer[cooked_bytes] = (u8)value;
                                cal_checksum += (u8)ihex->buffer[cooked_bytes];
                                bytes_read += 2;
                                cooked_bytes += 1;
@@ -594,7 +586,9 @@ static int image_mot_buffer_complete(image_t *image)
 
                        while (count-- > 0)
                        {
-                               sscanf(&lpszLine[bytes_read], "%2x", (u32*)&mot->buffer[cooked_bytes]);
+                               unsigned value;
+                               sscanf(&lpszLine[bytes_read], "%2x", &value);
+                               mot->buffer[cooked_bytes] = (u8)value;
                                cal_checksum += (u8)mot->buffer[cooked_bytes];
                                bytes_read += 2;
                                cooked_bytes += 1;