This simple little program may not work.
#include <stdio.h>
int main(void) {
printf("Hello, world! Now sleeping for 5 seconds.\n");
cyg_thread_delay(5*100);
printf("Back from the dead :-)\n");
}
Why? Because "cyg_thread_delay()" takes a cyg_tick_count_t argument, which
is typically a "long long" value. The compiler doesn't know this and without
any sort of prototypes and/or casts, it will send the wrong sort of value
to cyg_thread_delay(). In most cases, this will cause an arbitrarily long
delay!
Solution? Simply add this line:
#include <cyg/kernel/kapi.h>
This will define the native eCos kernel API, as well as prototypes for
all of the kernel functions. et voila! |