Difference between revisions of "CH32V307V-EVT-R1"

From Stm32World Wiki
Jump to navigation Jump to search
Line 186: Line 186:
 
=== Flashing ===
 
=== Flashing ===
  
To be added
+
Flashing first time should be straight forward.  Click on the flash button:
 +
 
 +
[[File:Flash button.png|100px]]
 +
 
 +
Results in the following console output:
 +
 
 +
<pre>
 +
11:14:20 **** Build of configuration obj for project first ****
 +
make -j4 all
 +
Building file: ../User/ch32v30x_it.c
 +
Building file: ../User/main.c
 +
Building file: ../User/system_ch32v30x.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"User/ch32v30x_it.d" -MT"User/ch32v30x_it.o" -c -o "User/ch32v30x_it.o" "../User/ch32v30x_it.c"
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"User/system_ch32v30x.d" -MT"User/system_ch32v30x.o" -c -o "User/system_ch32v30x.o" "../User/system_ch32v30x.c"
 +
Invoking: GNU RISC-V Cross C Compiler
 +
Building file: ../Startup/startup_ch32v30x_D8C.S
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"User/main.d" -MT"User/main.o" -c -o "User/main.o" "../User/main.c"
 +
Invoking: GNU RISC-V Cross Assembler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -x assembler -I"/home/lth/src/CH32V307V-EVT-R1/first/Startup" -MMD -MP -MF"Startup/startup_ch32v30x_D8C.d" -MT"Startup/startup_ch32v30x_D8C.o" -c -o "Startup/startup_ch32v30x_D8C.o" "../Startup/startup_ch32v30x_D8C.S"
 +
Finished building: ../Startup/startup_ch32v30x_D8C.S
 +
 +
Building file: ../Peripheral/src/ch32v30x_adc.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_adc.d" -MT"Peripheral/src/ch32v30x_adc.o" -c -o "Peripheral/src/ch32v30x_adc.o" "../Peripheral/src/ch32v30x_adc.c"
 +
Finished building: ../User/main.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_bkp.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_bkp.d" -MT"Peripheral/src/ch32v30x_bkp.o" -c -o "Peripheral/src/ch32v30x_bkp.o" "../Peripheral/src/ch32v30x_bkp.c"
 +
Finished building: ../User/ch32v30x_it.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_can.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_can.d" -MT"Peripheral/src/ch32v30x_can.o" -c -o "Peripheral/src/ch32v30x_can.o" "../Peripheral/src/ch32v30x_can.c"
 +
Finished building: ../User/system_ch32v30x.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_crc.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_crc.d" -MT"Peripheral/src/ch32v30x_crc.o" -c -o "Peripheral/src/ch32v30x_crc.o" "../Peripheral/src/ch32v30x_crc.c"
 +
Finished building: ../Peripheral/src/ch32v30x_bkp.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_dac.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_dac.d" -MT"Peripheral/src/ch32v30x_dac.o" -c -o "Peripheral/src/ch32v30x_dac.o" "../Peripheral/src/ch32v30x_dac.c"
 +
Finished building: ../Peripheral/src/ch32v30x_crc.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_dbgmcu.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_dbgmcu.d" -MT"Peripheral/src/ch32v30x_dbgmcu.o" -c -o "Peripheral/src/ch32v30x_dbgmcu.o" "../Peripheral/src/ch32v30x_dbgmcu.c"
 +
Finished building: ../Peripheral/src/ch32v30x_adc.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_dma.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_dma.d" -MT"Peripheral/src/ch32v30x_dma.o" -c -o "Peripheral/src/ch32v30x_dma.o" "../Peripheral/src/ch32v30x_dma.c"
 +
Finished building: ../Peripheral/src/ch32v30x_dac.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_dvp.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_dvp.d" -MT"Peripheral/src/ch32v30x_dvp.o" -c -o "Peripheral/src/ch32v30x_dvp.o" "../Peripheral/src/ch32v30x_dvp.c"
 +
Finished building: ../Peripheral/src/ch32v30x_dbgmcu.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_eth.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_eth.d" -MT"Peripheral/src/ch32v30x_eth.o" -c -o "Peripheral/src/ch32v30x_eth.o" "../Peripheral/src/ch32v30x_eth.c"
 +
Finished building: ../Peripheral/src/ch32v30x_can.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_exti.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_exti.d" -MT"Peripheral/src/ch32v30x_exti.o" -c -o "Peripheral/src/ch32v30x_exti.o" "../Peripheral/src/ch32v30x_exti.c"
 +
Finished building: ../Peripheral/src/ch32v30x_dma.c
 +
Finished building: ../Peripheral/src/ch32v30x_dvp.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_flash.c
 +
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_flash.d" -MT"Peripheral/src/ch32v30x_flash.o" -c -o "Peripheral/src/ch32v30x_flash.o" "../Peripheral/src/ch32v30x_flash.c"
 +
