mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-27 15:18:41 +00:00
Compare commits
6 Commits
machinecheck
...
v0.26.0
| Author | SHA1 | Date | |
|---|---|---|---|
| b5ad81c884 | |||
| c2fb1e776a | |||
| 895c542076 | |||
| e91fae5756 | |||
| f52ecf3054 | |||
| 725864d8dc |
@@ -1,3 +1,87 @@
|
||||
0.26.0
|
||||
---
|
||||
|
||||
* **general**
|
||||
- remove support for LLVM 13
|
||||
- remove calls to deprecated ioutil package
|
||||
- move from `os.IsFoo` to `errors.Is(err, ErrFoo)`
|
||||
- fix for builds using an Android host
|
||||
- make interp timeout configurable from command line
|
||||
- ignore ports with VID/PID if there is no candidates
|
||||
- drop support for Go 1.16 and Go 1.17
|
||||
- update serial package to v1.3.5 for latest bugfixes
|
||||
- remove GOARM from `tinygo info`
|
||||
- add flag for setting the goroutine stack size
|
||||
- add serial port monitoring functionality
|
||||
* **compiler**
|
||||
- `cgo`: implement support for static functions
|
||||
- `cgo`: fix panic when FuncType.Results is nil
|
||||
- `compiler`: add aliases for `edwards25519/field.feMul` and `field.feSquare`
|
||||
- `compiler`: fix incorrect DWARF type in some generic parameters
|
||||
- `compiler`: use LLVM math builtins everywhere
|
||||
- `compiler`: replace some math operation bodies with LLVM intrinsics
|
||||
- `compiler`: replace math aliases with intrinsics
|
||||
- `compiler`: fix `unsafe.Sizeof` for chan and map values
|
||||
- `compileopts`: use tags parser from buildutil
|
||||
- `compileopts`: use backticks for regexp to avoid extra escapes
|
||||
- `compileopts`: fail fast on duplicate values in target field slices
|
||||
- `compileopts`: fix windows/arm target triple
|
||||
- `compileopts`: improve error handling when loading target/*.json
|
||||
- `compileopts`: add support for stlink-dap programmer
|
||||
- `compileopts`: do not complain about `-no-debug` on MacOS
|
||||
- `goenv`: support `GOOS=android`
|
||||
- `interp`: fix reading from external global
|
||||
- `loader`: fix link error for `crypto/internal/boring/sig.StandardCrypto`
|
||||
* **standard library**
|
||||
- rename assembly files to .S extension
|
||||
- `machine`: add PWM peripheral comments to pins
|
||||
- `machine`: improve UARTParity slightly
|
||||
- `machine`: do not export DFU_MAGIC_* constants on nrf52840
|
||||
- `machine`: rename `PinInputPullUp`/`PinInputPullDown`
|
||||
- `machine`: add `KHz`, `MHz`, `GHz` constants, deprecate `TWI_FREQ_*` constants
|
||||
- `machine`: remove level triggered pin interrupts
|
||||
- `machine`: do not expose `RESET_MAGIC_VALUE`
|
||||
- `machine`: use `NoPin` constant where appropriate (instead of `0` for example)
|
||||
- `net`: sync net.go with Go 1.18 stdlib
|
||||
- `os`: add `SyscallError.Timeout`
|
||||
- `os`: add `ErrProcessDone` error
|
||||
- `reflect`: implement `CanInterface` and fix string `Index`
|
||||
- `runtime`: make `MemStats` available to leaking collector
|
||||
- `runtime`: add `MemStats.TotalAlloc`
|
||||
- `runtime`: add `MemStats.Mallocs` and `Frees`
|
||||
- `runtime`: add support for `time.NewTimer` and `time.NewTicker`
|
||||
- `runtime`: implement `resetTimer`
|
||||
- `runtime`: ensure some headroom for the GC to run
|
||||
- `runtime`: make gc and scheduler asserts settable with build tags
|
||||
- `runtime/pprof`: add `WriteHeapProfile`
|
||||
- `runtime/pprof`: `runtime/trace`: stub some additional functions
|
||||
- `sync`: implement `Map.LoadAndDelete`
|
||||
- `syscall`: group WASI consts by purpose
|
||||
- `syscall`: add WASI `{D,R}SYNC`, `NONBLOCK` FD flags
|
||||
- `syscall`: add ENOTCONN on darwin
|
||||
- `testing`: add support for -benchmem
|
||||
* **targets**
|
||||
- remove USB vid/pid pair of bootloader
|
||||
- `esp32c3`: remove unused `UARTStopBits` constants
|
||||
- `nrf`: implement `GetRNG` function
|
||||
- `nrf`: `rp2040`: add `machine.ReadTemperature`
|
||||
- `nrf52`: cleanup s140v6 and s140v7 uf2 targets
|
||||
- `rp2040`: implement semi-random RNG based on ROSC based on pico-sdk
|
||||
- `wasm`: add summary of wasm examples and fix callback bug
|
||||
- `wasm`: do not allow undefined symbols (`--allow-undefined`)
|
||||
- `wasm`: make sure buffers returned by `malloc` are kept until `free` is called
|
||||
- `windows`: save and restore xmm registers when switching goroutines
|
||||
* **boards**
|
||||
- add Pimoroni's Tufty2040
|
||||
- add XIAO ESP32C3
|
||||
- add Adafruit QT2040
|
||||
- add Adafruit QT Py RP2040
|
||||
- `esp32c3-12f`: `matrixportal-m4`: `p1am-100`: remove duplicate build tags
|
||||
- `hifive1-qemu`: remove this emulated board
|
||||
- `wioterminal`: add UART3 for RTL8720DN
|
||||
- `xiao-ble`: fix usbpid
|
||||
|
||||
|
||||
0.25.0
|
||||
---
|
||||
|
||||
|
||||
+11
-14
@@ -700,21 +700,18 @@ func Build(pkgName, outpath string, config *compileopts.Config, action func(Buil
|
||||
// Add embedded files.
|
||||
linkerDependencies = append(linkerDependencies, embedFileObjects...)
|
||||
|
||||
// Determine whether the compilation configuration would result in debug
|
||||
// (DWARF) information in the object files.
|
||||
var hasDebug = true
|
||||
if config.GOOS() == "darwin" {
|
||||
// Debug information isn't stored in the binary itself on MacOS but
|
||||
// is left in the object files by default. The binary does store the
|
||||
// path to these object files though.
|
||||
hasDebug = false
|
||||
}
|
||||
|
||||
// Strip debug information with -no-debug.
|
||||
if !config.Debug() {
|
||||
for _, tag := range config.BuildTags() {
|
||||
if tag == "baremetal" {
|
||||
// Don't use -no-debug on baremetal targets. It makes no sense:
|
||||
// the debug information isn't flashed to the device anyway.
|
||||
return fmt.Errorf("stripping debug information is unnecessary for baremetal targets")
|
||||
}
|
||||
}
|
||||
if config.GOOS() == "darwin" {
|
||||
// Debug information isn't stored in the binary itself on MacOS but
|
||||
// is left in the object files by default. The binary does store the
|
||||
// path to these object files though.
|
||||
return errors.New("cannot remove debug information: MacOS doesn't store debug info in the executable by default")
|
||||
}
|
||||
if hasDebug && !config.Debug() {
|
||||
if config.Target.Linker == "wasm-ld" {
|
||||
// Don't just strip debug information, also compress relocations
|
||||
// while we're at it. Relocations can only be compressed when debug
|
||||
|
||||
@@ -948,6 +948,9 @@ func (p *cgoPackage) isEquivalentAST(a, b ast.Node) bool {
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
if node == nil || b == nil {
|
||||
return node == b
|
||||
}
|
||||
if len(node.List) != len(b.List) {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -115,6 +115,84 @@ func TestCGo(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func Test_cgoPackage_isEquivalentAST(t *testing.T) {
|
||||
fieldA := &ast.Field{Type: &ast.BasicLit{Kind: token.STRING, Value: "a"}}
|
||||
fieldB := &ast.Field{Type: &ast.BasicLit{Kind: token.STRING, Value: "b"}}
|
||||
listOfFieldA := &ast.FieldList{List: []*ast.Field{fieldA}}
|
||||
listOfFieldB := &ast.FieldList{List: []*ast.Field{fieldB}}
|
||||
funcDeclA := &ast.FuncDecl{Name: &ast.Ident{Name: "a"}, Type: &ast.FuncType{Params: &ast.FieldList{}, Results: listOfFieldA}}
|
||||
funcDeclB := &ast.FuncDecl{Name: &ast.Ident{Name: "b"}, Type: &ast.FuncType{Params: &ast.FieldList{}, Results: listOfFieldB}}
|
||||
funcDeclNoResults := &ast.FuncDecl{Name: &ast.Ident{Name: "C"}, Type: &ast.FuncType{Params: &ast.FieldList{}}}
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
a, b ast.Node
|
||||
expected bool
|
||||
}{
|
||||
{
|
||||
name: "both nil",
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: "not same type",
|
||||
a: fieldA,
|
||||
b: &ast.FuncDecl{},
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: "Field same",
|
||||
a: fieldA,
|
||||
b: fieldA,
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: "Field different",
|
||||
a: fieldA,
|
||||
b: fieldB,
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: "FuncDecl Type Results nil",
|
||||
a: funcDeclNoResults,
|
||||
b: funcDeclNoResults,
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: "FuncDecl Type Results same",
|
||||
a: funcDeclA,
|
||||
b: funcDeclA,
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: "FuncDecl Type Results different",
|
||||
a: funcDeclA,
|
||||
b: funcDeclB,
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: "FuncDecl Type Results a nil",
|
||||
a: funcDeclNoResults,
|
||||
b: funcDeclB,
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: "FuncDecl Type Results b nil",
|
||||
a: funcDeclA,
|
||||
b: funcDeclNoResults,
|
||||
expected: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
p := &cgoPackage{}
|
||||
if got := p.isEquivalentAST(tc.a, tc.b); tc.expected != got {
|
||||
t.Errorf("expected %v, got %v", tc.expected, got)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// simpleImporter implements the types.Importer interface, but only allows
|
||||
// importing the unsafe package.
|
||||
type simpleImporter struct {
|
||||
|
||||
@@ -377,8 +377,8 @@ func (c *Config) VerifyIR() bool {
|
||||
}
|
||||
|
||||
// Debug returns whether debug (DWARF) information should be retained by the
|
||||
// linker. By default, debug information is retained but it can be removed with
|
||||
// the -no-debug flag.
|
||||
// linker. By default, debug information is retained, but it can be removed
|
||||
// with the -no-debug flag.
|
||||
func (c *Config) Debug() bool {
|
||||
return c.Options.Debug
|
||||
}
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
// Version of TinyGo.
|
||||
// Update this value before release of new version of software.
|
||||
const Version = "0.26.0-dev"
|
||||
const Version = "0.26.0"
|
||||
|
||||
var (
|
||||
// This variable is set at build time using -ldflags parameters.
|
||||
|
||||
@@ -52,8 +52,8 @@ const (
|
||||
I2C0_SDA_PIN = GPIO20
|
||||
I2C0_SCL_PIN = GPIO21
|
||||
|
||||
I2C1_SDA_PIN = 31 // not pinned out
|
||||
I2C1_SCL_PIN = 31 // not pinned out
|
||||
I2C1_SDA_PIN = NoPin // not pinned out
|
||||
I2C1_SCL_PIN = NoPin // not pinned out
|
||||
)
|
||||
|
||||
// SPI default pins
|
||||
@@ -65,9 +65,9 @@ const (
|
||||
// Default Serial In Bus 1 for SPI communications
|
||||
SPI1_SDI_PIN = GPIO28 // Rx
|
||||
|
||||
SPI0_SCK_PIN = 31 // not pinned out
|
||||
SPI0_SDO_PIN = 31 // not pinned out
|
||||
SPI0_SDI_PIN = 31 // not pinned out
|
||||
SPI0_SCK_PIN = NoPin // not pinned out
|
||||
SPI0_SDO_PIN = NoPin // not pinned out
|
||||
SPI0_SDI_PIN = NoPin // not pinned out
|
||||
)
|
||||
|
||||
// UART pins
|
||||
|
||||
@@ -18,15 +18,15 @@ const (
|
||||
|
||||
// MDBT50Q-RX dongle does not have pins broken out for the peripherals below,
|
||||
// however the machine_nrf*.go implementations of I2C/SPI/etc expect the pin
|
||||
// constants to be defined, so we are defining them all as 0
|
||||
// constants to be defined, so we are defining them all as NoPin
|
||||
const (
|
||||
UART_TX_PIN = 0
|
||||
UART_RX_PIN = 0
|
||||
SDA_PIN = 0
|
||||
SCL_PIN = 0
|
||||
SPI0_SCK_PIN = 0
|
||||
SPI0_SDO_PIN = 0
|
||||
SPI0_SDI_PIN = 0
|
||||
UART_TX_PIN = NoPin
|
||||
UART_RX_PIN = NoPin
|
||||
SDA_PIN = NoPin
|
||||
SCL_PIN = NoPin
|
||||
SPI0_SCK_PIN = NoPin
|
||||
SPI0_SDO_PIN = NoPin
|
||||
SPI0_SDI_PIN = NoPin
|
||||
)
|
||||
|
||||
// USB CDC identifiers
|
||||
|
||||
Vendored
+25
-25
@@ -4,51 +4,51 @@ import "time"
|
||||
|
||||
func main() {
|
||||
// Test ticker.
|
||||
ticker := time.NewTicker(time.Millisecond * 250)
|
||||
ticker := time.NewTicker(time.Millisecond * 500)
|
||||
println("waiting on ticker")
|
||||
go func() {
|
||||
time.Sleep(time.Millisecond * 125)
|
||||
println(" - after 125ms")
|
||||
time.Sleep(time.Millisecond * 250)
|
||||
println(" - after 375ms")
|
||||
time.Sleep(time.Millisecond * 250)
|
||||
println(" - after 625ms")
|
||||
time.Sleep(time.Millisecond * 150)
|
||||
println(" - after 150ms")
|
||||
time.Sleep(time.Millisecond * 200)
|
||||
println(" - after 200ms")
|
||||
time.Sleep(time.Millisecond * 300)
|
||||
println(" - after 300ms")
|
||||
}()
|
||||
<-ticker.C
|
||||
println("waited on ticker at 250ms")
|
||||
<-ticker.C
|
||||
println("waited on ticker at 500ms")
|
||||
<-ticker.C
|
||||
println("waited on ticker at 1000ms")
|
||||
ticker.Stop()
|
||||
time.Sleep(time.Millisecond * 500)
|
||||
time.Sleep(time.Millisecond * 750)
|
||||
select {
|
||||
case <-ticker.C:
|
||||
println("fail: ticker should have stopped!")
|
||||
default:
|
||||
println("ticker was stopped (didn't send anything after 500ms)")
|
||||
println("ticker was stopped (didn't send anything after 750ms)")
|
||||
}
|
||||
|
||||
timer := time.NewTimer(time.Millisecond * 250)
|
||||
timer := time.NewTimer(time.Millisecond * 500)
|
||||
println("waiting on timer")
|
||||
go func() {
|
||||
time.Sleep(time.Millisecond * 125)
|
||||
println(" - after 125ms")
|
||||
time.Sleep(time.Millisecond * 250)
|
||||
println(" - after 250ms")
|
||||
time.Sleep(time.Millisecond * 200)
|
||||
println(" - after 200ms")
|
||||
time.Sleep(time.Millisecond * 400)
|
||||
println(" - after 400ms")
|
||||
}()
|
||||
<-timer.C
|
||||
println("waited on timer at 250ms")
|
||||
time.Sleep(time.Millisecond * 250)
|
||||
println("waited on timer at 500ms")
|
||||
time.Sleep(time.Millisecond * 500)
|
||||
|
||||
reset := timer.Reset(time.Millisecond * 250)
|
||||
reset := timer.Reset(time.Millisecond * 500)
|
||||
println("timer reset:", reset)
|
||||
println("waiting on timer")
|
||||
go func() {
|
||||
time.Sleep(time.Millisecond * 125)
|
||||
println(" - after 125ms")
|
||||
time.Sleep(time.Millisecond * 250)
|
||||
println(" - after 250ms")
|
||||
time.Sleep(time.Millisecond * 200)
|
||||
println(" - after 200ms")
|
||||
time.Sleep(time.Millisecond * 400)
|
||||
println(" - after 400ms")
|
||||
}()
|
||||
<-timer.C
|
||||
println("waited on timer at 250ms")
|
||||
time.Sleep(time.Millisecond * 250)
|
||||
println("waited on timer at 500ms")
|
||||
time.Sleep(time.Millisecond * 500)
|
||||
}
|
||||
|
||||
Vendored
+11
-11
@@ -1,16 +1,16 @@
|
||||
waiting on ticker
|
||||
- after 125ms
|
||||
waited on ticker at 250ms
|
||||
- after 375ms
|
||||
- after 150ms
|
||||
- after 200ms
|
||||
waited on ticker at 500ms
|
||||
- after 625ms
|
||||
ticker was stopped (didn't send anything after 500ms)
|
||||
- after 300ms
|
||||
waited on ticker at 1000ms
|
||||
ticker was stopped (didn't send anything after 750ms)
|
||||
waiting on timer
|
||||
- after 125ms
|
||||
waited on timer at 250ms
|
||||
- after 250ms
|
||||
- after 200ms
|
||||
waited on timer at 500ms
|
||||
- after 400ms
|
||||
timer reset: false
|
||||
waiting on timer
|
||||
- after 125ms
|
||||
waited on timer at 250ms
|
||||
- after 250ms
|
||||
- after 200ms
|
||||
waited on timer at 500ms
|
||||
- after 400ms
|
||||
|
||||
Reference in New Issue
Block a user