This commit is contained in:
pvvx 2017-03-03 20:16:46 +03:00
parent 5e40d9d461
commit 6278f73e47
20 changed files with 2557 additions and 2579 deletions

View file

@ -381,8 +381,7 @@ typedef struct HeapRegion
* terminated by a HeapRegions_t structure that has a size of 0. The region
* with the lowest start address must appear first in the array.
*/
void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions );
static void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions );
/*
* Map to the memory management routines required for the port.

View file

@ -202,24 +202,22 @@ HeapRegion_t xHeapRegions[] =
#endif
/*-----------------------------------------------------------*/
#if 1
/*
Dump xBlock list
*/
void dump_mem_block_list()
void dump_mem_block_list(void)
{
if(pxEnd == NULL) vPortDefineHeapRegions( xHeapRegions );
#if CONFIG_DEBUG_LOG > 1
// if(pxEnd == NULL) vPortDefineHeapRegions( xHeapRegions ); // test code start
BlockLink_t *pxBlock = &xStart;
int count = 0;
DBG_8195A("RAM Heap Memory List:\n");
while(pxBlock->pxNextFreeBlock != NULL)
{
DBG_8195A(" [%d]=%p, %d\n", count++, pxBlock, pxBlock->xBlockSize);
pxBlock = pxBlock->pxNextFreeBlock;
DBG_8195A("RAM Free Heap Memory List:\n");
for(pxBlock = pxBlock->pxNextFreeBlock; pxBlock->pxNextFreeBlock != NULL; pxBlock = pxBlock->pxNextFreeBlock) {
DBG_8195A(" [%d]=%p, %d\n", ++count, pxBlock, pxBlock->xBlockSize);
}
}
#endif
}
void *pvPortMalloc( size_t xWantedSize )
{
@ -228,7 +226,6 @@ void *pvReturn = NULL;
/* Realtek test code start */
if(pxEnd == NULL) vPortDefineHeapRegions( xHeapRegions );
/* Realtek test code end */
/* The heap must be initialised before the first call to
@ -343,11 +340,14 @@ void *pvReturn = NULL;
{
mtCOVERAGE_TEST_MARKER();
}
traceMALLOC( pvReturn, xWantedSize );
}
( void ) xTaskResumeAll();
if(pvReturn == NULL) {
DBG_RAM_HEAP_WARN("ram_alloc(%d): freeSpace(%d)!\n", xWantedSize, xFreeBytesRemaining);
} else {
// DBG_RAM_HEAP_INFO("ram_alloc:%p[%d]\n", pvReturn , xWantedSize);
}
#if( configUSE_MALLOC_FAILED_HOOK == 1 )
{
if( pvReturn == NULL )
@ -410,6 +410,7 @@ BlockLink_t *pxLink;
{
mtCOVERAGE_TEST_MARKER();
}
// DBG_RAM_HEAP_INFO("ram_free:%p[%d]\n", pv , pxLink->xBlockSize);
}
}
@ -511,7 +512,7 @@ uint8_t *puc;
}
/*-----------------------------------------------------------*/
void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions )
static void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions )
{
BlockLink_t *pxFirstFreeBlockInRegion = NULL, *pxPreviousFreeBlock;
uint8_t *pucAlignedHeap;

View file

@ -3488,6 +3488,14 @@ TCB_t *pxTCB;
#endif /* portCRITICAL_NESTING_IN_TCB */
/*-----------------------------------------------------------*/
char * sprintf_pcTaskName(char * buf, char * name)
{
int len = sprintf(buf, name);
if(len < configMAX_TASK_NAME_LEN) {
memset(buf + len, ' ', configMAX_TASK_NAME_LEN - len);
}
return buf + configMAX_TASK_NAME_LEN;
}
#if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) )
@ -3559,8 +3567,9 @@ TCB_t *pxTCB;
cStatus = 0x00;
break;
}
pcWriteBuffer = sprintf_pcTaskName( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName);
sprintf( pcWriteBuffer, "%s\t\t%c\t%u\t%u\t%u\r\n", pxTaskStatusArray[ x ].pcTaskName, cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber );
sprintf( pcWriteBuffer, "\t%c\t%u\t%u\t%u\r\n", cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber );
pcWriteBuffer += strlen( pcWriteBuffer );
}
@ -3654,12 +3663,7 @@ TCB_t *pxTCB;
else
ulDeltaRunTimeCounter = portCONFIGURE_STATS_PEROID_VALUE*ulStatsAsPercentage/100;
#endif
int cnt = sprintf( pcWriteBuffer, "%s", pxTaskStatusArray[ x ].pcTaskName);
pcWriteBuffer += cnt;
while(cnt < configMAX_TASK_NAME_LEN) {
cnt++;
*pcWriteBuffer++ = ' ';
}
pcWriteBuffer = sprintf_pcTaskName( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName);
if( ulStatsAsPercentage > 0UL )
{
#ifdef portLU_PRINTF_SPECIFIER_REQUIRED