github.com/google/trillian-examples@v0.0.0-20240520080811-0d40d35cef0e/binary_transparency/firmware/devices/usbarmory/bootloader/boot.go (about)

     1  // https://github.com/usbarmory/armory-boot
     2  //
     3  // Copyright (c) F-Secure Corporation
     4  // https://foundry.f-secure.com
     5  //
     6  // Use of this source code is governed by the license
     7  // that can be found in the LICENSE file.
     8  
     9  //go:build armory
    10  // +build armory
    11  
    12  package main
    13  
    14  import (
    15  	"log"
    16  
    17  	"github.com/usbarmory/tamago/arm"
    18  	usbarmory "github.com/usbarmory/tamago/board/usbarmory/mk2"
    19  	"github.com/usbarmory/tamago/soc/nxp/imx6ul"
    20  )
    21  
    22  // defined in boot.s
    23  func exec(kernel uint32, params uint32)
    24  func svc()
    25  
    26  func boot(kernel uint, params uint) {
    27  	arm.SystemExceptionHandler = func(n int) {
    28  		if n != arm.SUPERVISOR {
    29  			panic("unhandled exception")
    30  		}
    31  
    32  		log.Printf("armory-boot: starting kernel@%x params@%x\n", kernel, params)
    33  
    34  		usbarmory.LED("blue", false)
    35  		usbarmory.LED("white", false)
    36  
    37  		// RNGB driver doesn't play well with previous initializations
    38  		imx6ul.RNGB.Reset()
    39  
    40  		imx6ul.ARM.DisableInterrupts()
    41  		imx6ul.ARM.FlushDataCache()
    42  		imx6ul.ARM.DisableCache()
    43  
    44  		exec(uint32(kernel), uint32(params))
    45  	}
    46  
    47  	svc()
    48  }