aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-02-14 18:20:33 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-02-14 18:20:33 +0000
commitfa9b36aff3676a897503a359314d08db8fc5a09d (patch)
treed7cbfc124faa41fa4ca14c270a178139931df8ad
parent50708b39516b77397dc76195ab963aa5909e48b0 (diff)
downloadChibiOS-fa9b36aff3676a897503a359314d08db8fc5a09d.tar.gz
ChibiOS-fa9b36aff3676a897503a359314d08db8fc5a09d.tar.bz2
ChibiOS-fa9b36aff3676a897503a359314d08db8fc5a09d.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@766 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--demos/ARM7-AT91SAM7X-GCC/chconf.h25
-rw-r--r--demos/ARM7-AT91SAM7X-WEB-GCC/chconf.h25
-rw-r--r--demos/ARM7-LPC214x-G++/chconf.h25
-rw-r--r--demos/ARM7-LPC214x-GCC-minimal/chconf.h25
-rw-r--r--demos/ARM7-LPC214x-GCC/chconf.h25
-rw-r--r--demos/ARMCM3-STM32F103-GCC/chconf.h25
-rw-r--r--demos/AVR-AT90CANx-GCC/chconf.h25
-rw-r--r--demos/AVR-ATmega128-GCC/chconf.h25
-rw-r--r--demos/MSP430-MSP430x1611-GCC/chconf.h25
-rw-r--r--demos/Win32-MinGW/chconf.h25
-rw-r--r--docs/Doxyfile2
-rw-r--r--docs/index.html2
-rw-r--r--ports/ARMCM3/chcore.c2
-rw-r--r--readme.txt8
-rw-r--r--src/chdebug.c67
-rw-r--r--src/chheap.c2
-rw-r--r--src/chschd.c6
-rw-r--r--src/chsys.c4
-rw-r--r--src/chthreads.c6
-rw-r--r--src/include/ch.h4
-rw-r--r--src/include/debug.h32
-rw-r--r--src/include/threads.h6
-rw-r--r--src/templates/chconf.h25
23 files changed, 254 insertions, 162 deletions
diff --git a/demos/ARM7-AT91SAM7X-GCC/chconf.h b/demos/ARM7-AT91SAM7X-GCC/chconf.h
index f05f8b0b5..588445ee0 100644
--- a/demos/ARM7-AT91SAM7X-GCC/chconf.h
+++ b/demos/ARM7-AT91SAM7X-GCC/chconf.h
@@ -310,21 +310,30 @@
#endif
/**
- * Debug option, if enableed includes basic debug support to the kernel.
- * @note The debug support is port-dependent, it may be not present on some
- * targets. In that case stub functions will be included.
+ * Debug option, if enabled all the assertions in the kernel code are
+ * activated. This includes function parameters checks and consistency
+ * checks inside the kernel.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_DEBUG
-#define CH_USE_DEBUG FALSE
+#ifndef CH_DBG_ENABLE_ASSERTS
+#define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/**
- * Debug option, includes the threads context switch tracing feature.
+ * Debug option, if enabled the context switch circular trace buffer is
+ * activated.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_TRACE
-#define CH_USE_TRACE FALSE
+#ifndef CH_DBG_ENABLE_TRACE
+#define CH_DBG_ENABLE_TRACE FALSE
+#endif
+
+/**
+ * Debug option, if enabled the threads working area is filled with a byte
+ * pattern when a thread is created.
+ */
+#ifndef CH_DBG_FILL_THREADS
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
diff --git a/demos/ARM7-AT91SAM7X-WEB-GCC/chconf.h b/demos/ARM7-AT91SAM7X-WEB-GCC/chconf.h
index f05f8b0b5..588445ee0 100644
--- a/demos/ARM7-AT91SAM7X-WEB-GCC/chconf.h
+++ b/demos/ARM7-AT91SAM7X-WEB-GCC/chconf.h
@@ -310,21 +310,30 @@
#endif
/**
- * Debug option, if enableed includes basic debug support to the kernel.
- * @note The debug support is port-dependent, it may be not present on some
- * targets. In that case stub functions will be included.
+ * Debug option, if enabled all the assertions in the kernel code are
+ * activated. This includes function parameters checks and consistency
+ * checks inside the kernel.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_DEBUG
-#define CH_USE_DEBUG FALSE
+#ifndef CH_DBG_ENABLE_ASSERTS
+#define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/**
- * Debug option, includes the threads context switch tracing feature.
+ * Debug option, if enabled the context switch circular trace buffer is
+ * activated.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_TRACE
-#define CH_USE_TRACE FALSE
+#ifndef CH_DBG_ENABLE_TRACE
+#define CH_DBG_ENABLE_TRACE FALSE
+#endif
+
+/**
+ * Debug option, if enabled the threads working area is filled with a byte
+ * pattern when a thread is created.
+ */
+#ifndef CH_DBG_FILL_THREADS
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
diff --git a/demos/ARM7-LPC214x-G++/chconf.h b/demos/ARM7-LPC214x-G++/chconf.h
index f05f8b0b5..588445ee0 100644
--- a/demos/ARM7-LPC214x-G++/chconf.h
+++ b/demos/ARM7-LPC214x-G++/chconf.h
@@ -310,21 +310,30 @@
#endif
/**
- * Debug option, if enableed includes basic debug support to the kernel.
- * @note The debug support is port-dependent, it may be not present on some
- * targets. In that case stub functions will be included.
+ * Debug option, if enabled all the assertions in the kernel code are
+ * activated. This includes function parameters checks and consistency
+ * checks inside the kernel.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_DEBUG
-#define CH_USE_DEBUG FALSE
+#ifndef CH_DBG_ENABLE_ASSERTS
+#define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/**
- * Debug option, includes the threads context switch tracing feature.
+ * Debug option, if enabled the context switch circular trace buffer is
+ * activated.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_TRACE
-#define CH_USE_TRACE FALSE
+#ifndef CH_DBG_ENABLE_TRACE
+#define CH_DBG_ENABLE_TRACE FALSE
+#endif
+
+/**
+ * Debug option, if enabled the threads working area is filled with a byte
+ * pattern when a thread is created.
+ */
+#ifndef CH_DBG_FILL_THREADS
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
diff --git a/demos/ARM7-LPC214x-GCC-minimal/chconf.h b/demos/ARM7-LPC214x-GCC-minimal/chconf.h
index 03352998a..bebe419b2 100644
--- a/demos/ARM7-LPC214x-GCC-minimal/chconf.h
+++ b/demos/ARM7-LPC214x-GCC-minimal/chconf.h
@@ -310,21 +310,30 @@
#endif
/**
- * Debug option, if enableed includes basic debug support to the kernel.
- * @note The debug support is port-dependent, it may be not present on some
- * targets. In that case stub functions will be included.
+ * Debug option, if enabled all the assertions in the kernel code are
+ * activated. This includes function parameters checks and consistency
+ * checks inside the kernel.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_DEBUG
-#define CH_USE_DEBUG FALSE
+#ifndef CH_DBG_ENABLE_ASSERTS
+#define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/**
- * Debug option, includes the threads context switch tracing feature.
+ * Debug option, if enabled the context switch circular trace buffer is
+ * activated.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_TRACE
-#define CH_USE_TRACE FALSE
+#ifndef CH_DBG_ENABLE_TRACE
+#define CH_DBG_ENABLE_TRACE FALSE
+#endif
+
+/**
+ * Debug option, if enabled the threads working area is filled with a byte
+ * pattern when a thread is created.
+ */
+#ifndef CH_DBG_FILL_THREADS
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
diff --git a/demos/ARM7-LPC214x-GCC/chconf.h b/demos/ARM7-LPC214x-GCC/chconf.h
index f05f8b0b5..588445ee0 100644
--- a/demos/ARM7-LPC214x-GCC/chconf.h
+++ b/demos/ARM7-LPC214x-GCC/chconf.h
@@ -310,21 +310,30 @@
#endif
/**
- * Debug option, if enableed includes basic debug support to the kernel.
- * @note The debug support is port-dependent, it may be not present on some
- * targets. In that case stub functions will be included.
+ * Debug option, if enabled all the assertions in the kernel code are
+ * activated. This includes function parameters checks and consistency
+ * checks inside the kernel.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_DEBUG
-#define CH_USE_DEBUG FALSE
+#ifndef CH_DBG_ENABLE_ASSERTS
+#define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/**
- * Debug option, includes the threads context switch tracing feature.
+ * Debug option, if enabled the context switch circular trace buffer is
+ * activated.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_TRACE
-#define CH_USE_TRACE FALSE
+#ifndef CH_DBG_ENABLE_TRACE
+#define CH_DBG_ENABLE_TRACE FALSE
+#endif
+
+/**
+ * Debug option, if enabled the threads working area is filled with a byte
+ * pattern when a thread is created.
+ */
+#ifndef CH_DBG_FILL_THREADS
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
diff --git a/demos/ARMCM3-STM32F103-GCC/chconf.h b/demos/ARMCM3-STM32F103-GCC/chconf.h
index f05f8b0b5..588445ee0 100644
--- a/demos/ARMCM3-STM32F103-GCC/chconf.h
+++ b/demos/ARMCM3-STM32F103-GCC/chconf.h
@@ -310,21 +310,30 @@
#endif
/**
- * Debug option, if enableed includes basic debug support to the kernel.
- * @note The debug support is port-dependent, it may be not present on some
- * targets. In that case stub functions will be included.
+ * Debug option, if enabled all the assertions in the kernel code are
+ * activated. This includes function parameters checks and consistency
+ * checks inside the kernel.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_DEBUG
-#define CH_USE_DEBUG FALSE
+#ifndef CH_DBG_ENABLE_ASSERTS
+#define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/**
- * Debug option, includes the threads context switch tracing feature.
+ * Debug option, if enabled the context switch circular trace buffer is
+ * activated.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_TRACE
-#define CH_USE_TRACE FALSE
+#ifndef CH_DBG_ENABLE_TRACE
+#define CH_DBG_ENABLE_TRACE FALSE
+#endif
+
+/**
+ * Debug option, if enabled the threads working area is filled with a byte
+ * pattern when a thread is created.
+ */
+#ifndef CH_DBG_FILL_THREADS
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
diff --git a/demos/AVR-AT90CANx-GCC/chconf.h b/demos/AVR-AT90CANx-GCC/chconf.h
index 5e787d675..da4744a16 100644
--- a/demos/AVR-AT90CANx-GCC/chconf.h
+++ b/demos/AVR-AT90CANx-GCC/chconf.h
@@ -310,21 +310,30 @@
#endif
/**
- * Debug option, if enableed includes basic debug support to the kernel.
- * @note The debug support is port-dependent, it may be not present on some
- * targets. In that case stub functions will be included.
+ * Debug option, if enabled all the assertions in the kernel code are
+ * activated. This includes function parameters checks and consistency
+ * checks inside the kernel.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_DEBUG
-#define CH_USE_DEBUG FALSE
+#ifndef CH_DBG_ENABLE_ASSERTS
+#define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/**
- * Debug option, includes the threads context switch tracing feature.
+ * Debug option, if enabled the context switch circular trace buffer is
+ * activated.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_TRACE
-#define CH_USE_TRACE FALSE
+#ifndef CH_DBG_ENABLE_TRACE
+#define CH_DBG_ENABLE_TRACE FALSE
+#endif
+
+/**
+ * Debug option, if enabled the threads working area is filled with a byte
+ * pattern when a thread is created.
+ */
+#ifndef CH_DBG_FILL_THREADS
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
diff --git a/demos/AVR-ATmega128-GCC/chconf.h b/demos/AVR-ATmega128-GCC/chconf.h
index 5e787d675..da4744a16 100644
--- a/demos/AVR-ATmega128-GCC/chconf.h
+++ b/demos/AVR-ATmega128-GCC/chconf.h
@@ -310,21 +310,30 @@
#endif
/**
- * Debug option, if enableed includes basic debug support to the kernel.
- * @note The debug support is port-dependent, it may be not present on some
- * targets. In that case stub functions will be included.
+ * Debug option, if enabled all the assertions in the kernel code are
+ * activated. This includes function parameters checks and consistency
+ * checks inside the kernel.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_DEBUG
-#define CH_USE_DEBUG FALSE
+#ifndef CH_DBG_ENABLE_ASSERTS
+#define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/**
- * Debug option, includes the threads context switch tracing feature.
+ * Debug option, if enabled the context switch circular trace buffer is
+ * activated.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_TRACE
-#define CH_USE_TRACE FALSE
+#ifndef CH_DBG_ENABLE_TRACE
+#define CH_DBG_ENABLE_TRACE FALSE
+#endif
+
+/**
+ * Debug option, if enabled the threads working area is filled with a byte
+ * pattern when a thread is created.
+ */
+#ifndef CH_DBG_FILL_THREADS
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
diff --git a/demos/MSP430-MSP430x1611-GCC/chconf.h b/demos/MSP430-MSP430x1611-GCC/chconf.h
index f24019fcd..e270a6ccf 100644
--- a/demos/MSP430-MSP430x1611-GCC/chconf.h
+++ b/demos/MSP430-MSP430x1611-GCC/chconf.h
@@ -310,21 +310,30 @@
#endif
/**
- * Debug option, if enableed includes basic debug support to the kernel.
- * @note The debug support is port-dependent, it may be not present on some
- * targets. In that case stub functions will be included.
+ * Debug option, if enabled all the assertions in the kernel code are
+ * activated. This includes function parameters checks and consistency
+ * checks inside the kernel.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_DEBUG
-#define CH_USE_DEBUG FALSE
+#ifndef CH_DBG_ENABLE_ASSERTS
+#define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/**
- * Debug option, includes the threads context switch tracing feature.
+ * Debug option, if enabled the context switch circular trace buffer is
+ * activated.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_TRACE
-#define CH_USE_TRACE FALSE
+#ifndef CH_DBG_ENABLE_TRACE
+#define CH_DBG_ENABLE_TRACE FALSE
+#endif
+
+/**
+ * Debug option, if enabled the threads working area is filled with a byte
+ * pattern when a thread is created.
+ */
+#ifndef CH_DBG_FILL_THREADS
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h
index ac7131871..396f8d9a1 100644
--- a/demos/Win32-MinGW/chconf.h
+++ b/demos/Win32-MinGW/chconf.h
@@ -310,21 +310,30 @@
#endif
/**
- * Debug option, if enableed includes basic debug support to the kernel.
- * @note The debug support is port-dependent, it may be not present on some
- * targets. In that case stub functions will be included.
+ * Debug option, if enabled all the assertions in the kernel code are
+ * activated. This includes function parameters checks and consistency
+ * checks inside the kernel.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_DEBUG
-#define CH_USE_DEBUG FALSE
+#ifndef CH_DBG_ENABLE_ASSERTS
+#define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/**
- * Debug option, includes the threads context switch tracing feature.
+ * Debug option, if enabled the context switch circular trace buffer is
+ * activated.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_TRACE
-#define CH_USE_TRACE FALSE
+#ifndef CH_DBG_ENABLE_TRACE
+#define CH_DBG_ENABLE_TRACE FALSE
+#endif
+
+/**
+ * Debug option, if enabled the threads working area is filled with a byte
+ * pattern when a thread is created.
+ */
+#ifndef CH_DBG_FILL_THREADS
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
diff --git a/docs/Doxyfile b/docs/Doxyfile
index e785dccc3..a7d3a256d 100644
--- a/docs/Doxyfile
+++ b/docs/Doxyfile
@@ -31,7 +31,7 @@ PROJECT_NAME = ChibiOS/RT
# This could be handy for archiving the generated documentation or
# if some version control system is used.
-PROJECT_NUMBER = 1.1.0unstable
+PROJECT_NUMBER = 1.1.1unstable
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
diff --git a/docs/index.html b/docs/index.html
index 6543c3647..f499e90a5 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -14,7 +14,7 @@
<td style="text-align: center; vertical-align: top; width: 150px;">Current
Versions<br>
1.0.0 stable<br>
-1.1.0 unstable<br>
+1.1.1 unstable<br>
-<br>
<a href="http://sourceforge.net/projects/chibios/" rel="me" target="_top">Project on SourceForge</a><br>
<a href="html/index.html" target="_top" rel="me">Documentation</a><br>
diff --git a/ports/ARMCM3/chcore.c b/ports/ARMCM3/chcore.c
index cd568a509..2e247289a 100644
--- a/ports/ARMCM3/chcore.c
+++ b/ports/ARMCM3/chcore.c
@@ -182,7 +182,7 @@ void PendSVVector(void) {
/* set the round-robin time quantum */
rlist.r_preempt = CH_TIME_QUANTUM;
#endif
-#if CH_USE_TRACE
+#if CH_DBG_ENABLE_TRACE
chDbgTrace(otp, currp);
#endif
sp_thd = currp->p_ctx.r13;
diff --git a/readme.txt b/readme.txt
index d14a92d3d..9ee439f12 100644
--- a/readme.txt
+++ b/readme.txt
@@ -73,14 +73,18 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
*****************************************************************************
*** 1.1.1unstable ***
-- FIX: fixed a small problem in the chcore.c template file.
+- FIX: Fixed a small problem in the chcore.c template file.
+- FIX: Fixed wrong assertions in chThdWait() and chHeapFree() (backported in
+ stable branch).
+- NEW: Mode flexible debug configuration options, removed the old CH_USE_DEBUG
+ and CH_USE_TRACE.
*** 1.1.0unstable ***
- FIX: Modified the default value for the STM32 HSI setup it was 1, it should
be 0x10 (backported in stable branch).
- FIX: Removed an obsolete constant (P_SUSPENDED) from thread.h (backported in
stable branch).
-- FIX: Removed unused field mp_grow in the MemoryPool structure (backported in
+- FIX: Removed unused field mp_grow in the MemoryPool structure (backported in
stable branch).
- NEW: Added to the STM32 demo makefile an option to build ChibiOS/RT with the
full STM32 FWLib 2.03. **NOTE**, except for the makefile option, the
diff --git a/src/chdebug.c b/src/chdebug.c
index 4a16e2d2a..63d5090ee 100644
--- a/src/chdebug.c
+++ b/src/chdebug.c
@@ -26,58 +26,57 @@
#include <ch.h>
-#if CH_USE_DEBUG
-
-char *panicmsg;
+#if CH_DBG_ENABLE_TRACE
+/**
+ * @brief Public trace buffer.
+ */
+TraceBuffer trace_buffer;
/**
- * @brief Debug subsystem initialization.
+ * @brief Trace circular buffer subsystem initialization.
*/
-void debug_init(void) {
+void trace_init(void) {
-#if CH_USE_TRACE
- dbgtb.tb_size = TRACE_BUFFER_SIZE;
- dbgtb.tb_ptr = &dbgtb.tb_buffer[0];
-#endif
+ trace_buffer.tb_size = TRACE_BUFFER_SIZE;
+ trace_buffer.tb_ptr = &trace_buffer.tb_buffer[0];
}
-
/**
- * @brief Prints a panic message on the console/debugger and then halts the
- * system.
+ * @brief Inserts in the circular debug trace buffer a context switch record.
*
- * @param msg the pointer to the message string
+ * @param otp the thread being switched out
+ * @param ntp the thread to be resumed
*/
-void chDbgPanic(char *msg) {
+void chDbgTrace(Thread *otp, Thread *ntp) {
- panicmsg = msg;
- chSysPuts("PANIC: ");
- chSysPuts(msg);
- chSysHalt();
+ trace_buffer.tb_ptr->cse_wtobjp = otp->p_wtobjp;
+ trace_buffer.tb_ptr->cse_time = chSysGetTime();
+ trace_buffer.tb_ptr->cse_state = otp->p_state;
+ trace_buffer.tb_ptr->cse_tid = (unsigned)ntp >> 4;
+ if (++trace_buffer.tb_ptr >= &trace_buffer.tb_buffer[TRACE_BUFFER_SIZE])
+ trace_buffer.tb_ptr = &trace_buffer.tb_buffer[0];
}
+#endif /* CH_DBG_ENABLE_TRACE */
-#if CH_USE_TRACE
+#if CH_DBG_ENABLE_ASSERTS
/**
- * @brief Public trace buffer.
+ * @brief Pointer to the panic message.
+ * @details This pointer is meant to be accessed through the debugger, it is
+ * written once and then the system is halted.
*/
-TraceBuffer dbgtb;
+char *panic_msg;
/**
- * @brief Inserts in the circular debug trace buffer a context switch record.
+ * @brief Prints a panic message on the console and then halts the system.
*
- * @param otp the thread being switched out
- * @param ntp the thread to be resumed
+ * @param msg the pointer to the panic message string
*/
-void chDbgTrace(Thread *otp, Thread *ntp) {
+void chDbgPanic(char *msg) {
- dbgtb.tb_ptr->cse_wtobjp = otp->p_wtobjp;
- dbgtb.tb_ptr->cse_time = chSysGetTime();
- dbgtb.tb_ptr->cse_state = otp->p_state;
- dbgtb.tb_ptr->cse_tid = (unsigned)ntp >> 4;
- if (++dbgtb.tb_ptr >= &dbgtb.tb_buffer[TRACE_BUFFER_SIZE])
- dbgtb.tb_ptr = &dbgtb.tb_buffer[0];
+ panic_msg = msg;
+ chSysPuts("PANIC: ");
+ chSysPuts(msg);
+ chSysHalt();
}
-#endif /* CH_USE_TRACE */
-
-#endif /* CH_USE_DEBUG */
+#endif /* CH_DBG_ENABLE_ASSERTS */
/** @} */
diff --git a/src/chheap.c b/src/chheap.c
index 5193f19b8..f2bcc2b9e 100644
--- a/src/chheap.c
+++ b/src/chheap.c
@@ -162,7 +162,7 @@ void chHeapFree(void *p) {
while (TRUE) {
- chDbgAssert((hp < qp) && (hp >= LIMIT(qp)), "chheap.c, chHeapFree() #2");
+ chDbgAssert((hp < qp) || (hp >= LIMIT(qp)), "chheap.c, chHeapFree() #2");
if (((qp == &heap.free) || (hp > qp)) &&
((qp->h_next == NULL) || (hp < qp->h_next))) {
diff --git a/src/chschd.c b/src/chschd.c
index a07db5737..e3f4d9e0d 100644
--- a/src/chschd.c
+++ b/src/chschd.c
@@ -88,7 +88,7 @@ void chSchGoSleepS(tstate_t newstate) {
#if CH_USE_ROUNDROBIN
rlist.r_preempt = CH_TIME_QUANTUM;
#endif
-#if CH_USE_TRACE
+#if CH_DBG_ENABLE_TRACE
chDbgTrace(otp, currp);
#endif
chSysSwitchI(otp, currp);
@@ -171,7 +171,7 @@ void chSchWakeupS(Thread *ntp, msg_t msg) {
#if CH_USE_ROUNDROBIN
rlist.r_preempt = CH_TIME_QUANTUM;
#endif
-#if CH_USE_TRACE
+#if CH_DBG_ENABLE_TRACE
/* trace the context switch */
chDbgTrace(otp, ntp);
#endif
@@ -194,7 +194,7 @@ void chSchDoRescheduleI(void) {
#if CH_USE_ROUNDROBIN
rlist.r_preempt = CH_TIME_QUANTUM;
#endif
-#if CH_USE_TRACE
+#if CH_DBG_ENABLE_TRACE
chDbgTrace(otp, currp);
#endif
chSysSwitchI(otp, currp);
diff --git a/src/chsys.c b/src/chsys.c
index 2b48278af..db1e7f955 100644
--- a/src/chsys.c
+++ b/src/chsys.c
@@ -61,11 +61,13 @@ void chSysInit(void) {
port_init();
scheduler_init();
- debug_init();
vt_init();
#if CH_USE_HEAP
heap_init();
#endif
+#if CH_DBG_ENABLE_TRACE
+ trace_init();
+#endif
/*
* Now this instructions flow becomes the main thread.
diff --git a/src/chthreads.c b/src/chthreads.c
index 58f2b46d5..e91c4c18f 100644
--- a/src/chthreads.c
+++ b/src/chthreads.c
@@ -55,7 +55,7 @@ Thread *init_thread(Thread *tp, tprio_t prio) {
return tp;
}
-#if CH_USE_DEBUG
+#if CH_DBG_FILL_THREADS
static void memfill(uint8_t *p, uint32_t n, uint8_t v) {
while (n)
@@ -91,7 +91,7 @@ Thread *chThdInit(void *workspace, size_t wsize,
chDbgAssert((wsize >= THD_WA_SIZE(0)) && (prio <= HIGHPRIO) &&
(workspace != NULL) && (pf != NULL),
"chthreads.c, chThdInit()");
-#if CH_USE_DEBUG
+#if CH_DBG_FILL_THREADS
memfill(workspace, wsize, MEM_FILL_PATTERN);
#endif
SETUP_CONTEXT(workspace, wsize, pf, arg);
@@ -327,7 +327,7 @@ msg_t chThdWait(Thread *tp) {
msg_t msg;
chSysLock();
- chDbgAssert((tp != NULL) && (tp != currp) && (tp->p_waiting != NULL),
+ chDbgAssert((tp != NULL) && (tp != currp) && (tp->p_waiting == NULL),
"chthreads.c, chThdWait()");
if (tp->p_state != PREXIT) {
tp->p_waiting = currp;
diff --git a/src/include/ch.h b/src/include/ch.h
index 8303d90f6..ec53b4197 100644
--- a/src/include/ch.h
+++ b/src/include/ch.h
@@ -35,7 +35,7 @@
/**
* Kernel version string.
*/
-#define CH_KERNEL_VERSION "1.1.0unstable"
+#define CH_KERNEL_VERSION "1.1.1unstable"
/**
* Kernel version major number.
@@ -50,7 +50,7 @@
/**
* Kernel version patch number.
*/
-#define CH_KERNEL_PATCH 0
+#define CH_KERNEL_PATCH 1
/*
* Common values.
diff --git a/src/include/debug.h b/src/include/debug.h
index 37400d967..ac9034a8b 100644
--- a/src/include/debug.h
+++ b/src/include/debug.h
@@ -27,8 +27,6 @@
#ifndef _DEBUG_H_
#define _DEBUG_H_
-#if CH_USE_DEBUG
-
/**
* @brief Trace buffer entries.
*/
@@ -62,25 +60,13 @@ typedef struct {
CtxSwcEvent tb_buffer[TRACE_BUFFER_SIZE]; /**< Ring buffer.*/
} TraceBuffer;
-extern CtxSwcEvent *dbgnext;
-extern TraceBuffer dbgtb;
-extern char *dbglastmsg;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
- void debug_init(void);
- void chDbgPanic(char *msg);
-#ifdef __cplusplus
-}
-#endif
-
+#if CH_DBG_ENABLE_ASSERTS
/**
* Condition assertion, if the condition check fails then the kernel panics
* with the specified message.
* @param c the condition to be verified to be true
* @param m the text message
- * @note The condition is tested only if the @p CH_USE_DEBUG switch is
+ * @note The condition is tested only if the @p CH_DBG_ENABLE_ASSERTS switch is
* specified in @p chconf.h else the macro does nothing.
*/
#define chDbgAssert(c, m) { \
@@ -88,23 +74,27 @@ extern "C" {
chDbgPanic(m); \
}
-#else /* !CH_USE_DEBUG */
+#else /* !CH_DBG_ENABLE_ASSERTS */
-#define debug_init()
#define chDbgPanic(msg) {}
#define chDbgAssert(c, m) {(void)(c);}
-#endif /* CH_USE_DEBUG */
+#endif /* !CH_DBG_ENABLE_ASSERTS */
-#if CH_USE_TRACE
#ifdef __cplusplus
extern "C" {
#endif
+#if CH_DBG_ENABLE_TRACE
+ extern TraceBuffer trace_buffer;
void chDbgTrace(Thread *otp, Thread *ntp);
+#endif
+#if CH_DBG_ENABLE_ASSERTS
+ extern char *panic_msg;
+ void chDbgPanic(char *msg);
+#endif
#ifdef __cplusplus
}
#endif
-#endif /* CH_USE_TRACE */
#endif /* _DEBUG_H_ */
diff --git a/src/include/threads.h b/src/include/threads.h
index 29ed7f21f..be48fcbb3 100644
--- a/src/include/threads.h
+++ b/src/include/threads.h
@@ -59,6 +59,8 @@ struct Thread {
msg_t p_rdymsg; /**< Thread wakeup code.*/
msg_t p_exitcode; /**< The thread exit code
(@p PREXIT state).*/
+ void *p_wtobjp; /**< Generic kernel object pointer used
+ for opaque access.*/
#if CH_USE_SEMAPHORES
Semaphore *p_wtsemp; /**< Semaphore where the thread is
waiting on (@p PRWTSEM state).*/
@@ -79,10 +81,6 @@ struct Thread {
eventmask_t p_ewmask; /**< Enabled events mask (@p PRWTOREVT
or @p PRWTANDEVT states).*/
#endif
-#if CH_USE_TRACE
- void *p_wtobjp; /**< Generic kernel object pointer used
- for opaque access.*/
-#endif
};
/*
* Start of the optional fields.
diff --git a/src/templates/chconf.h b/src/templates/chconf.h
index f05f8b0b5..3338d5b3f 100644
--- a/src/templates/chconf.h
+++ b/src/templates/chconf.h
@@ -310,21 +310,30 @@
#endif
/**
- * Debug option, if enableed includes basic debug support to the kernel.
- * @note The debug support is port-dependent, it may be not present on some
- * targets. In that case stub functions will be included.
+ * Debug option, if enabled all the assertions in the kernel code are
+ * activated. This includes function parameters checks and consistency
+ * checks inside the kernel.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_DEBUG
-#define CH_USE_DEBUG FALSE
+#ifndef CH_DBG_ENABLE_ASSERTS
+#define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/**
- * Debug option, includes the threads context switch tracing feature.
+ * Debug option, if enabled the context switch circular trace buffer is
+ * activated.
* @note The default is @p FALSE.
*/
-#ifndef CH_USE_TRACE
-#define CH_USE_TRACE FALSE
+#ifndef CH_DBG_ENABLE_TRACE
+#define CH_DBG_ENABLE_TRACE FALSE
+#endif
+
+/**
+ * Debug option, if enabled the threads working area is filled with a byte
+ * pattern when a thread is created.
+ */
+#ifndef CH_DBG_FILL_THREADS
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**