ADSP-SC572 Second stage loader won't boot main app with ad-_rom_boot()

Hi,

I made a second stage loader for a custom board with an SC572 chipset, but when I try booting from SPI flash using the adi_rom_boot() function it never works.

I tested that the loader works because when I write to the flash at address 0x00 it boots normally with the OTP bootloader.

I followed the documentation, and this is how I call the function.

 uint32_t boot_address = FLASH_XIP_BASE_ADDR + APP_OFFSET;
 uint32_t boot_cmd = (
        ENUM_ROM_BCMD_SPIM_DEVENUM_2 |
        ENUM_ROM_BCMD_SPIM_DEVICE_SPIXIP |
        ENUM_ROM_BCMD_SPIM_BCODE_D
    );

adi_rom_Boot((void *)boot_address, 0, 0, 0, boot_cmd);

any help would be appreciated, thank you!

Best,

Fabien