Building file: ../Peripheral/src/ch32v30x_fsmc.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_fsmc.d" -MT"Peripheral/src/ch32v30x_fsmc.o" -c -o "Peripheral/src/ch32v30x_fsmc.o" "../Peripheral/src/ch32v30x_fsmc.c"
 +
Finished building: ../Peripheral/src/ch32v30x_exti.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_gpio.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_gpio.d" -MT"Peripheral/src/ch32v30x_gpio.o" -c -o "Peripheral/src/ch32v30x_gpio.o" "../Peripheral/src/ch32v30x_gpio.c"
 +
Finished building: ../Peripheral/src/ch32v30x_fsmc.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_i2c.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_i2c.d" -MT"Peripheral/src/ch32v30x_i2c.o" -c -o "Peripheral/src/ch32v30x_i2c.o" "../Peripheral/src/ch32v30x_i2c.c"
 +
Finished building: ../Peripheral/src/ch32v30x_flash.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_iwdg.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_iwdg.d" -MT"Peripheral/src/ch32v30x_iwdg.o" -c -o "Peripheral/src/ch32v30x_iwdg.o" "../Peripheral/src/ch32v30x_iwdg.c"
 +
Finished building: ../Peripheral/src/ch32v30x_gpio.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_misc.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_misc.d" -MT"Peripheral/src/ch32v30x_misc.o" -c -o "Peripheral/src/ch32v30x_misc.o" "../Peripheral/src/ch32v30x_misc.c"
 +
Finished building: ../Peripheral/src/ch32v30x_iwdg.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_opa.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_opa.d" -MT"Peripheral/src/ch32v30x_opa.o" -c -o "Peripheral/src/ch32v30x_opa.o" "../Peripheral/src/ch32v30x_opa.c"
 +
Finished building: ../Peripheral/src/ch32v30x_eth.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_pwr.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_pwr.d" -MT"Peripheral/src/ch32v30x_pwr.o" -c -o "Peripheral/src/ch32v30x_pwr.o" "../Peripheral/src/ch32v30x_pwr.c"
 +
Finished building: ../Peripheral/src/ch32v30x_misc.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_rcc.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_rcc.d" -MT"Peripheral/src/ch32v30x_rcc.o" -c -o "Peripheral/src/ch32v30x_rcc.o" "../Peripheral/src/ch32v30x_rcc.c"
 +
Finished building: ../Peripheral/src/ch32v30x_opa.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_rng.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_rng.d" -MT"Peripheral/src/ch32v30x_rng.o" -c -o "Peripheral/src/ch32v30x_rng.o" "../Peripheral/src/ch32v30x_rng.c"
 +
Finished building: ../Peripheral/src/ch32v30x_i2c.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_rtc.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_rtc.d" -MT"Peripheral/src/ch32v30x_rtc.o" -c -o "Peripheral/src/ch32v30x_rtc.o" "../Peripheral/src/ch32v30x_rtc.c"
 +
Finished building: ../Peripheral/src/ch32v30x_pwr.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_sdio.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_sdio.d" -MT"Peripheral/src/ch32v30x_sdio.o" -c -o "Peripheral/src/ch32v30x_sdio.o" "../Peripheral/src/ch32v30x_sdio.c"
 +
Finished building: ../Peripheral/src/ch32v30x_rng.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_spi.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_spi.d" -MT"Peripheral/src/ch32v30x_spi.o" -c -o "Peripheral/src/ch32v30x_spi.o" "../Peripheral/src/ch32v30x_spi.c"
 +
Finished building: ../Peripheral/src/ch32v30x_rtc.c
 +
 +
Building file: ../Peripheral/src/ch32v30x_tim.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_tim.d" -MT"Peripheral/src/ch32v30x_tim.o" -c -o "Peripheral/src/ch32v30x_tim.o" "../Peripheral/src/ch32v30x_tim.c"
 +
Finished building: ../Peripheral/src/ch32v30x_spi.c
 +
 +
Finished building: ../Peripheral/src/ch32v30x_sdio.c
 +
Building file: ../Peripheral/src/ch32v30x_usart.c
 +
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_usart.d" -MT"Peripheral/src/ch32v30x_usart.o" -c -o "Peripheral/src/ch32v30x_usart.o" "../Peripheral/src/ch32v30x_usart.c"
 +
Building file: ../Peripheral/src/ch32v30x_wwdg.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_wwdg.d" -MT"Peripheral/src/ch32v30x_wwdg.o" -c -o "Peripheral/src/ch32v30x_wwdg.o" "../Peripheral/src/ch32v30x_wwdg.c"
 +
Finished building: ../Peripheral/src/ch32v30x_rcc.c
 +
 +
Building file: ../Debug/debug.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Debug/debug.d" -MT"Debug/debug.o" -c -o "Debug/debug.o" "../Debug/debug.c"
 +
