mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-05 19:43:44 +00:00
all: pretend to be linux/arm in baremetal targets
So far, we've pretended to be js/wasm in baremetal targets to make the
stdlib happy. Unfortunately, this has various problems because
syscall/js (a dependency of many stdlib packages) thinks it can do JS
calls, and emulating them gets quite hard with all changes to the
syscall/js packages in Go 1.12.
This commit does a few things:
* It lets baremetal targets pretend to be linux/arm instead of
js/wasm.
* It lets the loader only select particular packages from the src
overlay, instead of inserting them just before GOROOT. This makes it
possible to pick which packages to overlay for a given target.
* It adds a baremetal-only syscall package that stubs out almost all
syscalls.
This commit is contained in:
committed by
Ron Evans
parent
792274e86f
commit
a2d0f79be3
@@ -1,3 +1,5 @@
|
||||
// +build arm,!avr,!cortexm
|
||||
|
||||
package runtime
|
||||
|
||||
const GOARCH = "arm"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// +build tinygo.arm
|
||||
// +build cortexm
|
||||
|
||||
package runtime
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// +build wasm,!tinygo.arm,!avr
|
||||
// +build wasm
|
||||
|
||||
package runtime
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
// +build js,tinygo.arm avr
|
||||
|
||||
package runtime
|
||||
|
||||
// This file stubs out some external functions declared by the syscall/js
|
||||
// package. They cannot be used on microcontrollers.
|
||||
|
||||
type js_ref uint64
|
||||
|
||||
//go:linkname js_valueGet syscall/js.valueGet
|
||||
func js_valueGet(v js_ref, p string) js_ref {
|
||||
return 0
|
||||
}
|
||||
|
||||
//go:linkname js_valueNew syscall/js.valueNew
|
||||
func js_valueNew(v js_ref, args []js_ref) (js_ref, bool) {
|
||||
return 0, true
|
||||
}
|
||||
|
||||
//go:linkname js_valueCall syscall/js.valueCall
|
||||
func js_valueCall(v js_ref, m string, args []js_ref) (js_ref, bool) {
|
||||
return 0, true
|
||||
}
|
||||
|
||||
//go:linkname js_stringVal syscall/js.stringVal
|
||||
func js_stringVal(x string) js_ref {
|
||||
return 0
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// +build tinygo.arm
|
||||
// +build cortexm
|
||||
|
||||
package runtime
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// +build darwin linux
|
||||
// +build darwin linux,!avr,!cortexm
|
||||
|
||||
package runtime
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// +build wasm,!tinygo.arm,!avr
|
||||
// +build wasm
|
||||
|
||||
package runtime
|
||||
|
||||
|
||||
Reference in New Issue
Block a user