I'm currently using a MPC5746C, and i'm trying to startup the second core(z2), but without any success.
The SW application is really simple, as this is just for a demo project.
What I have done so far:
In the startup file for core0, I have the following code in the beginning:
; RCHW/ Boot header placement
.org base ; RCHW location ; base is set to 0x00FA0000
.long RCHW_VALUE ; This value is set to 0x005A0002
.long _start2 ; CPU2 entry point --> 0x00fa4020
.long _start ; CPU0 entry point
.long 0 ;
; Startup code
/*A lot of RAM init code and so on...*
e_b main ; Jump to main
/*interrupt vectors allocated below*/
#define KEY_VALUE1 0x5AF0ul
#define KEY_VALUE2 0xA50Ful
uint32_t mctl = MC_ME.MCTL.R;
/* enable core 2 in all modes */
MC_ME.CCTL3.R = 0x00FE;
/* Set Start address for core 2: Will reset and start */
MC_ME.CADDR3.R = (0x00fa4020 <<2) | 0x1;
MC_ME.MCTL.R = (mctl & 0xffff0000ul) | KEY_VALUE1;
MC_ME.MCTL.R = (mctl & 0xffff0000ul) | KEY_VALUE2; /* key value 2 always from MCTL */
The main code is taken from a example in "S32 Design studio Power Architecture" I donwloaded from NXP.com
core2 startup code:
; Startup code
; Write 8000 dec to 0x40000500 in RAM
The main idea about this code:
I want to startup core2, and write a value(8000) to the memory address 0x40000500 ( This address is set to zero in core0's startup code).
When I run this, it seems that core2 does not start up at all, as the address 0x40000500 still is zero after some time.
Or maybe core2 is starting up, but running somewhere else...
I have a breakpoint in core0's _start function, so I don't think that any resets is occurring. The core0s is running as expected, and ends up in my while(1) loop.
I can see the following in the debugger:
Current mode is DRUN
Both cores seems to be running according to the register:
The ADDR register is set as I expect:
Does someone have any idea what I have forgot?