Finished building: ../Peripheral/src/ch32v30x_wwdg.c
 +
 +
Building file: ../Core/core_riscv.c
 +
Invoking: GNU RISC-V Cross C Compiler
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Core/core_riscv.d" -MT"Core/core_riscv.o" -c -o "Core/core_riscv.o" "../Core/core_riscv.c"
 +
Finished building: ../Debug/debug.c
 +
 +
Finished building: ../Core/core_riscv.c
 +
 +
Finished building: ../Peripheral/src/ch32v30x_usart.c
 +
 +
Finished building: ../Peripheral/src/ch32v30x_tim.c
 +
 +
Building target: first.elf
 +
Invoking: GNU RISC-V Cross C Linker
 +
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -T "/home/lth/src/CH32V307V-EVT-R1/first/Ld/Link.ld" -nostartfiles -Xlinker --gc-sections -Wl,-Map,"first.map" --specs=nano.specs --specs=nosys.specs -o "first.elf" ./User/ch32v30x_it.o ./User/main.o ./User/system_ch32v30x.o  ./Startup/startup_ch32v30x_D8C.o  ./Peripheral/src/ch32v30x_adc.o ./Peripheral/src/ch32v30x_bkp.o ./Peripheral/src/ch32v30x_can.o ./Peripheral/src/ch32v30x_crc.o ./Peripheral/src/ch32v30x_dac.o ./Peripheral/src/ch32v30x_dbgmcu.o ./Peripheral/src/ch32v30x_dma.o ./Peripheral/src/ch32v30x_dvp.o ./Peripheral/src/ch32v30x_eth.o ./Peripheral/src/ch32v30x_exti.o ./Peripheral/src/ch32v30x_flash.o ./Peripheral/src/ch32v30x_fsmc.o ./Peripheral/src/ch32v30x_gpio.o ./Peripheral/src/ch32v30x_i2c.o ./Peripheral/src/ch32v30x_iwdg.o ./Peripheral/src/ch32v30x_misc.o ./Peripheral/src/ch32v30x_opa.o ./Peripheral/src/ch32v30x_pwr.o ./Peripheral/src/ch32v30x_rcc.o ./Peripheral/src/ch32v30x_rng.o ./Peripheral/src/ch32v30x_rtc.o ./Peripheral/src/ch32v30x_sdio.o ./Peripheral/src/ch32v30x_spi.o ./Peripheral/src/ch32v30x_tim.o ./Peripheral/src/ch32v30x_usart.o ./Peripheral/src/ch32v30x_wwdg.o  ./Debug/debug.o  ./Core/core_riscv.o 
 +
Finished building target: first.elf
 +
 +
Invoking: GNU RISC-V Cross Create Flash Image
 +
riscv-none-embed-objcopy -O ihex "first.elf"  "first.hex"
 +
Invoking: GNU RISC-V Cross Create Listing
 +
riscv-none-embed-objdump --all-headers --demangle --disassemble "first.elf" > "first.lst"
 +
Invoking: GNU RISC-V Cross Print Size
 +
riscv-none-embed-size --format=berkeley "first.elf"
 +
  text   data     bss     dec     hex filename
 +
  7160     136   2068   9364   2494 first.elf
 +
Finished building: first.hex
 +
Finished building: first.siz
 +
 +
 +
Finished building: first.lst
 +
 +
 
 +
11:14:22 Build Finished. 0 errors, 0 warnings. (took 1s.882ms)
 +
</pre>
 +
 
 +
In a console window a serial monitor can be run which will produce the following output:
 +
 
 +
<pre>
 +
lth@ncpws04:~/openwrt-bpir2$ microcom -f -s 115200 -p /dev/ttyACM0
 +
connected to /dev/ttyACM0
 +
Escape character: Ctrl-\
 +
Type the escape character to get to the prompt.
 +
SystemClk:72000000
 +
This is printf example
 +
</pre>
  
 
=== Serial console ===
 
=== Serial console ===

Revision as of 05:26, 29 June 2022

CH32V307V-EVT-R1 Top View

The CH32V307V-EVT-R1 is a development board for the CH32V307 RISC-V MCU. This page contains my initial notes on how to work with this board and the CH32V307 MCU. My initial experiments are also on Github here: https://github.com/lbthomsen/CH32V307V-EVT-R1.

As a development board, this one is clearly inspired by ST's Nucleo boards as it includes an Arduino header as well as a built-in flash/debug tool (they call it WCH-Link also inspired by ST-Link).

I never really understood why they (both this one and ST) choose to include an Arduino header. As far as I know, most - if not all - Arduino boards are running at 5V, which makes them possibly incompatible with the 3.3V used on boards such as this.

The CH32V307V-EVT-R1 board itself is readily availble from LCSC at around $12 (+ shipping).

