SoC common: bl30 src_ao add a print prompt for heap alloc fail [1/1]

PD#SWPL-193184

Problem:
Currently, bl30 rtos_sdk has no print prompt for task exit
error. Thus we wouldn't know which task at the first time when
heap alloc fail.

Solution:
add a print prompt for heap alloc fail

Verify:
t3

Change-Id: I20da40170e3b125554bda6519dde65e244bddec4
Signed-off-by: bangzheng.liu <bangzheng.liu@amlogic.com>
diff --git a/demos/amlogic/n200/p1/p1_as400/main.c b/demos/amlogic/n200/p1/p1_as400/main.c
index ec8691a..89caa28 100644
--- a/demos/amlogic/n200/p1/p1_as400/main.c
+++ b/demos/amlogic/n200/p1/p1_as400/main.c
@@ -207,18 +207,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/p1/p1_as408/main.c b/demos/amlogic/n200/p1/p1_as408/main.c
index 80f22ed..b66008b 100644
--- a/demos/amlogic/n200/p1/p1_as408/main.c
+++ b/demos/amlogic/n200/p1/p1_as408/main.c
@@ -207,18 +207,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/p1/p1_as409/main.c b/demos/amlogic/n200/p1/p1_as409/main.c
index 43ade3c..7c23359 100644
--- a/demos/amlogic/n200/p1/p1_as409/main.c
+++ b/demos/amlogic/n200/p1/p1_as409/main.c
@@ -207,18 +207,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/p1/p1_ninox_4/main.c b/demos/amlogic/n200/p1/p1_ninox_4/main.c
index 6b5f4d3..01033c8 100644
--- a/demos/amlogic/n200/p1/p1_ninox_4/main.c
+++ b/demos/amlogic/n200/p1/p1_ninox_4/main.c
@@ -207,18 +207,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/s4/s4_ap201/main.c b/demos/amlogic/n200/s4/s4_ap201/main.c
index d0f4114..6262bb1 100644
--- a/demos/amlogic/n200/s4/s4_ap201/main.c
+++ b/demos/amlogic/n200/s4/s4_ap201/main.c
@@ -214,18 +214,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/s4/s4_ap222/main.c b/demos/amlogic/n200/s4/s4_ap222/main.c
index d0f4114..6262bb1 100644
--- a/demos/amlogic/n200/s4/s4_ap222/main.c
+++ b/demos/amlogic/n200/s4/s4_ap222/main.c
@@ -214,18 +214,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/s4/s4_ap229/main.c b/demos/amlogic/n200/s4/s4_ap229/main.c
index d0f4114..6262bb1 100644
--- a/demos/amlogic/n200/s4/s4_ap229/main.c
+++ b/demos/amlogic/n200/s4/s4_ap229/main.c
@@ -214,18 +214,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/s4/s4_ap232/main.c b/demos/amlogic/n200/s4/s4_ap232/main.c
index d0f4114..6262bb1 100644
--- a/demos/amlogic/n200/s4/s4_ap232/main.c
+++ b/demos/amlogic/n200/s4/s4_ap232/main.c
@@ -214,18 +214,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/s4/s4_aq222/main.c b/demos/amlogic/n200/s4/s4_aq222/main.c
index a986fb1..f140cf1 100644
--- a/demos/amlogic/n200/s4/s4_aq222/main.c
+++ b/demos/amlogic/n200/s4/s4_aq222/main.c
@@ -214,18 +214,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/s4/s4_t211/main.c b/demos/amlogic/n200/s4/s4_t211/main.c
index a986fb1..f140cf1 100644
--- a/demos/amlogic/n200/s4/s4_t211/main.c
+++ b/demos/amlogic/n200/s4/s4_t211/main.c
@@ -214,18 +214,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/sc2/sc2_ah212/main.c b/demos/amlogic/n200/sc2/sc2_ah212/main.c
index 20a89ae..7c79236 100644
--- a/demos/amlogic/n200/sc2/sc2_ah212/main.c
+++ b/demos/amlogic/n200/sc2/sc2_ah212/main.c
@@ -219,18 +219,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/sc2/sc2_ah219/main.c b/demos/amlogic/n200/sc2/sc2_ah219/main.c
index 8e8af2f..474123a 100644
--- a/demos/amlogic/n200/sc2/sc2_ah219/main.c
+++ b/demos/amlogic/n200/sc2/sc2_ah219/main.c
@@ -212,18 +212,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/sc2/sc2_u212/main.c b/demos/amlogic/n200/sc2/sc2_u212/main.c
index 5efdbff..2c59759 100644
--- a/demos/amlogic/n200/sc2/sc2_u212/main.c
+++ b/demos/amlogic/n200/sc2/sc2_u212/main.c
@@ -211,18 +211,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/t3/t3_t963d4/main.c b/demos/amlogic/n200/t3/t3_t963d4/main.c
index 1329a4d..bc71baf 100644
--- a/demos/amlogic/n200/t3/t3_t963d4/main.c
+++ b/demos/amlogic/n200/t3/t3_t963d4/main.c
@@ -181,18 +181,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/t3/t3_t965d4/main.c b/demos/amlogic/n200/t3/t3_t965d4/main.c
index 1329a4d..bc71baf 100644
--- a/demos/amlogic/n200/t3/t3_t965d4/main.c
+++ b/demos/amlogic/n200/t3/t3_t965d4/main.c
@@ -181,18 +181,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/t3/t3_t982/main.c b/demos/amlogic/n200/t3/t3_t982/main.c
index 564d8dc..fbebf9a 100644
--- a/demos/amlogic/n200/t3/t3_t982/main.c
+++ b/demos/amlogic/n200/t3/t3_t982/main.c
@@ -183,18 +183,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/t5/t5_ak301_v1/main.c b/demos/amlogic/n200/t5/t5_ak301_v1/main.c
index b5fc0f9..07d414c 100644
--- a/demos/amlogic/n200/t5/t5_ak301_v1/main.c
+++ b/demos/amlogic/n200/t5/t5_ak301_v1/main.c
@@ -225,19 +225,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	vUartPuts("vApplicationMallocFailedHook\n");
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
 	vPrintFreeListAfterMallocFail();
