github.com/transparency-dev/armored-witness-boot@v0.1.0/console_debug.go (about) 1 // Copyright 2022 The Armored Witness Boot authors. All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 //go:build console 16 // +build console 17 18 package main 19 20 import ( 21 "fmt" 22 "log" 23 "runtime" 24 "time" 25 _ "unsafe" 26 27 usbarmory "github.com/usbarmory/tamago/board/usbarmory/mk2" 28 "github.com/usbarmory/tamago/soc/nxp/imx6ul" 29 ) 30 31 func init() { 32 switch model, _ := usbarmory.Model(); model { 33 case usbarmory.BETA, usbarmory.GAMMA: 34 if debugConsole, err := usbarmory.DetectDebugAccessory(250 * time.Millisecond); err == nil { 35 <-debugConsole 36 } 37 } 38 39 banner := fmt.Sprintf("armored-witness-boot • %s/%s (%s) • %s • %s", 40 runtime.GOOS, runtime.GOARCH, runtime.Version(), 41 Revision, 42 imx6ul.Model()) 43 44 log.SetFlags(0) 45 log.Printf("%s", banner) 46 } 47 48 //go:linkname printk runtime.printk 49 func printk(c byte) { 50 usbarmory.UART2.Tx(c) 51 }