File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ func main() {
46
46
riscv .MSTATUS .SetBits (1 << 3 ) // MIE
47
47
48
48
preinit ()
49
+ initPeripherals ()
49
50
initAll ()
50
51
callMain ()
51
52
abort ()
@@ -76,12 +77,8 @@ func handleInterrupt() {
76
77
}
77
78
}
78
79
79
- func init () {
80
- pric_init ()
81
- machine .UART0 .Configure (machine.UARTConfig {})
82
- }
83
-
84
- func pric_init () {
80
+ // initPeripherals configures periperhals the way the runtime expects them.
81
+ func initPeripherals () {
85
82
// Make sure the HFROSC is on
86
83
sifive .PRCI .HFROSCCFG .SetBits (sifive .PRCI_HFROSCCFG_ENABLE )
87
84
@@ -94,6 +91,9 @@ func pric_init() {
94
91
95
92
// Enable the RTC.
96
93
sifive .RTC .RTCCFG .Set (sifive .RTC_RTCCFG_ENALWAYS )
94
+
95
+ // Configure the UART.
96
+ machine .UART0 .Configure (machine.UARTConfig {})
97
97
}
98
98
99
99
func preinit () {
You can’t perform that action at this time.
0 commit comments