-    for ( ;; );
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/t5/t5_ak309_v1/main.c b/demos/amlogic/n200/t5/t5_ak309_v1/main.c
index b5fc0f9..07d414c 100644
--- a/demos/amlogic/n200/t5/t5_ak309_v1/main.c
+++ b/demos/amlogic/n200/t5/t5_ak309_v1/main.c
@@ -225,19 +225,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	vUartPuts("vApplicationMallocFailedHook\n");
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
 	vPrintFreeListAfterMallocFail();
-    for ( ;; );
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/t5/t5_ak311_v1/main.c b/demos/amlogic/n200/t5/t5_ak311_v1/main.c
index b5fc0f9..07d414c 100644
--- a/demos/amlogic/n200/t5/t5_ak311_v1/main.c
+++ b/demos/amlogic/n200/t5/t5_ak311_v1/main.c
@@ -225,19 +225,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	vUartPuts("vApplicationMallocFailedHook\n");
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
 	vPrintFreeListAfterMallocFail();
-    for ( ;; );
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/t5/t5_ak329_v1/main.c b/demos/amlogic/n200/t5/t5_ak329_v1/main.c
index b5fc0f9..07d414c 100644
--- a/demos/amlogic/n200/t5/t5_ak329_v1/main.c
+++ b/demos/amlogic/n200/t5/t5_ak329_v1/main.c
@@ -225,19 +225,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	vUartPuts("vApplicationMallocFailedHook\n");
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
 	vPrintFreeListAfterMallocFail();
-    for ( ;; );
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/t5d/t5d_am301_v1/main.c b/demos/amlogic/n200/t5d/t5d_am301_v1/main.c
index 853d36d..4a15865 100644
--- a/demos/amlogic/n200/t5d/t5d_am301_v1/main.c
+++ b/demos/amlogic/n200/t5d/t5d_am301_v1/main.c
@@ -239,19 +239,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	vUartPuts("vApplicationMallocFailedHook\n");
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
 	vPrintFreeListAfterMallocFail();
-    for ( ;; );
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/t5d/t5d_am309_v1/main.c b/demos/amlogic/n200/t5d/t5d_am309_v1/main.c
index 73e6d4e..075cee3 100644
--- a/demos/amlogic/n200/t5d/t5d_am309_v1/main.c
+++ b/demos/amlogic/n200/t5d/t5d_am309_v1/main.c
@@ -237,19 +237,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	vUartPuts("vApplicationMallocFailedHook\n");
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
 	vPrintFreeListAfterMallocFail();
-    for ( ;; );
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/t5d/t5d_am311_v1/main.c b/demos/amlogic/n200/t5d/t5d_am311_v1/main.c
index 73e6d4e..075cee3 100644
--- a/demos/amlogic/n200/t5d/t5d_am311_v1/main.c
+++ b/demos/amlogic/n200/t5d/t5d_am311_v1/main.c
@@ -237,19 +237,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	vUartPuts("vApplicationMallocFailedHook\n");
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
 	vPrintFreeListAfterMallocFail();
