Debugging tool for mbed enabled microcontrollers, especially for NUCLEO-F303RE and STM32F042F6P6.
Diff: Debug.h
- Revision:
- 17:5b0dd2a6b130
- Parent:
- 16:7fc964b6d127
- Child:
- 18:472b66aeb1f5
--- a/Debug.h Mon Jun 03 19:36:48 2019 +0000 +++ b/Debug.h Mon Jun 03 19:51:15 2019 +0000 @@ -4,7 +4,6 @@ //------------------------------------------------------------------------------------------------------------------ #include "mbed.h" #include <stdlib.h> -#include "SWO.h" @@ -183,7 +182,7 @@ * * while(1){ * deb.breakpoint(); - * pwm = pwm + 0.1; + * pwm = pwm + 0.1f; * wait(2); * } * } @@ -393,69 +392,3 @@ }; -//------------------------------------------------------------------------------------------------------------------ -/** Debug_swo class. - * - * Example program: - * @code - * // ---------------------------------------------------------------------------- - * // Author: Lukas Bielesch - * // Department of Measurement, Czech technical university in Prague, Czech Republic - * // Date of publication: 15. Apr 2019 - * // ---------------------------------------------------------------------------- - * #include "Debug.h" - * AnalogIn analog(PA_4); - * PwmOut pwm(PA_6); - * DigitalOut out(PA_5); - * Debug_swo pc; - * - * int main(){ - * pc.format(2,2,1,3);//breakpoint count,line number, address, value - * pc.breakpoint(__LINE__,0x48000001, 2); - * DigitalOut out2 (PA_0); - * pc.breakpoint(__LINE__,0x48000014, -3); - * AnalogIn analog2 (PA_1); - * pc.breakpoint(__LINE__,0x48000008); - * - * while(1){ - * wait(1); - * } - * } - * @endcode - */ -class Debug_swo { -public: - - /** Create object of Debug_swo class - */ - Debug_swo(); - - /** Set format of breakpoint message - * @param break_number format of number of actual breakpoint: 0->not show, 1->show in hexadecimal, 2->show in decimal(default) - * @param line format of line of actual breakpoint: 0->not show, 1->show in hexadecimal, 2->show in decimal(default) - * @param address format of address of register: 0->not show, 1->show in hexadecimal(default), 2->show in decimal - * @param value format of register value: 0->not show, 1->show in hexadecimal, 2->show in decimal, 3->show in binary(default) - */ - void format(int break_number = 2, int line = 2, int address = 1, int value = 3); - - /** Perform one breakpoint and print one register value - * @param line_number line number of breakpoint, macro __LINE__ is recommended - * @param address address of register , must be divisible by 4 - */ - void breakpoint(int line_number, uint32_t address, int number_of_words = 1); - - -protected: -// objects: - SWO_Channel pc; //debug serial device -// variables: - int breakpoint_count; //number of the current breakpoint - int count_format; // format of breakpoint count, 0->not show, 1->show in hexadecimal, 2->show in decimal - int line_format; // format of lineof breakpoint, 0->not show, 1->show in hexadecimal, 2->show in decimal - int address_format; // format of address of register, 0->not show, 1->show in hexadecimal, 2->show in decimal - int register_format;// format of register value, 0->not show, 1->show in hexadecimal, 2->show in decimal, 3->show in binary -// functions - // initialization function - void init(); - -}; \ No newline at end of file