diff --git a/.gdbinit b/.gdbinit new file mode 100644 index 0000000..542a8e3 --- /dev/null +++ b/.gdbinit @@ -0,0 +1,4 @@ +target ext :3333 +monitor init +monitor reset +monitor halt \ No newline at end of file diff --git a/Makefile b/Makefile index a4e6916..f1c1b60 100644 --- a/Makefile +++ b/Makefile @@ -8,9 +8,14 @@ TARGET = badgemagic-ch582 # building variables ###################################### # Uncomment below line to enable debugging -# DEBUG = 1 +DEBUG ?= 1 + # Uncomment below to build for USB-C version # USBC_VERSION = 1 + +PREFIX ?= riscv-none-embed- +OPENOCD ?= ../MRS_Toolchain_Linux_x64_V1.91/OpenOCD/bin/openocd + # optimization for size OPT = -Os @@ -92,7 +97,6 @@ CH5xx_ble_firmware_library/Startup/startup_CH583.S ####################################### # binaries ####################################### -PREFIX ?= riscv-none-embed- CC = $(PREFIX)gcc AS = $(PREFIX)gcc -x assembler-with-cpp @@ -199,7 +203,10 @@ $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf # Program ####################################### program: $(BUILD_DIR)/$(TARGET).elf - sudo wch-openocd -f /usr/share/wch-openocd/openocd/scripts/interface/wch-riscv.cfg -c 'init; halt; program $(BUILD_DIR)/$(TARGET).elf; reset; wlink_reset_resume; exit;' + $(OPENOCD) -f interface/wch-riscv.cfg -c 'init; halt; program $(BUILD_DIR)/$(TARGET).elf; reset; wlink_reset_resume; exit;' + +debug: + $(OPENOCD) -f debug.cfg isp: $(BUILD_DIR)/$(TARGET).bin wchisp flash $(BUILD_DIR)/$(TARGET).bin diff --git a/debug.cfg b/debug.cfg new file mode 100644 index 0000000..ddd8b96 --- /dev/null +++ b/debug.cfg @@ -0,0 +1,5 @@ +source [find interface/wch-riscv.cfg] + +init +halt +reset \ No newline at end of file diff --git a/src/leddrv.c b/src/leddrv.c index 37c3e4b..ba04976 100644 --- a/src/leddrv.c +++ b/src/leddrv.c @@ -101,8 +101,10 @@ static const pindesc_t led_pins[LED_PINCOUNT] = { PINDESC(A, 11), // G PINDESC(B, 9), // H PINDESC(B, 8), // I - PINDESC(B, 15), // J - PINDESC(B, 14), // K + + PINDESC(B, 17), // J + PINDESC(B, 16), // K + PINDESC(B, 13), // L PINDESC(B, 12), // M PINDESC(B, 5), // N