-    for ( ;; );
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/t5d/t5d_am319_v1/main.c b/demos/amlogic/n200/t5d/t5d_am319_v1/main.c
index 73e6d4e..075cee3 100644
--- a/demos/amlogic/n200/t5d/t5d_am319_v1/main.c
+++ b/demos/amlogic/n200/t5d/t5d_am319_v1/main.c
@@ -237,19 +237,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	vUartPuts("vApplicationMallocFailedHook\n");
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
 	vPrintFreeListAfterMallocFail();
-    for ( ;; );
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/t5w/t5w_at301/main.c b/demos/amlogic/n200/t5w/t5w_at301/main.c
index 2e9555a..c259071 100644
--- a/demos/amlogic/n200/t5w/t5w_at301/main.c
+++ b/demos/amlogic/n200/t5w/t5w_at301/main.c
@@ -227,19 +227,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	vUartPuts("vApplicationMallocFailedHook\n");
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
 	vPrintFreeListAfterMallocFail();
-    for ( ;; );
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/t7/t7_an400_lpddr4x/main.c b/demos/amlogic/n200/t7/t7_an400_lpddr4x/main.c
index d34fef0..88af476 100644
--- a/demos/amlogic/n200/t7/t7_an400_lpddr4x/main.c
+++ b/demos/amlogic/n200/t7/t7_an400_lpddr4x/main.c
@@ -216,18 +216,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/t7/t7_an400_mercury/main.c b/demos/amlogic/n200/t7/t7_an400_mercury/main.c
index 1181959..f4f0adf 100644
--- a/demos/amlogic/n200/t7/t7_an400_mercury/main.c
+++ b/demos/amlogic/n200/t7/t7_an400_mercury/main.c
@@ -214,18 +214,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/t7/t7_an400p_lpddr4x/main.c b/demos/amlogic/n200/t7/t7_an400p_lpddr4x/main.c
index 851dd84..eacf767 100644
--- a/demos/amlogic/n200/t7/t7_an400p_lpddr4x/main.c
+++ b/demos/amlogic/n200/t7/t7_an400p_lpddr4x/main.c
@@ -229,18 +229,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/t7/t7_an408_lpddr4x/main.c b/demos/amlogic/n200/t7/t7_an408_lpddr4x/main.c
index 601848f..4d3abe0 100644
--- a/demos/amlogic/n200/t7/t7_an408_lpddr4x/main.c
+++ b/demos/amlogic/n200/t7/t7_an408_lpddr4x/main.c
@@ -209,18 +209,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/t7/t7_an409_ddr4/main.c b/demos/amlogic/n200/t7/t7_an409_ddr4/main.c
index 601848f..4d3abe0 100644
--- a/demos/amlogic/n200/t7/t7_an409_ddr4/main.c
+++ b/demos/amlogic/n200/t7/t7_an409_ddr4/main.c
@@ -209,18 +209,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/t7/t7_an40a1/main.c b/demos/amlogic/n200/t7/t7_an40a1/main.c
index a873fb9..81a8ce6 100644
--- a/demos/amlogic/n200/t7/t7_an40a1/main.c
+++ b/demos/amlogic/n200/t7/t7_an40a1/main.c
@@ -227,18 +227,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/
 
diff --git a/demos/amlogic/n200/t7/t7_t319/main.c b/demos/amlogic/n200/t7/t7_t319/main.c
index d7c9a1e..5daf489 100644
--- a/demos/amlogic/n200/t7/t7_t319/main.c
+++ b/demos/amlogic/n200/t7/t7_t319/main.c
@@ -228,18 +228,20 @@
 
 void vApplicationMallocFailedHook( void )
 {
-    /* The malloc failed hook is enabled by setting
-    configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	/* The malloc failed hook is enabled by setting
+	 * configUSE_MALLOC_FAILED_HOOK to 1 in FreeRTOSConfig.h.
+	 *
+	 * Called if a call to pvPortMalloc() fails because there is insufficient
+	 * free memory available in the FreeRTOS heap. pvPortMalloc() is called
+	 * internally by FreeRTOS API functions that create tasks, queues, software
+	 * timers, and semaphores. The size of the FreeRTOS heap is set by the
+	 * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
+	 */
 
-    Called if a call to pvPortMalloc() fails because there is insufficient
-    free memory available in the FreeRTOS heap.  pvPortMalloc() is called
-    internally by FreeRTOS API functions that create tasks, queues, software
-    timers, and semaphores.  The size of the FreeRTOS heap is set by the
-    configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
-	//write(1,"malloc failed\n", 14);
-
-	printf("vApplicationMallocFailedHook\n");
-    for ( ;; );
+	printf("bl30 task %s malloc failed\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
+	vPrintFreeListAfterMallocFail();
+	for ( ;; )
+		;
 }
 /*-----------------------------------------------------------*/