Hardware Description

It is worth noticing that contrary to various ST development boards, the two user LED's and the user button are by default only wired to the header, not the MCU itself. This means that a jumper lead is necessary to use any of these.

MounRiver Studio

Installing

The MounRiver Studio community edition can be downloaded from http://www.mounriver.com/download (warning, insecure link).

Installing it (on Linux) is really quite simple. Unpack the downloaded archive:

lth@ncpws04:~$ tar xvf Downloads/MounRiver_Studio_Community_Linux_x64_V110.tar.xz

After the archive has been unpacked a few tweaks are necessary. MounRiver provided a script for this:

lth@ncpws04:~$ cd MounRiver_Studio_Community_Linux_x64_V110/beforeinstall/
lth@ncpws04:~/MounRiver_Studio_Community_Linux_x64_V110/beforeinstall$ ./start.sh

And that is about it. You can now run MounRiver Studio like this:

lth@ncpws04:~$ ~/MounRiver_Studio_Community_Linux_x64_V110/MRS_Community/MounRiver\ Studio_Community

Creating first project

Once the MounRiver Studio has been started, a new project can be created:

File - New project.png

In the resulting dialog, first select the appropriate MCU, then give the project a name:

Create project.png

Notice that there is a bug which change the project name once a MCU is selected, so unless you want all your projects to be named after the MCU, do change the name after you select the MCU.

Pressing Ok will generate a source tree, including a main.c in the User directory:

/********************************** (C) COPYRIGHT *******************************
* File Name          : main.c
* Author             : WCH
* Version            : V1.0.0
* Date               : 2021/06/06
* Description        : Main program body.
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
* SPDX-License-Identifier: Apache-2.0
*******************************************************************************/

/*
 *@Note
 串口打印调试例程:
 USART1_Tx(PA9)。
 本例程演示使用 USART1(PA9) 作打印调试口输出。

*/

#include "debug.h"


/* Global typedef */

/* Global define */

/* Global Variable */


/*********************************************************************
 * @fn      main
 *
 * @brief   Main program.
 *
 * @return  none
 */
int main(void)
{
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
	Delay_Init();
	USART_Printf_Init(115200);
	printf("SystemClk:%d\r\n",SystemCoreClock);

	printf("This is printf example\r\n");

	while(1)
    {

	}
}

As can be seen, the default application will print out a few statements and then do nothing.

By selecting Project/Build Project

Project-Build.png

The project should be successfully build. The Console window will show the result of the build process:

11:14:20 **** Build of configuration obj for project first ****
make -j4 all 
Building file: ../User/ch32v30x_it.c
Building file: ../User/main.c
Building file: ../User/system_ch32v30x.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"User/ch32v30x_it.d" -MT"User/ch32v30x_it.o" -c -o "User/ch32v30x_it.o" "../User/ch32v30x_it.c"
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"User/system_ch32v30x.d" -MT"User/system_ch32v30x.o" -c -o "User/system_ch32v30x.o" "../User/system_ch32v30x.c"
Invoking: GNU RISC-V Cross C Compiler
Building file: ../Startup/startup_ch32v30x_D8C.S
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"User/main.d" -MT"User/main.o" -c -o "User/main.o" "../User/main.c"
Invoking: GNU RISC-V Cross Assembler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -x assembler -I"/home/lth/src/CH32V307V-EVT-R1/first/Startup" -MMD -MP -MF"Startup/startup_ch32v30x_D8C.d" -MT"Startup/startup_ch32v30x_D8C.o" -c -o "Startup/startup_ch32v30x_D8C.o" "../Startup/startup_ch32v30x_D8C.S"
Finished building: ../Startup/startup_ch32v30x_D8C.S
 
Building file: ../Peripheral/src/ch32v30x_adc.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_adc.d" -MT"Peripheral/src/ch32v30x_adc.o" -c -o "Peripheral/src/ch32v30x_adc.o" "../Peripheral/src/ch32v30x_adc.c"
Finished building: ../User/main.c

(!!!repetitive stuff removed here!!!)
 
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_usart.d" -MT"Peripheral/src/ch32v30x_usart.o" -c -o "Peripheral/src/ch32v30x_usart.o" "../Peripheral/src/ch32v30x_usart.c"
Building file: ../Peripheral/src/ch32v30x_wwdg.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_wwdg.d" -MT"Peripheral/src/ch32v30x_wwdg.o" -c -o "Peripheral/src/ch32v30x_wwdg.o" "../Peripheral/src/ch32v30x_wwdg.c"
Finished building: ../Peripheral/src/ch32v30x_rcc.c
 
Building file: ../Debug/debug.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Debug/debug.d" -MT"Debug/debug.o" -c -o "Debug/debug.o" "../Debug/debug.c"
Finished building: ../Peripheral/src/ch32v30x_wwdg.c
 
