Start other cores in the program and run another program in it

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

Start other cores in the program and run another program in it

Jump to solution
1,243 Views
thomasbao
Contributor II

Hi,

    I am developed CAN Bootloader for MPC57485G. And now, I want to start CPU1 and CPU2 and perform some other functions in CPU1 and CPU2 after jumping from bootloader to APP (single-core program, CPU0) , how this should be done?

    Thanks.

0 Kudos
1 Solution
1,184 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

You have two options:

- start CPU1/CPU2 right before jumping to APP0 on CPU0 and then jump to the APP0 on CPU0

- or you can only jump to APP0 on CPU0 and this APP0 can start CPU1/CPU2 as needed in its own code.

Regards,

Lukas

View solution in original post

0 Kudos
5 Replies
1,238 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi Thomas,

here is an example how to start other cores:

/* Enable e200z4b and e200z2 cores in RUN0-RUN3, DRUN and SAFE modes */
MC_ME.CCTL[2].R = 0x00FC; /* e200z4b is active */
MC_ME.CCTL[3].R = 0x00FC; /* e200z2 is active */

/* Set start address for e200z4b and e200z2 cores */
MC_ME.CADDR[2].R = E200Z4B_BOOT_ADDRESS | 1; /* e200z4b boot address + RMC bit */
MC_ME.CADDR[3].R = E200Z2_BOOT_ADDRESS | 1; /* e200z2 boot address + RMC bit */

/* Mode change - re-enter the DRUN mode to start cores */
MC_ME.MCTL.R = 0x30005AF0; /* Mode & Key */
MC_ME.MCTL.R = 0x3000A50F; /* Mode & Key inverted */

while(MC_ME.GS.B.S_MTRANS == 1); /* Wait for mode entry complete */
while(MC_ME.GS.B.S_CURRENT_MODE != 0x3); /* Check DRUN mode entered */

Regards,

Lukas

0 Kudos
1,220 Views
thomasbao
Contributor II

Hi, Lukas

 

But how can I use CPU1 and CPU2 to execute other programs?

 

Regards,

Lukas

0 Kudos
1,199 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi Thomas,

when creating new project in S32DS, you can select which cores are used and you can adjust the memory layout if needed:

lukaszadrapa_0-1634535657023.png

Then three projects are created, each with own startup files, own linker file etc... 

So you can have three "independent" applications. But it's necessary to keep in mind that the resources are shared.

Regards,

Lukas

0 Kudos
1,188 Views
thomasbao
Contributor II

Hi, Lukas

I know this, but my question is how do I get CPU1 to run APP1 at the same time after I jump from bootloader to CPU0's APP0.

Thanks.

0 Kudos
1,185 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

You have two options:

- start CPU1/CPU2 right before jumping to APP0 on CPU0 and then jump to the APP0 on CPU0

- or you can only jump to APP0 on CPU0 and this APP0 can start CPU1/CPU2 as needed in its own code.

Regards,

Lukas

0 Kudos