mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-18 03:24:00 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f0391eac25 | |||
| 05cdde162c | |||
| 25c8d3ec3a |
@@ -1,3 +1,58 @@
|
|||||||
|
0.25.0
|
||||||
|
---
|
||||||
|
|
||||||
|
* **command line**
|
||||||
|
- change to ignore PortReset failures
|
||||||
|
* **compiler**
|
||||||
|
- `compiler`: darwin/arm64 is aarch64, not arm
|
||||||
|
- `compiler`: don't clobber X18 and FP registers on darwin/arm64
|
||||||
|
- `compiler`: fix issue with methods on generic structs
|
||||||
|
- `compiler`: do not try to build generic functions
|
||||||
|
- `compiler`: fix type names for generic named structs
|
||||||
|
- `compiler`: fix multiple defined function issue for generic functions
|
||||||
|
- `compiler`: implement `unsafe.Alignof` and `unsafe.Sizeof` for generic code
|
||||||
|
* **standard library**
|
||||||
|
- `machine`: add DTR and RTS to Serialer interface
|
||||||
|
- `machine`: reorder pin definitions to improve pin list on tinygo.org
|
||||||
|
- `machine/usb`: add support for MIDI
|
||||||
|
- `machine/usb`: adjust buffer alignment (samd21, samd51, nrf52840)
|
||||||
|
- `machine/usb/midi`: add `NoteOn`, `NoteOff`, and `SendCC` methods
|
||||||
|
- `machine/usb/midi`: add definition of MIDI note number
|
||||||
|
- `runtime`: add benchmarks for memhash
|
||||||
|
- `runtime`: add support for printing slices via print/println
|
||||||
|
* **targets**
|
||||||
|
- `avr`: fix some apparent mistake in atmega1280/atmega2560 pin constants
|
||||||
|
- `esp32`: provide hardware pin constants
|
||||||
|
- `esp32`: fix WDT reset on the MCH2022 badge
|
||||||
|
- `esp32`: optimize SPI transmit
|
||||||
|
- `esp32c3`: provide hardware pin constants
|
||||||
|
- `esp8266`: provide hardware pin constants like `GPIO2`
|
||||||
|
- `nrf51`: define and use `P0_xx` constants
|
||||||
|
- `nrf52840`, `samd21`, `samd51`: unify bootloader entry process
|
||||||
|
- `nrf52840`, `samd21`, `samd51`: change usbSetup and sendZlp to public
|
||||||
|
- `nrf52840`, `samd21`, `samd51`: refactor handleStandardSetup and initEndpoint
|
||||||
|
- `nrf52840`, `samd21`, `samd51`: improve usb-device initialization
|
||||||
|
- `nrf52840`, `samd21`, `samd51`: move usbcdc to machine/usb/cdc
|
||||||
|
- `rp2040`: add usb serial vendor/product ID
|
||||||
|
- `rp2040`: add support for usb
|
||||||
|
- `rp2040`: change default for serial to usb
|
||||||
|
- `rp2040`: add support for `machine.EnterBootloader`
|
||||||
|
- `rp2040`: turn off pullup/down when input type is not specified
|
||||||
|
- `rp2040`: make picoprobe default openocd interface
|
||||||
|
- `samd51`: add support for `DAC1`
|
||||||
|
- `samd51`: improve TRNG
|
||||||
|
- `wasm`: stub `runtime.buffered`, `runtime.getchar`
|
||||||
|
- `wasi`: make leveldb runtime hash the default
|
||||||
|
* **boards**
|
||||||
|
- add Challenger RP2040 LoRa
|
||||||
|
- add MCH2022 badge
|
||||||
|
- add XIAO RP2040
|
||||||
|
- `clue`: remove pins `D21`..`D28`
|
||||||
|
- `feather-rp2040`, `macropad-rp2040`: fix qspi-flash settings
|
||||||
|
- `xiao-ble`: add support for flash-1200-bps-reset
|
||||||
|
- `gopherbot`, `gopherbot2`: add these aliases to simplify for newer users
|
||||||
|
|
||||||
|
|
||||||
0.24.0
|
0.24.0
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
+10
-1
@@ -1039,9 +1039,17 @@ func (b *builder) createFunctionStart() {
|
|||||||
b.addError(b.fn.Pos(), errValue)
|
b.addError(b.fn.Pos(), errValue)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
b.addStandardDefinedAttributes(b.llvmFn)
|
b.addStandardDefinedAttributes(b.llvmFn)
|
||||||
if !b.info.exported {
|
if !b.info.exported {
|
||||||
b.llvmFn.SetVisibility(llvm.HiddenVisibility)
|
// Do not set visibility for local linkage (internal or private).
|
||||||
|
// Otherwise a "local linkage requires default visibility"
|
||||||
|
// assertion error in llvm-project/llvm/include/llvm/IR/GlobalValue.h:236
|
||||||
|
// is thrown.
|
||||||
|
if b.llvmFn.Linkage() != llvm.InternalLinkage &&
|
||||||
|
b.llvmFn.Linkage() != llvm.PrivateLinkage {
|
||||||
|
b.llvmFn.SetVisibility(llvm.HiddenVisibility)
|
||||||
|
}
|
||||||
b.llvmFn.SetUnnamedAddr(true)
|
b.llvmFn.SetUnnamedAddr(true)
|
||||||
}
|
}
|
||||||
if b.info.section != "" {
|
if b.info.section != "" {
|
||||||
@@ -1265,6 +1273,7 @@ func (b *builder) createFunction() {
|
|||||||
// Create anonymous functions (closures etc.).
|
// Create anonymous functions (closures etc.).
|
||||||
for _, sub := range b.fn.AnonFuncs {
|
for _, sub := range b.fn.AnonFuncs {
|
||||||
b := newBuilder(b.compilerContext, b.Builder, sub)
|
b := newBuilder(b.compilerContext, b.Builder, sub)
|
||||||
|
b.llvmFn.SetLinkage(llvm.InternalLinkage)
|
||||||
b.createFunction()
|
b.createFunction()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -196,7 +196,7 @@ entry:
|
|||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; Function Attrs: nounwind
|
||||||
define hidden void @"main.foo$1"(%main.kv.0* dereferenceable_or_null(1) %b, i8* %context) unnamed_addr #1 {
|
define internal void @"main.foo$1"(%main.kv.0* dereferenceable_or_null(1) %b, i8* %context) unnamed_addr #1 {
|
||||||
entry:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -115,7 +115,7 @@ declare i8* @llvm.stacksave() #2
|
|||||||
declare void @runtime.setupDeferFrame(%runtime.deferFrame* dereferenceable_or_null(24), i8*, i8*) #0
|
declare void @runtime.setupDeferFrame(%runtime.deferFrame* dereferenceable_or_null(24), i8*, i8*) #0
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; Function Attrs: nounwind
|
||||||
define hidden void @"main.deferSimple$1"(i8* %context) unnamed_addr #1 {
|
define internal void @"main.deferSimple$1"(i8* %context) unnamed_addr #1 {
|
||||||
entry:
|
entry:
|
||||||
call void @runtime.printint32(i32 3, i8* undef) #3
|
call void @runtime.printint32(i32 3, i8* undef) #3
|
||||||
ret void
|
ret void
|
||||||
@@ -246,14 +246,14 @@ rundefers.end9: ; preds = %rundefers.loophead1
|
|||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; Function Attrs: nounwind
|
||||||
define hidden void @"main.deferMultiple$1"(i8* %context) unnamed_addr #1 {
|
define internal void @"main.deferMultiple$1"(i8* %context) unnamed_addr #1 {
|
||||||
entry:
|
entry:
|
||||||
call void @runtime.printint32(i32 3, i8* undef) #3
|
call void @runtime.printint32(i32 3, i8* undef) #3
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; Function Attrs: nounwind
|
||||||
define hidden void @"main.deferMultiple$2"(i8* %context) unnamed_addr #1 {
|
define internal void @"main.deferMultiple$2"(i8* %context) unnamed_addr #1 {
|
||||||
entry:
|
entry:
|
||||||
call void @runtime.printint32(i32 5, i8* undef) #3
|
call void @runtime.printint32(i32 5, i8* undef) #3
|
||||||
ret void
|
ret void
|
||||||
|
|||||||
+2
-2
@@ -51,7 +51,7 @@ entry:
|
|||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; Function Attrs: nounwind
|
||||||
define hidden void @"main.inlineFunctionGoroutine$1"(i32 %x, i8* %context) unnamed_addr #1 {
|
define internal void @"main.inlineFunctionGoroutine$1"(i32 %x, i8* %context) unnamed_addr #1 {
|
||||||
entry:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ entry:
|
|||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; Function Attrs: nounwind
|
||||||
define hidden void @"main.closureFunctionGoroutine$1"(i32 %x, i8* %context) unnamed_addr #1 {
|
define internal void @"main.closureFunctionGoroutine$1"(i32 %x, i8* %context) unnamed_addr #1 {
|
||||||
entry:
|
entry:
|
||||||
%unpack.ptr = bitcast i8* %context to i32*
|
%unpack.ptr = bitcast i8* %context to i32*
|
||||||
store i32 7, i32* %unpack.ptr, align 4
|
store i32 7, i32* %unpack.ptr, align 4
|
||||||
|
|||||||
+2
-2
@@ -53,7 +53,7 @@ entry:
|
|||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; Function Attrs: nounwind
|
||||||
define hidden void @"main.inlineFunctionGoroutine$1"(i32 %x, i8* %context) unnamed_addr #1 {
|
define internal void @"main.inlineFunctionGoroutine$1"(i32 %x, i8* %context) unnamed_addr #1 {
|
||||||
entry:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ entry:
|
|||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; Function Attrs: nounwind
|
||||||
define hidden void @"main.closureFunctionGoroutine$1"(i32 %x, i8* %context) unnamed_addr #1 {
|
define internal void @"main.closureFunctionGoroutine$1"(i32 %x, i8* %context) unnamed_addr #1 {
|
||||||
entry:
|
entry:
|
||||||
%unpack.ptr = bitcast i8* %context to i32*
|
%unpack.ptr = bitcast i8* %context to i32*
|
||||||
store i32 7, i32* %unpack.ptr, align 4
|
store i32 7, i32* %unpack.ptr, align 4
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
// Version of TinyGo.
|
// Version of TinyGo.
|
||||||
// Update this value before release of new version of software.
|
// Update this value before release of new version of software.
|
||||||
const Version = "0.25.0-dev"
|
const Version = "0.25.0"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// This variable is set at build time using -ldflags parameters.
|
// This variable is set at build time using -ldflags parameters.
|
||||||
|
|||||||
@@ -49,6 +49,16 @@ func putchar(c byte) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getchar() byte {
|
||||||
|
// dummy, TODO
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func buffered() int {
|
||||||
|
// dummy, TODO
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
//go:linkname now time.now
|
//go:linkname now time.now
|
||||||
func now() (sec int64, nsec int32, mono int64) {
|
func now() (sec int64, nsec int32, mono int64) {
|
||||||
mono = nanotime()
|
mono = nanotime()
|
||||||
|
|||||||
Vendored
+8
@@ -1,11 +1,19 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/tinygo-org/tinygo/testdata/generics/testa"
|
||||||
|
"github.com/tinygo-org/tinygo/testdata/generics/testb"
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
println("add:", Add(3, 5))
|
println("add:", Add(3, 5))
|
||||||
println("add:", Add(int8(3), 5))
|
println("add:", Add(int8(3), 5))
|
||||||
|
|
||||||
var c C[int]
|
var c C[int]
|
||||||
c.F() // issue 2951
|
c.F() // issue 2951
|
||||||
|
|
||||||
|
testa.Test()
|
||||||
|
testb.Test()
|
||||||
}
|
}
|
||||||
|
|
||||||
type Integer interface {
|
type Integer interface {
|
||||||
|
|||||||
Vendored
+4
@@ -1,2 +1,6 @@
|
|||||||
add: 8
|
add: 8
|
||||||
add: 8
|
add: 8
|
||||||
|
value: 101
|
||||||
|
value: 101
|
||||||
|
value: 501
|
||||||
|
value: 501
|
||||||
|
|||||||
Vendored
+20
@@ -0,0 +1,20 @@
|
|||||||
|
package testa
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/tinygo-org/tinygo/testdata/generics/value"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Test() {
|
||||||
|
v := value.New(1)
|
||||||
|
vm := value.Map(v, Plus100)
|
||||||
|
vm.Get(callback, callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
func callback(v int) {
|
||||||
|
println("value:", v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Plus100 is a `Transform` that adds 100 to `value`.
|
||||||
|
func Plus100(value int) int {
|
||||||
|
return value + 100
|
||||||
|
}
|
||||||
Vendored
+20
@@ -0,0 +1,20 @@
|
|||||||
|
package testb
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/tinygo-org/tinygo/testdata/generics/value"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Test() {
|
||||||
|
v := value.New(1)
|
||||||
|
vm := value.Map(v, Plus500)
|
||||||
|
vm.Get(callback, callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
func callback(v int) {
|
||||||
|
println("value:", v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Plus500 is a `Transform` that adds 500 to `value`.
|
||||||
|
func Plus500(value int) int {
|
||||||
|
return value + 500
|
||||||
|
}
|
||||||
Vendored
+53
@@ -0,0 +1,53 @@
|
|||||||
|
package value
|
||||||
|
|
||||||
|
type (
|
||||||
|
Value[T any] interface {
|
||||||
|
Get(Callback[T], Callback[T])
|
||||||
|
}
|
||||||
|
|
||||||
|
Callback[T any] func(T)
|
||||||
|
|
||||||
|
Transform[S any, D any] func(S) D
|
||||||
|
)
|
||||||
|
|
||||||
|
func New[T any](v T) Value[T] {
|
||||||
|
return &value[T]{
|
||||||
|
v: v,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type value[T any] struct {
|
||||||
|
v T
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *value[T]) Get(fn1, fn2 Callback[T]) {
|
||||||
|
// For example purposes.
|
||||||
|
// Normally would be asynchronous callback.
|
||||||
|
fn1(v.v)
|
||||||
|
fn2(v.v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Map[S, D any](v Value[S], tx Transform[S, D]) Value[D] {
|
||||||
|
return &mapper[S, D]{
|
||||||
|
v: v,
|
||||||
|
tx: tx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type mapper[S, D any] struct {
|
||||||
|
v Value[S]
|
||||||
|
tx Transform[S, D]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *mapper[S, D]) Get(fn1, fn2 Callback[D]) {
|
||||||
|
// two callbacks are passed to generate more than
|
||||||
|
// one anonymous function symbol name.
|
||||||
|
m.v.Get(func(v S) {
|
||||||
|
// anonymous function inside of anonymous function.
|
||||||
|
func() {
|
||||||
|
fn1(m.tx(v))
|
||||||
|
}()
|
||||||
|
}, func(v S) {
|
||||||
|
fn2(m.tx(v))
|
||||||
|
})
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user