mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-21 04:49:04 +00:00
runtime/fe310: do peripheral initialization in an explicit call
This avoids some issues with interp in the next commit.
This commit is contained in:
committed by
Ron Evans
parent
46ccb6793e
commit
a9174d9184
@@ -46,6 +46,7 @@ func main() {
|
|||||||
riscv.MSTATUS.SetBits(1 << 3) // MIE
|
riscv.MSTATUS.SetBits(1 << 3) // MIE
|
||||||
|
|
||||||
preinit()
|
preinit()
|
||||||
|
initPeripherals()
|
||||||
initAll()
|
initAll()
|
||||||
callMain()
|
callMain()
|
||||||
abort()
|
abort()
|
||||||
@@ -76,12 +77,8 @@ func handleInterrupt() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
// initPeripherals configures periperhals the way the runtime expects them.
|
||||||
pric_init()
|
func initPeripherals() {
|
||||||
machine.UART0.Configure(machine.UARTConfig{})
|
|
||||||
}
|
|
||||||
|
|
||||||
func pric_init() {
|
|
||||||
// Make sure the HFROSC is on
|
// Make sure the HFROSC is on
|
||||||
sifive.PRCI.HFROSCCFG.SetBits(sifive.PRCI_HFROSCCFG_ENABLE)
|
sifive.PRCI.HFROSCCFG.SetBits(sifive.PRCI_HFROSCCFG_ENABLE)
|
||||||
|
|
||||||
@@ -94,6 +91,9 @@ func pric_init() {
|
|||||||
|
|
||||||
// Enable the RTC.
|
// Enable the RTC.
|
||||||
sifive.RTC.RTCCFG.Set(sifive.RTC_RTCCFG_ENALWAYS)
|
sifive.RTC.RTCCFG.Set(sifive.RTC_RTCCFG_ENALWAYS)
|
||||||
|
|
||||||
|
// Configure the UART.
|
||||||
|
machine.UART0.Configure(machine.UARTConfig{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func preinit() {
|
func preinit() {
|
||||||
|
|||||||
Reference in New Issue
Block a user