Using modified version of latest fork of stm32flash

This commit is contained in:
Roger Clark 2015-04-18 11:24:00 +10:00
parent 0f78542eef
commit 1faf1d6b0d
18 changed files with 368 additions and 352 deletions

2
.gitignore vendored
View File

@ -5,3 +5,5 @@ other/maple-bootloader/tags
other/maple-bootloader/cscope.out
other/maple-bootloader/build
other/maple-bootloader/*~
*.o
tools/src/stm32flash/src/parsers/parsers.a

View File

@ -32,7 +32,7 @@
#include "port.h"
#if defined(__WIN32__) || defined(__CYGWIN__) || defined(__APPLE__)
#if !defined(__linux__)
static port_err_t i2c_open(struct port_interface *port,
struct port_options *ops)

View File

@ -18,6 +18,7 @@
*/
#include <fcntl.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@ -197,13 +198,27 @@ static port_err_t serial_setup(serial_t *h, const serial_baud_t baud,
return PORT_ERR_OK;
}
static int startswith(const char *haystack, const char *needle) {
return strncmp(haystack, needle, strlen(needle)) == 0;
}
static int is_tty(const char *path) {
char resolved[PATH_MAX];
if(!realpath(path, resolved)) return 0;
if(startswith(resolved, "/dev/tty")) return 1;
return 0;
}
static port_err_t serial_posix_open(struct port_interface *port,
struct port_options *ops)
{
serial_t *h;
/* 1. check device name match */
if (strncmp(ops->device, "/dev/tty", strlen("/dev/tty")))
if (!is_tty(ops->device))
return PORT_ERR_NODEV;
/* 2. check options */

View File

@ -186,7 +186,6 @@ static port_err_t serial_w32_open(struct port_interface *port,
serial_t *h;
/* 1. check device name match */
/* Roger Clark. Added support for com10 and higher numbers */
if (!((strlen(ops->device) == 4 || strlen(ops->device) == 5)
&& !strncmp(ops->device, "COM", 3) && isdigit(ops->device[3]))
&& !(!strncmp(ops->device, "\\\\.\\COM", strlen("\\\\.\\COM"))

View File

@ -784,7 +784,7 @@ stm32_err_t stm32_erase_memory(const stm32_t *stm, uint8_t spage, uint8_t pages)
return STM32_ERR_UNKNOWN;
}
s_err = stm32_get_ack_timeout(stm, STM32_SECTERASE_TIMEOUT);
s_err = stm32_get_ack_timeout(stm, pages * STM32_SECTERASE_TIMEOUT);
if (s_err != STM32_ERR_OK) {
fprintf(stderr, "Page-by-page erase failed. Check the maximum pages your device supports.\n");
if (port->flags & PORT_STRETCH_W

Binary file not shown.