I'm currently working on a project using CodeWarrior 7.2 (with processor expert) using the highest optimization level (Level 4). This works pretty fine.
Now I tried to compile the same project with CodeWarrior 8.0 also using optimization level 4, but my program doesn't start. When I use the debugger and "break" debugging, it shows me that the program never leaves the entry code of the processor expert.
The entry code is:
Code:void _EntryPoint(void){ /*** !!! Here you can place your own code before PE initialization using property "User code before PE initialization" on the build options tab. !!! ***/ /*** ### 56F8323 "Cpu" init code ... ***/ /*** PE initialization code after reset ***/ /* System clock initialization */ setRegBitGroup(OSCTL, TRIM, (word)getReg(FMOPT1)); /* Set the trim osc freq with factory programmed value */ setRegBit(OSCTL, CLK_MODE); /* Select an internal oscillator mode */ clrRegBit(PLLCR, PRECS); /* Select an internal clock source for the CPU core */ setRegBit(OSCTL, COPD); /* External oscillator power-down */ setReg(PLLCR, (PLLCR_LCKON_MASK | PLLCR_ZSRC0_MASK)); /* Enable PLL, LCKON and select clock source from prescaler */ /* PLLDB: LORTP=2,PLLCOD=0,PLLCID=1,—–=0,PLLDB=0x3B */ setReg16(PLLDB, 0x213B); /* Set the clock prescalers */ while(!getRegBit(PLLSR, LCK0)){} /* Wait for PLL lock */ setReg(PLLCR, (PLLCR_LCKON_MASK | PLLCR_ZSRC1_MASK)); /* Select clock source from postscaler */ /* FMCLKD: ˜™=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,DIVLD=0,PRDIV8=1,DIV=0x12 */ setReg16(FMCLKD, 0x52); /* Set the flash clock prescaler */ /*** End of PE initialization code after reset ***/ /*** !!! Here you can place your own code after PE initialization using property "User code after PE initialization" on the build options tab. !!! ***/ asm(JMP init_56800_); /* Jump to C startup code */}
The program waits for PLL lock, which is the following line:
Code: while(!getRegBit(PLLSR, LCK0)){} /* Wait for PLL lock */
To get my program running, I have to use optimization level 1.
Holger