tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/examples/semihosting/semihosting.go (about)

     1  package main
     2  
     3  // A small example that demonstrates how SemiHosting can be used.
     4  // You could use it with a board that supports GDB, such as the BBC micro:bit:
     5  // 1. Compile and debug it:
     6  //      tinygo gdb -target=microbit -ocd-output tinygo.org/x/drivers/examples/semihosting
     7  // 2. Enable semihosting in the GDB shell:
     8  //      monitor arm semihosting enable
     9  // 3. Start the program:
    10  //      continue
    11  
    12  import (
    13  	"time"
    14  
    15  	"tinygo.org/x/drivers/semihosting"
    16  )
    17  
    18  func main() {
    19  	for {
    20  		semihosting.Stdout.Write([]byte("hello world!\n"))
    21  		time.Sleep(time.Second)
    22  	}
    23  }