Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
467f48f
kernel: ring buffer: use `MaybeUninit<T>`
bradjc Apr 17, 2026
6c98946
update to MaybeUninit RingBuffer
bradjc Apr 17, 2026
609cf0d
kernel: ring buffer: require T be `Copy`
bradjc Apr 17, 2026
330a191
kernel: ring buffer: use assume_init (no _read)
bradjc Apr 17, 2026
9814145
ring buffer: remove more unsafe
bradjc Apr 17, 2026
6a9f231
kernel: ring buffer: add back Copy to flux
bradjc May 11, 2026
ae8deba
kernel: ring buffer: use .get()
bradjc May 12, 2026
11c6042
kernel: add `init()` to `Chip`
bradjc Dec 2, 2025
00e24ea
chips: impl init() for Chip
bradjc Dec 2, 2025
1f3f871
boards: nrf52840dk: use ChipHw::init()
bradjc Dec 2, 2025
7470bf6
chips: move more init() to Chip::init()
bradjc May 14, 2026
359a5ba
boards: x86: call chip init
bradjc May 14, 2026
7334f73
chip: lpc55s6x: use init fn
bradjc May 14, 2026
0b2715b
chips: apollo3: init: better cast
bradjc May 15, 2026
1183755
arch: riscv: improve lib.rs asm comments
bradjc Apr 24, 2026
7b3b986
arch: riscv: use XLEN in lib.rs
bradjc May 18, 2026
694f668
arch: riscv: add xlen pseudo instructions
bradjc May 18, 2026
7ae71e2
arch: riscv: _start_trap support riscv64
bradjc May 18, 2026
f6d6ce5
arch: riscv: use XLEN_LOG2 to define XLEN.
bradjc May 19, 2026
6431e42
Core working group call notes: May 20, 2026
brghena May 20, 2026
7dd22b9
arch: riscv: use macro to make pseudo instruction
bradjc May 22, 2026
2c808aa
arch: define xlen_macros for doc
bradjc May 22, 2026
523e5a6
arch: riscv: doc semihosting asm
bradjc May 22, 2026
32a0aad
arch: riscv: simplify print_mcause
bradjc May 22, 2026
9287965
arch: riscv: pmp: spelling
bradjc May 22, 2026
4bac26d
arch: riscv: support: work for both rv32 and rv64
bradjc May 22, 2026
47b089f
kernel: process: error: support any Ok type
bradjc May 22, 2026
45a834c
components: console: add Type
bradjc May 22, 2026
871e38a
arch: riscv: thread_id: consistent format
bradjc May 22, 2026
7390806
arch: riscv: format syscall
bradjc May 22, 2026
9f5fd42
arch: riscv: simplify print_mcause further
bradjc May 27, 2026
76bb75b
Add core notes 2026-05-27
hudson-ayers May 28, 2026
eab9aae
hil: time: return Result from Counter::set_overflow_client
stanciugabriel Jun 8, 2026
2acec47
chips: earlgrey: updated set_overflow_client to return Err(ErrorCode:…
stanciugabriel Jun 8, 2026
c08e252
hil: time: extract overflow support into CounterOverflow trait
stanciugabriel Jun 8, 2026
8e79a42
riscv: fix RV64 CSR compilation
sijukurian-web Jun 6, 2026
8e48198
docs: added a new trd file to reflect the new changes
stanciugabriel Jun 9, 2026
05fe447
docs: modified trd105 status as obsolete
stanciugabriel Jun 9, 2026
02aa467
kernel: chip: add more init comments
bradjc Jun 9, 2026
c65a619
chips: apollo3: better init unsafe
bradjc Jun 9, 2026
7db1677
chips: rpi: init: nvic operations are unsafe
bradjc Jun 9, 2026
d2b98c3
Merge pull request #4850 from tock/dev/core-notes-2026-05-20
bradjc Jun 9, 2026
246e029
Merge pull request #4860 from hudson-ayers/core-notes-2026-05-27
bradjc Jun 9, 2026
a8dda69
Merge pull request #4853 from tock/dev/components/console-type
alevy Jun 9, 2026
ef14422
Merge pull request #4852 from tock/dev/kernel-process-error-T
alevy Jun 9, 2026
c3aa4c7
Merge branch 'tock:master' into fix-counter-overflow-hil
stanciugabriel Jun 9, 2026
706d3d6
boards: configuration: add nrf52840dk base board
bradjc May 22, 2026
ba060df
nrf52840dk-test-appid-sha256: use base board
bradjc May 22, 2026
6f51d43
nrf52840dk-test-appid-tbf: use base
bradjc May 22, 2026
66cf93e
nrf52840dk-test-appid-ecdsap256: use base
bradjc May 22, 2026
569d851
nrf52840dk-test-invs: use base
bradjc May 22, 2026
ea48237
Merge pull request #4865 from siju-felsite/riscv-rv64-csr-fix
jrvanwhy Jun 9, 2026
d03389b
Merge pull request #4851 from tock/dev/arch-riscv-updates
alevy Jun 10, 2026
9314bbf
Merge pull request #4854 from tock/dev/boards-config-base
alevy Jun 10, 2026
beb0118
Add deprecated attribute to new CounterOverflow trait
alevy Jun 10, 2026
e0f5b2f
Merge branch 'master' into dev/chip-init
alevy Jun 10, 2026
b8467e7
Merge pull request #4846 from tock/dev/riscv/xlen-instr
jrvanwhy Jun 10, 2026
ffe5160
arch/riscv: implement running_thread_id() for RV64
sijukurian-web Jun 6, 2026
305348d
chip init: revert x86
bradjc Jun 11, 2026
a687002
Merge pull request #4793 from tock/dev/ring-buffer-maybeuninit
alevy Jun 11, 2026
7c72838
Merge pull request #4871 from siju-felsite/riscv-rv64-threadid-fix
bradjc Jun 11, 2026
060f588
Merge pull request #4682 from tock/dev/chip-init
alevy Jun 12, 2026
236be95
Merge pull request #4867 from stanciugabriel/fix-counter-overflow-hil
bradjc Jun 12, 2026
54d4d0f
build(deps): bump pyjwt from 2.12.0 to 2.13.0 in /tools/ci/tockbot
dependabot[bot] Jun 16, 2026
7a45a8d
Merge pull request #4882 from tock/dependabot/pip/tools/ci/tockbot/py…
jrvanwhy Jun 16, 2026
43ce930
Initial dummy kernel compile for nucleo_u545re_q
FarhadGUL06 Mar 27, 2026
c719d01
Working usart sending X and led blink
FarhadGUL06 Mar 29, 2026
6d999ea
Added working debug!
FarhadGUL06 Mar 29, 2026
5535a81
Working tock$
FarhadGUL06 Mar 30, 2026
630dc50
Added led support
FarhadGUL06 Mar 30, 2026
2b2e334
Working app via objcopy
FarhadGUL06 Mar 31, 2026
c09e607
Working refactored usart
FarhadGUL06 Mar 31, 2026
82f981a
Added working usart with arrow
FarhadGUL06 Mar 31, 2026
e4003a0
[Button] Not working
FarhadGUL06 Apr 1, 2026
c0e656c
[Button] Working button, isr 40 -> irq 24
FarhadGUL06 Apr 1, 2026
c8257ae
Solved warnings
FarhadGUL06 Apr 1, 2026
b7691cc
Added DMA only for TX
FarhadGUL06 Apr 2, 2026
799e464
Tried RX DMA USART
FarhadGUL06 Apr 3, 2026
de55a44
Reverted to fifo rx
FarhadGUL06 Apr 3, 2026
09e00a3
Changed name from generic_init to init in lib
FarhadGUL06 Apr 6, 2026
4d98b39
Added copyright
FarhadGUL06 Apr 6, 2026
efff415
Added IPC
FarhadGUL06 Apr 6, 2026
3ea7b18
Solved warnings
FarhadGUL06 Apr 6, 2026
e053b70
Removed autogenerated dma
FarhadGUL06 Apr 6, 2026
4ac7355
Removed old files
FarhadGUL06 Apr 6, 2026
4a79ab4
Modified one comment
FarhadGUL06 Apr 6, 2026
a745f12
Formatted with cargo fmt
FarhadGUL06 Apr 6, 2026
650a18e
Delete boards/nucleo_u545re_q/STM32U545.svd
FarhadGUL06 Apr 6, 2026
42959f6
Removed jlink file
FarhadGUL06 Apr 7, 2026
f61f5b2
Removed 'a from dma
FarhadGUL06 Apr 7, 2026
77650d5
Solved prepush errors
FarhadGUL06 Apr 7, 2026
7e6f01e
Added README for board and chips nucleo_u545re_q
FarhadGUL06 Apr 7, 2026
ffa97ef
stm32f4xx: revert accidental change
FarhadGUL06 Apr 9, 2026
6f26084
nucleo_u545re_q/main.rs: Removed ipc
FarhadGUL06 Apr 9, 2026
e3d651a
usart: for io.rs, make sure usart is configured before panic
FarhadGUL06 Apr 9, 2026
56c3a54
usart: solved typo - unused
FarhadGUL06 Apr 9, 2026
f5a41ca
chips: replaced numbers with const
FarhadGUL06 Apr 9, 2026
9d4031b
exti: Used enum LineId
FarhadGUL06 Apr 9, 2026
4a0ebe6
gpio: documented deactivate_to_low_power
FarhadGUL06 Apr 9, 2026
a9bd704
gpio: documented self.exti.set_secure
FarhadGUL06 Apr 9, 2026
207be8c
gpio: implemented module to prevent other types in other crates from …
FarhadGUL06 Apr 9, 2026
c592c0b
tim: Added enable_clock as parameter
FarhadGUL06 Apr 9, 2026
20a2cbb
tim: Modified set_alarm to disarm and flag clear before re-arming
FarhadGUL06 Apr 9, 2026
855e449
usart: added comments
FarhadGUL06 Apr 9, 2026
ea69acb
tim: fixed prescaler issue
FarhadGUL06 Apr 9, 2026
7906750
tim: documented public API
FarhadGUL06 Apr 9, 2026
a5e4e0b
usart: explained the use of DeferredCall
FarhadGUL06 Apr 9, 2026
d3392fd
usart: documented public api
FarhadGUL06 Apr 9, 2026
6cac99b
exti: documented
FarhadGUL06 Apr 9, 2026
3659e97
main: moved init to lib.rs
FarhadGUL06 Apr 9, 2026
74a4174
main: Created init function for dma, usart, exti in their file
FarhadGUL06 Apr 9, 2026
0fb540b
main: added start to call kernel_loop
FarhadGUL06 Apr 9, 2026
705e853
main: change button to use button_component_helper
FarhadGUL06 Apr 9, 2026
143b950
main: Moved irq enable to each file
FarhadGUL06 Apr 9, 2026
8962104
Makefile: Changed APP_PATH to an environment variable
FarhadGUL06 Apr 9, 2026
1267778
Makefile: Added note for objcopy
FarhadGUL06 Apr 9, 2026
87fc8a6
README: Explained what Makefile targets do
FarhadGUL06 Apr 9, 2026
95aad56
Solved make prepush errors
FarhadGUL06 Apr 9, 2026
00dd898
boards: nucleo_u545re_q: add OpenOCD flashing targets and documentation
FarhadGUL06 Apr 15, 2026
1e4ce45
usart: removed 2.
FarhadGUL06 Apr 17, 2026
0b00d70
lib: added reference for maskable interrupt channels
FarhadGUL06 Apr 17, 2026
76fb08f
nvic: moved interrupts
FarhadGUL06 Apr 17, 2026
2c85f67
usart: removed software fifo
FarhadGUL06 Apr 17, 2026
ed69f22
tim: fixed wrong irq activation
FarhadGUL06 Apr 17, 2026
59e50ea
usart, gpio: Removed hardcoded irq
FarhadGUL06 Apr 17, 2026
c20ed77
main: Removed deferred
FarhadGUL06 Apr 17, 2026
a1f59b8
usart: Changed to DMA rx
FarhadGUL06 Apr 17, 2026
d4c4128
usart: Documented
FarhadGUL06 Apr 17, 2026
e2b0fe2
usart: checked if dma is configured
FarhadGUL06 Apr 17, 2026
0ad1e08
main: Modified start and main
FarhadGUL06 Apr 17, 2026
5a0f980
Fixed make prepush errors
FarhadGUL06 Apr 17, 2026
fab8afb
main: changed kernel_loop call
FarhadGUL06 Apr 17, 2026
8f125a0
nvic: removed non_upper_case_globals
FarhadGUL06 Apr 20, 2026
d4aa1c7
nvic: Added all interrupts
FarhadGUL06 Apr 20, 2026
ad8c675
layout: combined
FarhadGUL06 Apr 20, 2026
ffbb03c
gpio: used let else
FarhadGUL06 Apr 20, 2026
20b763f
gpio: removed debug message
FarhadGUL06 Apr 20, 2026
087640c
gpio: gpioport
FarhadGUL06 Apr 20, 2026
e6957f9
lib: Added addresses for base vectors
FarhadGUL06 Apr 20, 2026
701d28f
Saved make prepush errors
FarhadGUL06 Apr 20, 2026
114cd02
layout: Moved linker symbols to main.rs
FarhadGUL06 Apr 21, 2026
8dfccf1
lib: Changed to use StaticRef as const
FarhadGUL06 Apr 21, 2026
80bc14e
usart: Added error on receive_abort
FarhadGUL06 Apr 21, 2026
17376f3
usart: Added ErrorCode off for _abort
FarhadGUL06 Apr 21, 2026
0b165b0
Solved make prepush errors
FarhadGUL06 Apr 21, 2026
37b98b1
chips: Removed unnecessary enable nvic
FarhadGUL06 Apr 26, 2026
85d7604
gpio: Changed from unsafe conversion to from_u8
FarhadGUL06 Apr 26, 2026
821e6ca
main: moved static_init from dma, usart, exti to the main
FarhadGUL06 Apr 26, 2026
f0d6b47
Cargo: removed unused feature
FarhadGUL06 Apr 26, 2026
e9692ef
Cargo: Removed feature debug_load_processes
FarhadGUL06 Apr 26, 2026
19d4d63
gpio: removed from_u8
FarhadGUL06 Apr 27, 2026
5fc9c86
Makefile: removed manual stripping steps
FarhadGUL06 Apr 27, 2026
3de2283
Makefile: Made it similar to other boards
FarhadGUL06 Apr 27, 2026
63f2df9
Layout: Removed unnecessary section
FarhadGUL06 Apr 27, 2026
541a215
README: Documented new Makefile
FarhadGUL06 Apr 27, 2026
0d9bb8f
Fix CI errors by updating to latest kernel APIs
FarhadGUL06 Apr 27, 2026
34475da
dma: Added request channel and release channel
FarhadGUL06 May 5, 2026
cdac15d
dma: handled all channels irq
FarhadGUL06 May 5, 2026
530ec00
dma: added register_bitflields and usart base address
FarhadGUL06 May 6, 2026
007dec9
dma: changed match_channel to use channel.into
FarhadGUL06 May 6, 2026
9c9d021
dma: changed to setup based on direction
FarhadGUL06 May 6, 2026
4012cae
exti: Changed to use tock-registers
FarhadGUL06 May 7, 2026
c7dbe13
gpio: Changed to use tock-registers
FarhadGUL06 May 7, 2026
29d2318
rcc: Changed to use tock-registers
FarhadGUL06 May 7, 2026
ab081fa
tim: Changed to use tock-registers
FarhadGUL06 May 7, 2026
2061ea5
usart: Changed to use tock-registers
FarhadGUL06 May 7, 2026
3dddadc
usart: modified one line to use tock-register
FarhadGUL06 May 7, 2026
8f3b691
dma: added more tock-registers
FarhadGUL06 May 7, 2026
2a19122
cargo: removed enum_primitive
FarhadGUL06 May 10, 2026
3e7d4bc
Combined Stm32u5xxPeripherals and Stm32u5xxDefaultPeripherals
FarhadGUL06 May 10, 2026
d1578c2
chips: added init function
FarhadGUL06 May 10, 2026
abca0cf
io: changed to PanicWriter
FarhadGUL06 May 10, 2026
5cf7367
usart: added dmaslice
FarhadGUL06 May 10, 2026
ae819ef
Removed Writer and usart conf
FarhadGUL06 May 11, 2026
386cee4
dma: Removed match_channel function
FarhadGUL06 Jun 3, 2026
2a22f81
exti: added if check for line_num
FarhadGUL06 Jun 3, 2026
b78da11
usart: changed ok and busy on abort
FarhadGUL06 Jun 8, 2026
002ff7c
usart: changed to use deferred call
FarhadGUL06 Jun 8, 2026
2ea89e6
dma: added comment for channelid
FarhadGUL06 Jun 9, 2026
42328cd
chips: stm32u5xx: Implement required Chip::init()
FarhadGUL06 Jun 18, 2026
9958f01
lib: removed init
FarhadGUL06 Jun 18, 2026
770d7e5
main.rs: added init call
FarhadGUL06 Jun 19, 2026
a31a6fa
Makefile: Changed from openocd to probe-rs for better stability
FarhadGUL06 Jun 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,7 @@ dependencies = [
"ecdsa-sw",
"kernel",
"nrf52840",
"nrf52840dk-test-base",
"nrf52_components",
"segger",
"tock-tbf",
Expand All @@ -943,6 +944,7 @@ dependencies = [
"cortexm4",
"kernel",
"nrf52840",
"nrf52840dk-test-base",
"nrf52_components",
"segger",
"tock_build_scripts",
Expand All @@ -959,11 +961,27 @@ dependencies = [
"cortexm4",
"kernel",
"nrf52840",
"nrf52840dk-test-base",
"nrf52_components",
"segger",
"tock_build_scripts",
]

[[package]]
name = "nrf52840dk-test-base"
version = "0.2.3-dev"
dependencies = [
"capsules-core",
"capsules-extra",
"capsules-system",
"components",
"cortexm4",
"kernel",
"nrf52840",
"nrf52_components",
"segger",
]

[[package]]
name = "nrf52840dk-test-dynamic-app-load"
version = "0.2.3-dev"
Expand Down Expand Up @@ -991,6 +1009,7 @@ dependencies = [
"cortexm4",
"kernel",
"nrf52840",
"nrf52840dk-test-base",
"nrf52_components",
"segger",
"tock_build_scripts",
Expand Down Expand Up @@ -1093,6 +1112,20 @@ dependencies = [
"tock_build_scripts",
]

[[package]]
name = "nucleo_u545re_q"
version = "0.2.3-dev"
dependencies = [
"capsules-core",
"capsules-extra",
"capsules-system",
"components",
"cortexm33",
"kernel",
"stm32u545",
"tock_build_scripts",
]

[[package]]
name = "opaque-debug"
version = "0.3.1"
Expand Down Expand Up @@ -1582,6 +1615,23 @@ dependencies = [
"kernel",
]

[[package]]
name = "stm32u545"
version = "0.2.3-dev"
dependencies = [
"cortexm33",
"kernel",
"stm32u5xx",
]

[[package]]
name = "stm32u5xx"
version = "0.2.3-dev"
dependencies = [
"cortexm33",
"kernel",
]

[[package]]
name = "stm32wle5jc"
version = "0.2.3-dev"
Expand Down
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ members = [
"boards/sma_q3",
"boards/nucleo_f429zi",
"boards/nucleo_f446re",
"boards/nucleo_u545re_q",
"boards/particle_boron",
"boards/pico_explorer_base",
"boards/raspberry_pi_pico",
Expand All @@ -61,6 +62,7 @@ members = [
"boards/configurations/nrf52840dk/nrf52840dk-test-appid-ecdsap256",
"boards/configurations/nrf52840dk/nrf52840dk-test-appid-sha256",
"boards/configurations/nrf52840dk/nrf52840dk-test-appid-tbf",
"boards/configurations/nrf52840dk/nrf52840dk-test-base",
"boards/configurations/nrf52840dk/nrf52840dk-test-invs",
"boards/configurations/nrf52840dk/nrf52840dk-test-kernel",
"boards/configurations/nrf52840dk/nrf52840dk-test-dynamic-app-load",
Expand Down Expand Up @@ -109,6 +111,8 @@ members = [
"chips/stm32f429zi",
"chips/stm32f446re",
"chips/stm32f412g",
"chips/stm32u545",
"chips/stm32u5xx",
"chips/stm32f4xx",
"chips/veer_el2",
"chips/stm32wle5xx",
Expand Down
1 change: 1 addition & 0 deletions arch/cortex-m33/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub mod mpu {
}
}

pub use cortexm::dma_fence;
pub use cortexm::initialize_ram_jump_to_main;
pub use cortexm::interrupt_mask;
pub use cortexm::nvic;
Expand Down
36 changes: 22 additions & 14 deletions arch/riscv/src/csr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@
//! Tock Register interface for using CSR registers.

use riscv_csr::csr::{
ReadWriteRiscvCsr, MCAUSE, MCYCLE, MCYCLEH, MEPC, MIE, MINSTRET, MINSTRETH, MIP, MSCRATCH,
MSECCFG, MSECCFGH, MSTATUS, MTVAL, MTVEC, PMPADDR0, PMPADDR1, PMPADDR10, PMPADDR11, PMPADDR12,
PMPADDR13, PMPADDR14, PMPADDR15, PMPADDR16, PMPADDR17, PMPADDR18, PMPADDR19, PMPADDR2,
PMPADDR20, PMPADDR21, PMPADDR22, PMPADDR23, PMPADDR24, PMPADDR25, PMPADDR26, PMPADDR27,
PMPADDR28, PMPADDR29, PMPADDR3, PMPADDR30, PMPADDR31, PMPADDR32, PMPADDR33, PMPADDR34,
PMPADDR35, PMPADDR36, PMPADDR37, PMPADDR38, PMPADDR39, PMPADDR4, PMPADDR40, PMPADDR41,
PMPADDR42, PMPADDR43, PMPADDR44, PMPADDR45, PMPADDR46, PMPADDR47, PMPADDR48, PMPADDR49,
PMPADDR5, PMPADDR50, PMPADDR51, PMPADDR52, PMPADDR53, PMPADDR54, PMPADDR55, PMPADDR56,
PMPADDR57, PMPADDR58, PMPADDR59, PMPADDR6, PMPADDR60, PMPADDR61, PMPADDR62, PMPADDR63,
PMPADDR7, PMPADDR8, PMPADDR9, PMPCFG0, PMPCFG1, PMPCFG10, PMPCFG11, PMPCFG12, PMPCFG13,
PMPCFG14, PMPCFG15, PMPCFG2, PMPCFG3, PMPCFG4, PMPCFG5, PMPCFG6, PMPCFG7, PMPCFG8, PMPCFG9,
STVEC, UTVEC,
ReadWriteRiscvCsr, MCAUSE, MCYCLE, MEPC, MIE, MINSTRET, MIP, MSCRATCH, MSECCFG, MSTATUS, MTVAL,
MTVEC, PMPADDR0, PMPADDR1, PMPADDR10, PMPADDR11, PMPADDR12, PMPADDR13, PMPADDR14, PMPADDR15,
PMPADDR16, PMPADDR17, PMPADDR18, PMPADDR19, PMPADDR2, PMPADDR20, PMPADDR21, PMPADDR22,
PMPADDR23, PMPADDR24, PMPADDR25, PMPADDR26, PMPADDR27, PMPADDR28, PMPADDR29, PMPADDR3,
PMPADDR30, PMPADDR31, PMPADDR32, PMPADDR33, PMPADDR34, PMPADDR35, PMPADDR36, PMPADDR37,
PMPADDR38, PMPADDR39, PMPADDR4, PMPADDR40, PMPADDR41, PMPADDR42, PMPADDR43, PMPADDR44,
PMPADDR45, PMPADDR46, PMPADDR47, PMPADDR48, PMPADDR49, PMPADDR5, PMPADDR50, PMPADDR51,
PMPADDR52, PMPADDR53, PMPADDR54, PMPADDR55, PMPADDR56, PMPADDR57, PMPADDR58, PMPADDR59,
PMPADDR6, PMPADDR60, PMPADDR61, PMPADDR62, PMPADDR63, PMPADDR7, PMPADDR8, PMPADDR9, PMPCFG0,
PMPCFG10, PMPCFG12, PMPCFG14, PMPCFG2, PMPCFG4, PMPCFG6, PMPCFG8, STVEC, UTVEC,
};
#[cfg(not(target_arch = "riscv64"))]
use riscv_csr::csr::{
MCYCLEH, MINSTRETH, MSECCFGH, PMPCFG1, PMPCFG11, PMPCFG13, PMPCFG15, PMPCFG3, PMPCFG5, PMPCFG7,
PMPCFG9,
};
use tock_registers::fields::FieldValue;
use tock_registers::interfaces::{ReadWriteable, Readable, Writeable};
Expand Down Expand Up @@ -51,7 +54,10 @@ pub struct CSR {
pub mcycleh: ReadWriteRiscvCsr<usize, mcycle::mcycleh::Register, MCYCLEH>,
pub mcycle: ReadWriteRiscvCsr<usize, mcycle::mcycle::Register, MCYCLE>,

#[cfg(not(target_arch = "riscv64"))]
// `pmpcfg0` exists on both RV32 and RV64. On RV64 each `pmpcfgN` is XLEN-wide
// and holds 8 entries, so only the even-indexed registers (pmpcfg0, 2, 4, …,
// 14) are valid; the odd-indexed ones below are RV32-only. `pmpcfg0` is the
// first of those even-indexed registers and must always be present.
pub pmpcfg0: ReadWriteRiscvCsr<usize, pmpconfig::pmpcfg::Register, PMPCFG0>,
#[cfg(not(target_arch = "riscv64"))]
pub pmpcfg1: ReadWriteRiscvCsr<usize, pmpconfig::pmpcfg::Register, PMPCFG1>,
Expand Down Expand Up @@ -313,7 +319,9 @@ impl CSR {
// reads the cycle counter
#[cfg(target_arch = "riscv64")]
pub fn read_cycle_counter(&self) -> u64 {
CSR.mcycle.read(mcycle::mcycle::mcycle)
// On RV64 `mcycle` is a single 64-bit CSR; `read` returns `usize`, which
// is `u64` here but still needs an explicit cast to the return type.
CSR.mcycle.read(mcycle::mcycle::mcycle) as u64
}

pub fn pmpconfig_get(&self, index: usize) -> usize {
Expand Down
Loading
Loading