/*############################################################# Program Name : ex1_SWV_HelloWorld Author : Grant Phillips Date Modified : 13/01/2016 Compiler : ARMmbed Tested On : STM32F4-Discovery Description : Example program that uses Trace Events to write "Hello World!" via the ST-Link programmer to the ST-Link Utility's SWO Viewer and then display a count from 0 to 255 repeatedly. The count value is also written to the 8 USER LEDs. Requirements : * STM32F4-Discovery Board Circuit : * A wire link between PB3 and pin6 of the SWD connector (CN2) OR solder the solder bridge SB12 closed underneath the board * 8 LEDs connected to PD15 - PD8 ##############################################################*/ #include "mbed.h" #include "SWO.h" //required for using printf BusOut myleds(PD_8, PD_9, PD_10, PD_11, PD_12, PD_13, PD_14, PD_15); // bit0 bit1 bit2 bit3 bit4 bit5 bit6 bit7 . . . SWO_Channel SWO; //create SWO object to communicate via ST-Link programmer int main() { uint8_t count=0; SWO.printf("Hallo World!\n"); while(1) { SWO.printf("\n%2X", count); //print a newline and integer value (in HEX) myleds = count; count = count + 1; wait(0.25); } }