Skip to content

Commit

Permalink
add CH32V20x USB OTG/FS driver
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonlock2 committed Mar 23, 2024
1 parent 338ff2d commit 850cd12
Show file tree
Hide file tree
Showing 29 changed files with 2,212 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build_riscv.yml
Expand Up @@ -30,6 +30,7 @@ jobs:
matrix:
family:
# Alphabetical order
- 'ch32v20x'
- 'ch32v307'
- 'fomu'
- 'gd32vf103'
Expand All @@ -49,7 +50,7 @@ jobs:
path: linkermap

- name: Set Toolchain URL
run: echo >> $GITHUB_ENV TOOLCHAIN_URL=https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/download/v10.1.0-1.1/xpack-riscv-none-embed-gcc-10.1.0-1.1-linux-x64.tar.gz
run: echo >> $GITHUB_ENV TOOLCHAIN_URL=https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v13.2.0-2/xpack-riscv-none-elf-gcc-13.2.0-2-linux-x64.tar.gz

- name: Cache Toolchain
uses: actions/cache@v3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -80,6 +80,7 @@ hw/mcu/st/stm32l5xx_hal_driver
hw/mcu/st/stm32u5xx_hal_driver
hw/mcu/st/stm32wbxx_hal_driver
hw/mcu/ti
hw/mcu/wch/ch32v20x
hw/mcu/wch/ch32v307
hw/mcu/wch/ch32f20x
lib/CMSIS_5
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Expand Up @@ -157,7 +157,7 @@ Following CPUs are supported, check out `Supported Devices`_ for comprehensive l
+--------------+------------------------------------------------------------+
| ValentyUSB | eptri |
+--------------+------------------------------------------------------------+
| WCH | CH32F20x, CH32V307, |
| WCH | CH32F20x, CH32V20x, CH32V307 |
+--------------+------------------------------------------------------------+

License
Expand Down
1 change: 1 addition & 0 deletions docs/reference/dependencies.rst
Expand Up @@ -55,6 +55,7 @@ hw/mcu/st/stm32u5xx_hal_driver https://github.com/STMicroelectronics/
hw/mcu/st/stm32wbxx_hal_driver https://github.com/STMicroelectronics/stm32wbxx_hal_driver.git 2c5f06638be516c1b772f768456ba637f077bac8 stm32wb
hw/mcu/ti https://github.com/hathach/ti_driver.git 143ed6cc20a7615d042b03b21e070197d473e6e5 msp430 msp432e4 tm4c123
hw/mcu/wch/ch32f20x https://github.com/openwch/ch32f20x.git 77c4095087e5ed2c548ec9058e655d0b8757663b ch32f20x
hw/mcu/wch/ch32v20x https://github.com/openwch/ch32v20x.git de6d68c654340d7f27b00cebbfc9aa2740a1abc2 ch32v20x
hw/mcu/wch/ch32v307 https://github.com/openwch/ch32v307.git 17761f5cf9dbbf2dcf665b7c04934188add20082 ch32v307
lib/CMSIS_5 https://github.com/ARM-software/CMSIS_5.git 20285262657d1b482d132d20d755c8c330d55c1f imxrt kinetis_k32l2 kinetis_kl lpc51 lpc54 lpc55 mcx mm32 msp432e4 nrf ra saml2xstm32f0 stm32f1 stm32f2 stm32f3 stm32f4 stm32f7 stm32g0 stm32g4 stm32h7 stm32l0 stm32l1 stm32l4 stm32l5 stm32u5 stm32wb
lib/FreeRTOS-Kernel https://github.com/FreeRTOS/FreeRTOS-Kernel.git 4ff01a7a4a51f53b44496aefee1e3c0071b7b173 all
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/supported.rst
Expand Up @@ -128,9 +128,9 @@ Supported MCUs
+--------------+-----------------------+--------+------+-----------+-------------------+--------------+
| ValentyUSB | eptri |||| eptri | |
+--------------+-----------------------+--------+------+-----------+-------------------+--------------+
| WCH | CH32V307 || || ch32v307 | |
| +-----------------------+--------+------+-----------+-------------------+--------------+
| | CH32F20x || || ch32f205 | |
| WCH | CH32F20x || || ch32f205 | |
| | CH32V20x || || ch32v20x | |
| | CH32V307 || || ch32v307 | |
+--------------+-----------------------+--------+------+-----------+-------------------+--------------+


