Skip to content

Commit 6f4a9d4

Browse files
bors[bot]khrs
andauthored
Merge #58
58: Add hook to initialize custom interrupt controllers. r=Disasm a=khrs Co-authored-by: Karol Harasim <[email protected]>
2 parents 8ec323b + 4f09eda commit 6f4a9d4

12 files changed

+23
-8
lines changed

riscv-rt/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Add support to initialize custom interrupt controllers.
13+
1014
## [v0.7.0] - 2020-03-10
1115

1216
### Added

riscv-rt/asm.S

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,10 @@ _abs_start:
113113
// Set frame pointer
114114
add s0, sp, zero
115115

116-
// Set trap handler
117-
la t0, _start_trap
118-
csrw mtvec, t0
119-
120116
jal zero, _start_rust
121117

122118
.cfi_endproc
123119

124-
125120
/*
126121
Trap entry point (_start_trap)
127122
@@ -130,6 +125,8 @@ _abs_start:
130125
*/
131126
.section .trap, "ax"
132127
.global _start_trap
128+
/* Make it .weak so PAC/HAL can provide their own if needed. */
129+
.weak _start_trap
133130

134131
_start_trap:
135132
addi sp, sp, -16*REGBYTES
@@ -174,9 +171,16 @@ _start_trap:
174171
addi sp, sp, 16*REGBYTES
175172
mret
176173

174+
.section .text
175+
.global default_setup_interrupts
176+
177+
default_setup_interrupts:
178+
// Set trap handler
179+
la t0, _start_trap
180+
csrw mtvec, t0
181+
ret
177182

178183
/* Make sure there is an abort when linking */
179-
.section .text
180184
.globl abort
181185
abort:
182186
j abort
116 Bytes
Binary file not shown.
116 Bytes
Binary file not shown.
116 Bytes
Binary file not shown.
116 Bytes
Binary file not shown.
164 Bytes
Binary file not shown.
164 Bytes
Binary file not shown.
148 Bytes
Binary file not shown.
148 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)