kopia lustrzana https://github.com/stlink-org/stlink
Minor fixes
- Updated Standards-Version for deb-package - Fix for strcmp(value, "L4") in chipid.c - Minor formatting fixespull/1295/head
rodzic
1c6b5258ca
commit
c18293a82e
|
@ -2,7 +2,7 @@ Source: stlink
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Maintainer: Nightwalker-87 <stlink-org>
|
Maintainer: Nightwalker-87 <stlink-org>
|
||||||
Build-Depends: cmake (>= 3.10.2), dh-cmake, debhelper (>= 9), libusb-1.0-0-dev (>= 1.0.21), libgtk-3-dev (>= 3.22.30)
|
Build-Depends: cmake (>= 3.10.2), dh-cmake, debhelper (>= 9), libusb-1.0-0-dev (>= 1.0.21), libgtk-3-dev (>= 3.22.30)
|
||||||
Standards-Version: 4.5.0
|
Standards-Version: 4.6.2
|
||||||
Rules-Requires-Root: no
|
Rules-Requires-Root: no
|
||||||
Section: electronics
|
Section: electronics
|
||||||
Homepage: https://github.com/stlink-org/stlink
|
Homepage: https://github.com/stlink-org/stlink
|
||||||
|
|
|
@ -1,248 +1,248 @@
|
||||||
#include <stm32.h>
|
|
||||||
#include <stlink.h>
|
|
||||||
#include "chipid.h"
|
#include "chipid.h"
|
||||||
|
#include <stlink.h>
|
||||||
|
#include <stm32.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
static struct stlink_chipid_params *devicelist;
|
static struct stlink_chipid_params *devicelist;
|
||||||
|
|
||||||
void dump_a_chip (struct stlink_chipid_params *dev) {
|
void dump_a_chip(struct stlink_chipid_params *dev) {
|
||||||
DLOG("# Device Type: %s\n", dev->dev_type);
|
DLOG("# Device Type: %s\n", dev->dev_type);
|
||||||
DLOG("# Reference Manual: RM%s\n", dev->ref_manual_id);
|
DLOG("# Reference Manual: RM%s\n", dev->ref_manual_id);
|
||||||
DLOG("#\n");
|
DLOG("#\n");
|
||||||
DLOG("chip_id 0x%x\n", dev->chip_id);
|
DLOG("chip_id 0x%x\n", dev->chip_id);
|
||||||
DLOG("flash_type %d\n", dev->flash_type);
|
DLOG("flash_type %d\n", dev->flash_type);
|
||||||
DLOG("flash_size_reg 0x%x\n", dev->flash_size_reg);
|
DLOG("flash_size_reg 0x%x\n", dev->flash_size_reg);
|
||||||
DLOG("flash_pagesize 0x%x\n", dev->flash_pagesize);
|
DLOG("flash_pagesize 0x%x\n", dev->flash_pagesize);
|
||||||
DLOG("sram_size 0x%x\n", dev->sram_size);
|
DLOG("sram_size 0x%x\n", dev->sram_size);
|
||||||
DLOG("bootrom_base 0x%x\n", dev->bootrom_base);
|
DLOG("bootrom_base 0x%x\n", dev->bootrom_base);
|
||||||
DLOG("bootrom_size 0x%x\n", dev->bootrom_size);
|
DLOG("bootrom_size 0x%x\n", dev->bootrom_size);
|
||||||
DLOG("option_base 0x%x\n", dev->option_base);
|
DLOG("option_base 0x%x\n", dev->option_base);
|
||||||
DLOG("option_size 0x%x\n", dev->option_size);
|
DLOG("option_size 0x%x\n", dev->option_size);
|
||||||
DLOG("flags %d\n\n", dev->flags);
|
DLOG("flags %d\n\n", dev->flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct stlink_chipid_params *stlink_chipid_get_params(uint32_t chip_id) {
|
struct stlink_chipid_params *stlink_chipid_get_params(uint32_t chip_id) {
|
||||||
struct stlink_chipid_params *params = NULL;
|
struct stlink_chipid_params *params = NULL;
|
||||||
for (params = devicelist; params != NULL; params = params->next)
|
for (params = devicelist; params != NULL; params = params->next)
|
||||||
if (params->chip_id == chip_id) {
|
if (params->chip_id == chip_id) {
|
||||||
DLOG("detected chip_id parameters\n\n");
|
DLOG("detected chip_id parameters\n\n");
|
||||||
dump_a_chip(params);
|
dump_a_chip(params);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(params);
|
return (params);
|
||||||
}
|
}
|
||||||
|
|
||||||
void process_chipfile(char *fname) {
|
void process_chipfile(char *fname) {
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *p, buf[256];
|
char *p, buf[256];
|
||||||
char word[64], value[64];
|
char word[64], value[64];
|
||||||
struct stlink_chipid_params *ts;
|
struct stlink_chipid_params *ts;
|
||||||
int nc;
|
int nc;
|
||||||
|
|
||||||
// fprintf (stderr, "processing chip-id file %s.\n", fname);
|
// fprintf (stderr, "processing chip-id file %s.\n", fname);
|
||||||
fp = fopen(fname, "r");
|
fp = fopen(fname, "r");
|
||||||
|
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
perror(fname);
|
perror(fname);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ts = calloc(sizeof(struct stlink_chipid_params), 1);
|
ts = calloc(sizeof(struct stlink_chipid_params), 1);
|
||||||
|
|
||||||
while (fgets(buf, sizeof(buf), fp) != NULL) {
|
while (fgets(buf, sizeof(buf), fp) != NULL) {
|
||||||
|
|
||||||
if (strncmp(buf, "#", strlen("#")) == 0)
|
if (strncmp(buf, "#", strlen("#")) == 0)
|
||||||
continue; // ignore comments
|
continue; // ignore comments
|
||||||
|
|
||||||
if ((strncmp(buf, "\n", strlen("\n")) == 0) ||
|
if ((strncmp(buf, "\n", strlen("\n")) == 0) ||
|
||||||
(strncmp(buf, " ", strlen(" ")) == 0))
|
(strncmp(buf, " ", strlen(" ")) == 0))
|
||||||
continue; // ignore empty lines
|
continue; // ignore empty lines
|
||||||
|
|
||||||
sscanf(buf, "%s %s", word, value);
|
sscanf(buf, "%s %s", word, value);
|
||||||
|
|
||||||
if (strcmp (word, "dev_type") == 0) {
|
if (strcmp(word, "dev_type") == 0) {
|
||||||
buf[strlen(buf) - 1] = 0; // chomp newline
|
buf[strlen(buf) - 1] = 0; // chomp newline
|
||||||
sscanf(buf, "%*s %n", &nc);
|
sscanf(buf, "%*s %n", &nc);
|
||||||
ts->dev_type = strdup(buf + nc);
|
ts->dev_type = strdup(buf + nc);
|
||||||
} else if (strcmp(word, "ref_manual_id") == 0) {
|
} else if (strcmp(word, "ref_manual_id") == 0) {
|
||||||
buf[strlen(buf) - 1] = 0; // chomp newline
|
buf[strlen(buf) - 1] = 0; // chomp newline
|
||||||
sscanf(buf, "%*s %n", &nc);
|
sscanf(buf, "%*s %n", &nc);
|
||||||
ts->ref_manual_id = strdup(buf + nc);
|
ts->ref_manual_id = strdup(buf + nc);
|
||||||
} else if (strcmp(word, "chip_id") == 0) {
|
} else if (strcmp(word, "chip_id") == 0) {
|
||||||
buf[strlen(buf) - 1] = 0; // chomp newline
|
buf[strlen(buf) - 1] = 0; // chomp newline
|
||||||
sscanf(buf, "%*s %n", &nc);
|
sscanf(buf, "%*s %n", &nc);
|
||||||
if (sscanf(value, "%i", &ts->chip_id) < 1) {
|
if (sscanf(value, "%i", &ts->chip_id) < 1) {
|
||||||
fprintf(stderr, "Failed to parse chip-id\n");
|
fprintf(stderr, "Failed to parse chip-id\n");
|
||||||
}
|
}
|
||||||
} else if (strcmp(word, "flash_type") == 0) {
|
} else if (strcmp(word, "flash_type") == 0) {
|
||||||
buf[strlen(buf) - 1] = 0; // chomp newline
|
buf[strlen(buf) - 1] = 0; // chomp newline
|
||||||
sscanf(buf, "%*s %n", &nc);
|
sscanf(buf, "%*s %n", &nc);
|
||||||
if (strcmp(value, "F0_F1_F3") == 0) {
|
if (strcmp(value, "F0_F1_F3") == 0) {
|
||||||
ts->flash_type = STM32_FLASH_TYPE_F0_F1_F3;
|
ts->flash_type = STM32_FLASH_TYPE_F0_F1_F3;
|
||||||
} else if (strcmp(value, "F1_XL") == 0) {
|
} else if (strcmp(value, "F1_XL") == 0) {
|
||||||
ts->flash_type = STM32_FLASH_TYPE_F1_XL;
|
ts->flash_type = STM32_FLASH_TYPE_F1_XL;
|
||||||
} else if (strcmp(value, "F2_F4") == 0) {
|
} else if (strcmp(value, "F2_F4") == 0) {
|
||||||
ts->flash_type = STM32_FLASH_TYPE_F2_F4;
|
ts->flash_type = STM32_FLASH_TYPE_F2_F4;
|
||||||
} else if (strcmp(value, "F7") == 0) {
|
} else if (strcmp(value, "F7") == 0) {
|
||||||
ts->flash_type = STM32_FLASH_TYPE_F7;
|
ts->flash_type = STM32_FLASH_TYPE_F7;
|
||||||
} else if (strcmp(value, "G0") == 0) {
|
} else if (strcmp(value, "G0") == 0) {
|
||||||
ts->flash_type = STM32_FLASH_TYPE_G0;
|
ts->flash_type = STM32_FLASH_TYPE_G0;
|
||||||
} else if (strcmp(value, "G4") == 0) {
|
} else if (strcmp(value, "G4") == 0) {
|
||||||
ts->flash_type = STM32_FLASH_TYPE_G4;
|
ts->flash_type = STM32_FLASH_TYPE_G4;
|
||||||
} else if (strcmp(value, "H7") == 0) {
|
} else if (strcmp(value, "H7") == 0) {
|
||||||
ts->flash_type = STM32_FLASH_TYPE_H7;
|
ts->flash_type = STM32_FLASH_TYPE_H7;
|
||||||
} else if (strcmp(value, "L0_L1") == 0) {
|
} else if (strcmp(value, "L0_L1") == 0) {
|
||||||
ts->flash_type = STM32_FLASH_TYPE_L0_L1;
|
ts->flash_type = STM32_FLASH_TYPE_L0_L1;
|
||||||
} else if (strcmp(value, "L4_L4P") == 0) {
|
} else if (strcmp(value, "L4") == 0) {
|
||||||
ts->flash_type = STM32_FLASH_TYPE_L4;
|
ts->flash_type = STM32_FLASH_TYPE_L4;
|
||||||
} else if (strcmp(value, "L5_U5") == 0) {
|
} else if (strcmp(value, "L5_U5") == 0) {
|
||||||
ts->flash_type = STM32_FLASH_TYPE_L5_U5;
|
ts->flash_type = STM32_FLASH_TYPE_L5_U5;
|
||||||
} else if (strcmp(value, "WB_WL") == 0) {
|
} else if (strcmp(value, "WB_WL") == 0) {
|
||||||
ts->flash_type = STM32_FLASH_TYPE_WB_WL;
|
ts->flash_type = STM32_FLASH_TYPE_WB_WL;
|
||||||
} else {
|
} else {
|
||||||
ts->flash_type = STM32_FLASH_TYPE_UNKNOWN;
|
ts->flash_type = STM32_FLASH_TYPE_UNKNOWN;
|
||||||
}
|
}
|
||||||
} else if (strcmp(word, "flash_size_reg") == 0) {
|
} else if (strcmp(word, "flash_size_reg") == 0) {
|
||||||
buf[strlen(buf) - 1] = 0; // chomp newline
|
buf[strlen(buf) - 1] = 0; // chomp newline
|
||||||
sscanf(buf, "%*s %n", &nc);
|
sscanf(buf, "%*s %n", &nc);
|
||||||
if (sscanf(value, "%i", &ts->flash_size_reg) < 1) {
|
if (sscanf(value, "%i", &ts->flash_size_reg) < 1) {
|
||||||
fprintf(stderr, "Failed to parse flash size reg\n");
|
fprintf(stderr, "Failed to parse flash size reg\n");
|
||||||
}
|
}
|
||||||
} else if (strcmp(word, "flash_pagesize") == 0) {
|
} else if (strcmp(word, "flash_pagesize") == 0) {
|
||||||
buf[strlen(buf) - 1] = 0; // chomp newline
|
buf[strlen(buf) - 1] = 0; // chomp newline
|
||||||
sscanf(buf, "%*s %n", &nc);
|
sscanf(buf, "%*s %n", &nc);
|
||||||
if (sscanf(value, "%i", &ts->flash_pagesize) < 1) {
|
if (sscanf(value, "%i", &ts->flash_pagesize) < 1) {
|
||||||
fprintf(stderr, "Failed to parse flash page size\n");
|
fprintf(stderr, "Failed to parse flash page size\n");
|
||||||
}
|
}
|
||||||
} else if (strcmp(word, "sram_size") == 0) {
|
} else if (strcmp(word, "sram_size") == 0) {
|
||||||
buf[strlen(buf) - 1] = 0; // chomp newline
|
buf[strlen(buf) - 1] = 0; // chomp newline
|
||||||
sscanf(buf, "%*s %n", &nc);
|
sscanf(buf, "%*s %n", &nc);
|
||||||
if (sscanf(value, "%i", &ts->sram_size) < 1) {
|
if (sscanf(value, "%i", &ts->sram_size) < 1) {
|
||||||
fprintf(stderr, "Failed to parse SRAM size\n");
|
fprintf(stderr, "Failed to parse SRAM size\n");
|
||||||
}
|
}
|
||||||
} else if (strcmp(word, "bootrom_base") == 0) {
|
} else if (strcmp(word, "bootrom_base") == 0) {
|
||||||
buf[strlen(buf) - 1] = 0; // chomp newline
|
buf[strlen(buf) - 1] = 0; // chomp newline
|
||||||
sscanf(buf, "%*s %n", &nc);
|
sscanf(buf, "%*s %n", &nc);
|
||||||
if (sscanf(value, "%i", &ts->bootrom_base) < 1) {
|
if (sscanf(value, "%i", &ts->bootrom_base) < 1) {
|
||||||
fprintf(stderr, "Failed to parse BootROM base\n");
|
fprintf(stderr, "Failed to parse BootROM base\n");
|
||||||
}
|
}
|
||||||
} else if (strcmp(word, "bootrom_size") == 0) {
|
} else if (strcmp(word, "bootrom_size") == 0) {
|
||||||
buf[strlen(buf) - 1] = 0; // chomp newline
|
buf[strlen(buf) - 1] = 0; // chomp newline
|
||||||
sscanf(buf, "%*s %n", &nc);
|
sscanf(buf, "%*s %n", &nc);
|
||||||
if (sscanf(value, "%i", &ts->bootrom_size) < 1) {
|
if (sscanf(value, "%i", &ts->bootrom_size) < 1) {
|
||||||
fprintf(stderr, "Failed to parse BootROM size\n");
|
fprintf(stderr, "Failed to parse BootROM size\n");
|
||||||
}
|
}
|
||||||
} else if (strcmp(word, "option_base") == 0) {
|
} else if (strcmp(word, "option_base") == 0) {
|
||||||
buf[strlen(buf) - 1] = 0; // chomp newline
|
buf[strlen(buf) - 1] = 0; // chomp newline
|
||||||
sscanf(buf, "%*s %n", &nc);
|
sscanf(buf, "%*s %n", &nc);
|
||||||
if (sscanf(value, "%i", &ts->option_base) < 1) {
|
if (sscanf(value, "%i", &ts->option_base) < 1) {
|
||||||
fprintf(stderr, "Failed to parse option base\n");
|
fprintf(stderr, "Failed to parse option base\n");
|
||||||
}
|
}
|
||||||
} else if (strcmp(word, "option_size") == 0) {
|
} else if (strcmp(word, "option_size") == 0) {
|
||||||
buf[strlen(buf) - 1] = 0; // chomp newline
|
buf[strlen(buf) - 1] = 0; // chomp newline
|
||||||
sscanf(buf, "%*s %n", &nc);
|
sscanf(buf, "%*s %n", &nc);
|
||||||
if (sscanf(value, "%i", &ts->option_size) < 1) {
|
if (sscanf(value, "%i", &ts->option_size) < 1) {
|
||||||
fprintf(stderr, "Failed to parse option size\n");
|
fprintf(stderr, "Failed to parse option size\n");
|
||||||
}
|
}
|
||||||
} else if (strcmp(word, "flags") == 0) {
|
} else if (strcmp(word, "flags") == 0) {
|
||||||
buf[strlen(buf) - 1] = 0; // chomp newline
|
buf[strlen(buf) - 1] = 0; // chomp newline
|
||||||
sscanf(buf, "%*s %n", &nc);
|
sscanf(buf, "%*s %n", &nc);
|
||||||
p = strtok (buf, " \t\n");
|
p = strtok(buf, " \t\n");
|
||||||
|
|
||||||
while ((p = strtok (NULL, " \t\n"))) {
|
while ((p = strtok(NULL, " \t\n"))) {
|
||||||
if (strcmp(p, "none") == 0) {
|
if (strcmp(p, "none") == 0) {
|
||||||
// NOP
|
// NOP
|
||||||
} else if (strcmp(p, "dualbank") == 0) {
|
} else if (strcmp(p, "dualbank") == 0) {
|
||||||
ts->flags |= CHIP_F_HAS_DUAL_BANK;
|
ts->flags |= CHIP_F_HAS_DUAL_BANK;
|
||||||
} else if (strcmp(p, "swo") == 0) {
|
} else if (strcmp(p, "swo") == 0) {
|
||||||
ts->flags |= CHIP_F_HAS_SWO_TRACING;
|
ts->flags |= CHIP_F_HAS_SWO_TRACING;
|
||||||
} else {
|
|
||||||
fprintf(stderr, "Unknown flags word in %s: '%s'\n",
|
|
||||||
fname, p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sscanf(value, "%x", &ts->flags);
|
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Unknown keyword in %s: %s\n", fname, word);
|
fprintf(stderr, "Unknown flags word in %s: '%s'\n", fname, p);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sscanf(value, "%x", &ts->flags);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "Unknown keyword in %s: %s\n", fname, word);
|
||||||
}
|
}
|
||||||
fclose(fp);
|
}
|
||||||
ts->next = devicelist;
|
fclose(fp);
|
||||||
devicelist = ts;
|
ts->next = devicelist;
|
||||||
|
devicelist = ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(STLINK_HAVE_DIRENT_H)
|
#if defined(STLINK_HAVE_DIRENT_H)
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
void init_chipids(char *dir_to_scan) {
|
void init_chipids(char *dir_to_scan) {
|
||||||
DIR *d;
|
DIR *d;
|
||||||
size_t nl; // namelen
|
size_t nl; // namelen
|
||||||
struct dirent *dir;
|
struct dirent *dir;
|
||||||
|
|
||||||
if (!dir_to_scan) {
|
if (!dir_to_scan) {
|
||||||
dir_to_scan = "./";
|
dir_to_scan = "./";
|
||||||
|
}
|
||||||
|
|
||||||
|
devicelist = NULL;
|
||||||
|
d = opendir(dir_to_scan);
|
||||||
|
|
||||||
|
if (d) {
|
||||||
|
while ((dir = readdir(d)) != NULL) {
|
||||||
|
nl = strlen(dir->d_name);
|
||||||
|
|
||||||
|
if (strcmp(dir->d_name + nl - 5, ".chip") == 0) {
|
||||||
|
char buf[1024];
|
||||||
|
sprintf(buf, "%s/%s", dir_to_scan, dir->d_name);
|
||||||
|
process_chipfile(buf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
devicelist = NULL;
|
closedir(d);
|
||||||
d = opendir(dir_to_scan);
|
} else {
|
||||||
|
perror(dir_to_scan);
|
||||||
if (d) {
|
return;
|
||||||
while ((dir = readdir(d)) != NULL) {
|
}
|
||||||
nl = strlen(dir->d_name);
|
|
||||||
|
|
||||||
if (strcmp(dir->d_name + nl - 5, ".chip") == 0) {
|
|
||||||
char buf[1024];
|
|
||||||
sprintf(buf, "%s/%s", dir_to_scan, dir->d_name);
|
|
||||||
process_chipfile(buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
closedir(d);
|
|
||||||
} else {
|
|
||||||
perror (dir_to_scan);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif //STLINK_HAVE_DIRENT_H
|
#endif // STLINK_HAVE_DIRENT_H
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(STLINK_HAVE_DIRENT_H)
|
#if defined(_WIN32) && !defined(STLINK_HAVE_DIRENT_H)
|
||||||
#include <fileapi.h>
|
#include <fileapi.h>
|
||||||
#include <strsafe.h>
|
#include <strsafe.h>
|
||||||
|
|
||||||
void init_chipids(char *dir_to_scan) {
|
void init_chipids(char *dir_to_scan) {
|
||||||
HANDLE hFind = INVALID_HANDLE_VALUE;
|
HANDLE hFind = INVALID_HANDLE_VALUE;
|
||||||
WIN32_FIND_DATAA ffd;
|
WIN32_FIND_DATAA ffd;
|
||||||
char filepath[MAX_PATH] = {0};
|
char filepath[MAX_PATH] = {0};
|
||||||
|
StringCchCopyA(filepath, STLINK_ARRAY_SIZE(filepath), dir_to_scan);
|
||||||
|
|
||||||
|
if (FAILED(
|
||||||
|
StringCchCatA(filepath, STLINK_ARRAY_SIZE(filepath), "\\*.chip"))) {
|
||||||
|
ELOG("Path to chips's dir too long.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hFind = FindFirstFileA(filepath, &ffd);
|
||||||
|
|
||||||
|
if (INVALID_HANDLE_VALUE == hFind) {
|
||||||
|
ELOG("Can't find any chip description file in %s.\n", filepath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
memset(filepath, 0, STLINK_ARRAY_SIZE(filepath));
|
||||||
StringCchCopyA(filepath, STLINK_ARRAY_SIZE(filepath), dir_to_scan);
|
StringCchCopyA(filepath, STLINK_ARRAY_SIZE(filepath), dir_to_scan);
|
||||||
|
StringCchCatA(filepath, STLINK_ARRAY_SIZE(filepath), "\\");
|
||||||
|
StringCchCatA(filepath, STLINK_ARRAY_SIZE(filepath), ffd.cFileName);
|
||||||
|
process_chipfile(filepath);
|
||||||
|
} while (FindNextFileA(hFind, &ffd) != 0);
|
||||||
|
|
||||||
if (FAILED(StringCchCatA(filepath, STLINK_ARRAY_SIZE(filepath), "\\*.chip"))) {
|
FindClose(hFind);
|
||||||
ELOG("Path to chips's dir too long.\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
hFind = FindFirstFileA(filepath, &ffd);
|
|
||||||
|
|
||||||
if (INVALID_HANDLE_VALUE == hFind) {
|
|
||||||
ELOG("Can't find any chip description file in %s.\n", filepath);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
|
||||||
memset(filepath, 0, STLINK_ARRAY_SIZE(filepath));
|
|
||||||
StringCchCopyA(filepath, STLINK_ARRAY_SIZE(filepath), dir_to_scan);
|
|
||||||
StringCchCatA(filepath, STLINK_ARRAY_SIZE(filepath), "\\");
|
|
||||||
StringCchCatA(filepath, STLINK_ARRAY_SIZE(filepath), ffd.cFileName);
|
|
||||||
process_chipfile(filepath);
|
|
||||||
} while (FindNextFileA(hFind, &ffd) != 0);
|
|
||||||
|
|
||||||
FindClose(hFind);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //defined(_WIN32) && !defined(STLINK_HAVE_DIRENT_H)
|
#endif // defined(_WIN32) && !defined(STLINK_HAVE_DIRENT_H)
|
||||||
|
|
Ładowanie…
Reference in New Issue