Skip to content

Commit 098b046

Browse files
committed
first release
0 parents  commit 098b046

File tree

251 files changed

+52248
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

251 files changed

+52248
-0
lines changed

Diff for: README.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Arduino core support for CH32 EVT Boards
2+
3+
* [Introduction](https://github.com/openwch/arduino_core_ch32#Introduction)<br>
4+
* [How to use](https://github.com/openwch/arduino_core_ch32#How-to-use)<br>
5+
* [Supported boards](https://github.com/openwch/arduino_core_ch32#Supported-boards)<br>
6+
* [Submit bugs](https://github.com/openwch/arduino_core_ch32#Submit-bugs)<br>
7+
8+
## Introduction
9+
10+
This repo adds the support of CH32 MCU in Arduino IDE.<br>
11+
12+
The file includes:
13+
* [Arduino_Core_CH32](https://github.com/openwch/arduino_core_ch32):Public library files.
14+
* [openocd](https://github.com/openwch/openocd_wch):can directly use WCH-LINKE to download and debug wch chips.
15+
* [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.
16+
17+
## How to use
18+
19+
You can add this software package directly on the IDE through the [Arduino Boards Manager](https://www.arduino.cc/en/guide/cores).
20+
21+
Add the following link in the "*Additional Boards Managers URLs*" field:
22+
23+
https://github.com/openwch/board_manager_files/raw/main/package_ch32v_index.json
24+
25+
Then you can search for "**wch**" through the "**board manager**", find the installation package, and install it.
26+
27+
## Supported boards
28+
29+
It will be a long-term support and maintenance project, unless we encounter force majeure factors.The current version supports the following development boards:
30+
31+
- [CH32V00x EVT Boards](#CH32V00x-EVT-Boards)
32+
- [CH32V20x EVT Boards](#CH32V20x-EVT-Boards)
33+
34+
### CH32V00x EVT Boards
35+
36+
| Status | Boards name | Release |
37+
| :----: | ---- | :-----: |
38+
| :heavy_check_mark: | CH32V003F4P | 1.0.0 |
39+
40+
### CH32V20x EVT Boards
41+
42+
| Status | Boards name | Release |
43+
| :----: | ---- | :-----: |
44+
| :heavy_check_mark: | CH32V203G8U | 1.0.0 |
45+
46+
## Submit bugs
47+
48+
If you have any questions, you could contact me through the email "*[email protected]*".
49+
Or you could [file an issue on GitHub](https://github.com/openwch/arduino_core_ch32/issues/new).
50+
51+

Diff for: boards.txt

+186
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
# See: https://arduino.github.io/arduino-cli/latest/platform-specification/
2+
3+
menu.pnum=Board Select
4+
5+
menu.xserial=U(S)ART support
6+
menu.usb=USB support (if available)
7+
menu.xusb=USB speed (if available)
8+
menu.virtio=Virtual serial support
9+
10+
menu.opt=Optimize
11+
menu.dbg=Debug symbols and core logs
12+
menu.rtlib=C Runtime Library
13+
menu.upload_method=Upload method
14+
15+
16+
17+
#############################################################################
18+
##CH32V00x EVT Board
19+
20+
CH32V00x_EVT.name=CH32V00x
21+
CH32V00x_EVT.build.core=arduino
22+
CH32V00x_EVT.build.board=CH32V00x_EVT
23+
CH32V00x_EVT.upload.maximum_size=0
24+
CH32V00x_EVT.upload.maximum_data_size=0
25+
CH32V00x_EVT.build.variant_h=variant_{build.board}.h
26+
27+
28+
#CH32V003F4 EVT Board
29+
CH32V00x_EVT.menu.pnum.CH32V003F4=CH32V003F4 EVT
30+
CH32V00x_EVT.menu.pnum.CH32V003F4.node=NODE_V003F4
31+
CH32V00x_EVT.menu.pnum.CH32V003F4.upload.maximum_size=16384
32+
CH32V00x_EVT.menu.pnum.CH32V003F4.upload.maximum_data_size=2048
33+
CH32V00x_EVT.menu.pnum.CH32V003F4.build.mcu=QingKe-V2
34+
CH32V00x_EVT.menu.pnum.CH32V003F4.build.board=CH32V003F4
35+
CH32V00x_EVT.menu.pnum.CH32V003F4.build.series=CH32V00x
36+
CH32V00x_EVT.menu.pnum.CH32V003F4.build.variant=CH32V00x/CH32V003F4
37+
CH32V00x_EVT.menu.pnum.CH32V003F4.build.chip=CH32V003F4
38+
CH32V00x_EVT.menu.pnum.CH32V003F4.build.march=rv32ecxw
39+
CH32V00x_EVT.menu.pnum.CH32V003F4.build.mabi=ilp32e
40+
CH32V00x_EVT.menu.pnum.CH32V003F4.build.math_lib_gcc=-lm
41+
CH32V00x_EVT.menu.pnum.CH32V003F4.build.IQ_math_RV32=
42+
CH32V00x_EVT.menu.pnum.CH32V003F4.build.ch_extra_lib=-lprintf
43+
44+
45+
# Upload menu
46+
CH32V00x_EVT.menu.upload_method.swdMethod=WCH-SWD
47+
CH32V00x_EVT.menu.upload_method.swdMethod.upload.protocol=
48+
CH32V00x_EVT.menu.upload_method.swdMethod.upload.options=
49+
CH32V00x_EVT.menu.upload_method.swdMethod.upload.tool=WCH_linkE
50+
51+
52+
53+
# Optimizations
54+
CH32V00x_EVT.menu.opt.osstd=Smallest (-Os default)
55+
CH32V00x_EVT.menu.opt.osstd.build.flags.optimize=-Os
56+
CH32V00x_EVT.menu.opt.oslto=Smallest (-Os) with LTO
57+
CH32V00x_EVT.menu.opt.oslto.build.flags.optimize=-Os -flto
58+
CH32V00x_EVT.menu.opt.o1std=Fast (-O1)
59+
CH32V00x_EVT.menu.opt.o1std.build.flags.optimize=-O1
60+
CH32V00x_EVT.menu.opt.o1lto=Fast (-O1) with LTO
61+
CH32V00x_EVT.menu.opt.o1lto.build.flags.optimize=-O1 -flto
62+
CH32V00x_EVT.menu.opt.o2std=Faster (-O2)
63+
CH32V00x_EVT.menu.opt.o2std.build.flags.optimize=-O2
64+
CH32V00x_EVT.menu.opt.o2lto=Faster (-O2) with LTO
65+
CH32V00x_EVT.menu.opt.o2lto.build.flags.optimize=-O2 -flto
66+
CH32V00x_EVT.menu.opt.o3std=Fastest (-O3)
67+
CH32V00x_EVT.menu.opt.o3std.build.flags.optimize=-O3
68+
CH32V00x_EVT.menu.opt.o3lto=Fastest (-O3) with LTO
69+
CH32V00x_EVT.menu.opt.o3lto.build.flags.optimize=-O3 -flto
70+
CH32V00x_EVT.menu.opt.ogstd=Debug (-Og)
71+
CH32V00x_EVT.menu.opt.ogstd.build.flags.optimize=-Og
72+
CH32V00x_EVT.menu.opt.o0std=No Optimization (-O0)
73+
CH32V00x_EVT.menu.opt.o0std.build.flags.optimize=-O0
74+
75+
76+
# Debug information
77+
CH32V00x_EVT.menu.dbg.none=None
78+
CH32V00x_EVT.menu.dbg.none.build.flags.debug=
79+
CH32V00x_EVT.menu.dbg.enable_sym=Symbols Enabled (-g)
80+
CH32V00x_EVT.menu.dbg.enable_sym.build.flags.debug=-g -DNDEBUG
81+
CH32V00x_EVT.menu.dbg.enable_log=Core logs Enabled
82+
CH32V00x_EVT.menu.dbg.enable_log.build.flags.debug=
83+
CH32V00x_EVT.menu.dbg.enable_all=Core Logs and Symbols Enabled (-g)
84+
CH32V00x_EVT.menu.dbg.enable_all.build.flags.debug=-g
85+
86+
87+
# C Runtime Library
88+
CH32V00x_EVT.menu.rtlib.nano=Newlib Nano (default)
89+
CH32V00x_EVT.menu.rtlib.nano.build.flags.ldflags=--specs=nano.specs --specs=nosys.specs
90+
CH32V00x_EVT.menu.rtlib.nanofp=Newlib Nano + Float Printf
91+
CH32V00x_EVT.menu.rtlib.nanofp.build.flags.ldspecs=--specs=nano.specs --specs=nosys.specs -u _printf_float
92+
CH32V00x_EVT.menu.rtlib.nanofs=Newlib Nano + Float Scanf
93+
CH32V00x_EVT.menu.rtlib.nanofs.build.flags.ldspecs=--specs=nano.specs --specs=nosys.specs -u _scanf_float
94+
CH32V00x_EVT.menu.rtlib.nanofps=Newlib Nano + Float Printf/Scanf
95+
CH32V00x_EVT.menu.rtlib.nanofps.build.flags.ldspecs=--specs=nano.specs --specs=nosys.specs -u _printf_float -u _scanf_float
96+
CH32V00x_EVT.menu.rtlib.full=Newlib Standard
97+
CH32V00x_EVT.menu.rtlib.full.build.flags.ldspecs=
98+
99+
100+
101+
#############################################################################
102+
##CH32V20x EVT Board
103+
104+
CH32V20x_EVT.name=CH32V20x
105+
CH32V20x_EVT.build.core=arduino
106+
CH32V20x_EVT.build.board=CH32V20x_EVT
107+
CH32V20x_EVT.upload.maximum_size=0
108+
CH32V20x_EVT.upload.maximum_data_size=0
109+
CH32V20x_EVT.build.variant_h=variant_{build.board}.h
110+
111+
112+
#CH32V203G8 EVT Board
113+
CH32V20x_EVT.menu.pnum.CH32V203G8=CH32V203G8 EVT
114+
CH32V20x_EVT.menu.pnum.CH32V203G8.node=NODE_V203G8
115+
CH32V20x_EVT.menu.pnum.CH32V203G8.upload.maximum_size=65536
116+
CH32V20x_EVT.menu.pnum.CH32V203G8.upload.maximum_data_size=20480
117+
CH32V20x_EVT.menu.pnum.CH32V203G8.build.mcu=QingKe-V4C
118+
CH32V20x_EVT.menu.pnum.CH32V203G8.build.board=CH32V203G8
119+
CH32V20x_EVT.menu.pnum.CH32V203G8.build.series=CH32V20x
120+
CH32V20x_EVT.menu.pnum.CH32V203G8.build.variant=CH32V20x/CH32V203G8
121+
CH32V20x_EVT.menu.pnum.CH32V203G8.build.chip=CH32V203
122+
CH32V20x_EVT.menu.pnum.CH32V203G8.build.march=rv32imacxw
123+
CH32V20x_EVT.menu.pnum.CH32V203G8.build.mabi=ilp32
124+
CH32V20x_EVT.menu.pnum.CH32V203G8.build.math_lib_gcc=-lm
125+
CH32V20x_EVT.menu.pnum.CH32V203G8.build.IQ_math_RV32=
126+
CH32V20x_EVT.menu.pnum.CH32V203G8.build.ch_extra_lib=-lprintf
127+
128+
129+
# Upload menu
130+
CH32V20x_EVT.menu.upload_method.swdMethod=WCH-SWD
131+
CH32V20x_EVT.menu.upload_method.swdMethod.upload.protocol=
132+
CH32V20x_EVT.menu.upload_method.swdMethod.upload.options=
133+
CH32V20x_EVT.menu.upload_method.swdMethod.upload.tool=WCH_linkE
134+
135+
136+
137+
# Optimizations
138+
CH32V20x_EVT.menu.opt.osstd=Smallest (-Os default)
139+
CH32V20x_EVT.menu.opt.osstd.build.flags.optimize=-Os
140+
CH32V20x_EVT.menu.opt.oslto=Smallest (-Os) with LTO
141+
CH32V20x_EVT.menu.opt.oslto.build.flags.optimize=-Os -flto
142+
CH32V20x_EVT.menu.opt.o1std=Fast (-O1)
143+
CH32V20x_EVT.menu.opt.o1std.build.flags.optimize=-O1
144+
CH32V20x_EVT.menu.opt.o1lto=Fast (-O1) with LTO
145+
CH32V20x_EVT.menu.opt.o1lto.build.flags.optimize=-O1 -flto
146+
CH32V20x_EVT.menu.opt.o2std=Faster (-O2)
147+
CH32V20x_EVT.menu.opt.o2std.build.flags.optimize=-O2
148+
CH32V20x_EVT.menu.opt.o2lto=Faster (-O2) with LTO
149+
CH32V20x_EVT.menu.opt.o2lto.build.flags.optimize=-O2 -flto
150+
CH32V20x_EVT.menu.opt.o3std=Fastest (-O3)
151+
CH32V20x_EVT.menu.opt.o3std.build.flags.optimize=-O3
152+
CH32V20x_EVT.menu.opt.o3lto=Fastest (-O3) with LTO
153+
CH32V20x_EVT.menu.opt.o3lto.build.flags.optimize=-O3 -flto
154+
CH32V20x_EVT.menu.opt.ogstd=Debug (-Og)
155+
CH32V20x_EVT.menu.opt.ogstd.build.flags.optimize=-Og
156+
CH32V20x_EVT.menu.opt.o0std=No Optimization (-O0)
157+
CH32V20x_EVT.menu.opt.o0std.build.flags.optimize=-O0
158+
159+
160+
# Debug information
161+
CH32V20x_EVT.menu.dbg.none=None
162+
CH32V20x_EVT.menu.dbg.none.build.flags.debug=
163+
CH32V20x_EVT.menu.dbg.enable_sym=Symbols Enabled (-g)
164+
CH32V20x_EVT.menu.dbg.enable_sym.build.flags.debug=-g -DNDEBUG
165+
CH32V20x_EVT.menu.dbg.enable_log=Core logs Enabled
166+
CH32V20x_EVT.menu.dbg.enable_log.build.flags.debug=
167+
CH32V20x_EVT.menu.dbg.enable_all=Core Logs and Symbols Enabled (-g)
168+
CH32V20x_EVT.menu.dbg.enable_all.build.flags.debug=-g
169+
170+
171+
# C Runtime Library
172+
CH32V20x_EVT.menu.rtlib.nano=Newlib Nano (default)
173+
CH32V20x_EVT.menu.rtlib.nano.build.flags.ldflags=--specs=nano.specs --specs=nosys.specs
174+
CH32V20x_EVT.menu.rtlib.nanofp=Newlib Nano + Float Printf
175+
CH32V20x_EVT.menu.rtlib.nanofp.build.flags.ldspecs=--specs=nano.specs --specs=nosys.specs -u _printf_float
176+
CH32V20x_EVT.menu.rtlib.nanofs=Newlib Nano + Float Scanf
177+
CH32V20x_EVT.menu.rtlib.nanofs.build.flags.ldspecs=--specs=nano.specs --specs=nosys.specs -u _scanf_float
178+
CH32V20x_EVT.menu.rtlib.nanofps=Newlib Nano + Float Printf/Scanf
179+
CH32V20x_EVT.menu.rtlib.nanofps.build.flags.ldspecs=--specs=nano.specs --specs=nosys.specs -u _printf_float -u _scanf_float
180+
CH32V20x_EVT.menu.rtlib.full=Newlib Standard
181+
CH32V20x_EVT.menu.rtlib.full.build.flags.ldspecs=
182+
183+
184+
185+
186+

Diff for: cores/arduino/Arduino.h

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
Arduino.h - Main include file for the Arduino SDK
3+
Copyright (c) 2005-2013 Arduino Team. All right reserved.
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
9+
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
#ifndef Arduino_h
21+
#define Arduino_h
22+
23+
#ifndef GCC_VERSION
24+
#define GCC_VERSION (__GNUC__ * 10000 \
25+
+ __GNUC_MINOR__ * 100 \
26+
+ __GNUC_PATCHLEVEL__)
27+
#endif
28+
#if GCC_VERSION < 60300
29+
#error "GCC version 6.3 or higher is required"
30+
#endif
31+
32+
#ifdef __IN_ECLIPSE__
33+
// #include "SrcWrapper.h"
34+
#endif
35+
36+
#include "wiring.h"
37+
38+
/* sketch */
39+
#ifdef __cplusplus
40+
extern "C" {
41+
#endif // __cplusplus
42+
43+
extern void setup(void) ;
44+
extern void loop(void) ;
45+
46+
// void yield(void)
47+
48+
#ifdef __cplusplus
49+
} // extern "C"
50+
#endif // __cplusplus
51+
52+
// Include pins variant
53+
#include "pins_arduino.h"
54+
55+
#endif // Arduino_h

0 commit comments

Comments
 (0)