Hi
I think your M4 code, should just kick off the A5 by setting the entry_point of the A5 code just before waking it up.
/* Set entry function for secondary core. */
SRC->GPR[2] = a5_entry_point_address;
/* Wakes up the secondary (non-master) core. */
CCM->CCOWR = 0x15a5a;
/* Keep Primary core waiting for interrupt (WFI) */
__asm(" wfi");
This is the same way it is used when A5 is the primary code. I think it should also applied when M4 is the primary.
Regarding Question number2
In DS5 you can generate a project for the A5 code and generate a c array output from the elf output by
setting a Post-build step like this
fromelf --cadcombined a5Project.axf --output a5ProjectImage.c
Then you can use another quadspi loader project that initializes, erase and configure the QuadSPI on writing mode.
(Please refer to the quadspi-load project in the set of examples released)
This project will place in DDR or SRAM the object file for the a5ProjectImage then at runtime you can copy the contents to the QuadSPI. You only need to add the a5ProjectImage.c and modify the DDR_QuadSPI_Load scatter file to add the name of the corresponding object file.
; External applicatin is at this location and used to program QuadSPI memory
EXTERNAL_APPLICATION 0x80080000
{
EXTERNAL_CODE +0
{
a5ProjectImage.o(+RW)
}
EXTERNAL_CODE_END ImageLImit(EXTERNAL_CODE) EMPTY 0 {}
}
Be aware that you need to --keep=a5ProjectImage.o to the linker options