add WDT, new console, ...

This commit is contained in:
pvvx 2017-02-28 10:39:37 +03:00
parent e851661fa4
commit de57c04fb4
21 changed files with 3158 additions and 2639 deletions

View file

@ -2753,6 +2753,9 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
{
mtCOVERAGE_TEST_MARKER();
}
#ifdef CONFIG_WDG_ON_IDLE
WDGRefresh();
#endif
}
#endif /* configUSE_TICKLESS_IDLE */
}
@ -3641,7 +3644,7 @@ TCB_t *pxTCB;
/* What percentage of the total run time has the task used?
This will always be rounded down to the nearest integer.
ulTotalRunTimeDiv100 has already been divided by 100. */
#if 0
#if 1
ulStatsAsPercentage = pxTaskStatusArray[ x ].ulRunTimeCounter / ulTotalTime;
#else
ulStatsAsPercentage = (100*pxTaskStatusArray[ x ].ulDelataRunTimeCounterOfPeroid) / ulDeltaTotalRunTime;
@ -3651,25 +3654,30 @@ 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++ = ' ';
}
if( ulStatsAsPercentage > 0UL )
{
#ifdef portLU_PRINTF_SPECIFIER_REQUIRED
{
#if 0
sprintf( pcWriteBuffer, "%s\t\t%lu\t\t%lu%%\n", pxTaskStatusArray[ x ].pcTaskName, pxTaskStatusArray[ x ].ulRunTimeCounter, ulStatsAsPercentage );
#if 1
sprintf( pcWriteBuffer, "\t%lu\t\t%lu%%\n", pxTaskStatusArray[ x ].ulRunTimeCounter, ulStatsAsPercentage );
#else
sprintf( pcWriteBuffer, "%s\t\t%lu\t\t%lu%%\n", pxTaskStatusArray[ x ].pcTaskName, ulDeltaRunTimeCounter, ulStatsAsPercentage );
sprintf( pcWriteBuffer, "\t%lu\t\t%lu%%\n", ulDeltaRunTimeCounter, ulStatsAsPercentage );
#endif
}
#else
{
/* sizeof( int ) == sizeof( long ) so a smaller
printf() library can be used. */
#if 0
sprintf( pcWriteBuffer, "%s\t\t%u\t\t%u%%\n", pxTaskStatusArray[ x ].pcTaskName, ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter, ( unsigned int ) ulStatsAsPercentage );
#if 1
sprintf( pcWriteBuffer, "\t%lu\t\t%u%%\n", ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter, ( unsigned int ) ulStatsAsPercentage );
#else
sprintf( pcWriteBuffer, "%s\t\t%u\t\t%u%%\n", pxTaskStatusArray[ x ].pcTaskName, ( unsigned int ) ulDeltaRunTimeCounter, ( unsigned int ) ulStatsAsPercentage );
sprintf( pcWriteBuffer, "\t%u\t\t%u%%\n", ( unsigned int ) ulDeltaRunTimeCounter, ( unsigned int ) ulStatsAsPercentage );
#endif
}
#endif
@ -3680,20 +3688,20 @@ TCB_t *pxTCB;
consumed less than 1% of the total run time. */
#ifdef portLU_PRINTF_SPECIFIER_REQUIRED
{
#if 0
sprintf( pcWriteBuffer, "%s\t\t%lu\t\t<1%%\n", pxTaskStatusArray[ x ].pcTaskName, pxTaskStatusArray[ x ].ulRunTimeCounter );
#if 1
sprintf( pcWriteBuffer, "\t%lu\t\t<1%%\n", pxTaskStatusArray[ x ].ulRunTimeCounter );
#else
sprintf( pcWriteBuffer, "%s\t\t%lu\t\t<1%%\n", pxTaskStatusArray[ x ].pcTaskName, ulDeltaRunTimeCounter );
sprintf( pcWriteBuffer, "\t%lu\t\t<1%%\n", ulDeltaRunTimeCounter );
#endif
}
#else
{
/* sizeof( int ) == sizeof( long ) so a smaller
printf() library can be used. */
#if 0
sprintf( pcWriteBuffer, "%s\t\t%u\t\t<1%%\n", pxTaskStatusArray[ x ].pcTaskName, ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter );
#if 1
sprintf( pcWriteBuffer, "\t%lu\t\t<1%%\n", ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter );
#else
sprintf( pcWriteBuffer, "%s\t\t%u\t\t<1%%\n", pxTaskStatusArray[ x ].pcTaskName, ( unsigned int ) ulDeltaRunTimeCounter );
sprintf( pcWriteBuffer, "\t%u\t\t<1%%\n", ( unsigned int ) ulDeltaRunTimeCounter );
#endif
}
#endif

View file

@ -89,6 +89,32 @@ prvDiagSPrintf(
IN const char *fmt, ...
);
#if CONFIG_DEBUG_LOG > 3
#define debug_printf(fmt, ...) rtl_printf(fmt, ##__VA_ARGS__)
#define info_printf(fmt, ...) rtl_printf(fmt, ##__VA_ARGS__)
#define warning_printf(fmt, ...) rtl_printf(fmt, ##__VA_ARGS__)
#define error_printf(fmt, ...) rtl_printf(fmt, ##__VA_ARGS__)
#elif CONFIG_DEBUG_LOG > 2
#define debug_printf(fmt, ...)
#define info_printf(fmt, ...) rtl_printf(fmt, ##__VA_ARGS__)
#define warning_printf(fmt, ...) rtl_printf(fmt, ##__VA_ARGS__)
#define error_printf(fmt, ...) rtl_printf(fmt, ##__VA_ARGS__)
#elif CONFIG_DEBUG_LOG > 1
#define debug_printf(fmt, ...)
#define info_printf(fmt, ...)
#define warning_printf(fmt, ...) rtl_printf(fmt, ##__VA_ARGS__)
#define error_printf(fmt, ...) rtl_printf(fmt, ##__VA_ARGS__)
#elif CONFIG_DEBUG_LOG > 0
#define debug_printf(fmt, ...)
#define info_printf(fmt, ...)
#define warning_printf(fmt, ...)
#define error_printf(fmt, ...) rtl_printf(fmt, ##__VA_ARGS__)
#else
#define debug_printf(fmt, ...)
#define info_printf(fmt, ...)
#define warning_printf(fmt, ...)
#define error_printf(fmt, ...)
#endif
#define _DbgDump DiagPrintf

View file

@ -624,6 +624,7 @@ SECTIONS
rom_wps_rcons = 0x35d88;
rom_wps_Td4s = 0x35d94;
rom_wps_Td0 = 0x35e94;
str_rom_hex_addr = 0x442D6;
__rom_b_cut_end__ = 0x4467c;
__rom_c_cut_text_start__ = 0x4467c;
HalInitPlatformLogUartV02 = 0x4467d;

View file

@ -150,7 +150,13 @@ SECTIONS
LONG(__sdram_heap_end__ - __sdram_heap_start__)
LONG(0)
LONG(0)
UartLogRamCmdTable = .;
KEEP(*(SORT(.mon.tab*)))
UartLogRamCmdTable_end = .;
LONG(0)
} > BD_RAM
PROVIDE(UartLogRamCmdTableSize = UartLogRamCmdTable_end - UartLogRamCmdTable);
.ram.data :
{

View file

@ -230,7 +230,7 @@ RtlConsolInitRam(
pUartLogCtl->TaskRdy = 0;
#ifdef PLATFORM_FREERTOS
#define LOGUART_STACK_SIZE 200 //USE_MIN_STACK_SIZE modify from 512 to 128
#if CONFIG_USE_TCM_HEAP
#if 0 //CONFIG_USE_TCM_HEAP
{
int ret = 0;
void *stack_addr = tcm_heap_malloc(LOGUART_STACK_SIZE*sizeof(int));
@ -249,13 +249,13 @@ RtlConsolInitRam(
NULL);
if (pdTRUE != ret)
{
DiagPrintf("Create Log UART Task Err!!\n");
DiagPrintf("Create Log UART Task Err!\n");
}
}
#else
if (pdTRUE != xTaskCreate( RtlConsolTaskRam, (const signed char * const)"log_uart", LOGUART_STACK_SIZE, NULL, tskIDLE_PRIORITY + 5 + PRIORITIE_OFFSET, NULL))
{
DiagPrintf("Create Log UART Task Err!!\n");
DiagPrintf("Create Log UART Task Err!\n");
}
#endif
@ -312,6 +312,10 @@ RtlConsolTaskRam(
{
#if SUPPORT_LOG_SERVICE
log_service_init();
#else
#ifdef CONFIG_AT_USR
at_user_init();
#endif
#endif
//4 Set this for UartLog check cmd history
#ifdef CONFIG_KERNEL

View file

@ -29,17 +29,16 @@
#define UART_LOG_CMD_BUFLEN 127
#define MAX_ARGV 10
extern COMMAND_TABLE UartLogRomCmdTable[6]; // in ROM (hal_diag.h)
typedef u32 (*ECHOFUNC)(IN u8*,...); //UART LOG echo-function type.
typedef struct _UART_LOG_BUF_ {
u8 BufCount; //record the input cmd char number.
u8 BufCount; //record the input cmd char number.
u8 UARTLogBuf[UART_LOG_CMD_BUFLEN]; //record the input command.
} UART_LOG_BUF, *PUART_LOG_BUF;
typedef struct _UART_LOG_CTL_ {
u8 NewIdx; //+0x00
u8 SeeIdx; //+0x01
@ -49,19 +48,17 @@ typedef struct _UART_LOG_CTL_ {
u8 ExecuteEsc; //+0x05
u8 BootRdy; //+0x06
u8 Resvd; //+0x07
PUART_LOG_BUF pTmpLogBuf;
VOID *pfINPUT;
PCOMMAND_TABLE pCmdTbl;
u32 CmdTblSz;
PUART_LOG_BUF pTmpLogBuf; //+0x08 = UartLogBuf
VOID *pfINPUT; //+0x0C = DiagPrintf
PCOMMAND_TABLE pCmdTbl; //+0x10
u32 CmdTblSz; //+0x14
#ifdef CONFIG_UART_LOG_HISTORY
u32 CRSTS;
#endif
#ifdef CONFIG_UART_LOG_HISTORY
u8 (*pHistoryBuf)[UART_LOG_CMD_BUFLEN];
u32 CRSTS; //+0x18
u8 (*pHistoryBuf)[UART_LOG_CMD_BUFLEN]; //+0x1C UartLogHistoryBuf[UART_LOG_HISTORY_LEN][UART_LOG_CMD_BUFLEN]
#endif
#ifdef CONFIG_KERNEL
u32 TaskRdy;
_Sema Sema;
u32 TaskRdy; //+0x20
_Sema Sema; //+0x24
#else
// Since ROM code will reference this typedef, so keep the typedef same size
u32 TaskRdy;
@ -128,6 +125,8 @@ Strtoul(
IN u32 base
);
_LONG_CALL_ extern VOID UartLogIrqHandle(VOID * Data); // in ROM
void console_init(void);
extern _LONG_CALL_ROM_ int GetArgc(const u8 *string);

View file

@ -203,6 +203,8 @@
#define MON_RAM_BSS_SECTION \
SECTION(".mon.ram.bss")
#define MON_RAM_TAB_SECTION \
SECTION(".mon.tab.rodata")
//3 SDIO Section
#define SECTION_SDIO_RAM

View file

@ -39,7 +39,7 @@ void test_sha1(void)
if ( rtl_memcmpb((void*)digest, (void*)&sha1_test_digest[i][0], 20) == 0 )
DiagPrintf("SHA1 test result is correct, ret=%d\r\n", ret);
else
DiagPrintf("SHA test result is WRONG!!, ret=%d\r\n", ret);
DiagPrintf("SHA test result is WRONG!, ret=%d\r\n", ret);
}
}
//static const u8 plaintext[] = "The quick brown fox jumps over the lazy dog";
@ -144,7 +144,7 @@ void test_md5(void)
if ( rtl_memcmpb(digest, md5_digest, 16) == 0 ) {
DiagPrintf("MD5 test result is correct, ret=%d\r\n", ret);
} else {
DiagPrintf("MD5 test result is WRONG!!, ret=%d\r\n", ret);
DiagPrintf("MD5 test result is WRONG!, ret=%d\r\n", ret);
}
for( i = 0; i < 16; i++ )