Place code at specific memory location (internal ram) in Win CE

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Place code at specific memory location (internal ram) in Win CE

532 Views
andrew_questps
Contributor III

Hi all,

We are having an issue with suspend/resume with the iMX25 in WinCE6. We are entering STOP mode and powering off the 24MHz oscillator and we are finding that sometimes the unit fails to resume from suspend.

There is an errata for the iMX25 http://www.freescale.com/files/dsp/doc/errata/IMX25CE.pdf that states that if powering off the 24MHz clock it is necessary to run the code that controls this process in internal ram, and then reconfigure the SDRAM before resuming executing from SDRAM, as the PLL can lock at a lower frequency when leaving STOP mode. If I leave the 24MHz clock running I can suspend and resume successfully. Mind you when it fails it is 1 out of 40/50, so it doesn't happen every time. I've tried lowering the clock frequency before entering STOP mode but that doesn't seem to resolve the issue.

How do I get WinCE to place the OEMPowerOff() function into internal RAM? I can see where the SDMA uses internal RAM for buffers for audio but in that case they are just specifically mapping a block of memory to read and write from, not calling functions at that address.

Any pointers would be appreciated!

Andre

Labels (2)
0 Kudos
1 Reply

355 Views
andrew_questps
Contributor III

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.

0 Kudos