Index: boards/ST_STM32F4_DISCOVERY/board.h
===================================================================
--- boards/ST_STM32F4_DISCOVERY/board.h	(revision 2723)
+++ boards/ST_STM32F4_DISCOVERY/board.h	(working copy)
@@ -27,6 +27,7 @@
 #define BOARD_ST_STM32F4_DISCOVERY
 #define BOARD_NAME                  "STMicroelectronics STM32F4-Discovery"
 
+#define STM32_LSECLK			32768
 
 /*
  * Board oscillators-related settings.
Index: os/kernel/src/chdebug.c
===================================================================
--- os/kernel/src/chdebug.c	(revision 2723)
+++ os/kernel/src/chdebug.c	(working copy)
@@ -114,7 +114,7 @@
 void dbg_check_lock(void) {
 
   if ((dbg_isr_cnt != 0) || (dbg_lock_cnt != 0))
-    chDbgPanic("SV#4");
+    chDbgPanic("SV#4 misplaced chSysLock()");
   dbg_enter_lock();
 }
 
@@ -138,7 +138,7 @@
 void dbg_check_lock_from_isr(void) {
 
   if ((dbg_isr_cnt <= 0) || (dbg_lock_cnt != 0))
-    chDbgPanic("SV#6");
+    chDbgPanic("SV#6 misplaced chSysLockFromIsr");
   dbg_enter_lock();
 }
 
@@ -193,7 +193,7 @@
 void chDbgCheckClassI(void) {
 
   if ((dbg_isr_cnt < 0) || (dbg_lock_cnt <= 0))
-    chDbgPanic("SV#10");
+    chDbgPanic("SV#10 misplaced I-class function");
 }
 
 /**
@@ -268,10 +268,11 @@
  *
  * @param[in] msg       the pointer to the panic message string
  */
+
+void chDbgPanic3(const char *msg, char * file, int line);
+
 void chDbgPanic(const char *msg) {
-
-  dbg_panic_msg = msg;
-  chSysHalt();
+	chDbgPanic3(msg, __FILE__, __LINE__);
 }
 #endif /* CH_DBG_ENABLED */
 
Index: os/ports/GCC/ARMCMx/chcore_v7m.h
===================================================================
--- os/ports/GCC/ARMCMx/chcore_v7m.h	(revision 2723)
+++ os/ports/GCC/ARMCMx/chcore_v7m.h	(working copy)
@@ -36,6 +36,8 @@
 #ifndef _CHCORE_V7M_H_
 #define _CHCORE_V7M_H_
 
+#include "chdebug.h"
+
 /*===========================================================================*/
 /* Port constants.                                                           */
 /*===========================================================================*/
@@ -486,6 +488,8 @@
 #define port_wait_for_interrupt()
 #endif
 
+void chDbgStackOverflowPanic(Thread *otp);
+
 /**
  * @brief   Performs a context switch between two threads.
  * @details This is the most critical code in any port, this function
@@ -502,7 +506,7 @@
 #define port_switch(ntp, otp) {                                             \
   register struct intctx *r13 asm ("r13");                                  \
   if ((stkalign_t *)(r13 - 1) < otp->p_stklimit)                            \
-    chDbgPanic("stack overflow");                                           \
+    chDbgStackOverflowPanic(otp);                                           \
   _port_switch(ntp, otp);                                                   \
 }
 #endif
Index: os/ports/GCC/ARMCMx/rules.mk
===================================================================
--- os/ports/GCC/ARMCMx/rules.mk	(revision 2723)
+++ os/ports/GCC/ARMCMx/rules.mk	(working copy)
@@ -60,7 +60,7 @@
 ASFLAGS   = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.s=.lst)) $(ADEFS)
 ASXFLAGS  = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.S=.lst)) $(ADEFS)
 CFLAGS    = $(MCFLAGS) $(OPT) $(COPT) $(CWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.c=.lst)) $(DEFS)
-CPPFLAGS  = $(MCFLAGS) $(OPT) $(CPPOPT) $(CPPWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.cpp=.lst)) $(DEFS)
+CPPFLAGS  = $(MCFLAGS) $(CPPOPT) $(CPPWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.cpp=.lst)) $(DEFS)
 ifeq ($(USE_LINK_GC),yes)
   LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch,--gc-sections $(LLIBDIR)
 else
@@ -113,7 +113,7 @@
 $(BUILDDIR) $(OBJDIR) $(LSTDIR):
 ifneq ($(USE_VERBOSE_COMPILE),yes)
 	@echo Compiler Options
-	@echo $(CC) -c $(CFLAGS) -I. $(IINCDIR) main.c -o main.o
+	@echo $(CPPC) -c $(CPPFLAGS) -I. $(IINCDIR) main.cpp -o main.o -llibstd++
 	@echo
 endif
 	mkdir -p $(OBJDIR)
