Hello,
I am trying to test secure boot through SPI2 slave. I am using the (modifief) code frome the SecureBoot_Open example project.
If I use an empty hook function I can bootload unsigned ldr files.
uint32_t spimBootCommand = 0x212; //(Spi, use SPI2, slave mode)
adi_rom_Boot(0,BITM_ROM_BFLAG_HOOK,0,&ConfigureForSecureBoot,spimBootCommand);
For secure boot I use the hook function:
int32_t ConfigureForSecureBoot (ADI_ROM_BOOT_CONFIG * pBootConfig, ROM_HOOK_CALL_CAUSE cause)
{
if (cause == ROM_HOOK_CALL_INIT_COMPLETE)
{
//return 0; //test: normal boot
/* executed after kernel has completed boot peripheral initialization */
/* 1. Set the boot type to secure */
pBootConfig->bootType = ADI_ROM_SECURE_BOOT;
/* 2. Set they key type to custom ( this disables reading the key from OTP ) */
pBootConfig->keyType = ADI_ROM_CUSTOM_SECURITY;
// 3. load the key to be used, this is the key that would normally be read from OTP
//configureBlx (pBootConfig);
configureBlp (pBootConfig);
}
else
{
/* executed after the initial boot kernel configuration is completed */
//nothing to do
}
return 0;
}
The keys are set accordingly.
In secure boot setup, after writing 1024 bytes to the SPI from host, the SPI does not accept any more data and the when checking the bf704 with the debugger it seems to have entered the ROM error handler:
040026ba: NOP;
040026bc: R0=0x59(X);
040026c0: [0x20004008]=R0;
040026c8: R0=-0x2152bc00;
040026d0: [0x20040428]=R0;
040026d8: IDLE;
040026da: JUMP.S -0x2; <- PC points here
So what's possibly going wrong? Are there any errorcodes stored somewhere?
I have tried BLp and BLx files (and matching hook function settings) but makes no difference.