Skip to content
Snippets Groups Projects
Commit e24fc6f0 authored by Alexander Mandera's avatar Alexander Mandera
Browse files

Fix minichlink compilation

parent 45d5cca3
No related branches found
No related tags found
No related merge requests found
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)
......
No preview for this file type
......@@ -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
......
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment