From 54169c714fb9e9142fed5e7a70897ff466f31d28 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Wed, 31 Jul 2019 20:32:18 +0200 Subject: [PATCH] all: use baremetal build tag This simplifies adding more baremetal targets, like a GameBoy Advance, or baremetal x86 for unikernels. --- compiler/compiler.go | 2 +- compiler/gc.go | 2 +- src/machine/i2c.go | 2 +- src/machine/machine_generic.go | 2 +- src/machine/spi.go | 2 +- src/os/file_other.go | 2 +- src/os/file_unix.go | 2 +- src/runtime/arch_arm.go | 2 +- src/runtime/baremetal.go | 2 +- src/runtime/gc_globals_conservative.go | 2 +- src/runtime/gc_globals_precise.go | 2 +- src/runtime/gc_stack_portable.go | 2 +- src/runtime/gc_stack_raw.go | 2 +- src/runtime/runtime_unix.go | 2 +- src/syscall/syscall_baremetal.go | 2 +- src/syscall/tables_baremetal.go | 2 +- targets/avr.json | 2 +- targets/cortex-m.json | 2 +- targets/riscv.json | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/compiler/compiler.go b/compiler/compiler.go index c68a4010..c12aec89 100644 --- a/compiler/compiler.go +++ b/compiler/compiler.go @@ -226,7 +226,7 @@ func (c *Compiler) Compile(mainPath string) []error { return path } else if path == "syscall" { for _, tag := range c.BuildTags { - if tag == "avr" || tag == "cortexm" || tag == "darwin" || tag == "riscv" { + if tag == "baremetal" || tag == "darwin" { return path } } diff --git a/compiler/gc.go b/compiler/gc.go index e6b19614..d9679efc 100644 --- a/compiler/gc.go +++ b/compiler/gc.go @@ -18,7 +18,7 @@ func (c *Compiler) needsStackObjects() bool { return false } for _, tag := range c.BuildTags { - if tag == "cortexm" || tag == "tinygo.riscv" { + if tag == "baremetal" { return false } } diff --git a/src/machine/i2c.go b/src/machine/i2c.go index 4fe7b816..7270d918 100644 --- a/src/machine/i2c.go +++ b/src/machine/i2c.go @@ -1,4 +1,4 @@ -// +build !stm32f4disco,!hifive1b +// +build avr nrf sam stm32,!stm32f4disco package machine diff --git a/src/machine/machine_generic.go b/src/machine/machine_generic.go index 7bfc5d2e..f20fd4b9 100644 --- a/src/machine/machine_generic.go +++ b/src/machine/machine_generic.go @@ -1,4 +1,4 @@ -// +build !avr,!nrf,!sam,!sifive,!stm32 +// +build !baremetal package machine diff --git a/src/machine/spi.go b/src/machine/spi.go index f79c8a24..b913f200 100644 --- a/src/machine/spi.go +++ b/src/machine/spi.go @@ -1,4 +1,4 @@ -// +build !stm32f407,!avr,!hifive1b +// +build nrf sam stm32,!stm32f407 package machine diff --git a/src/os/file_other.go b/src/os/file_other.go index 8d168ebc..50bfa226 100644 --- a/src/os/file_other.go +++ b/src/os/file_other.go @@ -1,4 +1,4 @@ -// +build avr cortexm tinygo.riscv wasm +// +build baremetal wasm package os diff --git a/src/os/file_unix.go b/src/os/file_unix.go index d881f62f..b4aaa772 100644 --- a/src/os/file_unix.go +++ b/src/os/file_unix.go @@ -1,4 +1,4 @@ -// +build darwin linux,!avr,!cortexm,!tinygo.riscv +// +build darwin linux,!baremetal package os diff --git a/src/runtime/arch_arm.go b/src/runtime/arch_arm.go index 6f75323b..a84ccfda 100644 --- a/src/runtime/arch_arm.go +++ b/src/runtime/arch_arm.go @@ -1,4 +1,4 @@ -// +build arm,!avr,!cortexm,!tinygo.riscv +// +build arm,!baremetal package runtime diff --git a/src/runtime/baremetal.go b/src/runtime/baremetal.go index 90c15628..b5acdfec 100644 --- a/src/runtime/baremetal.go +++ b/src/runtime/baremetal.go @@ -1,4 +1,4 @@ -// +build avr cortexm tinygo.riscv +// +build baremetal package runtime diff --git a/src/runtime/gc_globals_conservative.go b/src/runtime/gc_globals_conservative.go index a09d01ae..b4882d6e 100644 --- a/src/runtime/gc_globals_conservative.go +++ b/src/runtime/gc_globals_conservative.go @@ -1,5 +1,5 @@ // +build gc.conservative -// +build cortexm tinygo.riscv +// +build baremetal package runtime diff --git a/src/runtime/gc_globals_precise.go b/src/runtime/gc_globals_precise.go index 464c8e03..79659b78 100644 --- a/src/runtime/gc_globals_precise.go +++ b/src/runtime/gc_globals_precise.go @@ -1,5 +1,5 @@ // +build gc.conservative -// +build !cortexm,!tinygo.riscv +// +build !baremetal package runtime diff --git a/src/runtime/gc_stack_portable.go b/src/runtime/gc_stack_portable.go index 1f1847c3..b1840bc2 100644 --- a/src/runtime/gc_stack_portable.go +++ b/src/runtime/gc_stack_portable.go @@ -1,5 +1,5 @@ // +build gc.conservative -// +build !cortexm,!tinygo.riscv +// +build !baremetal package runtime diff --git a/src/runtime/gc_stack_raw.go b/src/runtime/gc_stack_raw.go index 0c37af60..62fff6b1 100644 --- a/src/runtime/gc_stack_raw.go +++ b/src/runtime/gc_stack_raw.go @@ -1,5 +1,5 @@ // +build gc.conservative -// +build cortexm tinygo.riscv +// +build baremetal package runtime diff --git a/src/runtime/runtime_unix.go b/src/runtime/runtime_unix.go index 61572ba7..47c7316e 100644 --- a/src/runtime/runtime_unix.go +++ b/src/runtime/runtime_unix.go @@ -1,4 +1,4 @@ -// +build darwin linux,!avr,!cortexm,!tinygo.riscv +// +build darwin linux,!baremetal package runtime diff --git a/src/syscall/syscall_baremetal.go b/src/syscall/syscall_baremetal.go index fe17fcab..28fa39ba 100644 --- a/src/syscall/syscall_baremetal.go +++ b/src/syscall/syscall_baremetal.go @@ -1,4 +1,4 @@ -// +build avr cortexm +// +build baremetal package syscall diff --git a/src/syscall/tables_baremetal.go b/src/syscall/tables_baremetal.go index c10799c0..c081feac 100644 --- a/src/syscall/tables_baremetal.go +++ b/src/syscall/tables_baremetal.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build avr cortexm +// +build baremetal package syscall diff --git a/targets/avr.json b/targets/avr.json index a7a3773f..474790a0 100644 --- a/targets/avr.json +++ b/targets/avr.json @@ -1,5 +1,5 @@ { - "build-tags": ["avr", "linux", "arm"], + "build-tags": ["avr", "baremetal", "linux", "arm"], "goos": "linux", "goarch": "arm", "compiler": "avr-gcc", diff --git a/targets/cortex-m.json b/targets/cortex-m.json index 7fb1b028..e8588e81 100644 --- a/targets/cortex-m.json +++ b/targets/cortex-m.json @@ -1,5 +1,5 @@ { - "build-tags": ["cortexm", "linux", "arm"], + "build-tags": ["cortexm", "baremetal", "linux", "arm"], "goos": "linux", "goarch": "arm", "compiler": "clang", diff --git a/targets/riscv.json b/targets/riscv.json index 581c5e8c..33475eb2 100644 --- a/targets/riscv.json +++ b/targets/riscv.json @@ -2,7 +2,7 @@ "llvm-target": "riscv32--none", "goos": "linux", "goarch": "arm", - "build-tags": ["tinygo.riscv", "linux", "arm"], + "build-tags": ["tinygo.riscv", "baremetal", "linux", "arm"], "gc": "conservative", "compiler": "riscv64-unknown-elf-gcc", "linker": "riscv64-unknown-elf-ld",