-
Notifications
You must be signed in to change notification settings - Fork 80
Add esp32c3 support #334
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
Merged
nooopslol
merged 60 commits into
vivoblueos:main
from
xuchang-vivo:xc/seeed_xiao_esp32c3_support
Mar 24, 2026
Merged
Add esp32c3 support #334
Changes from all commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
6acdfd5
minor
xuchang-vivo 172e8b5
minor
xuchang-vivo 9e6e07b
minor
xuchang-vivo 2f7b0af
minor
xuchang-vivo 36b9af1
laji
xuchang-vivo 56cc513
wip
xuchang-vivo 2f71fac
minor
xuchang-vivo 0d05786
add intr
xuchang-vivo a36acfc
minor
xuchang-vivo 755837d
minor
xuchang-vivo 432023f
minor
xuchang-vivo c01a162
minor
xuchang-vivo 8f0bf26
del idf deps
xuchang-vivo ac01382
add riscv kconfig
xuchang-vivo 1a25367
set mie
xuchang-vivo a765702
minor
xuchang-vivo 3f5ec16
minor
xuchang-vivo af1b8ba
minor
xuchang-vivo 38f486a
minor
xuchang-vivo cd0d3c1
minor
xuchang-vivo a4a01c3
minor
xuchang-vivo 6cbaacb
minor
xuchang-vivo f91cc18
minor
xuchang-vivo d6dd799
minor
xuchang-vivo e4b5401
make fifo tx enable
xuchang-vivo 5a7e627
disable wdt
xuchang-vivo 9607f68
add intc
xuchang-vivo 182b422
minor
xuchang-vivo 8259b52
add copyright
xuchang-vivo f534098
add link.x
xuchang-vivo f410546
make mtime optional
xuchang-vivo 85309b6
minor
xuchang-vivo fbd885f
Apply suggestion from @lawkai-vivo
lawkai-vivo 4765dc2
Update kconfig/config/seeed_xiao_esp32c3/debug/defconfig
lawkai-vivo e7b958b
Update driver/src/systimer/esp32_sys_timer.rs
xuchang-vivo 75a05a9
Update driver/src/systimer/esp32_sys_timer.rs
xuchang-vivo b15a20b
add unittest_kernel
xuchang-vivo 3f5616f
fix bug
xuchang-vivo e378194
set unittest thread num options
xuchang-vivo 542501f
fix
xuchang-vivo c60e865
minor
xuchang-vivo dca99cf
add check_all
xuchang-vivo 92b317a
del kconfig.test
xuchang-vivo 299c405
fix compile error
xuchang-vivo 72d0a14
minor
xuchang-vivo 04a7516
minor
xuchang-vivo 9afb0a0
Update driver/src/interrupt_controller/esp32_intc.rs
xuchang-vivo 5b29bf4
Update driver/src/interrupt_controller/esp32_intc.rs
xuchang-vivo 18de384
Update driver/src/interrupt_controller/esp32_intc.rs
xuchang-vivo 49ab813
Update driver/src/interrupt_controller/esp32_intc.rs
xuchang-vivo fc9dc85
fix
xuchang-vivo bd59638
add compensation
xuchang-vivo 447dfe2
minor
xuchang-vivo b05f556
minor
xuchang-vivo 2778b01
minor
xuchang-vivo c4c69cc
add compensation
xuchang-vivo 7587ca1
minor
xuchang-vivo 4bdef13
minor
xuchang-vivo 6ab2426
add gen_esp32_qemu_runner
xuchang-vivo d51179f
fix typo
xuchang-vivo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| // Copyright (c) 2026 vivo Mobile Communication Co., Ltd. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| use tock_registers::{ | ||
| interfaces::{ReadWriteable, Readable, Writeable}, | ||
| register_bitfields, register_structs, | ||
| registers::ReadWrite, | ||
| }; | ||
|
|
||
| use crate::{ | ||
| interrupt_controller::Interrupt, static_ref::StaticRef, | ||
| uart::esp32_usb_serial::JFIFO_ST_REG::OUT_FIFO_FULL, | ||
| }; | ||
|
|
||
| register_structs! { | ||
| pub IntcRegisters { | ||
| (0x000 => _reserved0), | ||
| (0x104 => cpu_int_enable_reg: ReadWrite<u32>), | ||
| (0x108 => _reserved1), | ||
| (0x118 => priority_reg: [ReadWrite<u32, PRIORITY_REG::Register>; 31]), | ||
| (0x194 => threshold_reg: ReadWrite<u32, THRESHOLD_REG::Register>), | ||
| (0x198 => @END), | ||
| } | ||
| } | ||
|
|
||
| register_bitfields! [ | ||
| u32, | ||
|
|
||
| pub PRIORITY_REG [ | ||
| PRIORITY OFFSET(0) NUMBITS(4) [], | ||
| ], | ||
|
|
||
| pub THRESHOLD_REG [ | ||
| THRESHOLD OFFSET(0) NUMBITS(4) [], | ||
| ], | ||
| ]; | ||
|
|
||
| pub struct Esp32Intc { | ||
| registers: StaticRef<IntcRegisters>, | ||
| } | ||
|
|
||
| impl Esp32Intc { | ||
| pub const fn new(base: usize) -> Self { | ||
| Self { | ||
| registers: unsafe { StaticRef::new(base as *const IntcRegisters) }, | ||
| } | ||
| } | ||
|
|
||
| pub fn allocate_irq(&self, irq: Interrupt) { | ||
| let mut map_reg = | ||
| self.registers.inner() as *const IntcRegisters as usize + irq.source_no * 4; | ||
| unsafe { | ||
| core::ptr::write_volatile(map_reg as *mut u32, irq.irq_no as u32); | ||
| } | ||
| } | ||
|
|
||
| pub fn enable_irq(&self, irq: Interrupt) { | ||
| let mut enable_reg = self.registers.cpu_int_enable_reg.get(); | ||
| enable_reg |= 1 << irq.irq_no; | ||
| self.registers.cpu_int_enable_reg.set(enable_reg); | ||
| } | ||
|
|
||
| pub fn set_priority(&self, irq: Interrupt, priority: u8) { | ||
| self.registers.priority_reg[(irq.irq_no - 1) as usize] | ||
| .write(PRIORITY_REG::PRIORITY.val(priority as u32)); | ||
| } | ||
|
|
||
| pub fn set_threshold(&self, threshold: u8) { | ||
| self.registers | ||
| .threshold_reg | ||
| .write(THRESHOLD_REG::THRESHOLD.val(threshold as u32)); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| // Copyright (c) 2026 vivo Mobile Communication Co., Ltd. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| #[cfg(target_chip = "esp32c3")] | ||
| pub mod esp32_intc; | ||
|
|
||
| pub struct Interrupt { | ||
| pub(crate) source_no: usize, | ||
| pub(crate) irq_no: usize, | ||
| } | ||
|
|
||
| impl Interrupt { | ||
| pub const fn new(source_no: usize, irq_no: usize) -> Self { | ||
| Self { source_no, irq_no } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.