Building file: ../Core/core_riscv.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Core/core_riscv.d" -MT"Core/core_riscv.o" -c -o "Core/core_riscv.o" "../Core/core_riscv.c"
Finished building: ../Debug/debug.c
 
Finished building: ../Core/core_riscv.c
 
Finished building: ../Peripheral/src/ch32v30x_usart.c
 
Finished building: ../Peripheral/src/ch32v30x_tim.c
 
Building target: first.elf
Invoking: GNU RISC-V Cross C Linker
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -T "/home/lth/src/CH32V307V-EVT-R1/first/Ld/Link.ld" -nostartfiles -Xlinker --gc-sections -Wl,-Map,"first.map" --specs=nano.specs --specs=nosys.specs -o "first.elf" ./User/ch32v30x_it.o ./User/main.o ./User/system_ch32v30x.o  ./Startup/startup_ch32v30x_D8C.o  ./Peripheral/src/ch32v30x_adc.o ./Peripheral/src/ch32v30x_bkp.o ./Peripheral/src/ch32v30x_can.o ./Peripheral/src/ch32v30x_crc.o ./Peripheral/src/ch32v30x_dac.o ./Peripheral/src/ch32v30x_dbgmcu.o ./Peripheral/src/ch32v30x_dma.o ./Peripheral/src/ch32v30x_dvp.o ./Peripheral/src/ch32v30x_eth.o ./Peripheral/src/ch32v30x_exti.o ./Peripheral/src/ch32v30x_flash.o ./Peripheral/src/ch32v30x_fsmc.o ./Peripheral/src/ch32v30x_gpio.o ./Peripheral/src/ch32v30x_i2c.o ./Peripheral/src/ch32v30x_iwdg.o ./Peripheral/src/ch32v30x_misc.o ./Peripheral/src/ch32v30x_opa.o ./Peripheral/src/ch32v30x_pwr.o ./Peripheral/src/ch32v30x_rcc.o ./Peripheral/src/ch32v30x_rng.o ./Peripheral/src/ch32v30x_rtc.o ./Peripheral/src/ch32v30x_sdio.o ./Peripheral/src/ch32v30x_spi.o ./Peripheral/src/ch32v30x_tim.o ./Peripheral/src/ch32v30x_usart.o ./Peripheral/src/ch32v30x_wwdg.o  ./Debug/debug.o  ./Core/core_riscv.o   
Finished building target: first.elf
 
Invoking: GNU RISC-V Cross Create Flash Image
riscv-none-embed-objcopy -O ihex "first.elf"  "first.hex"
Invoking: GNU RISC-V Cross Create Listing
riscv-none-embed-objdump --all-headers --demangle --disassemble "first.elf" > "first.lst"
Invoking: GNU RISC-V Cross Print Size
riscv-none-embed-size --format=berkeley "first.elf"
   text	   data	    bss	    dec	    hex	filename
   7160	    136	   2068	   9364	   2494	first.elf
Finished building: first.hex
Finished building: first.siz
 
 
Finished building: first.lst
 

11:14:22 Build Finished. 0 errors, 0 warnings. (took 1s.882ms)

Flashing

Flashing first time should be straight forward. Click on the flash button:

Flash button.png

Results in the following console output:

11:14:20 **** Build of configuration obj for project first ****
make -j4 all 
Building file: ../User/ch32v30x_it.c
Building file: ../User/main.c
Building file: ../User/system_ch32v30x.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"User/ch32v30x_it.d" -MT"User/ch32v30x_it.o" -c -o "User/ch32v30x_it.o" "../User/ch32v30x_it.c"
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"User/system_ch32v30x.d" -MT"User/system_ch32v30x.o" -c -o "User/system_ch32v30x.o" "../User/system_ch32v30x.c"
Invoking: GNU RISC-V Cross C Compiler
Building file: ../Startup/startup_ch32v30x_D8C.S
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"User/main.d" -MT"User/main.o" -c -o "User/main.o" "../User/main.c"
Invoking: GNU RISC-V Cross Assembler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -x assembler -I"/home/lth/src/CH32V307V-EVT-R1/first/Startup" -MMD -MP -MF"Startup/startup_ch32v30x_D8C.d" -MT"Startup/startup_ch32v30x_D8C.o" -c -o "Startup/startup_ch32v30x_D8C.o" "../Startup/startup_ch32v30x_D8C.S"
Finished building: ../Startup/startup_ch32v30x_D8C.S
 
Building file: ../Peripheral/src/ch32v30x_adc.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_adc.d" -MT"Peripheral/src/ch32v30x_adc.o" -c -o "Peripheral/src/ch32v30x_adc.o" "../Peripheral/src/ch32v30x_adc.c"
Finished building: ../User/main.c
 
