GNU vs GHS
I am using SPC58EC. When I compile same code with GNU and GHS(Green Hills Software) I see different results.
int main(void) {
uint8_t mode;
MC_ME.PCTL[15].R = (uint8_t)18;
mode = (uint8_t)MC_ME.MCTL.B.TARGET_MODE;
//SPCSetRunMode
/* Clearing status register bits */
MC_ME.IS.R = 0x3FU;
/* Starts a transition process.*/
MC_ME.MCTL.R = (mode << 28) | 0x5AF0UL;
MC_ME.MCTL.R = (mode << 28) | 0xA50FUL;
/* Waits for the mode switch or an error condition.*/
while (MC_ME.IS.R == 0U) {
;
}
/* Check if no error during mode switch */
if (MC_ME.IS.B.I_MTC != 1U)
{
while(1);
}
SIUL2.GPDO[88].R = 0;
SIUL2.MSCR_IO[88].R = ((2 << 24) | (1 << 23));
SIUL2.GPDO[89].R = 0;
SIUL2.MSCR_IO[89].R = ((2 << 24) | (1 << 23));
/* Application main loop.*/
for ( ; ; ) {
SIUL2.GPDO[88].R = ~SIUL2.GPDO[88].R;
SIUL2.GPDO[89].R = ~SIUL2.GPDO[89].R;
for(long i=0;i<10000000;i++);
}
}All code is this, I am not using library functions. Startup files are almost same only order of ram init, interrupt vector init etc. is different. In GNU version I can toggle LED, but in GHS version I cant modify SIUL2 registers, so I cant do settings or toggle the output. Why is this happening? Cant we compile SPC5 studio example codes with GHS?
