Skip to content

Commit

Permalink
first release
Browse files Browse the repository at this point in the history
  • Loading branch information
TianpeiLee committed May 30, 2023
0 parents commit 098b046
Show file tree
Hide file tree
Showing 251 changed files with 52,248 additions and 0 deletions.
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Arduino core support for CH32 EVT Boards

* [Introduction](https://github.com/openwch/arduino_core_ch32#Introduction)<br>
* [How to use](https://github.com/openwch/arduino_core_ch32#How-to-use)<br>
* [Supported boards](https://github.com/openwch/arduino_core_ch32#Supported-boards)<br>
* [Submit bugs](https://github.com/openwch/arduino_core_ch32#Submit-bugs)<br>

## Introduction

This repo adds the support of CH32 MCU in Arduino IDE.<br>

The file includes:
* [Arduino_Core_CH32](https://github.com/openwch/arduino_core_ch32):Public library files.
* [openocd](https://github.com/openwch/openocd_wch):can directly use WCH-LINKE to download and debug wch chips.
* [riscv-none-embed-gcc](https://github.com/openwch/risc-none-embed-gcc):A toolchain that supports WCH custom half word and byte compression instruction extensions and hardware stack push/pop functions.

## How to use

You can add this software package directly on the IDE through the [Arduino Boards Manager](https://www.arduino.cc/en/guide/cores).

Add the following link in the "*Additional Boards Managers URLs*" field:

https://github.com/openwch/board_manager_files/raw/main/package_ch32v_index.json

Then you can search for "**wch**" through the "**board manager**", find the installation package, and install it.

## Supported boards

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)
- [CH32V20x EVT Boards](#CH32V20x-EVT-Boards)

### CH32V00x EVT Boards

| Status | Boards name | Release |
| :----: | ---- | :-----: |
| :heavy_check_mark: | CH32V003F4P | 1.0.0 |

### CH32V20x EVT Boards

| Status | Boards name | Release |
| :----: | ---- | :-----: |
| :heavy_check_mark: | CH32V203G8U | 1.0.0 |

## Submit bugs

If you have any questions, you could contact me through the email "*[email protected]*".
Or you could [file an issue on GitHub](https://github.com/openwch/arduino_core_ch32/issues/new).


186 changes: 186 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
# See: https://arduino.github.io/arduino-cli/latest/platform-specification/

menu.pnum=Board Select

menu.xserial=U(S)ART support
menu.usb=USB support (if available)
menu.xusb=USB speed (if available)
menu.virtio=Virtual serial support

menu.opt=Optimize
menu.dbg=Debug symbols and core logs
menu.rtlib=C Runtime Library
menu.upload_method=Upload method



#############################################################################
##CH32V00x EVT Board

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


#CH32V003F4 EVT Board
CH32V00x_EVT.menu.pnum.CH32V003F4=CH32V003F4 EVT
CH32V00x_EVT.menu.pnum.CH32V003F4.node=NODE_V003F4
CH32V00x_EVT.menu.pnum.CH32V003F4.upload.maximum_size=16384
CH32V00x_EVT.menu.pnum.CH32V003F4.upload.maximum_data_size=2048
CH32V00x_EVT.menu.pnum.CH32V003F4.build.mcu=QingKe-V2
CH32V00x_EVT.menu.pnum.CH32V003F4.build.board=CH32V003F4
CH32V00x_EVT.menu.pnum.CH32V003F4.build.series=CH32V00x
CH32V00x_EVT.menu.pnum.CH32V003F4.build.variant=CH32V00x/CH32V003F4
CH32V00x_EVT.menu.pnum.CH32V003F4.build.chip=CH32V003F4
CH32V00x_EVT.menu.pnum.CH32V003F4.build.march=rv32ecxw
CH32V00x_EVT.menu.pnum.CH32V003F4.build.mabi=ilp32e
CH32V00x_EVT.menu.pnum.CH32V003F4.build.math_lib_gcc=-lm
CH32V00x_EVT.menu.pnum.CH32V003F4.build.IQ_math_RV32=
CH32V00x_EVT.menu.pnum.CH32V003F4.build.ch_extra_lib=-lprintf


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



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


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


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



#############################################################################
##CH32V20x EVT Board

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


#CH32V203G8 EVT Board
CH32V20x_EVT.menu.pnum.CH32V203G8=CH32V203G8 EVT
CH32V20x_EVT.menu.pnum.CH32V203G8.node=NODE_V203G8
CH32V20x_EVT.menu.pnum.CH32V203G8.upload.maximum_size=65536
CH32V20x_EVT.menu.pnum.CH32V203G8.upload.maximum_data_size=20480
CH32V20x_EVT.menu.pnum.CH32V203G8.build.mcu=QingKe-V4C
CH32V20x_EVT.menu.pnum.CH32V203G8.build.board=CH32V203G8
CH32V20x_EVT.menu.pnum.CH32V203G8.build.series=CH32V20x
CH32V20x_EVT.menu.pnum.CH32V203G8.build.variant=CH32V20x/CH32V203G8
CH32V20x_EVT.menu.pnum.CH32V203G8.build.chip=CH32V203
CH32V20x_EVT.menu.pnum.CH32V203G8.build.march=rv32imacxw
CH32V20x_EVT.menu.pnum.CH32V203G8.build.mabi=ilp32
CH32V20x_EVT.menu.pnum.CH32V203G8.build.math_lib_gcc=-lm
CH32V20x_EVT.menu.pnum.CH32V203G8.build.IQ_math_RV32=
CH32V20x_EVT.menu.pnum.CH32V203G8.build.ch_extra_lib=-lprintf


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



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


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


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





55 changes: 55 additions & 0 deletions cores/arduino/Arduino.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
Arduino.h - Main include file for the Arduino SDK
Copyright (c) 2005-2013 Arduino Team. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef Arduino_h
#define Arduino_h

#ifndef GCC_VERSION
#define GCC_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__)
#endif
#if GCC_VERSION < 60300
#error "GCC version 6.3 or higher is required"
#endif

#ifdef __IN_ECLIPSE__
// #include "SrcWrapper.h"
#endif

#include "wiring.h"

/* sketch */
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus

extern void setup(void) ;
extern void loop(void) ;

// void yield(void)

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

// Include pins variant
#include "pins_arduino.h"

#endif // Arduino_h
Loading

0 comments on commit 098b046

Please sign in to comment.