corestar
Contributor
5 years agoBug in "Simple Socket Server" example.
I'm using Quartus 18.0 Std and generated the "Simple Socket Server" with BSP. There is a bug in led.c:
while(1) { /* Wait 50 milliseconds between pattern updates, to make the pattern slow * enough for the human eye, and more impotantly, to give up control so * MicroC/OS-II can schedule other lower priority tasks. */ OSTimeDlyHMSM(0,0,0,1000);
Besides the fact that it says it wants a 50 ms delay and appears to be try and generate a 1000 ms delay, the code for OSTimeDlyHMSM in os_time.c has the following:
if (hours == 0) { if (minutes == 0) { if (seconds == 0) { if (ms == 0) { return (OS_ERR_TIME_ZERO_DLY); } } } } if (minutes > 59) { return (OS_ERR_TIME_INVALID_MINUTES); /* Validate arguments to be within range */ } if (seconds > 59) { return (OS_ERR_TIME_INVALID_SECONDS); } if (ms > 999) { return (OS_ERR_TIME_INVALID_MS); }
So if ms is > 999, as it is here, the function fails.
And I have to wonder why the first part was not written:
if (hours == 0 && minutes == 0 && seconds == 0 && ms == 0) { return (OS_ERR_TIME_ZERO_DLY); }