Building file: ../Peripheral/src/ch32v30x_bkp.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_bkp.d" -MT"Peripheral/src/ch32v30x_bkp.o" -c -o "Peripheral/src/ch32v30x_bkp.o" "../Peripheral/src/ch32v30x_bkp.c"
Finished building: ../User/ch32v30x_it.c
 
Building file: ../Peripheral/src/ch32v30x_can.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_can.d" -MT"Peripheral/src/ch32v30x_can.o" -c -o "Peripheral/src/ch32v30x_can.o" "../Peripheral/src/ch32v30x_can.c"
Finished building: ../User/system_ch32v30x.c
 
Building file: ../Peripheral/src/ch32v30x_crc.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_crc.d" -MT"Peripheral/src/ch32v30x_crc.o" -c -o "Peripheral/src/ch32v30x_crc.o" "../Peripheral/src/ch32v30x_crc.c"
Finished building: ../Peripheral/src/ch32v30x_bkp.c
 
Building file: ../Peripheral/src/ch32v30x_dac.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_dac.d" -MT"Peripheral/src/ch32v30x_dac.o" -c -o "Peripheral/src/ch32v30x_dac.o" "../Peripheral/src/ch32v30x_dac.c"
Finished building: ../Peripheral/src/ch32v30x_crc.c
 
Building file: ../Peripheral/src/ch32v30x_dbgmcu.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_dbgmcu.d" -MT"Peripheral/src/ch32v30x_dbgmcu.o" -c -o "Peripheral/src/ch32v30x_dbgmcu.o" "../Peripheral/src/ch32v30x_dbgmcu.c"
Finished building: ../Peripheral/src/ch32v30x_adc.c
 
Building file: ../Peripheral/src/ch32v30x_dma.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_dma.d" -MT"Peripheral/src/ch32v30x_dma.o" -c -o "Peripheral/src/ch32v30x_dma.o" "../Peripheral/src/ch32v30x_dma.c"
Finished building: ../Peripheral/src/ch32v30x_dac.c
 
Building file: ../Peripheral/src/ch32v30x_dvp.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_dvp.d" -MT"Peripheral/src/ch32v30x_dvp.o" -c -o "Peripheral/src/ch32v30x_dvp.o" "../Peripheral/src/ch32v30x_dvp.c"
Finished building: ../Peripheral/src/ch32v30x_dbgmcu.c
 
Building file: ../Peripheral/src/ch32v30x_eth.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_eth.d" -MT"Peripheral/src/ch32v30x_eth.o" -c -o "Peripheral/src/ch32v30x_eth.o" "../Peripheral/src/ch32v30x_eth.c"
Finished building: ../Peripheral/src/ch32v30x_can.c
 
Building file: ../Peripheral/src/ch32v30x_exti.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_exti.d" -MT"Peripheral/src/ch32v30x_exti.o" -c -o "Peripheral/src/ch32v30x_exti.o" "../Peripheral/src/ch32v30x_exti.c"
Finished building: ../Peripheral/src/ch32v30x_dma.c
Finished building: ../Peripheral/src/ch32v30x_dvp.c
 
Building file: ../Peripheral/src/ch32v30x_flash.c
 
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_flash.d" -MT"Peripheral/src/ch32v30x_flash.o" -c -o "Peripheral/src/ch32v30x_flash.o" "../Peripheral/src/ch32v30x_flash.c"
Building file: ../Peripheral/src/ch32v30x_fsmc.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_fsmc.d" -MT"Peripheral/src/ch32v30x_fsmc.o" -c -o "Peripheral/src/ch32v30x_fsmc.o" "../Peripheral/src/ch32v30x_fsmc.c"
Finished building: ../Peripheral/src/ch32v30x_exti.c
 
Building file: ../Peripheral/src/ch32v30x_gpio.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_gpio.d" -MT"Peripheral/src/ch32v30x_gpio.o" -c -o "Peripheral/src/ch32v30x_gpio.o" "../Peripheral/src/ch32v30x_gpio.c"
Finished building: ../Peripheral/src/ch32v30x_fsmc.c
 
Building file: ../Peripheral/src/ch32v30x_i2c.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_i2c.d" -MT"Peripheral/src/ch32v30x_i2c.o" -c -o "Peripheral/src/ch32v30x_i2c.o" "../Peripheral/src/ch32v30x_i2c.c"
Finished building: ../Peripheral/src/ch32v30x_flash.c
 
Building file: ../Peripheral/src/ch32v30x_iwdg.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_iwdg.d" -MT"Peripheral/src/ch32v30x_iwdg.o" -c -o "Peripheral/src/ch32v30x_iwdg.o" "../Peripheral/src/ch32v30x_iwdg.c"
Finished building: ../Peripheral/src/ch32v30x_gpio.c
 
Building file: ../Peripheral/src/ch32v30x_misc.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_misc.d" -MT"Peripheral/src/ch32v30x_misc.o" -c -o "Peripheral/src/ch32v30x_misc.o" "../Peripheral/src/ch32v30x_misc.c"
Finished building: ../Peripheral/src/ch32v30x_iwdg.c
 
Building file: ../Peripheral/src/ch32v30x_opa.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_opa.d" -MT"Peripheral/src/ch32v30x_opa.o" -c -o "Peripheral/src/ch32v30x_opa.o" "../Peripheral/src/ch32v30x_opa.c"
Finished building: ../Peripheral/src/ch32v30x_eth.c
 
Building file: ../Peripheral/src/ch32v30x_pwr.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_pwr.d" -MT"Peripheral/src/ch32v30x_pwr.o" -c -o "Peripheral/src/ch32v30x_pwr.o" "../Peripheral/src/ch32v30x_pwr.c"
Finished building: ../Peripheral/src/ch32v30x_misc.c
 
Building file: ../Peripheral/src/ch32v30x_rcc.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_rcc.d" -MT"Peripheral/src/ch32v30x_rcc.o" -c -o "Peripheral/src/ch32v30x_rcc.o" "../Peripheral/src/ch32v30x_rcc.c"
Finished building: ../Peripheral/src/ch32v30x_opa.c
 
Building file: ../Peripheral/src/ch32v30x_rng.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_rng.d" -MT"Peripheral/src/ch32v30x_rng.o" -c -o "Peripheral/src/ch32v30x_rng.o" "../Peripheral/src/ch32v30x_rng.c"
Finished building: ../Peripheral/src/ch32v30x_i2c.c
 
Building file: ../Peripheral/src/ch32v30x_rtc.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_rtc.d" -MT"Peripheral/src/ch32v30x_rtc.o" -c -o "Peripheral/src/ch32v30x_rtc.o" "../Peripheral/src/ch32v30x_rtc.c"
Finished building: ../Peripheral/src/ch32v30x_pwr.c
 
Building file: ../Peripheral/src/ch32v30x_sdio.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_sdio.d" -MT"Peripheral/src/ch32v30x_sdio.o" -c -o "Peripheral/src/ch32v30x_sdio.o" "../Peripheral/src/ch32v30x_sdio.c"
Finished building: ../Peripheral/src/ch32v30x_rng.c
 
Building file: ../Peripheral/src/ch32v30x_spi.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_spi.d" -MT"Peripheral/src/ch32v30x_spi.o" -c -o "Peripheral/src/ch32v30x_spi.o" "../Peripheral/src/ch32v30x_spi.c"
Finished building: ../Peripheral/src/ch32v30x_rtc.c
 
Building file: ../Peripheral/src/ch32v30x_tim.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_tim.d" -MT"Peripheral/src/ch32v30x_tim.o" -c -o "Peripheral/src/ch32v30x_tim.o" "../Peripheral/src/ch32v30x_tim.c"
Finished building: ../Peripheral/src/ch32v30x_spi.c
 
Finished building: ../Peripheral/src/ch32v30x_sdio.c
Building file: ../Peripheral/src/ch32v30x_usart.c
 
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_usart.d" -MT"Peripheral/src/ch32v30x_usart.o" -c -o "Peripheral/src/ch32v30x_usart.o" "../Peripheral/src/ch32v30x_usart.c"
Building file: ../Peripheral/src/ch32v30x_wwdg.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Peripheral/src/ch32v30x_wwdg.d" -MT"Peripheral/src/ch32v30x_wwdg.o" -c -o "Peripheral/src/ch32v30x_wwdg.o" "../Peripheral/src/ch32v30x_wwdg.c"
Finished building: ../Peripheral/src/ch32v30x_rcc.c
 
Building file: ../Debug/debug.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Debug/debug.d" -MT"Debug/debug.o" -c -o "Debug/debug.o" "../Debug/debug.c"
Finished building: ../Peripheral/src/ch32v30x_wwdg.c
 
Building file: ../Core/core_riscv.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -I"/home/lth/src/CH32V307V-EVT-R1/first/Debug" -I"/home/lth/src/CH32V307V-EVT-R1/first/Core" -I"/home/lth/src/CH32V307V-EVT-R1/first/User" -I"/home/lth/src/CH32V307V-EVT-R1/first/Peripheral/inc" -std=gnu99 -MMD -MP -MF"Core/core_riscv.d" -MT"Core/core_riscv.o" -c -o "Core/core_riscv.o" "../Core/core_riscv.c"
Finished building: ../Debug/debug.c
 
Finished building: ../Core/core_riscv.c
 
Finished building: ../Peripheral/src/ch32v30x_usart.c
 
Finished building: ../Peripheral/src/ch32v30x_tim.c
 
