Why the same program for a MCF51QE128 run on CW10 eclipse work slower than on CW 6.3 Clasic IDE?

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

Why the same program for a MCF51QE128 run on CW10 eclipse work slower than on CW 6.3 Clasic IDE?

621 Views
euge
Contributor I

Hi

I regularly work with CW6.3 classic IDE and now I'm trying CW10 eclipse and have found that the following code works in CW10 slower than CW6.3.

I could not import the file classic project , so I made a new bareboard project and then copy the files.c on sources and files.h on Project_ Headers.

This way I could compile,  install code on microcontroller, debug step by step and run  without problem.

the only thing I've found is that when I work on CW10 The program runs slower

Working on CW6.3 function  Delay_ms(1) generates a 1ms delay tested with osciloscope.

Working on CW10 function  Delay_ms(1) generates a 1,7ms delay tested with osciloscope.

What will be the problem?

Best Regards

Eugenio

 

void main(void)

{

  InitSystems();

  Conf_Clock();

  ConfTIM1();

  ConfPuertosGPF51();

 

 

for(;;)

{

  oLED_Z=1;                 //oLED_Z is PTCD_PTCD3 OUT1

  Delay_ms(1);

  oLED_Z=0;

  Delay_ms(1);

  oLED_Z=1;

  Delay_ms(1);

  oLED_Z=0;

  Delay_ms(1);

}

}

 

void InitSystems()

{

  SOPT1  = 0x23;                 // Disable COP,RSTO, enable STOP,BKGD,RESET

  SOPT2  = 0x00;                          // SPI1 on PTB2/3/4/5, IIC1 on PTA2/3

  SPMSC1 = 0x00;                          // Disable LVD

  SPMSC2 = 0x00;                          // Disable power-down modes

  SPMSC3 = 0x00;                          // Disable LVWIE, low trip points

  SCGC1  = 0xFF;                          // Enable bus clock to peripherals

  SCGC2  = 0xFF;                          // Enable bus clock to peripherals

}

 

void Conf_Clock(void)

{

//Modo FEE  con cristal 32,768 KHz

//sigo la AN99 or AN3499

 

//ICS Control Register 2 (ICSC2)

//  bit7-6  bit 5  bit 4 bit 3  bit 2   bit 1     bit 0

// --------- --------- --------- --------- --------- ---------- ---------

// | BDIV | RANGE | HGO | LP | EREFS | ERCLKEN | EREFSTEN|

// ------------------- --------- --------- --------- ---------- ---------

// | 0  0 |   0   |  0  |  0 |   1   |     1   |     0   |

// ------------------- --------- --------- --------- ---------- ---------

/////////////////////////////////////////////////////////////////////////

ICSC2_BDIV=0;      //==>dBDIV=1 divisor de bus clock tabla12-4 pag251

 

ICSC2_RANGE=0;     //uso cristal baja frecuencia Low Freq range selected

ICSC2_HGO=0;       //Ext Osc configured for low gain, low power

ICSC2_LP=0;        //FLL is not disabled in bypass modes

 

ICSC2_EREFS=1;     //External Ref clock selected

ICSC2_ERCLKEN=1;   //External Ref clock enable

ICSC2_EREFSTEN=0;  //External Ref clock disable en stop

 

// Loop until OSCINIT = 1 =>crystal selected by EREFS bit has been init

while(ICSSC_OSCINIT!=1);

 

//ICS Control Register 1 (ICSC1)

// bit 7-6 bit 5-4-3  bit 2   bit 1     bit 0

// ----------------------------------------------

// | CLKS |   RDIV  | IREFS |IRCLKEN |IREFSTEN |

// ------------------- --------- --------- ------

// | 0  0 | 0  0  0 |   0   |   0    |    0    |

// ------------------- --------- --------- ------

/////////////////////////////////////////////////////////////////////////

ICSC1_CLKS=0;   //selecciono fuente del clock via FLL

                //00 --> la fuente es la salidad FLL

 

ICSC1_RDIV=0;   //==>dRDIV=1 divisor de la ref del clock

                //32.768kHz/1 = 32.768kHz   tabla12-3 pag250

                //RANGE=0 porque el cristal es de baja frecuencia

 

ICSC1_IREFS=0;  //elijo el clock externo como fuente del FLL

ICSC1_IRCLKEN=0;   //internal reference clock inactivo

ICSC1_IREFSTEN=0;  //internal reference clock in stop

 

//loop until IREFST = 0 - indicates ext ref is current source

while(ICSSC_IREFST!=0);

 

//loop until CLKST = 00 - indiates ext ref clk selected to feed ICSOUT

while(ICSSC_CLKST!=0b00);

 

ICSSC_DMX32 =1;    //1==>Fine Tuned for max frec a 32,768KHz

                   //de tabla12-7 pag253 ==>FLL factor=1216

ICSSC_DRST_DRS =1; //00==>low Rangue

 

}

//fbus=(fref/dRDIV) x (FFL factor)/dBDIV)

//fbus= (32,768KHz/2*1) x (1216/1) = 19923000 Hz teorico

//ciclo de maquina 50,193nseg  teorico

Original Attachment has been moved to: CW10-vs-Clasic-soft.txt.zip

Labels (1)
0 Kudos
1 Reply

398 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Eugenio Mendez,

The program might be running slower on CodeWarrior 10.6 because of the Optimization Options in the compiler, you can modify these options by going to Project>>Properties>>C/C++ Build>>Settings>>ColdFire Compiler>>Optimization:

pastedImage_0.png

The option "Speed vs Size" allows you to optimize the code for a faster execution speed, you can find more information on the chapter 3.3.2.5 in the CodeWarrior Development Studio for Microcontrollers V10.x ColdFire Build Tools Reference Manual located at C:\Freescale\CW MCU v10.6\MCU\Help\PDF\MCU_ColdFire_Compiler.pdf.

Regards!

Carlos

0 Kudos