/* Hook function related definitions. */
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
-#define configUSE_MALLOC_FAILED_HOOK 0
-#define configCHECK_FOR_STACK_OVERFLOW 0
+#define configUSE_MALLOC_FAILED_HOOK 1
+#define configCHECK_FOR_STACK_OVERFLOW 2
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
/* Run time and task stats gathering related definitions. */
#define configGENERATE_RUN_TIME_STATS 0
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
#define portGET_RUN_TIME_COUNTER_VALUE() xTaskGetTickCount()
-#define configUSE_TRACE_FACILITY 0
+#define configUSE_TRACE_FACILITY 1
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
/* Co-routine related definitions. */
for( ;; )
{
+ {
+ void mem_scan( void );
+ mem_scan();
+ }
xSemaphoreTake(xSemaphoreTx, portMAX_DELAY);
//strcpy((char *)uart0TxBuff, "$CMSGH,<"__DEVICES_ID__">,$#");
sprintf((char *)uart0TxBuff, "$CMSGH,<%s>,$#", g_devinfo.serial);
xTaskCreate(queueCommandTask, "Command", configMINIMAL_STACK_SIZE+128, NULL, 1, &Command_Handler);
xTaskCreate(queueGatherTask1, "Gather1", configMINIMAL_STACK_SIZE+128, NULL, 1, &Gather_Handler1);
xTaskCreate(queueGatherTask2, "Gather2", configMINIMAL_STACK_SIZE+128, NULL, 1, &Gather_Handler2);
- xTaskCreate(queueSendTask, "Senddata", configMINIMAL_STACK_SIZE, NULL, 1, &Send_Handler);
- xTaskCreate(queueHeartBeatTask, "Heartbeat", configMINIMAL_STACK_SIZE, NULL, 1, &HeartBeat_Handler);
- xTaskCreate(queueUserDaemonTask, "UserDaemon", configMINIMAL_STACK_SIZE, NULL, 1, &UserDaemon_Handler);
+ xTaskCreate(queueSendTask, "Senddata", configMINIMAL_STACK_SIZE+32, NULL, 1, &Send_Handler);
+ xTaskCreate(queueHeartBeatTask, "Heartbeat", configMINIMAL_STACK_SIZE+32, NULL, 1, &HeartBeat_Handler);
+ xTaskCreate(queueUserDaemonTask, "UserDaemon", configMINIMAL_STACK_SIZE+32, NULL, 1, &UserDaemon_Handler);
xTaskCreate(parameterTask, "Parameter", configMINIMAL_STACK_SIZE+128, NULL, 1, &Parameter_Handler);
}
+// freertos/src/task_mem_stats.c
+
+#include "FreeRTOS.h"
+#include "task.h"
+//#include "heap_4.h" /* Èç¹ûʹÓÃÆäËûheap·½°¸£¬°üº¬¶ÔÓ¦µÄÍ·Îļþ */
+#include <stdio.h>
+
+volatile size_t xFreeHeapSize;
+volatile size_t xMinimumEverFreeHeapSize;
+UBaseType_t uxHighWaterMark[10];
+/* ÄÚ´æÍ³¼ÆÈÎÎñ */
+void mem_scan( void )
+{
+ /* »ñÈ¡¶ÑÄÚ´æÐÅÏ¢ */
+ xFreeHeapSize = xPortGetFreeHeapSize();
+ xMinimumEverFreeHeapSize = xPortGetMinimumEverFreeHeapSize();
+
+ uxHighWaterMark[0] = uxTaskGetStackHighWaterMark(Command_Handler);
+ uxHighWaterMark[1] = uxTaskGetStackHighWaterMark(Gather_Handler1);
+ uxHighWaterMark[2] = uxTaskGetStackHighWaterMark(Gather_Handler2);
+ uxHighWaterMark[3] = uxTaskGetStackHighWaterMark(Send_Handler);
+ uxHighWaterMark[4] = uxTaskGetStackHighWaterMark(HeartBeat_Handler);
+ uxHighWaterMark[5] = uxTaskGetStackHighWaterMark(UserDaemon_Handler);
+
+ /* ´òÓ¡ÄÚ´æÐÅÏ¢ */
+ //printf("========================================\r\n");
+ //printf("ÄÚ´æÍ³¼ÆÐÅÏ¢ (ÿ5Ãë)\r\n");
+ //printf("----------------------------------------\r\n");
+ //printf("µ±Ç°¿ÕÏжÑÄÚ´æ: %u bytes\r\n", (unsigned int)xFreeHeapSize);
+ //printf("ÀúÊ·×îС¿ÕÏжÑ: %u bytes\r\n", (unsigned int)xMinimumEverFreeHeapSize);
+ //printf("ÒÑʹÓöÑÄÚ´æ: %u bytes\r\n",
+ // (unsigned int)(configTOTAL_HEAP_SIZE - xFreeHeapSize));
+}