Skip to content

Commit a153434

Browse files
committed
Add CH585/584 support
1 parent e5dc97f commit a153434

File tree

30 files changed

+842
-10
lines changed

30 files changed

+842
-10
lines changed

.github/workflows/examples.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ jobs:
77
strategy:
88
fail-fast: false
99
matrix:
10-
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
10+
#os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
11+
os: [ubuntu-latest, windows-latest, macos-latest]
1112
example:
1213
- "examples/adc-cpu-temp-none-os"
1314
- "examples/adc-simple-none-os"
@@ -28,6 +29,7 @@ jobs:
2829
- "examples/blinky-freertos"
2930
- "examples/blinky-freertos-ch58x-ch59x"
3031
- "examples/hello-world-harmony-liteos"
32+
- "examples/hello-world-harmony-liteos-ch5xx"
3133
- "examples/hello-world-rt-thread"
3234
- "examples/hello-world-rt-thread-ch5xx"
3335
- "examples/hello-world-tencent-os"

boards/genericCH584F.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"build": {
3+
"clock_source": "hsi+pll",
4+
"extra_flags": "-DCH58 -DCH58xF -DCH5xx -DCH58X -DCH58x -DCH584",
5+
"f_cpu": "78000000L",
6+
"hwids": [
7+
[
8+
"0x1A86",
9+
"0x8010"
10+
]
11+
],
12+
"mabi": "ilp32",
13+
"march": "rv32imc_zba_zbb_zbc_zbs_xw",
14+
"mcu": "ch584f",
15+
"series": "ch585",
16+
"spl_series": "ch585"
17+
},
18+
"debug": {
19+
"onboard_tools": [
20+
"wch-link"
21+
],
22+
"openocd_config": "wch-riscv.cfg",
23+
"svd_path": "CH584.svd"
24+
},
25+
"frameworks": [
26+
"noneos-sdk",
27+
"freertos",
28+
"rt-thread",
29+
"harmony-liteos",
30+
"ch32v003fun"
31+
],
32+
"name": "Generic CH584F",
33+
"upload": {
34+
"maximum_ram_size": 131072,
35+
"maximum_size": 491520,
36+
"protocol": "wch-link",
37+
"protocols": [
38+
"wch-link",
39+
"minichlink",
40+
"isp",
41+
"wlink"
42+
]
43+
},
44+
"url": "http://www.wch-ic.com/products/CH585.html",
45+
"vendor": "W.CH"
46+
}

boards/genericCH584M.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"build": {
3+
"clock_source": "hsi+pll",
4+
"extra_flags": "-DCH58 -DCH58xM -DCH5xx -DCH58X -DCH58x -DCH584",
5+
"f_cpu": "78000000L",
6+
"hwids": [
7+
[
8+
"0x1A86",
9+
"0x8010"
10+
]
11+
],
12+
"mabi": "ilp32",
13+
"march": "rv32imc_zba_zbb_zbc_zbs_xw",
14+
"mcu": "ch584m",
15+
"series": "ch585",
16+
"spl_series": "ch585"
17+
},
18+
"debug": {
19+
"onboard_tools": [
20+
"wch-link"
21+
],
22+
"openocd_config": "wch-riscv.cfg",
23+
"svd_path": "CH584.svd"
24+
},
25+
"frameworks": [
26+
"noneos-sdk",
27+
"freertos",
28+
"rt-thread",
29+
"harmony-liteos",
30+
"ch32v003fun"
31+
],
32+
"name": "Generic CH584M",
33+
"upload": {
34+
"maximum_ram_size": 131072,
35+
"maximum_size": 491520,
36+
"protocol": "wch-link",
37+
"protocols": [
38+
"wch-link",
39+
"minichlink",
40+
"isp",
41+
"wlink"
42+
]
43+
},
44+
"url": "http://www.wch-ic.com/products/CH585.html",
45+
"vendor": "W.CH"
46+
}

boards/genericCH585C.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"build": {
3+
"clock_source": "hsi+pll",
4+
"extra_flags": "-DCH58 -DCH58xC -DCH5xx -DCH58X -DCH58x -DCH585",
5+
"f_cpu": "78000000L",
6+
"hwids": [
7+
[
8+
"0x1A86",
9+
"0x8010"
10+
]
11+
],
12+
"mabi": "ilp32",
13+
"march": "rv32imc_zba_zbb_zbc_zbs_xw",
14+
"mcu": "ch585c",
15+
"series": "ch585",
16+
"spl_series": "ch585"
17+
},
18+
"debug": {
19+
"onboard_tools": [
20+
"wch-link"
21+
],
22+
"openocd_config": "wch-riscv.cfg",
23+
"svd_path": "CH585.svd"
24+
},
25+
"frameworks": [
26+
"noneos-sdk",
27+
"freertos",
28+
"rt-thread",
29+
"harmony-liteos",
30+
"ch32v003fun"
31+
],
32+
"name": "Generic CH585C",
33+
"upload": {
34+
"maximum_ram_size": 131072,
35+
"maximum_size": 491520,
36+
"protocol": "wch-link",
37+
"protocols": [
38+
"wch-link",
39+
"minichlink",
40+
"isp",
41+
"wlink"
42+
]
43+
},
44+
"url": "http://www.wch-ic.com/products/CH585.html",
45+
"vendor": "W.CH"
46+
}

boards/genericCH585D.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"build": {
3+
"clock_source": "hsi+pll",
4+
"extra_flags": "-DCH58 -DCH58xD -DCH5xx -DCH58X -DCH58x -DCH585",
5+
"f_cpu": "78000000L",
6+
"hwids": [
7+
[
8+
"0x1A86",
9+
"0x8010"
10+
]
11+
],
12+
"mabi": "ilp32",
13+
"march": "rv32imc_zba_zbb_zbc_zbs_xw",
14+
"mcu": "ch585d",
15+
"series": "ch585",
16+
"spl_series": "ch585"
17+
},
18+
"debug": {
19+
"onboard_tools": [
20+
"wch-link"
21+
],
22+
"openocd_config": "wch-riscv.cfg",
23+
"svd_path": "CH585.svd"
24+
},
25+
"frameworks": [
26+
"noneos-sdk",
27+
"freertos",
28+
"rt-thread",
29+
"harmony-liteos",
30+
"ch32v003fun"
31+
],
32+
"name": "Generic CH585D",
33+
"upload": {
34+
"maximum_ram_size": 131072,
35+
"maximum_size": 491520,
36+
"protocol": "wch-link",
37+
"protocols": [
38+
"wch-link",
39+
"minichlink",
40+
"isp",
41+
"wlink"
42+
]
43+
},
44+
"url": "http://www.wch-ic.com/products/CH585.html",
45+
"vendor": "W.CH"
46+
}

boards/genericCH585F.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"build": {
3+
"clock_source": "hsi+pll",
4+
"extra_flags": "-DCH58 -DCH58xF -DCH5xx -DCH58X -DCH58x -DCH585",
5+
"f_cpu": "78000000L",
6+
"hwids": [
7+
[
8+
"0x1A86",
9+
"0x8010"
10+
]
11+
],
12+
"mabi": "ilp32",
13+
"march": "rv32imc_zba_zbb_zbc_zbs_xw",
14+
"mcu": "ch585f",
15+
"series": "ch585",
16+
"spl_series": "ch585"
17+
},
18+
"debug": {
19+
"onboard_tools": [
20+
"wch-link"
21+
],
22+
"openocd_config": "wch-riscv.cfg",
23+
"svd_path": "CH585.svd"
24+
},
25+
"frameworks": [
26+
"noneos-sdk",
27+
"freertos",
28+
"rt-thread",
29+
"harmony-liteos",
30+
"ch32v003fun"
31+
],
32+
"name": "Generic CH585F",
33+
"upload": {
34+
"maximum_ram_size": 131072,
35+
"maximum_size": 491520,
36+
"protocol": "wch-link",
37+
"protocols": [
38+
"wch-link",
39+
"minichlink",
40+
"isp",
41+
"wlink"
42+
]
43+
},
44+
"url": "http://www.wch-ic.com/products/CH585.html",
45+
"vendor": "W.CH"
46+
}

boards/genericCH585M.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"build": {
3+
"clock_source": "hsi+pll",
4+
"extra_flags": "-DCH58 -DCH58xM -DCH5xx -DCH58X -DCH58x -DCH585",
5+
"f_cpu": "78000000L",
6+
"hwids": [
7+
[
8+
"0x1A86",
9+
"0x8010"
10+
]
11+
],
12+
"mabi": "ilp32",
13+
"march": "rv32imc_zba_zbb_zbc_zbs_xw",
14+
"mcu": "ch585m",
15+
"series": "ch585",
16+
"spl_series": "ch585"
17+
},
18+
"debug": {
19+
"onboard_tools": [
20+
"wch-link"
21+
],
22+
"openocd_config": "wch-riscv.cfg",
23+
"svd_path": "CH585.svd"
24+
},
25+
"frameworks": [
26+
"noneos-sdk",
27+
"freertos",
28+
"rt-thread",
29+
"harmony-liteos",
30+
"ch32v003fun"
31+
],
32+
"name": "Generic CH585M",
33+
"upload": {
34+
"maximum_ram_size": 131072,
35+
"maximum_size": 491520,
36+
"protocol": "wch-link",
37+
"protocols": [
38+
"wch-link",
39+
"minichlink",
40+
"isp",
41+
"wlink"
42+
]
43+
},
44+
"url": "http://www.wch-ic.com/products/CH585.html",
45+
"vendor": "W.CH"
46+
}

builder/frameworks/noneos_sdk.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ def get_linker_script(mcu: str):
3333

3434
# for now, when building for ch56x, ch57x, ch58x, use the original linker scripts..
3535
if mcu.lower().startswith("ch5"):
36+
if mcu.lower().startswith("ch585") or mcu.lower().startswith("ch584"):
37+
return join(FRAMEWORK_DIR, "platformio", "ldscripts", "Link_CH585") + ".ld"
3638
return join(FRAMEWORK_DIR, "platformio", "ldscripts", "Link_" + board.get("build.series", "")[0:-1].upper() + "x") + ".ld"
3739
ram = board.get("upload.maximum_ram_size", 0)
3840
flash = board.get("upload.maximum_size", 0)
@@ -181,8 +183,10 @@ def get_startup_filename(board):
181183
libs += ["ISP573"] # actually for 571 and 573
182184
elif chip_series.startswith("ch572") or chip_series.startswith("ch570"):
183185
libs += ["ISP572"] # for 570 and 572
184-
elif chip_series.startswith("ch58"):
186+
elif chip_series.startswith("ch58") and not chip_series.startswith("ch585") and not chip_series.startswith("ch584"):
185187
libs += ["ISP583"]
188+
elif chip_series.startswith("ch585") or chip_series.startswith("ch584"):
189+
libs += ["ISP585"]
186190
else:
187191
libs += ["ISP592"]
188192

examples/blinky-ch32fun-ch5xx/platformio.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ board = genericCH570D
2121

2222
[env:genericCH572Q]
2323
board = genericCH572Q
24+
25+
[env:genericCH585D]
26+
board = genericCH585D

examples/blinky-ch32fun-ch5xx/src/funconfig.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
#ifndef _FUNCONFIG_H
22
#define _FUNCONFIG_H
33

4+
#if !defined(CH585) && !defined(CH584)
45
#define FUNCONF_USE_HSI 0 // CH5xx does not have HSI
56
#define FUNCONF_USE_HSE 1
67
#define CLK_SOURCE_CH5XX CLK_SOURCE_PLL_60MHz // default so not really needed
78
#define FUNCONF_SYSTEM_CORE_CLOCK 60 * 1000 * 1000 // keep in line with CLK_SOURCE_CH5XX
9+
#else
10+
#define FUNCONF_USE_HSI 1 // CH585/584 has HSI
11+
#define FUNCONF_USE_HSE 0
12+
#define CLK_SOURCE_CH5XX CLK_SOURCE_HSI_PLL_62_4MHz
13+
#define FUNCONF_SYSTEM_CORE_CLOCK 62400000 // keep in line with CLK_SOURCE_CH5XX
14+
#endif
815

916
#define FUNCONF_DEBUG_HARDFAULT 0
1017
#define FUNCONF_USE_CLK_SEC 0

0 commit comments

Comments
 (0)