mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-07-26 10:38:41 +00:00
semihosting: add example
This commit is contained in:
committed by
Ron Evans
parent
d61fe99ef1
commit
6380ad5ed5
@@ -0,0 +1,23 @@
|
||||
package main
|
||||
|
||||
// A small example that demonstrates how SemiHosting can be used.
|
||||
// You could use it with a board that supports GDB, such as the BBC micro:bit:
|
||||
// 1. Compile and debug it:
|
||||
// tinygo gdb -target=microbit -ocd-output tinygo.org/x/drivers/examples/semihosting
|
||||
// 2. Enable semihosting in the GDB shell:
|
||||
// monitor arm semihosting enable
|
||||
// 3. Start the program:
|
||||
// continue
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"tinygo.org/x/drivers/semihosting"
|
||||
)
|
||||
|
||||
func main() {
|
||||
for {
|
||||
semihosting.Stdout.Write([]byte("hello world!\n"))
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user