Merge pull request #121 from WinterMute/64bit_win_fix
authortexane <texane@gmail.com>
Sun, 6 Jan 2013 17:20:41 +0000 (09:20 -0800)
committertexane <texane@gmail.com>
Sun, 6 Jan 2013 17:20:41 +0000 (09:20 -0800)
64bit win fix

configure.ac
src/stlink-common.c
src/stlink-common.h

index 1f00f3a808587a6fc7784ee8e6fedd5b036c7dbc..e8923ed364a65dd2952e76159aefa2377dc00207 100644 (file)
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.61)
-AC_INIT([stlink],[0.5.3],[davem@devkitpro.org])
+AC_INIT([stlink],[0.5.6],[davem@devkitpro.org])
 AC_CONFIG_SRCDIR([src/stlink-common.c])
 AC_CONFIG_LIBOBJ_DIR([src])
 AM_INIT_AUTOMAKE([1.10])
index 1ac3d6029a7d4f7cfb1be2db8de97b10d611d495..2d7db142cfa6ee5a5ed6d6bc7966bc2052a7fdf0 100644 (file)
 #include "stlink-common.h"
 #include "uglylogging.h"
 
+#ifndef _WIN32
+#define O_BINARY 0
+#endif
+
 #define LOG_TAG __FILE__
 #define DLOG(format, args...)         ugly_log(UDEBUG, LOG_TAG, format, ## args)
 #define ILOG(format, args...)         ugly_log(UINFO, LOG_TAG, format, ## args)
@@ -757,7 +761,7 @@ static int map_file(mapped_file_t* mf, const char* path) {
     int error = -1;
     struct stat st;
 
-    const int fd = open(path, O_RDONLY);
+    const int fd = open(path, O_RDONLY | O_BINARY);
     if (fd == -1) {
         fprintf(stderr, "open(%s) == -1\n", path);
         return -1;
@@ -1415,7 +1419,7 @@ int stm32l1_write_half_pages(stlink_t *sl, stm32_addr_t addr, uint8_t* base, uns
     return 0;
 }
 
-int stlink_write_flash(stlink_t *sl, stm32_addr_t addr, uint8_t* base, unsigned len) {
+int stlink_write_flash(stlink_t *sl, stm32_addr_t addr, uint8_t* base, uint32_t len) {
     size_t off;
     flash_loader_t fl;
     ILOG("Attempting to write %d (%#x) bytes to stm32 address: %u (%#x)\n",
index 6496a10c22796df7e5a4cfca6cb74212f13d0f78..a2b73d93b1d18710269e7c20eae23eb1cf14577a 100644 (file)
@@ -410,10 +410,10 @@ static const chip_params_t devices[] = {
 
     // unprocessed
     int stlink_erase_flash_mass(stlink_t* sl);
-    int stlink_write_flash(stlink_t* sl, stm32_addr_t address, uint8_t* data, unsigned length);
+    int stlink_write_flash(stlink_t* sl, stm32_addr_t address, uint8_t* data, uint32_t length);
     int stlink_fwrite_flash(stlink_t *sl, const char* path, stm32_addr_t addr);
     int stlink_fwrite_sram(stlink_t *sl, const char* path, stm32_addr_t addr);
-    int stlink_verify_write_flash(stlink_t *sl, stm32_addr_t address, uint8_t *data, unsigned length);
+    int stlink_verify_write_flash(stlink_t *sl, stm32_addr_t address, uint8_t *data, uint32_t length);
     
     // PUBLIC
     uint32_t stlink_chip_id(stlink_t *sl);