Add KBOOT.

This commit is contained in:
László Monda
2016-08-10 01:45:15 +02:00
commit e6c1fce5b4
9392 changed files with 3751375 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
00112233445566778899aabbccddeeff
+28
View File
@@ -0,0 +1,28 @@
# No source file needed, keep this block empty
sources {
}
# The section block specifies the sequence of boot commands to be written to the SB file.
section (0) {
# Use the 'load ifr' statement to program the SB key to IFR memory.
# The SB key occupies IFR index 0x30-0x33.
# The SB key is 128-bit specifies as 4 little-endian long-word values.
# SB Key = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}
load ifr 0x33221100 > 0x30;
load ifr 0x77665544 > 0x31;
load ifr 0xbbaa9988 > 0x32;
load ifr 0xffeeddcc > 0x33;
# Use the 'load ifr' statement to program the OTFAD KEK to IFR memory.
# The KEK is used to unwrap(decrypt) the keyblob at boot time in order to correctly set up the OTFAD engine.
# The key is specified as 4 little-endian values, with the "least significant" key word going into the lowest IFR index
# KEK = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}
load ifr 0x0f0e0d0c > 0x20;
load ifr 0x0b0a0908 > 0x21;
load ifr 0x07060504 > 0x22;
load ifr 0x03020100 > 0x23;
# Reset target in order to let these keys take effect.
reset;
}
+35
View File
@@ -0,0 +1,35 @@
# The sources block assigns file names to identifiers
sources {
# SREC File path
mySrecFile = "led_demo_qspi_0000.srec";
# QCB file path
qspiConfigBlock = "qspi_config_block.bin";
}
# The section block specifies the sequence of boot commands to be written to
# the SB file
section (0) {
#1. Erase the vector table and flash config field.
erase 0..0x800;
# Step 2 and Step 3 are optional if the QuadSPI is configured at startup.
#2. Load the QCB to RAM
load qspiConfigBlock > 0x20000000;
#3. Configure QuadSPI with the QCB above
enable qspi 0x20000000;
#4. Erase the QuadSPI memory region before programming.
erase 0x68000000..0x68004000;
#5.Load the QCB above to the start address of QuadSPI memory
load qspiConfigBlock > 0x68000000;
#6,7. Load all the RO data from srec file, including vector table, flash config field and codes.
load mySrecFile;
#8. Reset target.
reset;
}
+35
View File
@@ -0,0 +1,35 @@
# The sources block assigns file names to identifiers
sources {
# SREC File path
mySrecFile = "led_demo_qspi_a000.srec";
# QCB file path
qspiConfigBlock = "qspi_config_block.bin";
}
# The section block specifies the sequence of boot commands to be written to
# the SB file
section (0) {
#1. Erase the vector table and flash config field.
erase 0xa000..0xa800;
# Step 2 and Step 3 are optional if the QuadSPI is configured at startup.
#2. Load the QCB to RAM
load qspiConfigBlock > 0x20000000;
#3. Configure QuadSPI with the QCB above
enable qspi 0x20000000;
#4. Erase the QuadSPI memory region before programming.
erase 0x68000000..0x68004000;
#5.Load the QCB above to the start address of QuadSPI memory
load qspiConfigBlock > 0x68000000;
#6,7. Load all the RO data from srec file, including vector table, flash config field and codes.
load mySrecFile;
#8. Reset target.
reset;
}
@@ -0,0 +1,35 @@
# The sources block assigns file names to identifiers
sources {
# SREC File path
mySrecFile = "led_demo_qspi_alias_a000.srec";
# QCB file path
qspiConfigBlock = "qspi_config_block.bin";
}
# The section block specifies the sequence of boot commands to be written to
# the SB file
section (0) {
#1. Erase the vector table and flash config field.
erase 0xa000..0xa800;
# Step 2 and Step 3 are optional if the QuadSPI is configured at startup.
#2. Load the QCB to RAM
load qspiConfigBlock > 0x20000000;
#3. Configure QuadSPI with the QCB above
enable qspi 0x20000000;
#4. Erase the QuadSPI memory region before programming.
erase 0x04000000..0x04004000;
#5.Load the QCB above to the start address of QuadSPI memory
load qspiConfigBlock > 0x68000000;
#6. Load all boot_to_qspi_alias_memory applcation
load mySrecFile;
#7. Reset target.
reset;
}
@@ -0,0 +1,70 @@
# The sources block assigns file names to identifiers
sources {
# SREC File path
mySrecFile = "boot_to_qspi_alias_memory_rom.srec";
# QCB file path
qspiConfigBlock = "qspi_config_block.bin";
# Alias QSPI image file path
myBinFile = "led_demo_qspi_alias_rom.bin";
}
# The keyblob creates a structure with up to 4 keyblob entries.
# The empty parentheses syntax specifies an entry of all zeros (no encryption)
# Each entry consists of 4 parameters:
# start - start address of encrypted block.
# end - end address of encrypted block.
# key - AES-CTR mode encryption key for this range.
# counter - initial counter value for AES-CTR encryption for this range.
keyblob (0) {
(
start=0x68001000,
end = 0x68001fff,
key="000102030405060708090a0b0c0d0e0f",
counter="0123456789abcdef"
)
()
()
()
}
# The section block specifies the sequence of boot commands to be written to
# the SB file
section (0) {
#1. Erase the vector table and flash config field.
erase 0..0x800;
# Step 2 and Step 3 are optional if the QuadSPI is configured at startup.
#2. Load the QCB to RAM
load qspiConfigBlock > 0x20000000;
#3. Configure QuadSPI with the QCB above
enable qspi 0x20000000;
#4. Erase the QuadSPI memory region before programming.
erase 0x68000000..0x68004000;
#5.Load the QCB above to the start address of QuadSPI memory
load qspiConfigBlock > 0x68000000;
#6. Load all boot_to_qspi_alias_memory applcation
load mySrecFile;
#7. The encrypt argument (0) specifies the keyblob parameters range of one of the keyblob entries are left unencrypted.
encrypt(0) {
# Load alias QSPI image
load myBinFile > 0x68001000;
}
#8. Load the encrypted keyblob block to specified location.
# The keywrap statement wraps (encrypts) the keyblob specified in the argument (0) using the specified Key Encryption Key (KEK) and loads the keyblob to internal flas.
# The load destination (0x1000, which is defined via keyBlobPointer in BCA) must match the defualt location (0x410) or the keyblob pointer in the Bootloader Configuraion Area(BCA) contained in the SREC image.
# Make sure the sector at 0x1000 has not been written by the srec file load above, otherwise it will need to be erased again.
keywrap (0) {
load {{000102030405060708090a0b0c0d0e0f}} > 0x1000;
}
#9. Reset target.
reset;
}
@@ -0,0 +1,40 @@
# The sources block assigns file names to identifiers
sources {
# SREC File path
mySrecFile = "boot_to_qspi_alias_memory_rom.srec";
# QCB file path
qspiConfigBlock = "qspi_config_block.bin";
# Alias QSPI image file path
myBinFile = "led_demo_qspi_alias_rom.bin";
}
# The section block specifies the sequence of boot commands to be written to
# the SB file
section (0) {
#1. Erase the vector table and flash config field.
erase 0..0x800;
# Step 2 and Step 3 are optional if the QuadSPI is configured at startup.
#2. Load the QCB to RAM
load qspiConfigBlock > 0x20000000;
#3. Configure QuadSPI with the QCB above
enable qspi 0x20000000;
#4. Erase the QuadSPI memory region before programming.
erase 0x68000000..0x68004000;
#5.Load the QCB above to the start address of QuadSPI memory
load qspiConfigBlock > 0x68000000;
#. Load all boot_to_qspi_alias_memory applcation
load mySrecFile;
#7. Load Alias QSPI image
load myBinFile > 0x68001000;
#8. Reset target.
reset;
}
@@ -0,0 +1,67 @@
# The sources block assigns file names to identifiers
sources {
# SREC File path
mySrecFile = "led_demo_QSPI.srec";
# QCB file path
qspiConfigBlock = "qspi_config_block.bin";
}
# The keyblob creates a structure with up to 4 keyblob entries.
# The empty parentheses syntax specifies an entry of all zeros (no encryption)
# Each entry consists of 4 parameters:
# start - start address of encrypted block.
# end - end address of encrypted block.
# key - AES-CTR mode encryption key for this range.
# counter - initial counter value for AES-CTR encryption for this range.
keyblob (0) {
(
start=0x68001000,
end = 0x68001fff,
key="000102030405060708090a0b0c0d0e0f",
counter="0123456789abcdef"
)
()
()
()
}
# The section block specifies the sequence of boot commands to be written to
# the SB file
section (0) {
#1. Erase the vector table and flash config field.
erase 0..0x800;
# Step 2 and Step 3 are optional if the QuadSPI is configured at startup.
#2. Load the QCB to RAM
load qspiConfigBlock > 0x20000000;
#3. Configure QuadSPI with the QCB above
enable qspi 0x20000000;
#4. Erase the QuadSPI memory region before programming.
erase 0x68000000..0x68004000;
#5.Load the QCB above to the start address of QuadSPI memory
load qspiConfigBlock > 0x68000000;
#6,7. The encrypt statement indicates that load commands should encrypt load from the srec file using AES-CTR mode encrypteion.
# The encrypt argument (0) specifies the keyblob parameters range of one of the keyblob entries are left unencrypted.
encrypt(0) {
# Load all the RO data from SREC fiel.
load mySrecFile;
}
#8. Load the encrypted keyblob block to specified location.
# The keywrap statement wraps (encrypts) the keyblob specified in the argument (0) using the specified Key Encryption Key (KEK) and loads the keyblob to internal flas.
# The load destination (0x1000, which is defined via keyBlobPointer in BCA) must match the defualt location (0x410) or the keyblob pointer in the Bootloader Configuraion Area(BCA) contained in the SREC image.
# Make sure the sector at 0x1000 has not been written by the srec file load above, otherwise it will need to be erased again.
keywrap (0) {
load {{000102030405060708090a0b0c0d0e0f}} > 0x1000;
}
#9. Reset target.
reset;
}
@@ -0,0 +1,70 @@
# The sources block assigns file names to identifiers
sources {
# SREC File path
mySrecFile = "led_demo_qspi_a000.srec";
# QCB file path
qspiConfigBlock = "qspi_config_block.bin";
}
# The keyblob creates a structure with up to 4 keyblob entries.
# The empty parentheses syntax specifies an entry of all zeros (no encryption)
# Each entry consists of 4 parameters:
# start - start address of encrypted block.
# end - end address of encrypted block.
# key - AES-CTR mode encryption key for this range.
# counter - initial counter value for AES-CTR encryption for this range.
keyblob (0) {
(
start=0x68001000,
end = 0x68001fff,
key="000102030405060708090a0b0c0d0e0f",
counter="0123456789abcdef"
)
()
()
()
}
# The section block specifies the sequence of boot commands to be written to
# the SB file
section (0) {
#1. Erase the vector table and flash config field.
erase 0xa000..0xc000;
# Step 2 and Step 3 are optional if the QuadSPI is configured at startup.
#2. Load the QCB to RAM
load qspiConfigBlock > 0x20000000;
#3. Configure QuadSPI with the QCB above
enable qspi 0x20000000;
#4. Erase the QuadSPI memory region before programming.
erase 0x68000000..0x68004000;
#5.Load the QCB above to the start address of QuadSPI memory
load qspiConfigBlock > 0x68000000;
#6,7. The encrypt statement indicates that load commands should encrypt load from the srec file using AES-CTR mode encrypteion.
# The encrypt argument (0) specifies the keyblob parameters range of one of the keyblob entries are left unencrypted.
encrypt(0) {
# Load all the RO data from SREC field.
load mySrecFile;
}
#8. Load kek to 0xb000
load {{000102030405060708090a0b0c0d0e0f}} > 0xb000;
#9. Load the encrypted keyblob block to specified location.
# The keywrap statement wraps (encrypts) the keyblob specified in the argument (0) using the specified Key Encryption Key (KEK) and loads the keyblob to internal flash.
# The load destination (0xc000, which is defined via keyBlobPointer in BCA) must match the keyblob pointer in the Bootloader Configuraion Area(BCA) contained in the SREC image.
# Make sure the sector at 0xc000 has not been written by the srec file load above, otherwise it will need to be erased again.
keywrap (0) {
load {{000102030405060708090a0b0c0d0e0f}} > 0xc000;
}
#10. Reset target.
reset;
}
@@ -0,0 +1,43 @@
# The sources block assigns file names to identifiers
sources {
# SREC File path
mySrecFile = "led_demo_qspi_patch_rom.srec";
# QCB file path
qspiConfigBlock = "qspi_config_block.bin";
# ROM patch
rom_patch = "ROM_QSPI_patch.bin";
}
# The section block specifies the sequence of boot commands to be written to
# the SB file
section (0) {
#1. Erase the internal flash
erase 0..0x3000;
# Step 2 and Step 3 are optional if the QuadSPI is configured at startup.
#2. Load the QCB to RAM
load qspiConfigBlock > 0x20000000;
#3. Configure QuadSPI with the QCB above
enable qspi 0x20000000;
#4. Load patch to RAM
load rom_patch > 0x20000200;
#5. Call patch to invoke ROM workaround
call 0x20000201 (0x20000000);
#6. Erase the QuadSPI memory region before programming.
erase 0x68000000..0x68090000;
#7.Load the QCB above to the address specified by qspiConfigBlockPointer in BCA
load qspiConfigBlock > 0x2000;
#8. Load all the RO data from srec file, including vector table, flash config field and codes.
load mySrecFile;
#9. Reset target.
reset;
}