Skip to content

doc:AsmFull examples are outdated and cause compilation errors #5004

@luoliwoshang

Description

@luoliwoshang

The documentation for device.AsmFull contains outdated examples that use pointer operands, which were removed in TinyGo 0.23. Following the documented examples results in compilation errors.

package main
import "device"

func main() {
    var dest int32
    device.AsmFull("str {value}, {result}", map[string]interface{}{
        "value":  1,
        "result": &dest, // This line causes the error
    })
}
$ tinygo build -target=esp32-coreboard-v2 test.go
test.go:7:16: support for pointer operands was dropped in TinyGo 0.23

so i think this comment need update,like follow

// Run the given inline assembly. The code will be marked as having side
// effects, as it would otherwise be optimized away. The inline assembly string
// recognizes template values in the form {name}, like so:
//
//	arm.AsmFull(
//	    "st {value}, {result}",
//	    map[string]interface{}{
//	        "value":  1
//	        "result": uintptr(unsafe.Pointer(&dest)),
//	    })
//
// You can use {} in the asm string (which expands to a register) to set the
// return value.
func AsmFull(asm string, regs map[string]interface{}) uintptr

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions