Debug tools / show registers, memory and system clock data

Dependencies:   mbed CheckRTC

Target mbed board

LPC1768
LPC1114FN28
ST Nucleo L152RE
ST NUcleo F401RE
ST Nucleo F411RE

Command structure

Top

1 - goto step1 -> no connection all pins
2 - goto step2 -> connects pin_x and pin_y (not impliment yet)
t - Check and set RTC
x - Goto HW monitor
q - Return to main

>1

l - Check LED
b - Check button
s - CPU system info & clock
o - CPU clock output (Bug fix, port_mco1_mco2_set() function. Thanks Topi Makinen on April 25th, 2015)

>x(Hardware level monitor)

m - Entry Memory Mode
m>? -> Aditinal functions can see by ?
r - Entry Register Mode
r>? -> Aditinal functions can see by ?
s - System Clock -> sf, System / CPU information -> sc
q - Quit (back to called routine)
p - Entry Port Mode
p>? -> Aditinal functions can see by ?

Usage

Please modify "mon_hw_config.h" file for your purpose.
Especially LPC114FN28 has small memory, you cannot run your own program together with this program.
You don't need any additional HW. Just connect with PC via terminal software.

CAUTION

Due to several CPU's and short development time, I cannot grantee the quality level and several functions are not available yet.
If you found the bug, please let me know. Thanks in advance.

Revision:
2:b96103f9270e
Parent:
1:84813f6b798e
--- a/main.cpp	Tue Oct 14 11:09:00 2014 +0000
+++ b/main.cpp	Sun Nov 02 09:28:26 2014 +0000
@@ -5,7 +5,7 @@
  *  http://www.page.sannet.ne.jp/kenjia/index.html
  *  http://mbed.org/users/kenjiArai/
  *      Created: May        5th, 2014
- *      Revised: October   14th, 2014
+ *      Revised: Nobember   2nd, 2014
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
@@ -16,86 +16,26 @@
 
 //  Include ---------------------------------------------------------------------------------------
 #include "mbed.h"
-#if !defined(TARGET_LPC1114)
-#include "rtos.h"
-#endif
 
 //  Definition ------------------------------------------------------------------------------------
-#define USE_COM         // use Communication with PC(UART)
-
-#ifdef USE_COM
-#define BAUD(x)         pc.baud(x)
-#define GETC(x)         pc.getc(x)
-#define PUTC(x)         pc.putc(x)
-#define PRINTF(...)     pc.printf(__VA_ARGS__)
-#define READABLE(x)     pc.readable(x)
-#else
-#define BAUD(x)         {;}
-#define GETC(x)         {;}
-#define PUTC(x)         {;}
-#define PRINTF(...)     {;}
-#define READABLE(x)     {;}
-#endif
 
 //  Object ----------------------------------------------------------------------------------------
-DigitalOut myled(LED1);
-#if defined(TARGET_NUCLEO_L152RE) || defined(TARGET_NUCLEO_F401RE)
-DigitalIn usr_sw(PC_13);
-#endif
-Serial pc(USBTX, USBRX);
 
 //  RAM -------------------------------------------------------------------------------------------
-uint8_t print_control_flag = 0;
-uint32_t count;
 
 //  ROM / Constant data ---------------------------------------------------------------------------
 
 //  Function prototypes ---------------------------------------------------------------------------
 
 //  Function prototypes ---------------------------------------------------------------------------
-extern int mon(void);
-extern void put_rn ( void );
+extern void debug_interface(void);
 
 //-------------------------------------------------------------------------------------------------
 //  Control Program
 //-------------------------------------------------------------------------------------------------
-#if defined(TARGET_NUCLEO_L152RE)||defined(TARGET_NUCLEO_F401RE)||defined(TARGET_LPC1768)
-
-void data_output(void)
-{
-    PRINTF( "Count: %d", count);
-    put_rn();
-}
-
-void led1_thread(void const *args)
-{
-    while (true) {
-        myled = !myled;
-        count++;
-        if (print_control_flag) {
-            data_output();
-        }
-        Thread::wait(1000);
-    }
-}
-
-int main()
-{
-    Thread thread(led1_thread);
-
-    while (true) {
-        mon();
-    }
-}
-
-#endif  // defined(TARGET_NUCLEO_L152RE)||defined(TARGET_NUCLEO_F401RE)||defined(TARGET_LPC1768)
-
-#if defined(TARGET_LPC1114)
-// Only for LPC1114
 int main()
 {
     while (true) {
-        mon();
+        debug_interface();
     }
 }
-#endif  // defined(TARGET_LPC1114)