github.com/usbarmory/armory-boot@v0.0.0-20240307133412-208c66a380b9/debug.go (about)

     1  // Copyright (c) WithSecure Corporation
     2  // https://foundry.withsecure.com
     3  //
     4  // Use of this source code is governed by the license
     5  // that can be found in the LICENSE file.
     6  
     7  //go:build console
     8  // +build console
     9  
    10  package main
    11  
    12  import (
    13  	"fmt"
    14  	"log"
    15  	"runtime"
    16  	"time"
    17  	_ "unsafe"
    18  
    19  	usbarmory "github.com/usbarmory/tamago/board/usbarmory/mk2"
    20  	"github.com/usbarmory/tamago/soc/nxp/imx6ul"
    21  )
    22  
    23  func init() {
    24  	debugConsole, _ := usbarmory.DetectDebugAccessory(250 * time.Millisecond)
    25  	<-debugConsole
    26  
    27  	banner := fmt.Sprintf("armory-boot • %s/%s (%s) • %s %s • %s",
    28  		runtime.GOOS, runtime.GOARCH, runtime.Version(),
    29  		Revision, Build,
    30  		imx6ul.Model())
    31  
    32  	log.SetFlags(0)
    33  	log.Printf("%s", banner)
    34  }
    35  
    36  //go:linkname printk runtime.printk
    37  func printk(c byte) {
    38  	usbarmory.UART2.Tx(c)
    39  }