Expand Down
1 change: 1 addition & 0 deletions examples/device/cdc_msc_freertos/skip.txt
@@ -1,3 +1,4 @@
mcu:CH32V20X
mcu:CH32V307
mcu:CXD56
mcu:F1C100S
Expand Down
1 change: 1 addition & 0 deletions examples/device/hid_composite_freertos/skip.txt
@@ -1,3 +1,4 @@
mcu:CH32V20X
mcu:CH32V307
mcu:CXD56
mcu:F1C100S
Expand Down
1 change: 1 addition & 0 deletions examples/device/msc_dual_lun/skip.txt
@@ -1,3 +1,4 @@
mcu:CH32V20X
mcu:SAMD11
mcu:MKL25ZXX
family:espressif
1 change: 1 addition & 0 deletions examples/device/video_capture/skip.txt
@@ -1,3 +1,4 @@
mcu:CH32V20X
mcu:MSP430x5xx
mcu:NUC121
mcu:SAMD11
Expand Down
17 changes: 17 additions & 0 deletions hw/bsp/ch32v20x/boards/nanoch32v203/board.h
@@ -0,0 +1,17 @@
#ifndef BOARD_H_
#define BOARD_H_

#ifdef __cplusplus
extern "C" {
#endif

#define LED_PORT GPIOA
#define LED_PIN GPIO_Pin_15
#define LED_STATE_ON 0
#define LED_CLOCK_EN() RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE)

#ifdef __cplusplus
}
#endif

#endif
5 changes: 5 additions & 0 deletions hw/bsp/ch32v20x/boards/nanoch32v203/board.mk
@@ -0,0 +1,5 @@
CFLAGS += \
-DCH32V20x_D6

SRC_S += \
$(CH32V20X_SDK_SRC)/Startup/startup_ch32v20x_D6.S
36 changes: 36 additions & 0 deletions hw/bsp/ch32v20x/ch32v20x_conf.h
@@ -0,0 +1,36 @@
/********************************** (C) COPYRIGHT *******************************
* File Name : ch32v20x_conf.h
* Author : WCH
* Version : V1.0.0
* Date : 2021/06/06
* Description : Library configuration file.
*********************************************************************************
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
* Attention: This software (modified or not) and binary are used for
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/
#ifndef __CH32V20x_CONF_H
#define __CH32V20x_CONF_H

#include "ch32v20x_adc.h"
#include "ch32v20x_bkp.h"
#include "ch32v20x_can.h"
#include "ch32v20x_crc.h"
#include "ch32v20x_dbgmcu.h"
#include "ch32v20x_dma.h"
#include "ch32v20x_exti.h"
#include "ch32v20x_flash.h"
#include "ch32v20x_gpio.h"
#include "ch32v20x_i2c.h"
#include "ch32v20x_iwdg.h"
#include "ch32v20x_pwr.h"
#include "ch32v20x_rcc.h"
#include "ch32v20x_rtc.h"
#include "ch32v20x_spi.h"
#include "ch32v20x_tim.h"
#include "ch32v20x_usart.h"
#include "ch32v20x_wwdg.h"
#include "ch32v20x_it.h"
#include "ch32v20x_misc.h"

#endif /* __CH32V20x_CONF_H */
15 changes: 15 additions & 0 deletions hw/bsp/ch32v20x/ch32v20x_it.h
@@ -0,0 +1,15 @@
/********************************** (C) COPYRIGHT *******************************
* File Name : ch32v20x_it.h
* Author : WCH
* Version : V1.0.0
* Date : 2021/06/06
* Description : This file contains the headers of the interrupt handlers.
*********************************************************************************
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
* Attention: This software (modified or not) and binary are used for
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/
#ifndef __CH32V20x_IT_H
#define __CH32V20x_IT_H

#endif /* __CH32V20x_IT_H */

0 comments on commit 850cd12

Please sign in to comment.