mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 19:17:47 +00:00
all: make TinyGo code usable with "big Go" CGo
I managed to get CGo sort-of working in VSCode (meaning that it will typecheck code in the IDE itself) using a few crude hacks, but it requires a few minor changes to the TinyGo standard library. I intend to eventually add this support in the TinyGo extension for VSCode directly, but for now I've manually updated .vscode/settings.json to get IDE support. In any case, it would be nice to have this for when I hopefully add this to the TinyGo extension eventually.
This commit is contained in:
committed by
Ron Evans
parent
36d60b8349
commit
7486277012
@@ -1,3 +1,5 @@
|
||||
//go:build tinygo
|
||||
|
||||
// Only generate .debug_frame, don't generate .eh_frame.
|
||||
.cfi_sections .debug_frame
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//go:build tinygo
|
||||
|
||||
.section .bss.tinygo_systemStack
|
||||
.global tinygo_systemStack
|
||||
.type tinygo_systemStack, %object
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//go:build tinygo
|
||||
|
||||
// Only generate .debug_frame, don't generate .eh_frame.
|
||||
.cfi_sections .debug_frame
|
||||
|
||||
|
||||
@@ -52,17 +52,17 @@ func (s *state) archInit(r *calleeSavedRegs, fn uintptr, args unsafe.Pointer) {
|
||||
}
|
||||
|
||||
func (s *state) resume() {
|
||||
switchToTask(s.sp)
|
||||
tinygo_switchToTask(s.sp)
|
||||
}
|
||||
|
||||
//export tinygo_switchToTask
|
||||
func switchToTask(uintptr)
|
||||
func tinygo_switchToTask(uintptr)
|
||||
|
||||
//export tinygo_switchToScheduler
|
||||
func switchToScheduler(*uintptr)
|
||||
func tinygo_switchToScheduler(*uintptr)
|
||||
|
||||
func (s *state) pause() {
|
||||
switchToScheduler(&s.sp)
|
||||
tinygo_switchToScheduler(&s.sp)
|
||||
}
|
||||
|
||||
// SystemStack returns the system stack pointer. On Cortex-M, it is always
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//go:build tinygo
|
||||
|
||||
.section .text.tinygo_startTask,"ax",@progbits
|
||||
.global tinygo_startTask
|
||||
.type tinygo_startTask, %function
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//go:build tinygo
|
||||
|
||||
.section .text.tinygo_startTask,"ax",@progbits
|
||||
.global tinygo_startTask
|
||||
.type tinygo_startTask, %function
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//go:build tinygo
|
||||
|
||||
.section .text.tinygo_startTask
|
||||
.global tinygo_startTask
|
||||
.type tinygo_startTask, %function
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//go:build rp2040
|
||||
//go:build tinygo && rp2040
|
||||
|
||||
package machine
|
||||
|
||||
|
||||
Reference in New Issue
Block a user