Skip to content

Commit

Permalink
Template: Update Programming rule
Browse files Browse the repository at this point in the history
  • Loading branch information
Kongou Hikari committed Sep 4, 2019
1 parent 4e35a85 commit 548744b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
14 changes: 11 additions & 3 deletions Template/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ LDSCRIPT = $(FIRMWARE_DIR)/RISCV/env_Eclipse/GD32VF103x8.lds
# libraries
#LIBS = -lc_nano -lm
LIBDIR =
LDFLAGS = -flto $(ARCH) -T$(LDSCRIPT) $(LIBDIR) $(LIBS) $(PERIFLIB_SOURCES) -Wl,--no-relax -Wl,--gc-sections -Wl,-M=$(BUILD_DIR)/$(TARGET).map -nostartfiles #-ffreestanding -nostdlib
LDFLAGS = -flto $(ARCH) -T$(LDSCRIPT) $(LIBDIR) $(LIBS) $(PERIFLIB_SOURCES) -Wl,--cref -Wl,--no-relax -Wl,--gc-sections -Wl,-M=$(BUILD_DIR)/$(TARGET).map -nostartfiles #-ffreestanding -nostdlib

# default action: build all
all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
Expand Down Expand Up @@ -152,8 +152,16 @@ $(BUILD_DIR):
clean:
-rm -fR .dep $(BUILD_DIR)
flash: all
$()openocd -f ./openocd_ft2232.cfg -c init -c "halt; flash protect 0 0 last off; \
program {build\gd32vf103.elf} verify ; mww 0xe004200c 0x4b5a6978; mww 0xe0042008 0x01; resume; exit;"
-openocd -f ./openocd_ft2232.cfg -c init -c " flash protect 0 0 last off; \
program {$(BUILD_DIR)/$(TARGET).elf} verify; mww 0xe004200c 0x4b5a6978; mww 0xe0042008 0x01; resume; exit 0;"

dfu: all
dfu-util -d 28e9:0189 -a 0 --dfuse-address 0x08000000:leave -D $(BUILD_DIR)/$(TARGET).bin

#Remove ':leave', the microcontroller will not boot to application when finished programming.

uart: all
stm32flash -w $(BUILD_DIR)/$(TARGET).bin /dev/ttyUSB0

#######################################
# dependencies
Expand Down
3 changes: 1 addition & 2 deletions Template/openocd_ft2232.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 10000 -work-ar
set _FLASHNAME $_CHIPNAME.flash
flash bank $_FLASHNAME gd32vf103 0x08000000 0 0 0 $_TARGETNAME

riscv expose_csrs 3040-3071
bindto 0.0.0.0
#riscv expose_csrs 3040-3071
init
#reset
#if {[ info exists pulse_srst]} {
Expand Down

0 comments on commit 548744b

Please sign in to comment.