Skip to content

Commit

Permalink
add V10x and V30x
Browse files Browse the repository at this point in the history
  • Loading branch information
TianpeiLee committed Jul 26, 2023
1 parent ad69366 commit 29c76ad
Show file tree
Hide file tree
Showing 206 changed files with 54,546 additions and 98 deletions.
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,40 @@ Then you can search for "**wch**" through the "**board manager**", find the inst
It will be a long-term support and maintenance project, unless we encounter force majeure factors.The current version supports the following development boards:

- [CH32V00x EVT Boards](#CH32V00x-EVT-Boards)
- [CH32V10x EVT Boards](#CH32V10x-EVT-Boards)
- [CH32V20x EVT Boards](#CH32V20x-EVT-Boards)
- [CH32V30x EVT Boards](#CH32V30x-EVT-Boards)
- [CH32X035 EVT Boards](#CH32X035-EVT-Boards)

### CH32V00x EVT Boards

| Status | Boards name | Peripherals | Release | Notes |
| :----: | ---- | ---- | :-----: | :---- |
| :heavy_check_mark: | CH32V003F4P | ADC,DAC,USART,GPIO,EXTI,SysTick | 1.0.0 | SPI,I2C since 1.0.2 |
| :heavy_check_mark: | CH32V003F4P | ADC,DAC,USART,GPIO,EXTI,SysTick | 1.0.0 | SPI,I2C_Master since 1.0.2 |

### CH32V20x EVT Boards

| Status | Boards name | Peripherals | Release | Notes |
| :----: | ---- | ---- | :-----: | :---- |
| :heavy_check_mark: | CH32V203G8U | ADC,DAC,USART,GPIO,EXTI,SysTick | 1.0.0 | SPI,I2C since 1.0.2 |
| :heavy_check_mark: | CH32V203G8U | ADC,DAC,USART,GPIO,EXTI,SysTick | 1.0.0 | SPI,I2C_Master since 1.0.2 |

### CH32X035 EVT Boards

| Status | Boards name | Peripherals | Release | Notes |
| :----: | ---- | ---- | :-----: | :---- |
| :heavy_check_mark: | CH32X035G8U | ADC,DAC,USART,GPIO,EXTI,SysTick | 1.0.1 | SPI,I2C since 1.0.2 |
| :heavy_check_mark: | CH32X035G8U | ADC,DAC,USART,GPIO,EXTI,SysTick | 1.0.1 | SPI,I2C_Master since 1.0.2 |

### CH32V10x EVT Boards

| Status | Boards name | Peripherals | Release | Notes |
| :----: | ---- | ---- | :-----: | :---- |
| :heavy_check_mark: | CH32V103R8T6_BLACK | ADC,DAC,USART,GPIO,EXTI,SysTick,SPI,I2C_Master | 1.0.3 | - |

### CH32V30x EVT Boards

| Status | Boards name | Peripherals | Release | Notes |
| :----: | ---- | ---- | :-----: | :---- |
| :heavy_check_mark: | CH32V307VCT6_BLACK | ADC,DAC,USART,GPIO,EXTI,SysTick,SPI,I2C_Master | 1.0.3 | - |

## Submit bugs

Expand Down
167 changes: 167 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,91 @@ CH32X035_EVT.menu.rtlib.full.build.flags.ldspecs=



#############################################################################
##CH32V10x EVT Board -lprintf

CH32V10x_EVT.name=CH32V10x
CH32V10x_EVT.build.core=arduino
CH32V10x_EVT.build.board=CH32V10x_EVT
CH32V10x_EVT.upload.maximum_size=0
CH32V10x_EVT.upload.maximum_data_size=0
CH32V10x_EVT.build.variant_h=variant_{build.board}.h


#CH32V103R8T6 EVT Board CH32V10x_3V3: 3.3V power supply CH32V10x_5V: 5V power supply
CH32V10x_EVT.menu.pnum.CH32V103R8T6=CH32V103R8T6 EVT
CH32V10x_EVT.menu.pnum.CH32V103R8T6.node=NODE_V103R8T6
CH32V10x_EVT.menu.pnum.CH32V103R8T6.upload.maximum_size=65536
CH32V10x_EVT.menu.pnum.CH32V103R8T6.upload.maximum_data_size=20480
CH32V10x_EVT.menu.pnum.CH32V103R8T6.build.mcu=QingKe-V3A
CH32V10x_EVT.menu.pnum.CH32V103R8T6.build.board=CH32V103R8T6
CH32V10x_EVT.menu.pnum.CH32V103R8T6.build.series=CH32V10x
CH32V10x_EVT.menu.pnum.CH32V103R8T6.build.variant=CH32V10x/CH32V103R8T6
CH32V10x_EVT.menu.pnum.CH32V103R8T6.build.chip=CH32V10x_3V3
CH32V10x_EVT.menu.pnum.CH32V103R8T6.build.march=rv32imac
CH32V10x_EVT.menu.pnum.CH32V103R8T6.build.mabi=ilp32
CH32V10x_EVT.menu.pnum.CH32V103R8T6.build.math_lib_gcc=-lm
CH32V10x_EVT.menu.pnum.CH32V103R8T6.build.IQ_math_RV32=
CH32V10x_EVT.menu.pnum.CH32V103R8T6.build.ch_extra_lib=-lprintf


# Upload menu
CH32V10x_EVT.menu.upload_method.swdMethod=WCH-SWD
CH32V10x_EVT.menu.upload_method.swdMethod.upload.protocol=
CH32V10x_EVT.menu.upload_method.swdMethod.upload.options=
CH32V10x_EVT.menu.upload_method.swdMethod.upload.tool=WCH_linkE



# Optimizations
CH32V10x_EVT.menu.opt.osstd=Smallest (-Os default)
CH32V10x_EVT.menu.opt.osstd.build.flags.optimize=-Os
CH32V10x_EVT.menu.opt.oslto=Smallest (-Os) with LTO
CH32V10x_EVT.menu.opt.oslto.build.flags.optimize=-Os -flto
CH32V10x_EVT.menu.opt.o1std=Fast (-O1)
CH32V10x_EVT.menu.opt.o1std.build.flags.optimize=-O1
CH32V10x_EVT.menu.opt.o1lto=Fast (-O1) with LTO
CH32V10x_EVT.menu.opt.o1lto.build.flags.optimize=-O1 -flto
CH32V10x_EVT.menu.opt.o2std=Faster (-O2)
CH32V10x_EVT.menu.opt.o2std.build.flags.optimize=-O2
CH32V10x_EVT.menu.opt.o2lto=Faster (-O2) with LTO
CH32V10x_EVT.menu.opt.o2lto.build.flags.optimize=-O2 -flto
CH32V10x_EVT.menu.opt.o3std=Fastest (-O3)
CH32V10x_EVT.menu.opt.o3std.build.flags.optimize=-O3
CH32V10x_EVT.menu.opt.o3lto=Fastest (-O3) with LTO
CH32V10x_EVT.menu.opt.o3lto.build.flags.optimize=-O3 -flto
CH32V10x_EVT.menu.opt.ogstd=Debug (-Og)
CH32V10x_EVT.menu.opt.ogstd.build.flags.optimize=-Og
CH32V10x_EVT.menu.opt.o0std=No Optimization (-O0)
CH32V10x_EVT.menu.opt.o0std.build.flags.optimize=-O0


# Debug information
CH32V10x_EVT.menu.dbg.none=None
CH32V10x_EVT.menu.dbg.none.build.flags.debug=
CH32V10x_EVT.menu.dbg.enable_sym=Symbols Enabled (-g)
CH32V10x_EVT.menu.dbg.enable_sym.build.flags.debug=-g -DNDEBUG
CH32V10x_EVT.menu.dbg.enable_log=Core logs Enabled
CH32V10x_EVT.menu.dbg.enable_log.build.flags.debug=
CH32V10x_EVT.menu.dbg.enable_all=Core Logs and Symbols Enabled (-g)
CH32V10x_EVT.menu.dbg.enable_all.build.flags.debug=-g


# C Runtime Library
CH32V10x_EVT.menu.rtlib.nano=Newlib Nano (default)
CH32V10x_EVT.menu.rtlib.nano.build.flags.ldflags=--specs=nano.specs --specs=nosys.specs
CH32V10x_EVT.menu.rtlib.nanofp=Newlib Nano + Float Printf
CH32V10x_EVT.menu.rtlib.nanofp.build.flags.ldspecs=--specs=nano.specs --specs=nosys.specs -u _printf_float
CH32V10x_EVT.menu.rtlib.nanofs=Newlib Nano + Float Scanf
CH32V10x_EVT.menu.rtlib.nanofs.build.flags.ldspecs=--specs=nano.specs --specs=nosys.specs -u _scanf_float
CH32V10x_EVT.menu.rtlib.nanofps=Newlib Nano + Float Printf/Scanf
CH32V10x_EVT.menu.rtlib.nanofps.build.flags.ldspecs=--specs=nano.specs --specs=nosys.specs -u _printf_float -u _scanf_float
CH32V10x_EVT.menu.rtlib.full=Newlib Standard
CH32V10x_EVT.menu.rtlib.full.build.flags.ldspecs=






#############################################################################
Expand Down Expand Up @@ -269,4 +354,86 @@ CH32V20x_EVT.menu.rtlib.full.build.flags.ldspecs=



#############################################################################
##CH32V30x EVT Board -lprintfloat

CH32V30x_EVT.name=CH32V30x
CH32V30x_EVT.build.core=arduino
CH32V30x_EVT.build.board=CH32V30x_EVT
CH32V30x_EVT.upload.maximum_size=0
CH32V30x_EVT.upload.maximum_data_size=0
CH32V30x_EVT.build.variant_h=variant_{build.board}.h


#CH32V307VCT6 EVT Board CH32V30x_C: connected product_line CH32V30x: normal product_line
CH32V30x_EVT.menu.pnum.CH32V307VCT6=CH32V307VCT6 EVT
CH32V30x_EVT.menu.pnum.CH32V307VCT6.node=NODE_V307VCT6
CH32V30x_EVT.menu.pnum.CH32V307VCT6.upload.maximum_size=262144
CH32V30x_EVT.menu.pnum.CH32V307VCT6.upload.maximum_data_size=65536
CH32V30x_EVT.menu.pnum.CH32V307VCT6.build.mcu=QingKe-V4F
CH32V30x_EVT.menu.pnum.CH32V307VCT6.build.board=CH32V307VCT6
CH32V30x_EVT.menu.pnum.CH32V307VCT6.build.series=CH32V30x
CH32V30x_EVT.menu.pnum.CH32V307VCT6.build.variant=CH32V30x/CH32V307VCT6
CH32V30x_EVT.menu.pnum.CH32V307VCT6.build.chip=CH32V30x_C
CH32V30x_EVT.menu.pnum.CH32V307VCT6.build.march=rv32imafcxw
CH32V30x_EVT.menu.pnum.CH32V307VCT6.build.mabi=ilp32f
CH32V30x_EVT.menu.pnum.CH32V307VCT6.build.math_lib_gcc=-lm
CH32V30x_EVT.menu.pnum.CH32V307VCT6.build.IQ_math_RV32=
CH32V30x_EVT.menu.pnum.CH32V307VCT6.build.ch_extra_lib=-lprintfloat


# Upload menu
CH32V30x_EVT.menu.upload_method.swdMethod=WCH-SWD
CH32V30x_EVT.menu.upload_method.swdMethod.upload.protocol=
CH32V30x_EVT.menu.upload_method.swdMethod.upload.options=
CH32V30x_EVT.menu.upload_method.swdMethod.upload.tool=WCH_linkE



# Optimizations
CH32V30x_EVT.menu.opt.osstd=Smallest (-Os default)
CH32V30x_EVT.menu.opt.osstd.build.flags.optimize=-Os
CH32V30x_EVT.menu.opt.oslto=Smallest (-Os) with LTO
CH32V30x_EVT.menu.opt.oslto.build.flags.optimize=-Os -flto
CH32V30x_EVT.menu.opt.o1std=Fast (-O1)
CH32V30x_EVT.menu.opt.o1std.build.flags.optimize=-O1
CH32V30x_EVT.menu.opt.o1lto=Fast (-O1) with LTO
CH32V30x_EVT.menu.opt.o1lto.build.flags.optimize=-O1 -flto
CH32V30x_EVT.menu.opt.o2std=Faster (-O2)
CH32V30x_EVT.menu.opt.o2std.build.flags.optimize=-O2
CH32V30x_EVT.menu.opt.o2lto=Faster (-O2) with LTO
CH32V30x_EVT.menu.opt.o2lto.build.flags.optimize=-O2 -flto
CH32V30x_EVT.menu.opt.o3std=Fastest (-O3)
CH32V30x_EVT.menu.opt.o3std.build.flags.optimize=-O3
CH32V30x_EVT.menu.opt.o3lto=Fastest (-O3) with LTO
CH32V30x_EVT.menu.opt.o3lto.build.flags.optimize=-O3 -flto
CH32V30x_EVT.menu.opt.ogstd=Debug (-Og)
CH32V30x_EVT.menu.opt.ogstd.build.flags.optimize=-Og
CH32V30x_EVT.menu.opt.o0std=No Optimization (-O0)
CH32V30x_EVT.menu.opt.o0std.build.flags.optimize=-O0


# Debug information
CH32V30x_EVT.menu.dbg.none=None
CH32V30x_EVT.menu.dbg.none.build.flags.debug=
CH32V30x_EVT.menu.dbg.enable_sym=Symbols Enabled (-g)
CH32V30x_EVT.menu.dbg.enable_sym.build.flags.debug=-g -DNDEBUG
CH32V30x_EVT.menu.dbg.enable_log=Core logs Enabled
CH32V30x_EVT.menu.dbg.enable_log.build.flags.debug=
CH32V30x_EVT.menu.dbg.enable_all=Core Logs and Symbols Enabled (-g)
CH32V30x_EVT.menu.dbg.enable_all.build.flags.debug=-g


# C Runtime Library
CH32V30x_EVT.menu.rtlib.nano=Newlib Nano (default)
CH32V30x_EVT.menu.rtlib.nano.build.flags.ldflags=--specs=nano.specs --specs=nosys.specs
CH32V30x_EVT.menu.rtlib.nanofp=Newlib Nano + Float Printf
CH32V30x_EVT.menu.rtlib.nanofp.build.flags.ldspecs=--specs=nano.specs --specs=nosys.specs -u _printf_float
CH32V30x_EVT.menu.rtlib.nanofs=Newlib Nano + Float Scanf
CH32V30x_EVT.menu.rtlib.nanofs.build.flags.ldspecs=--specs=nano.specs --specs=nosys.specs -u _scanf_float
CH32V30x_EVT.menu.rtlib.nanofps=Newlib Nano + Float Printf/Scanf
CH32V30x_EVT.menu.rtlib.nanofps.build.flags.ldspecs=--specs=nano.specs --specs=nosys.specs -u _printf_float -u _scanf_float
CH32V30x_EVT.menu.rtlib.full=Newlib Standard
CH32V30x_EVT.menu.rtlib.full.build.flags.ldspecs=


7 changes: 7 additions & 0 deletions cores/arduino/ch32/PinAF_ch32yyxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,16 @@
#include "../../../variants/CH32V00x/PinAF_CH32V00x.h"
#endif

#if defined(CH32V10x)
#include "../../../variants/CH32V10x/PinAF_CH32V10x.h"
#endif

#if defined(CH32X035)
#include "../../../variants/CH32X035/PinAF_CH32X035.h"
#endif

#if defined(CH32V30x) || defined(CH32V30x_C)
#include "../../../variants/CH32V30x/PinAF_CH32V30x.h"
#endif

#endif /* _PINAF_CH32YYXX_H */
6 changes: 3 additions & 3 deletions cores/arduino/ch32/PortNames.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ GPIO_TypeDef *set_GPIO_Port_Clock(uint32_t port_idx)
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOE, ENABLE);
break;
#endif
#if defined GPIOF_BASE
#if defined RCC_APB2Periph_GPIOF
case PortF:
gpioPort = GPIOF;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOF, ENABLE);
break;
#endif
#if defined GPIOG_BASE
#if defined RCC_APB2Periph_GPIOG
case PortG:
gpioPort = GPIOG;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOG, ENABLE);
break;
#endif
#if defined GPIOH_BASE
#if defined RCC_APB2Periph_GPIOH
case PortH:
gpioPort = GPIOH;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOH, ENABLE);
Expand Down
6 changes: 4 additions & 2 deletions cores/arduino/ch32/analog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static int calibration_value = 0;
/* Private_Defines */
#if defined(ADC_MODULE_ENABLED) && !defined(ADC_MODULE_ONLY)

#if (defined(CH32V20x) || defined(CH32V30x) || defined(CH32V10x) )
#if (defined(CH32V20x) || defined(CH32V30x) || defined(CH32V30x_C) || defined(CH32V10x) )

/* Default to use maximum sampling period */
#ifndef ADC_SAMPLINGTIME
Expand Down Expand Up @@ -423,6 +423,8 @@ void dac_write_value(PinName pin, uint32_t value, uint8_t do_init)

if (do_init == 1)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE );
RCC_APB1PeriphClockCmd(RCC_APB1Periph_DAC, ENABLE );
/*##-1- Configure the DAC peripheral */
g_current_pin = pin;

