/**************************************************************************//** * @brief Main function * The main function demonstrates two ITM trace features; * First printf is utilized to print strings to trace channel 0. * Then a while loop demonstrates how to send data to another * ITM channel, specifically channel 1. *****************************************************************************/ int main(void) { int i; volatile int testpoint; SWO_Setup(); BSP_TraceEtmSetup(); /* The below line can be used for trace start or stop breakpoints. */ testpoint = 0; printf("hello world\n"); /* The below line can be used for trace start or stop breakpoints. */ testpoint; /* If the eAcommander-commandline readswo feature us used, printing ENDSWO will abort the eAcommander session. */ printf("ENDSWO"); /* This while loop increments i and sends the variable to ITM trace channel 1, notice that printf used ITM channel 0. */ while(1){ /* First we need to wait until the ITM buffer is ready to accept new data. */ while (ITM_Port32(0) == 0); /* Use the define at the top of this file to write to the correct ITM-port address. */ ITM_Port32(1) = i++; } }
int fputc(int ch, FILE *f) { if (DEMCR & TRCENA) { while (ITM_Port32(0) == 0); ITM_Port8(0) = ch; } return(ch); }
/**************************************************************************//** * @brief Main function * The main function demonstrates two ITM trace features; * First printf is utilized to print strings to trace channel 0. * Then a while loop demonstrates how to send data to another * ITM channel, specifically channel 1. *****************************************************************************/ int main(void) { int i; /* Configures the SWO to output both printf-information, PC-samples and interrupt trace. */ SWO_Setup(); printf("hello world\n"); /* If the energyAware Commander command line readswo feature us used, printing ENDSWO will abort the eAcommander session. */ printf("ENDSWO"); /* This while loop increments i and sends the variable to ITM trace channel 1, notice that printf used ITM channel 0. */ while(1){ /* First we need to wait until the ITM buffer is ready to accept new data. */ while (ITM_Port32(0) == 0); /* Use the define at the top of this file to write to the correct ITM-port address. */ ITM_Port32(1) = i++; } }