c'è la possibilità di elencare tutti i processi in esecuzione in contiki os e di produrre il risultato sull'output di debug (cioè UART)?Elenco di tutti i processi in esecuzione in Contiki OS
6
A
risposta
3
Inserire questo nel platform.c Contiki e 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;
}
questa uscita volontà i processi in esecuzione ad ogni iterazione 100 ° del ciclo principale
se si utilizza UART come il debug porta che avete reindirizzare l'output di PRINTF() alla porta corretta cioè sulla 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 */
/* #if RF230BB_CONF_LEDONPORTE1 || defined(RAVEN_LCD_INTERFACE) */
rs232_redirect_stdout(RS232_PORT_1);
il contik Il codice sorgente di shell contiene comandi molto utili che possono essere facilmente utilizzati per il debug senza utilizzare l'intera shell, vedere http://anrg.usc.edu/contiki/index.php/Contiki_Shell