Added debug level opt in configure and re-enabled debug macros.
--- a/configure Sat May 12 23:07:48 2007 +0200
+++ b/configure Sun May 13 10:29:08 2007 +0200
@@ -101,10 +101,7 @@
echo "On user request: Won't optimize with \"-Ox\"";;
--disable-dll) DISABLE_DLL=1;
echo "On user request: Won't create and link to dll";;
- --debug) DEBUG=1;
- echo "Debug messages enabled !!";;
- --debugPDO) DEBUG=PDO;
- echo "Debug messages (PDO) enabled !!";;
+ --debug=*) DEBUG=$optarg;;
--MAX_CAN_BUS_ID=*) MAX_CAN_BUS_ID=$1;;
--SDO_MAX_LENGTH_TRANSFERT=*) SDO_MAX_LENGTH_TRANSFERT=$1;;
--SDO_MAX_SIMULTANEOUS_TRANSFERTS=*) SDO_MAX_SIMULTANEOUS_TRANSFERTS=$1;;
@@ -137,8 +134,10 @@
echo " --timers=foo Use 'foo' as TIMERS driver (can be either 'unix' or 'xeno')"
echo " --disable-dll Disable run-time dynamic linking of can, led and nvram drivers"
echo " --disable-Ox Disable gcc \"-Ox\" optimizations."
- echo " --debug Enable debug messages."
- echo " --debugPDO Enable debug messages, using PDO."
+ echo " --debug=foo Enable debug messages, ERR -> only errors, WAR)."
+ echo " \"PDO\" send errors and warnings through PDO messages"
+ echo " \"ERR\" errors only, to stdout"
+ echo " \"WAR\" errors and warnings, to stdout"
echo
echo "Stack compilation constants"
echo " --MAX_CAN_BUS_ID [=1] Number of can bus to use"
@@ -593,12 +592,16 @@
###########################################################################
# DEBUG DEFINES/CFLAGS #
###########################################################################
-if [ "$DEBUG" != "" ]; then
- SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DDEBUG_CAN\ -DDEBUG_WAR_CONSOLE_ON\ -DDEBUG_ERR_CONSOLE_ON\ -g
+if [ "$DEBUG" = "WAR" ]; then
+ SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DDEBUG_WAR_CONSOLE_ON\ -DDEBUG_ERR_CONSOLE_ON\ -g
+fi
+
+if [ "$DEBUG" = "ERR" ]; then
+ SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DDEBUG_ERR_CONSOLE_ON\ -g
fi
if [ "$DEBUG" = "PDO" ]; then
- SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DPDO_ERROR
+ SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DDEBUG_WAR_CONSOLE_ON\ -DDEBUG_ERR_CONSOLE_ON\ -g\ -DPDO_ERROR
fi
if [ "$DISABLE_OPT" = "1" ]; then
--- a/include/unix/applicfg.h Sat May 12 23:07:48 2007 +0200
+++ b/include/unix/applicfg.h Sun May 13 10:29:08 2007 +0200
@@ -78,8 +78,8 @@
/* Definition of MSG_ERR */
/* --------------------- */
#ifdef DEBUG_ERR_CONSOLE_ON
-# define MSG_ERR(num, str, val)/* \
- printf("%s,%d : 0X%x %s 0X%x \n",__FILE__, __LINE__,num, str, val);*/
+# define MSG_ERR(num, str, val) \
+ printf("%s,%d : 0X%x %s 0X%x \n",__FILE__, __LINE__,num, str, val);
#else
# define MSG_ERR(num, str, val)
#endif
@@ -87,8 +87,8 @@
/* Definition of MSG_WAR */
/* --------------------- */
#ifdef DEBUG_WAR_CONSOLE_ON
-# define MSG_WAR(num, str, val)/* \
- printf("%s,%d : 0X%x %s 0X%x \n",__FILE__, __LINE__,num, str, val);*/
+# define MSG_WAR(num, str, val) \
+ printf("%s,%d : 0X%x %s 0X%x \n",__FILE__, __LINE__,num, str, val);
#else
# define MSG_WAR(num, str, val)
#endif
--- a/src/states.c Sat May 12 23:07:48 2007 +0200
+++ b/src/states.c Sun May 13 10:29:08 2007 +0200
@@ -75,11 +75,11 @@
#define StartOrStop(CommType, FuncStart, FuncStop) \
if(newCommunicationState->CommType && !d->CurrentCommunicationState.CommType){\
- MSG_ERR(0x9999,#FuncStart, 9999);\
+ MSG_WAR(0x9999,#FuncStart, 9999);\
d->CurrentCommunicationState.CommType = 1;\
FuncStart;\
}else if(!newCommunicationState->CommType && d->CurrentCommunicationState.CommType){\
- MSG_ERR(0x9999,#FuncStop, 9999);\
+ MSG_WAR(0x9999,#FuncStop, 9999);\
d->CurrentCommunicationState.CommType = 0;\
FuncStop;\
}