Building target: first.elf
Invoking: GNU RISC-V Cross C Linker
riscv-none-embed-gcc -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wunused -Wuninitialized  -g -T "/home/lth/src/CH32V307V-EVT-R1/first/Ld/Link.ld" -nostartfiles -Xlinker --gc-sections -Wl,-Map,"first.map" --specs=nano.specs --specs=nosys.specs -o "first.elf" ./User/ch32v30x_it.o ./User/main.o ./User/system_ch32v30x.o  ./Startup/startup_ch32v30x_D8C.o  ./Peripheral/src/ch32v30x_adc.o ./Peripheral/src/ch32v30x_bkp.o ./Peripheral/src/ch32v30x_can.o ./Peripheral/src/ch32v30x_crc.o ./Peripheral/src/ch32v30x_dac.o ./Peripheral/src/ch32v30x_dbgmcu.o ./Peripheral/src/ch32v30x_dma.o ./Peripheral/src/ch32v30x_dvp.o ./Peripheral/src/ch32v30x_eth.o ./Peripheral/src/ch32v30x_exti.o ./Peripheral/src/ch32v30x_flash.o ./Peripheral/src/ch32v30x_fsmc.o ./Peripheral/src/ch32v30x_gpio.o ./Peripheral/src/ch32v30x_i2c.o ./Peripheral/src/ch32v30x_iwdg.o ./Peripheral/src/ch32v30x_misc.o ./Peripheral/src/ch32v30x_opa.o ./Peripheral/src/ch32v30x_pwr.o ./Peripheral/src/ch32v30x_rcc.o ./Peripheral/src/ch32v30x_rng.o ./Peripheral/src/ch32v30x_rtc.o ./Peripheral/src/ch32v30x_sdio.o ./Peripheral/src/ch32v30x_spi.o ./Peripheral/src/ch32v30x_tim.o ./Peripheral/src/ch32v30x_usart.o ./Peripheral/src/ch32v30x_wwdg.o  ./Debug/debug.o  ./Core/core_riscv.o   
Finished building target: first.elf
 
Invoking: GNU RISC-V Cross Create Flash Image
riscv-none-embed-objcopy -O ihex "first.elf"  "first.hex"
Invoking: GNU RISC-V Cross Create Listing
riscv-none-embed-objdump --all-headers --demangle --disassemble "first.elf" > "first.lst"
Invoking: GNU RISC-V Cross Print Size
riscv-none-embed-size --format=berkeley "first.elf"
   text	   data	    bss	    dec	    hex	filename
   7160	    136	   2068	   9364	   2494	first.elf
Finished building: first.hex
Finished building: first.siz
 
 
Finished building: first.lst
 

11:14:22 Build Finished. 0 errors, 0 warnings. (took 1s.882ms)

In a console window a serial monitor can be run which will produce the following output:

lth@ncpws04:~/openwrt-bpir2$ microcom -f -s 115200 -p /dev/ttyACM0
connected to /dev/ttyACM0
Escape character: Ctrl-\
Type the escape character to get to the prompt.
SystemClk:72000000
This is printf example

Serial console

To be added

Single step debugging

To be added

Getting Started

SysTick Timer

Coming from STM32, I like to have a counter running calibrated at ms resolution (HAL_GetTick() on STM32). By default that is not available on the CH32V307 using the provided SDK. Fortunately it is quite easy to implement:

/*
 * systick.c
 *
 *  Created on: Jun 29, 2022
 *      Author: lth
 */

//#include "ch32v30x.h"
#include "systick.h"

uint32_t uwTick = 0;

/*********************************************************************
 * @fn      SysTick_Handler
 *
 * @brief   This function handles SysTick interrupt.
 *
 * @return  none
 */
__attribute__((interrupt("WCH-Interrupt-fast"))) void SysTick_Handler(void) {
        SysTick->SR=0;
        ++uwTick;
}

/*********************************************************************
 * @fn      Systick_Init
 *
 * @brief   Initializes Systick.
 *
 * @return  none
 */
void Systick_Init(void) {
    /*Configuration interrupt priority*/
    NVIC_InitTypeDef NVIC_InitStructure = {0};
    NVIC_InitStructure.NVIC_IRQChannel = SysTicK_IRQn;
    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;//Seeing priority
    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;//Response priority
    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;//Enable
    NVIC_Init(&NVIC_InitStructure);

    /*Configuration timer*/
        SysTick->CTLR= 0;
    SysTick->SR  = 0;
    SysTick->CNT = 0;
    SysTick->CMP = SystemCoreClock / 1000; //The latter 1000 represents 1000Hz (that is, 1MS to interrupt once)
    SysTick->CTLR= 0xf;
}

*********************************************************************
 * @fn      GetTick
 *
 * @brief   Get current tick in ms resolution
 *
 * @return  Current tick
 */
uint32_t GetTick() {
        return uwTick;
}

Call the Systick_Init() at the beginning of main and GetTick() will return the number of milliseconds since startup (with wraparound after about 1 1/2 month).

GPIOs

To be added

Miscellaneous Links