-
Notifications
You must be signed in to change notification settings - Fork 7.4k
dts: wch: Enable using whole flash with CH32V208 #87345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dts: wch: Enable using whole flash with CH32V208 #87345
Conversation
1d88336
to
d4880f1
Compare
d4880f1
to
cbb1ae2
Compare
cc @kholia (need to open a issue to add you to the collaborators) |
145559b
to
f6d4d2e
Compare
soc/wch/ch32v/qingke_v4/vector.S
Outdated
j __start | ||
.rept CONFIG_VECTOR_TABLE_SIZE | ||
.word _isr_wrapper | ||
.endr | ||
|
||
SECTION_FUNC(vectors, __start) | ||
li a0, 3 | ||
li a0, 0xf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first, I wanted to ask what this change is about but I now have some idea:
You need this because lui and jr from above are now at 0x0 and then the table starts at 0x8, right?
I think this warrants a comment in code for the next person that tries to understand this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 first bits are settings, 2 after that are 0xC start of the table (0x4+0x4+0x4 3 32-bits instructions)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, my bad.
But then vector table is one entry to small (check VECTOR_TABLE_SIZE and Table 9-2 in RM).
Could also verify using DMA2_CH11 interrupt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, the number should be 104, I'll make a PR for fixing this later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have applied it there since I had to spend another hour updating this PR again since other things were merged before it was.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have applied it there since I had to spend another hour updating this PR again since other things were merged before it was.
Feel free to mark other PRs as DNM if there are dependencies or preferences w.r.t merge order
Not only do i expect people to be pissed if I do that, but I also expected y'all take the normal time to merge that PR, eg 2 to 3 months counted in buisness days so i could have the time to actually take a look at it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not only do i expect people to be pissed if I do that, but I also expected y'all take the normal time to merge that PR, eg 2 to 3 months counted in buisness days so i could have the time to actually take a look at it.
I don't know what this is supposed to mean. PRs get merged when they're... mergeable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What it means is being unpredictable is worse than being slow, you cant just have trivial PRs taking months to merge because no one bothers taking a look or assigned person disappeared, while having big PRs being reviewed very partially (100 % certain nordicjm's review was only relevant to the board part, dont know about yours but i'm also sure there wasnt a overall architectural review because it didn't match the current architecture of the wch soc folders that my PRs had to match being merged) and merged near-instantly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like ffs we still cant use west flash on ch32v208 because we have to make sure <random person 458485> is ok with fixing a obvious bug but apparently breaking other PRs and making 4 contributors wait for months on end because no one can be bothered to actually review something agreed upon by 3/4th of the contributors of a platform is perfectly ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to apologize to you two, it's really not your fault, it's only the normal, insanely frustrating (especially in areas of low mainstream interest), process...
1e6a8b8
to
b8cca14
Compare
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>
b8cca14
to
964f09e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, the ch32v00x series (like the ch32v006) is different from the ch32v003 - including having a different microarchitecture (v2c) and different pinmux.
Happy to discuss.
@@ -90,7 +90,7 @@ static void clock_control_wch_rcc_setup_flash(void) | |||
} else { | |||
latency = FLASH_ACTLR_LATENCY_1; | |||
} | |||
#elif defined(CONFIG_SOC_SERIES_CH32V00X) | |||
#elif defined(CONFIG_SOC_SERIES_QINGKE_V2A) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To add detail: the flash latency is a SOC feature, not a core feature, and it's different on the CH32V003 to the others in the CH32V00x series.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this is the correct filter right? This will be CONFIG_SOC_SERIES_QINGKE_V2 soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
soc/wch/ch32v/qingke_v2a/Kconfig
Outdated
@@ -6,3 +6,4 @@ config SOC_SERIES_QINGKE_V2A | |||
select RISCV_ISA_EXT_ZICSR | |||
select RISCV_ISA_EXT_ZIFENCEI | |||
select RISCV_ISA_EXT_C | |||
select RISCV_ISA_EXT_ZMMUL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The V2A does not have ZMMUL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
if SOC_SERIES_QINGKE_V2A | ||
|
||
config SYS_CLOCK_HW_CYCLES_PER_SEC | ||
default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency) | ||
|
||
config MAIN_STACK_SIZE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are needed on the CH32V003, which is the only SOC using the V2A.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please look at the new version while i run functionaility tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -1,12 +1,12 @@ | |||
# Copyright (c) 2025 Michael Hope <michaelh@juju.nz> | |||
# SPDX-License-Identifier: Apache-2.0 | |||
|
|||
if SOC_SERIES_CH32V00X | |||
if SOC_CH32V006 | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! No action requested.
@@ -3,7 +3,7 @@ | |||
|
|||
config SOC_CH32V006 | |||
bool | |||
select SOC_SERIES_CH32V00X | |||
select SOC_SERIES_QINGKE_V2A |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original is correct. Also, the CH32V00x series is a QINGKE_V2C.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -10,7 +10,7 @@ | |||
/** | |||
* @brief Type to hold a pin's pinctrl configuration. | |||
*/ | |||
struct ch32v00x_pinctrl_soc_pin { | |||
struct qingke_v4_pinctrl_soc_pin { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this file moved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deduplication.
soc/wch/ch32v/soc.yml
Outdated
@@ -7,9 +7,7 @@ family: | |||
- name: qingke-v2a | |||
socs: | |||
- name: ch32v003 | |||
- name: ch32v00x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ch32v006 is not a qingke-v2a but a v2c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's not clear i'm quite a bit annoyed CH32V006 was merged, because it messes up this PR and means it requires ANOTHER round of reviews and hours of update for me, and obviously I have made errors on adding ch32v006 to it, but I'm really not inclined in spending more time on it while everyone has been dragging their feets about this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And you know, the fact that it's probably going to need another round of reorganization as discussed there #87345 (comment) and so it's basically doubly wasted time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hear you, and I'm sorry for your wasted time. When I reviewed it, this PR breaks both the ch32v003 and ch32v00x, so I can't LGTM it as is.
Could I suggest breaking this up into separate PRs covering separate concerns? For example, the CH32V208 PLL, flash, and startup changes are independent of the rename.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am working on fixing it so it doesnt break them and they are organized as they are supposed to be in this version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be good now.
re: naming in general, is #87345 (comment) the plan of record? I used that for the ch32v00x structure, but this PR reverses much of that. |
bdc2db6
to
8ae6dfa
Compare
Someone else can take care of the reorganization reviewers have asked for: #87125 (comment) |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Enables using the whole flash on CH32V208
This needs #87141This fixes it differently.and #85395