Hi again,
someone posted on the Platform Builder forum that the H4 sample provided with PB6 has an example that copies code into SRAM for execution during suspend/resume.
For a test I am attempting to copy just the OALCPUEnterWFi function into internal ram and excecute however I cannot seem to even copy the function without causing the CPU to halt.
Here is the code I am using for power.c:
#define IRAM_API_SUSPEND (OALPAtoCA(CSP_BASE_MEM_PA_IRAM))
VOID OALCPUPowerOff(void) {
void (*suspend_func_ptr)();
int suspend_func_size;
....
up to the clock enabling after the comment
// Need to keep the following clocks gated on for successful handshake
....
suspend_func_ptr = (void*)IRAM_API_SUSPEND;
suspend_func_size = (UINT32)OALCPUEnterWFI_sz - (UINT32)OALCPUEnterWFI + 256; //include constants
memcpy(suspend_func_ptr, OALCPUEnterWFI, suspend_func_size );
LED_ON();
// OALCPUEnterWFI();
suspend_func_ptr();
LED_OFF();
....
}
And my wfi.s file looks like:
LEAF_ENTRY OALCPUEnterWFI
mov r0,#0
mcr p15, 0, r0, c7, c0, 4 ; Enter WFI
RETURN
LEAF_ENTRY OALCPUEnterWFI_sz
;Entry used to calculate the size of the function
nop
nop
ENTRY_END
END
Does anyone have any ideas?
Cheers.