add rp2040, pico

adds preliminary support (just enough to run blinky1) for the Raspberry Pi Pico board along with the rp2040 mcu.
This commit is contained in:
Rajiv Kanchan
2021-04-09 11:32:49 +05:30
committed by Ron Evans
parent ed2db8a26d
commit 722a3a5c94
16 changed files with 882 additions and 2 deletions
+44
View File
@@ -0,0 +1,44 @@
// +build rp2040
package machine
import (
"device/rp"
_ "unsafe"
)
//go:linkname machineInit runtime.machineInit
func machineInit() {
// Reset all peripherals to put system into a known state,
// except for QSPI pads and the XIP IO bank, as this is fatal if running from flash
// and the PLLs, as this is fatal if clock muxing has not been reset on this boot
// and USB, syscfg, as this disturbs USB-to-SWD on core 1
bits := ^uint32(rp.RESETS_RESET_IO_QSPI |
rp.RESETS_RESET_PADS_QSPI |
rp.RESETS_RESET_PLL_USB |
rp.RESETS_RESET_USBCTRL |
rp.RESETS_RESET_SYSCFG |
rp.RESETS_RESET_PLL_SYS)
resetBlock(bits)
// Remove reset from peripherals which are clocked only by clkSys and
// clkRef. Other peripherals stay in reset until we've configured clocks.
bits = ^uint32(rp.RESETS_RESET_ADC |
rp.RESETS_RESET_RTC |
rp.RESETS_RESET_SPI0 |
rp.RESETS_RESET_SPI1 |
rp.RESETS_RESET_UART0 |
rp.RESETS_RESET_UART1 |
rp.RESETS_RESET_USBCTRL)
unresetBlockWait(bits)
clocks.init()
// Peripheral clocks should now all be running
unresetBlockWait(RESETS_RESET_Msk)
}
//go:linkname ticks runtime.machineTicks
func ticks() uint64 {
return timer.timeElapsed()
}