github.com/usbarmory/tamago@v0.0.0-20240508072735-8612bbe1e454/board/qemu/sifive_u/sifive_u.go (about)

     1  // QEMU virt support for tamago/riscv64
     2  // https://github.com/usbarmory/tamago
     3  //
     4  // Copyright (c) WithSecure Corporation
     5  // https://foundry.withsecure.com
     6  //
     7  // Use of this source code is governed by the license
     8  // that can be found in the LICENSE file.
     9  
    10  // Package sifive_u provides hardware initialization, automatically on import,
    11  // for the QEMU sifive_u machine configured (see the `dts` file in this
    12  // directory) with a single U54 core.
    13  //
    14  // This package is only meant to be used with `GOOS=tamago GOARCH=riscv64` as
    15  // supported by the TamaGo framework for bare metal Go on RISC-V SoCs, see
    16  // https://github.com/usbarmory/tamago.
    17  package sifive_u
    18  
    19  import (
    20  	_ "unsafe"
    21  
    22  	"github.com/usbarmory/tamago/soc/sifive/fu540"
    23  )
    24  
    25  // Peripheral instances
    26  var (
    27  	UART0 = fu540.UART0
    28  )
    29  
    30  // Init takes care of the lower level SoC initialization triggered early in
    31  // runtime setup.
    32  //
    33  //go:linkname Init runtime.hwinit
    34  func Init() {
    35  	// initialize SoC
    36  	fu540.Init()
    37  
    38  	// initialize serial console
    39  	fu540.UART0.Init()
    40  }