Switch-over to new chip-files

pull/1216/head
nightwalker-87 2022-01-09 21:52:55 +01:00
rodzic 14498bb3c0
commit 5cde863c03
3 zmienionych plików z 55 dodań i 53 usunięć

Wyświetl plik

@ -106,19 +106,21 @@ enum target_state {
#define C_BUF_LEN 32
/* Old flash type definitions */
// TODO: Transition to the new defines in stm32.h
enum stlink_flash_type {
STLINK_FLASH_TYPE_UNKNOWN = 0,
STLINK_FLASH_TYPE_F0, // used by f0, f1 (except f1xl),f3. */
STLINK_FLASH_TYPE_F1_XL, // f0 flash with dual bank, apparently */
STLINK_FLASH_TYPE_F4, // used by f2, f4 */
STLINK_FLASH_TYPE_F7,
STLINK_FLASH_TYPE_L0, // l0, l1 */
STLINK_FLASH_TYPE_L4, // l4, l4+ */
STLINK_FLASH_TYPE_G0,
STLINK_FLASH_TYPE_G4,
STLINK_FLASH_TYPE_WB,
STLINK_FLASH_TYPE_H7,
STLINK_FLASH_TYPE_MAX,
/* 0 */ STLINK_FLASH_TYPE_UNKNOWN = 0,
/* 1 */ STLINK_FLASH_TYPE_F0, // used by f0, f1 (except f1xl),f3. */
/* 2 */ STLINK_FLASH_TYPE_F1_XL, // f0 flash with dual bank */
/* 3 */ STLINK_FLASH_TYPE_F4, // used by f2, f4 */
/* 4 */ STLINK_FLASH_TYPE_F7,
/* 5 */ STLINK_FLASH_TYPE_L0, // l0, l1 */
/* 6 */ STLINK_FLASH_TYPE_L4, // l4, l4+ */
/* 7 */ STLINK_FLASH_TYPE_G0,
/* 8 */ STLINK_FLASH_TYPE_G4,
/* 9 */ STLINK_FLASH_TYPE_WB,
/* 10 */ STLINK_FLASH_TYPE_H7,
/* 11 */ STLINK_FLASH_TYPE_MAX,
};
struct stlink_reg {

Wyświetl plik

@ -1,6 +1,6 @@
#include <stlink.h>
#include "chipid.h"
#include "chipid_db_old.h"
//#include "chipid_db_old.h"
#include <string.h>
#include <errno.h>
@ -9,17 +9,17 @@
#include <stdlib.h>
struct stlink_chipid_params *stlink_chipid_get_params_old(uint32_t chipid) {
struct stlink_chipid_params *params = NULL;
// struct stlink_chipid_params *stlink_chipid_get_params_old(uint32_t chipid) {
// struct stlink_chipid_params *params = NULL;
for (size_t n = 0; n < STLINK_ARRAY_SIZE(devices); n++)
if (devices[n].chip_id == chipid) {
params = &devices[n];
break;
}
// for (size_t n = 0; n < STLINK_ARRAY_SIZE(devices); n++)
// if (devices[n].chip_id == chipid) {
// params = &devices[n];
// break;
// }
return (params);
}
// return (params);
// }
static struct stlink_chipid_params *devicelist;
@ -165,7 +165,7 @@ void process_chipfile(char *fname) {
while ((pp = strtok (NULL, " \t\n"))) {
if (strcmp (pp, "none") == 0) {
ts->flags = 0; // not necessary: calloc did this already.
// NOP
} else if (strcmp (pp, "dualbank") == 0) {
ts->flags |= CHIP_F_HAS_DUAL_BANK;
} else if (strcmp (pp, "swo") == 0) {
@ -187,37 +187,37 @@ void process_chipfile(char *fname) {
devicelist = ts;
}
void dump_chips (void) {
struct stlink_chipid_params *ts;
char *p, buf[100];
FILE *fp;
// void dump_chips (void) {
// struct stlink_chipid_params *ts;
// char *p, buf[100];
// FILE *fp;
for (size_t n = 0; n < STLINK_ARRAY_SIZE(devices); n++) {
ts = &devices[n];
// for (size_t n = 0; n < STLINK_ARRAY_SIZE(devices); n++) {
// ts = &devices[n];
strcpy(buf, ts->dev_type);
// strcpy(buf, ts->dev_type);
while ((p = strchr(buf, '/'))) // change slashes to underscore.
*p = '_';
// while ((p = strchr(buf, '/'))) // change slashes to underscore.
// *p = '_';
strcat(buf, ".chip");
fp = fopen(buf, "w");
fprintf(fp, "# Device Type: %s\n", ts->dev_type);
fprintf(fp, "# Reference Manual: RM%s\n", ts->ref_manual_id);
fprintf(fp, "#\n");
fprintf(fp, "chip_id %x\n", ts->chip_id);
fprintf(fp, "flash_type %x\n", ts->flash_type);
fprintf(fp, "flash_size_reg %x\n", ts->flash_size_reg);
fprintf(fp, "flash_pagesize %x\n", ts->flash_pagesize);
fprintf(fp, "sram_size %x\n", ts->sram_size);
fprintf(fp, "bootrom_base %x\n", ts->bootrom_base);
fprintf(fp, "bootrom_size %x\n", ts->bootrom_size);
fprintf(fp, "option_base %x\n", ts->option_base);
fprintf(fp, "option_size %x\n", ts->option_size);
fprintf(fp, "flags %x\n\n", ts->flags);
fclose(fp);
}
}
// strcat(buf, ".chip");
// fp = fopen(buf, "w");
// fprintf(fp, "# Device Type: %s\n", ts->dev_type);
// fprintf(fp, "# Reference Manual: RM%s\n", ts->ref_manual_id);
// fprintf(fp, "#\n");
// fprintf(fp, "chip_id %x\n", ts->chip_id);
// fprintf(fp, "flash_type %x\n", ts->flash_type);
// fprintf(fp, "flash_size_reg %x\n", ts->flash_size_reg);
// fprintf(fp, "flash_pagesize %x\n", ts->flash_pagesize);
// fprintf(fp, "sram_size %x\n", ts->sram_size);
// fprintf(fp, "bootrom_base %x\n", ts->bootrom_base);
// fprintf(fp, "bootrom_size %x\n", ts->bootrom_size);
// fprintf(fp, "option_base %x\n", ts->option_base);
// fprintf(fp, "option_size %x\n", ts->option_size);
// fprintf(fp, "flags %x\n\n", ts->flags);
// fclose(fp);
// }
// }
#if defined(STLINK_HAVE_DIRENT_H)
#include <dirent.h>
@ -248,7 +248,7 @@ void init_chipids(char *dir_to_scan) {
closedir(d);
} else {
perror (dir_to_scan);
return; // XXX
return;
}
}
#endif //STLINK_HAVE_DIRENT_H

Wyświetl plik

@ -5,7 +5,7 @@
// change it both here and in the corresponding
// config/chips/*.chip file.
static struct stlink_chipid_params devices[] = {
//static struct stlink_chipid_params devices[] = {
{
// STM32F03x
// RM0091
@ -874,4 +874,4 @@ static struct stlink_chipid_params devices[] = {
.bootrom_base = 0x0,
.bootrom_size = 0x0,
},
};
//};