Expand Down Expand Up @@ -580,7 +582,7 @@ uint16_t adc_read_value(PinName pin, uint32_t resolution)
ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;
ADC_InitStructure.ADC_NbrOfChannel = 1;
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;
#if !defined(CH32V00x)
#if !defined(CH32V00x) && !defined(CH32V10x)
ADC_InitStructure.ADC_OutputBuffer = ENABLE;
#endif
ADC_Init(padc, &ADC_InitStructure);
Expand Down
2 changes: 1 addition & 1 deletion cores/arduino/ch32/ch32_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
#if defined(CH32V20x) || defined(CH32V203xB) || defined(CH32V208)
#include "ch32v20x.h"
#elif defined(CH32V30x)
#elif defined(CH32V30x) || defined(CH32V30x_C)
#include "ch32v30x.h"
#elif defined(CH32V10x)
#include "ch32v10x.h"
Expand Down
13 changes: 13 additions & 0 deletions cores/arduino/ch32/ch32_def_build.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
#define COM_STARTUP_FILE "startup_ch32v00x.S"
#elif defined(CH32X035)
#define COM_STARTUP_FILE "startup_ch32x035.S"

#elif defined(CH32V10x_3V3)
#define COM_STARTUP_FILE "startup_ch32v10x_3v3.S"
#elif defined(CH32V10x_5V)
#define COM_STARTUP_FILE "startup_ch32v10x_5v.S"

#elif defined(CH32V203)
#define COM_STARTUP_FILE "startup_ch32v20x_D6.S"
#define CH32V20x_D6
Expand All @@ -16,6 +22,13 @@
#elif defined(CH32V208)
#define COM_STARTUP_FILE "startup_ch32v20x_D8W.S"
#define CH32V20x_D8W

#elif defined(CH32V30x_C)
#define COM_STARTUP_FILE "startup_ch32v30x_D8C.S"
#define CH32V30x_D8C
#elif defined(CH32V30x)
#define COM_STARTUP_FILE "startup_ch32v30x_D8.S"
#define CH32V30x_D8
#else
#error "Unknow chip!"
#endif
Expand Down
Loading

0 comments on commit 29c76ad

Please sign in to comment.