Due to a problem that the Agliex™ 7 FPGA Secure Device Manager (SDM) is busy with FPGA initialization, Nios® V HAL function mailbox_client_flash_open() may fail to open flash after mailbox_client_open() when running SDM Bootloader.
To work around this problem in Agliex™ 7 FPGA Secure Device Manager, add a delayed attempt after function mailbox_client_flash_open() to open flash in the main function in <Project Location>\top_project\sw\mailbox_bootloader\app\mailbox_bootloader.c.
The max attempts shown below are 1000, and each attempt is delayed by 10 milliseconds.
attribute_((noreturn)) int main(int argc, char **argv){
intel_mailbox_client* mbox_client = mailbox_client_open(MBOX_NAME);
int record_address_ptr = PAYLOAD_OFFSET;
// Obtain exclusive flash access
int attempt = 0;
int MAX_ATTEMPTS = 1000;
while((mailbox_client_flash_open(mbox_client)!=0) &&(++attempt < MAX_ATTEMPTS)){ usleep(10000);
if (attempt == MAX_ATTEMPTS) error();
......