diff --git a/minichlink/Makefile b/minichlink/Makefile index 8f215a19d888b8e592adc1a8d338f80640ce8c21..f4b2d8e399636304c45d9dd5c6471aad557b34d9 100644 --- a/minichlink/Makefile +++ b/minichlink/Makefile @@ -1,6 +1,6 @@ TOOLS:=minichlink minichlink.so -CFLAGS:=-O0 -g3 -Wall -I. +CFLAGS:=-O0 -g3 -Wall -DCH32V003 -I. C_S:=minichlink.c pgm-wch-linke.c pgm-esp32s2-ch32xx.c nhc-link042.c ardulink.c serial_dev.c pgm-b003fun.c minichgdb.c # General Note: To use with GDB, gdb-multiarch @@ -9,7 +9,7 @@ C_S:=minichlink.c pgm-wch-linke.c pgm-esp32s2-ch32xx.c nhc-link042.c ardulink.c ifeq ($(OS),Windows_NT) LDFLAGS:=-L. -lpthread -lusb-1.0 -lsetupapi -lws2_32 - CFLAGS:=-Os -s -Wall -D_WIN32_WINNT=0x0600 -I. + CFLAGS:=-Os -s -Wall -D_WIN32_WINNT=0x0600 -DCH32V003 -I. TOOLS:=minichlink.exe else OS_NAME := $(shell uname -s | tr A-Z a-z) @@ -18,7 +18,7 @@ else endif ifeq ($(OS_NAME),darwin) LDFLAGS:=-lpthread -lusb-1.0 -framework CoreFoundation -framework IOKit - CFLAGS:=-O0 -Wall -Wno-asm-operand-widths -Wno-deprecated-declarations -Wno-deprecated-non-prototype -D__MACOSX__ -I. + CFLAGS:=-O0 -Wall -Wno-asm-operand-widths -Wno-deprecated-declarations -Wno-deprecated-non-prototype -D__MACOSX__ -DCH32V003 -I. INCLUDES:=$(shell pkg-config --cflags-only-I libusb-1.0) LIBINCLUDES:=$(shell pkg-config --libs-only-L libusb-1.0) INCS:=$(INCLUDES) $(LIBINCLUDES) diff --git a/minichlink/minichlink.exe b/minichlink/minichlink.exe index df60e922ad7b48584993e0b6c5ce86de66bc14f6..276e83f802abc51a6c9dc345d7e52041d0fecf41 100644 Binary files a/minichlink/minichlink.exe and b/minichlink/minichlink.exe differ diff --git a/minichlink/minichlink.h b/minichlink/minichlink.h index a46793cd331e2f58fe02a3a35c402e13061fd7cd..11cf32c48707716e66721ec9909700eaf5e249fb 100644 --- a/minichlink/minichlink.h +++ b/minichlink/minichlink.h @@ -105,13 +105,13 @@ struct ProgrammerStructBase #define MAX_FLASH_SECTORS 262144 enum RiscVChip { - CH32V10x = 0x01, - CH57x = 0x02, - CH56x = 0x03, - CH32V20x = 0x05, - CH32V30x = 0x06, - CH58x = 0x07, - CH32V003 = 0x09 + CHIP_CH32V10x = 0x01, + CHIP_CH57x = 0x02, + CHIP_CH56x = 0x03, + CHIP_CH32V20x = 0x05, + CHIP_CH32V30x = 0x06, + CHIP_CH58x = 0x07, + CHIP_CH32V003 = 0x09 }; struct InternalState diff --git a/minichlink/pgm-wch-linke.c b/minichlink/pgm-wch-linke.c index 7a98ce45cf0d3d6724f982127b5f479fb6887382..fe4205417269265009165851230cd02f25a0f5cd 100644 --- a/minichlink/pgm-wch-linke.c +++ b/minichlink/pgm-wch-linke.c @@ -18,25 +18,25 @@ struct LinkEProgrammerStruct static void printChipInfo(enum RiscVChip chip) { switch(chip) { - case CH32V10x: + case CHIP_CH32V10x: fprintf(stderr, "Detected: CH32V10x\n"); break; - case CH57x: + case CHIP_CH57x: fprintf(stderr, "Detected: CH57x\n"); break; - case CH56x: + case CHIP_CH56x: fprintf(stderr, "Detected: CH56x\n"); break; - case CH32V20x: + case CHIP_CH32V20x: fprintf(stderr, "Detected: CH32V20x\n"); break; - case CH32V30x: + case CHIP_CH32V30x: fprintf(stderr, "Detected: CH32V30x\n"); break; - case CH58x: + case CHIP_CH58x: fprintf(stderr, "Detected: CH58x\n"); break; - case CH32V003: + case CHIP_CH32V003: fprintf(stderr, "Detected: CH32V003\n"); break; } @@ -44,15 +44,15 @@ static void printChipInfo(enum RiscVChip chip) { static int checkChip(enum RiscVChip chip) { switch(chip) { - case CH32V003: + case CHIP_CH32V003: return 0; // Use direct mode - case CH32V10x: - case CH32V20x: - case CH32V30x: + case CHIP_CH32V10x: + case CHIP_CH32V20x: + case CHIP_CH32V30x: return 1; // Use binary blob mode - case CH56x: - case CH57x: - case CH58x: + case CHIP_CH56x: + case CHIP_CH57x: + case CHIP_CH58x: default: return -1; // Not supported yet } @@ -530,10 +530,10 @@ int bootloader_len = 512; static const uint8_t * GetFlashLoader( enum RiscVChip chip ) { switch(chip) { - case CH32V10x: + case CHIP_CH32V10x: return bootloader_v1; - case CH32V20x: - case CH32V30x: + case CHIP_CH32V20x: + case CHIP_CH32V30x: default: return bootloader_v2; }