Booting Flash

Hi, 

Can anyone verify that the main structure is correct?, or if not, what is the correct way. 

I want to write/read the .ldr into flash, and then boot the flash to run the application. Here is my main structure:

void main(void)
{
Init_pinmux();
Init_SPI2();
Verify_flash_codes();

Erase_flash(WR_Block_ID, sizeof(Write_BUFF));
Write_flash(WR_Block_ID, Write_BUFF, sizeof(Write_BUFF));
Read_flash (RD_Block_ID, Read_BUFF, sizeof(Read_BUFF));

//Boot command

uint32_t spimBootCommand = ((ENUM_ROM_BCMD_DEVICE_SPI) |
(0x2 << BITP_ROM_BCMD_SPIM_SPEED) |
(0x2 << BITP_ROM_BCMD_SPIM_ADDR) |
(0x1 << BITP_ROM_BCMD_SPIM_BCODE) |
(ENUM_ROM_BCMD_DEVENUM_2));

adi_rom_Boot(SPIADDR,BITM_ROM_BFLAG_HOOK,0,&ConfigureForSecureBoot, spimBootCommand);


}

Can I use the adi_rom_Boot() just after flash read is finished?. Anyway, I am not able to boot the flash and it is hanging in adi_rom_Boot().

Thanks