1
0

GenerateBootROM: use compiled DTB

This commit is contained in:
Wesley W. Terpstra
2017-03-24 14:35:11 -07:00
parent 17b1ee3037
commit 9a2f0d01a1
4 changed files with 22 additions and 5 deletions

View File

@ -307,7 +307,7 @@ trait PeripheryBootROM {
private val bootrom_address = 0x1000
private val bootrom_size = 0x1000
private lazy val bootrom_contents = GenerateBootROM(p, bootrom_address, coreplex.dts)
private lazy val bootrom_contents = GenerateBootROM(p, bootrom_address, coreplex.dtb)
val bootrom = LazyModule(new TLROM(bootrom_address, bootrom_size, bootrom_contents, true, peripheryBusConfig.beatBytes))
bootrom.node := TLFragmenter(peripheryBusConfig.beatBytes, cacheBlockBytes)(peripheryBus.node)
}

View File

@ -53,17 +53,17 @@ class GlobalVariable[T] {
}
object GenerateBootROM {
def apply(p: Parameters, address: BigInt, dts: String) = {
def apply(p: Parameters, address: BigInt, dtb: DTB) = {
val romdata = Files.readAllBytes(Paths.get(p(BootROMFile)))
val rom = ByteBuffer.wrap(romdata)
rom.order(ByteOrder.LITTLE_ENDIAN)
require(address == address.toInt)
val dtsAddr = address.toInt + rom.capacity
val dtbAddr = address.toInt + rom.capacity
require(rom.getInt(12) == 0,
"DTS address position should not be occupied by code")
rom.putInt(12, dtsAddr)
rom.array() ++ (dts.getBytes.toSeq)
rom.putInt(12, dtbAddr)
rom.array() ++ dtb.contents
}
}