Debugging tool for mbed enabled microcontrollers, especially for NUCLEO-F303RE and STM32F042F6P6.

Revision:
3:3d7837ae4a37
Parent:
0:e36b454cc2e6
Child:
6:1ee26b7b9c2f
--- a/debug_register_print.cpp	Mon May 06 00:32:53 2019 +0000
+++ b/debug_register_print.cpp	Mon May 06 21:16:37 2019 +0000
@@ -24,44 +24,55 @@
 
 // perform one breakpoint and print one register
 //------------------------------------------------------------------------------------------------------------------  
-void Debug_register_print::breakpoint(int line_number, uint32_t address, uint32_t offset){
+void Debug_register_print::breakpoint(int line_number, uint32_t address, uint32_t offset, int number_of_words){
 
+    address += offset;
+    address -= address%4;
 
     breakpoint_count++;
 
-    if( count_format == 1){
-        pc.printf("Break no. 0x%3x  ",breakpoint_count);
-    }else if( count_format == 2){
-        pc.printf("Break no. %3d  ",breakpoint_count);
-    }
+    for (int i = 0; i < abs(number_of_words); i++){
+        
+        if( count_format == 1){
+            pc.printf("Break no. 0x%3x  ",breakpoint_count);
+        }else if( count_format == 2){
+            pc.printf("Break no. %3d  ",breakpoint_count);
+        }
+        
+        if( line_format == 1){
+            pc.printf("Line no. 0x%3x  ",line_number);
+        }else if( line_format == 2){
+            pc.printf("Line no. %3d  ",line_number);
+        }
     
-    if( line_format == 1){
-        pc.printf("Line no. 0x%3x  ",line_number);
-    }else if( line_format == 2){
-        pc.printf("Line no. %3d  ",line_number);
-    }
-
-    if( address_format == 1){
-        pc.printf("Address 0x%8x  ", address + offset);
-    }else if( address_format == 2){
-        pc.printf("Address %10u  ", address + offset);
+        if( address_format == 1){
+            pc.printf("Address 0x%8x  ", address);
+        }else if( address_format == 2){
+            pc.printf("Address %10u  ", address);
+        }
+        
+        uint32_t reg = read_word(address, 0);
+        
+        if( register_format == 1){
+            pc.printf("Value 0x%8x  ", reg);
+        }else if( register_format == 2){
+            pc.printf("Value %10u  ", reg);
+        }else if( register_format == 3){
+            pc.printf("Value ");
+            for (int i = 0; i < 32; i++){
+                if (i%4 == 0) pc.printf(" ");
+                pc.printf("%d",reg >> (31 - i));
+                reg -= ((reg >> (31 - i)) << (31 - i));
+            }
+        }
+        pc.printf("\n\r");
+        if (number_of_words > 0){
+            address += 4;
+        }else{
+            address -= 4;            
+        }
+        
     }
-    
-    uint32_t reg = read_word(address, offset);
-    
-    if( register_format == 1){
-        pc.printf("Value 0x%8x  ", reg);
-    }else if( register_format == 2){
-        pc.printf("Value %10u  ", reg);
-    }else if( register_format == 3){
-        pc.printf("Value ");
-        for (int i = 0; i < 32; i++){
-            if (i%4 == 0) pc.printf(" ");
-            pc.printf("%d",reg >> (31 - i));
-            reg -= ((reg >> (31 - i)) << (31 - i));
-        }
-    }
-    pc.printf("\n\r");