Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gdbinit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
target ext :3333
monitor init
monitor reset
monitor halt
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions debug.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source [find interface/wch-riscv.cfg]

init
halt
reset
6 changes: 4 additions & 2 deletions src/leddrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading