Skip to content

Commit bab50a5

Browse files
VynDragonkartben
authored andcommitted
dts: wch: Enable using whole flash with CH32V208
Enables using the whole flash on CH32V208 This also involves limiting frequency of the CPU to 120Mhz from 144Mhz to meet recommendations. Signed-off-by: Camille BAUD <mail@massdriver.space>
1 parent 14b4e30 commit bab50a5

File tree

4 files changed

+10
-16
lines changed

4 files changed

+10
-16
lines changed

dts/riscv/wch/ch32v208/ch32v208.dtsi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
pll: pll {
3838
#clock-cells = <0>;
3939
compatible = "wch,ch32v20x_30x-pll-clock";
40-
mul = <18>;
40+
mul = <15>;
4141
status = "disabled";
4242
};
4343
};
@@ -54,9 +54,9 @@
5454
#address-cells = <1>;
5555
#size-cells = <1>;
5656

57-
flash0: flash@0 {
57+
flash0: flash@8000000 {
5858
compatible = "soc-nv-flash";
59-
reg = <0 DT_SIZE_K(128)>;
59+
reg = <0x08000000 DT_SIZE_K(480)>;
6060
};
6161
};
6262

@@ -160,5 +160,5 @@
160160
};
161161

162162
&cpu0 {
163-
clock-frequency = <DT_FREQ_M(144)>;
163+
clock-frequency = <DT_FREQ_M(120)>;
164164
};

soc/wch/ch32v/qingke_v4c/Kconfig.defconfig

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@ if SOC_SERIES_QINGKE_V4C
66
config SYS_CLOCK_HW_CYCLES_PER_SEC
77
default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency)
88

9-
config MAIN_STACK_SIZE
10-
default 512
11-
12-
config IDLE_STACK_SIZE
13-
default 256
14-
15-
config ISR_STACK_SIZE
16-
default 256
17-
189
config CLOCK_CONTROL
1910
default y
2011

soc/wch/ch32v/qingke_v4c/Kconfig.defconfig.ch32v208

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
if SOC_CH32V208
55

66
config VECTOR_TABLE_SIZE
7-
default 103
7+
default 104
88

99
config NUM_IRQS
1010
default 128

soc/wch/ch32v/qingke_v4c/vector.S

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Michael Hope
2+
* Copyright (c) 2025 MASSDRIVER EI (massdriver.space)
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -18,12 +18,15 @@ GTEXT(__initialize)
1818

1919
SECTION_FUNC(vectors, ivt)
2020
.option norvc
21+
/* Jump to 0x08000008, into the main flash zone where j __start is */
22+
lui x5, 0x8000
23+
jr 0x8(x5)
2124
j __start
2225
.rept CONFIG_VECTOR_TABLE_SIZE
2326
.word _isr_wrapper
2427
.endr
2528

2629
SECTION_FUNC(vectors, __start)
27-
li a0, 3
30+
li a0, 0xf
2831
csrw mtvec, a0
2932
j __initialize

0 commit comments

Comments
 (0)