Insert this into contiki platform.c and main ():
struct process *p; uint8_t ps; int n; int main(void) /*contiki main() here */ { n=0; while(1) { //... //... /*************************************************************/ if(n==100) { uint8_t ps=process_nevents(); PRINTF("there are %u events in the queue", ps); PRINTF("\n\n"); PRINTF("Processes:"); for(p = PROCESS_LIST(); p != NULL; p = p->next) { char namebuf[30]; strncpy(namebuf, PROCESS_NAME_STRING(p), sizeof(namebuf)); PRINTF("%s", namebuf); PRINTF("\n\n"); n=0; } } n +=1; /*********************************************************************/ //... //... } return 0; }
this will output the current processes every 100th iteration of the main loop
if you use UART as a debug port, you need to redirect the output of PRINTF () to the correct port, i.e. to atmega128rfa1
/* Second rs232 port for debugging or slip alternative */ rs232_init(RS232_PORT_1, USART_BAUD_9600,USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8); /* Redirect stdout */ /*
The source code for the contiki shell contains very useful commands that can be easily used for debugging without using the entire shell, see http://anrg.usc.edu/contiki/index.php/Contiki_Shell
source share