optimization problem

thomas84 wrote on Tuesday, April 03, 2012:

Hello there,

i made the uIP Webserver DEmo run on a nxp lpc1758 using LPCxpresso and the Keil MCB1700! It works fine while optimization is -O0. If I change it to for example -O2 the programm stucks here:

if( uxTasksDeleted > ( unsigned portBASE_TYPE ) 0U )

this is line 2062 in tasks.c.

Has someone had the same problem or a equivalent? I think i need to change some variables to volatile but until now it does not work. Has someone an idea what to do?

Thanks and regards

rtel wrote on Tuesday, April 03, 2012:

The line of code you reference is in the idle task - so it is not getting stuck there, it just looks like the idle task is running.  The idle task will run when there are no other tasks that are able to run. 

I would expect the code to run at all optimisation levels.  Have you changed any code from the provided examples (presumably so to interface to the PHY on the MCB hardware?).


thomas84 wrote on Wednesday, April 04, 2012:

These are the things i changed:

setupEMACHardware ( // LPC_PINCON->PINSEL3 = ( LPC_PINCON->PINSEL3 & ~0x0000000F ) | 0x00000005;
                      LPC_PINCON->PINSEL4 &= ~0x000F0000;
                      LPC_GPIO2->FIODIR |=  0x00000100; )

prvwritePHY+readPHY (the software MII Management for LPC175x)