mirror of
https://github.com/hathach/tinyusb.git
synced 2026-08-18 11:02:16 +00:00
bsp, hil: flash with the unified OpenOCD fork https://github.com/hathach/openocd (branch tinyusb) is mainline plus every config these boards need: RPi RP2350, ADI max32/max78, the MounRiver WCH configs, and the wlinke adapter on mainline's riscv target. It is a superset of the vendor forks, so one 'openocd' covers all boards; -DOPENOCD=/OPENOCD= still select another, msdk's when MAXIM_PATH is set. Drops family_flash_openocd_wch and the OPENOCD_WCH pair, dedups family_flash_openocd_adi, aligns ch583's work area, and points hil at the flasher's own config instead of generating one per probe. Verified: HIL green on all four WCH boards and max32666fthr.
60 lines
1.5 KiB
Makefile
60 lines
1.5 KiB
Makefile
# https://www.embecosm.com/resources/tool-chain-downloads/#riscv-stable
|
|
#CROSS_COMPILE ?= riscv32-unknown-elf-
|
|
|
|
# Toolchain from https://nucleisys.com/download.php
|
|
#CROSS_COMPILE ?= riscv-nuclei-elf-
|
|
|
|
# Toolchain from https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack
|
|
CROSS_COMPILE ?= riscv-none-elf-
|
|
|
|
SDK_DIR = hw/mcu/wch/ch583
|
|
SDK_SRC_DIR = $(SDK_DIR)/EVT/EXAM/SRC
|
|
|
|
include $(TOP)/$(BOARD_PATH)/board.mk
|
|
CPU_CORE ?= rv32imac-ilp32
|
|
|
|
CFLAGS += \
|
|
-flto \
|
|
-msmall-data-limit=16 \
|
|
-mno-save-restore \
|
|
-fmessage-length=0 \
|
|
-fsigned-char \
|
|
-DCFG_TUSB_MCU=OPT_MCU_CH583 \
|
|
-DCFG_TUD_WCH_USBIP_USBFS=1 \
|
|
-DFREQ_SYS=60000000 \
|
|
-DDISK_LIB_ENABLE=0 \
|
|
-DINT_SOFT \
|
|
-Wno-error=strict-prototypes
|
|
|
|
LDFLAGS += \
|
|
-nostartfiles \
|
|
--specs=nosys.specs --specs=nano.specs
|
|
|
|
LIBS += $(TOP)/$(SDK_SRC_DIR)/StdPeriphDriver/libISP583.a
|
|
|
|
SRC_C += \
|
|
src/portable/wch/dcd_ch32_usbfs.c \
|
|
$(SDK_SRC_DIR)/StdPeriphDriver/CH58x_gpio.c \
|
|
$(SDK_SRC_DIR)/StdPeriphDriver/CH58x_clk.c \
|
|
$(SDK_SRC_DIR)/StdPeriphDriver/CH58x_uart1.c \
|
|
$(SDK_SRC_DIR)/StdPeriphDriver/CH58x_sys.c \
|
|
$(FAMILY_PATH)/debug_uart.c \
|
|
$(FAMILY_PATH)/ch583_it.c \
|
|
$(FAMILY_PATH)/system_ch583.c
|
|
|
|
SRC_S += \
|
|
$(SDK_SRC_DIR)/Startup/startup_CH583.S
|
|
|
|
INC += \
|
|
$(TOP)/$(BOARD_PATH) \
|
|
$(TOP)/$(SDK_SRC_DIR)/RVMSIS \
|
|
$(TOP)/$(SDK_SRC_DIR)/StdPeriphDriver/inc
|
|
|
|
LD_FILE ?= $(FAMILY_PATH)/linker/ch582.ld
|
|
|
|
OPENOCD_OPTION=-f $(TOP)/$(FAMILY_PATH)/wch-riscv.cfg
|
|
flash: flash-openocd-wch
|
|
|
|
# For freeRTOS port source
|
|
FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/RISC-V
|