mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 19:17:47 +00:00
ffa38b183b
This page has been a big help in adding support for this new chip: https://wiki.osdev.org/HiFive-1_Bare_Bones
20 lines
343 B
Go
20 lines
343 B
Go
// +build tinygo.riscv
|
|
|
|
package runtime
|
|
|
|
import "device/riscv"
|
|
|
|
const GOARCH = "arm" // riscv pretends to be arm
|
|
|
|
// The bitness of the CPU (e.g. 8, 32, 64).
|
|
const TargetBits = 32
|
|
|
|
// Align on word boundary.
|
|
func align(ptr uintptr) uintptr {
|
|
return (ptr + 3) &^ 3
|
|
}
|
|
|
|
func getCurrentStackPointer() uintptr {
|
|
return riscv.ReadRegister("sp")
|
|
}
|