diff --git a/kernel/include/los_config.h b/kernel/include/los_config.h index b58fc066..04dca546 100644 --- a/kernel/include/los_config.h +++ b/kernel/include/los_config.h @@ -550,7 +550,7 @@ extern UINT8 *m_aucSysMem0; #endif /* ============================================================================= - CPUP configuration + CPUP module configuration ============================================================================= */ /** * @ingroup los_config @@ -567,6 +567,9 @@ extern UINT8 *m_aucSysMem0; * @ingroup los_config * Configuration test case to open */ +#ifndef LOSCFG_TEST +#define LOSCFG_TEST 0 +#endif /** * @ingroup los_config @@ -577,14 +580,10 @@ extern UINT8 *m_aucSysMem0; #endif /* ============================================================================= - trace configuration + Fs module configuration ============================================================================= */ -/** - * @ingroup los_config - * Configuration liteos trace - */ -#ifndef LOSCFG_KERNEL_TRACE -#define LOSCFG_KERNEL_TRACE 0 +#ifndef LOSCFG_SUPPORT_FATFS +#define LOSCFG_SUPPORT_FATFS 0 #endif #ifndef LOSCFG_SUPPORT_LITTLEFS @@ -595,7 +594,9 @@ extern UINT8 *m_aucSysMem0; #define LOSCFG_LFS_MAX_MOUNT_SIZE 3 #endif - +/* ============================================================================= + Trace module configuration +============================================================================= */ /** * @ingroup los_config * Configuration trace tool @@ -604,6 +605,41 @@ extern UINT8 *m_aucSysMem0; #define LOSCFG_DEBUG_HOOK 0 #endif +/* ============================================================================= + PM module configuration +============================================================================= */ +/** + * @ingroup los_config + * Configuration item for low power frame tailoring + */ +#ifndef LOSCFG_KERNEL_PM +#define LOSCFG_KERNEL_PM 1 +#endif + +/** + * @ingroup los_config + * Configuration item for priority of low-power task. + */ +#ifndef LOSCFG_KERNEL_PM_TASK_PTIORITY +#define LOSCFG_KERNEL_PM_TASK_PTIORITY 1 +#endif + +/** + * @ingroup los_config + * Configuration item for stack size of low-power task. + */ +#ifndef LOSCFG_KERNEL_PM_TASK_STACKSIZE +#define LOSCFG_KERNEL_PM_TASK_STACKSIZE 0x800 +#endif + +/** + * @ingroup los_config + * Configuration item for low power frame debug tailoring + */ +#ifndef LOSCFG_KERNEL_PM_DEBUG +#define LOSCFG_KERNEL_PM_DEBUG 0 +#endif + /* ============================================================================= printf configuration ============================================================================= */ @@ -639,38 +675,9 @@ extern UINT8 *m_aucSysMem0; #define LOSCFG_BACKTRACE_DEPTH 15 #endif -/** - * @ingroup los_config - * Configuration item for low power frame tailoring - */ -#ifndef LOSCFG_KERNEL_PM -#define LOSCFG_KERNEL_PM 1 -#endif - -/** - * @ingroup los_config - * Configuration item for priority of low-power task. - */ -#ifndef LOSCFG_KERNEL_PM_TASK_PTIORITY -#define LOSCFG_KERNEL_PM_TASK_PTIORITY 1 -#endif - -/** - * @ingroup los_config - * Configuration item for stack size of low-power task. - */ -#ifndef LOSCFG_KERNEL_PM_TASK_STACKSIZE -#define LOSCFG_KERNEL_PM_TASK_STACKSIZE 0x800 -#endif - -/** - * @ingroup los_config - * Configuration item for low power frame debug tailoring - */ -#ifndef LOSCFG_KERNEL_PM_DEBUG -#define LOSCFG_KERNEL_PM_DEBUG 0 -#endif - +/* ============================================================================= + trustzone configuration +============================================================================= */ /** * @ingroup los_config * Configuration trustzone secure heap size. diff --git a/kernel/src/los_init.c b/kernel/src/los_init.c index b5ec6cfe..93b7e01a 100644 --- a/kernel/src/los_init.c +++ b/kernel/src/los_init.c @@ -42,10 +42,6 @@ #include "los_interrupt.h" #endif -#if (LOSCFG_KERNEL_TRACE == 1) -#include "los_debug.h" -#endif - #if (LOSCFG_BASE_CORE_SWTMR == 1) #include "los_swtmr.h" #endif @@ -186,14 +182,6 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID) return ret; } -#if (LOSCFG_KERNEL_TRACE == 1) - ret = LOS_TraceInit(); - if (ret != LOS_OK) { - PRINT_ERR("LOS_TraceInit error\n"); - return ret; - } -#endif - #if (LOSCFG_KERNEL_PM == 1) ret = OsPmInit(); if (ret != LOS_OK) { @@ -202,7 +190,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID) } #endif -#ifdef LOSCFG_TEST +#if (LOSCFG_TEST == 1) //ret = los_TestInit(); //if (ret != LOS_OK) { // PRINT_ERR("los_TestInit error\n"); diff --git a/kernel/src/los_task.c b/kernel/src/los_task.c index 81cbc7f0..cc9b260f 100644 --- a/kernel/src/los_task.c +++ b/kernel/src/los_task.c @@ -581,10 +581,6 @@ LITE_OS_SEC_TEXT VOID OsTaskSwitchCheck(VOID) g_pfnUsrTskSwitchHook(); } -#if (LOSCFG_KERNEL_TRACE == 1) - LOS_Trace(LOS_TRACE_SWITCH, 0); -#endif - #if (LOSCFG_BASE_CORE_CPUP == 1) OsTskCycleEndStart(); #endif /* LOSCFG_BASE_CORE_CPUP */ diff --git a/kernel/src/mm/los_memory.c b/kernel/src/mm/los_memory.c index 16c90184..ba6ce980 100644 --- a/kernel/src/mm/los_memory.c +++ b/kernel/src/mm/los_memory.c @@ -41,7 +41,6 @@ /* Used to cut non-essential functions. */ #define OS_MEM_EXPAND_ENABLE 0 -#define OS_MEM_TRACE 0 UINT8 *m_aucSysMem0 = NULL; @@ -906,11 +905,6 @@ UINT32 LOS_MemInit(VOID *pool, UINT32 size) } #endif -#if OS_MEM_TRACE - LOS_TraceReg(LOS_TRACE_MEM_TIME, OsMemTimeTrace, LOS_TRACE_MEM_TIME_NAME, LOS_TRACE_ENABLE); - LOS_TraceReg(LOS_TRACE_MEM_INFO, OsMemInfoTrace, LOS_TRACE_MEM_INFO_NAME, LOS_TRACE_ENABLE); -#endif - OsHookCall(LOS_HOOK_TYPE_MEM_INIT, pool, size); return LOS_OK; @@ -929,11 +923,6 @@ UINT32 LOS_MemDeInit(VOID *pool) OsMemPoolDeinit(pool); -#if OS_MEM_TRACE - LOS_TraceUnreg(LOS_TRACE_MEM_TIME); - LOS_TraceUnreg(LOS_TRACE_MEM_INFO); -#endif - OsHookCall(LOS_HOOK_TYPE_MEM_DEINIT, pool); return LOS_OK; @@ -1003,10 +992,6 @@ retry: VOID *LOS_MemAlloc(VOID *pool, UINT32 size) { -#if OS_MEM_TRACE - UINT64 start = HalClockGetCycles(); -#endif - if ((pool == NULL) || (size == 0)) { return NULL; } @@ -1028,19 +1013,6 @@ VOID *LOS_MemAlloc(VOID *pool, UINT32 size) } while (0); MEM_UNLOCK(poolHead, intSave); -#if OS_MEM_TRACE - UINT64 end = HalClockGetCycles(); - UINT32 timeUsed = MEM_TRACE_CYCLE_TO_US(end - start); - LOS_Trace(LOS_TRACE_MEM_TIME, (UINTPTR)pool & MEM_POOL_ADDR_MASK, MEM_TRACE_MALLOC, timeUsed); - - LOS_MEM_POOL_STATUS poolStatus = {0}; - (VOID)LOS_MemInfoGet(pool, &poolStatus); - UINT8 fragment = 100 - poolStatus.maxFreeNodeSize * 100 / poolStatus.totalFreeSize; /* 100: percent denominator. */ - UINT8 usage = LOS_MemTotalUsedGet(pool) * 100 / LOS_MemPoolSizeGet(pool); /* 100: percent denominator. */ - LOS_Trace(LOS_TRACE_MEM_INFO, (UINTPTR)pool & MEM_POOL_ADDR_MASK, fragment, usage, poolStatus.totalFreeSize, - poolStatus.maxFreeNodeSize, poolStatus.usedNodeNum, poolStatus.freeNodeNum); -#endif - OsHookCall(LOS_HOOK_TYPE_MEM_ALLOC, pool, size); return ptr; @@ -1048,10 +1020,6 @@ VOID *LOS_MemAlloc(VOID *pool, UINT32 size) VOID *LOS_MemAllocAlign(VOID *pool, UINT32 size, UINT32 boundary) { -#if OS_MEM_TRACE - UINT64 start = HalClockGetCycles(); -#endif - UINT32 gapSize; if ((pool == NULL) || (size == 0) || (boundary == 0) || !OS_MEM_IS_POW_TWO(boundary) || @@ -1100,12 +1068,6 @@ VOID *LOS_MemAllocAlign(VOID *pool, UINT32 size, UINT32 boundary) } while (0); MEM_UNLOCK(poolHead, intSave); -#if OS_MEM_TRACE - UINT64 end = HalClockGetCycles(); - UINT32 timeUsed = MEM_TRACE_CYCLE_TO_US(end - start); - LOS_Trace(LOS_TRACE_MEM_TIME, (UINTPTR)pool & MEM_POOL_ADDR_MASK, MEM_TRACE_MEMALIGN, timeUsed); -#endif - OsHookCall(LOS_HOOK_TYPE_MEM_ALLOCALIGN, pool, size, boundary); return ptr; @@ -1277,10 +1239,6 @@ STATIC INLINE VOID *OsGetRealPtr(const VOID *pool, VOID *ptr) UINT32 LOS_MemFree(VOID *pool, VOID *ptr) { -#if OS_MEM_TRACE - UINT64 start = HalClockGetCycles(); -#endif - if ((pool == NULL) || (ptr == NULL) || !OS_MEM_IS_ALIGNED(pool, sizeof(VOID *)) || !OS_MEM_IS_ALIGNED(ptr, sizeof(VOID *))) { return LOS_NOK; @@ -1304,12 +1262,6 @@ UINT32 LOS_MemFree(VOID *pool, VOID *ptr) } while (0); MEM_UNLOCK(poolHead, intSave); -#if OS_MEM_TRACE - UINT64 end = HalClockGetCycles(); - UINT32 timeUsed = MEM_TRACE_CYCLE_TO_US(end - start); - LOS_Trace(LOS_TRACE_MEM_TIME, (UINTPTR)pool & MEM_POOL_ADDR_MASK, MEM_TRACE_FREE, timeUsed); -#endif - return ret; } @@ -1382,10 +1334,6 @@ STATIC INLINE VOID *OsMemRealloc(struct OsMemPoolHead *pool, const VOID *ptr, VOID *LOS_MemRealloc(VOID *pool, VOID *ptr, UINT32 size) { -#if OS_MEM_TRACE - UINT64 start = HalClockGetCycles(); -#endif - if ((pool == NULL) || OS_MEM_NODE_GET_USED_FLAG(size) || OS_MEM_NODE_GET_ALIGNED_FLAG(size)) { return NULL; } @@ -1426,12 +1374,6 @@ VOID *LOS_MemRealloc(VOID *pool, VOID *ptr, UINT32 size) } while (0); MEM_UNLOCK(poolHead, intSave); -#if OS_MEM_TRACE - UINT64 end = HalClockGetCycles(); - UINT32 timeUsed = MEM_TRACE_CYCLE_TO_US(end - start); - LOS_Trace(LOS_TRACE_MEM_TIME, (UINTPTR)pool & MEM_POOL_ADDR_MASK, MEM_TRACE_REALLOC, timeUsed); -#endif - return newPtr; } diff --git a/utils/los_debug.h b/utils/los_debug.h index cd061554..009b754c 100644 --- a/utils/los_debug.h +++ b/utils/los_debug.h @@ -169,200 +169,6 @@ typedef VOID (*BACK_TRACE_HOOK)(UINTPTR *LR, UINT32 LRSize, UINT32 jumpCount, UI extern VOID OsBackTraceHookSet(BACK_TRACE_HOOK hook); extern VOID OsBackTraceHookCall(UINTPTR *LR, UINT32 LRSize, UINT32 jumpCount, UINTPTR SP); -/** - * @ingroup los_trace - * Task error code: Insufficient memory for trace struct. - * - * Value: 0x02001400 - * - * Solution: Decrease the maximum number of tasks. - */ -#define LOS_ERRNO_TRACE_NO_MEMORY LOS_ERRNO_OS_ERROR(LOS_MOD_TRACE, 0x00) - -/** - * @ingroup los_trace - * Task error code: User type is invalid when register new trace. - * - * Value: 0x02001401 - * - * Solution: Use valid type to register the new trace. - */ -#define LOS_ERRNO_TRACE_TYPE_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_TRACE, 0x01) - - -/** - * @ingroup los_trace - * Task error code: The callback function is null when register new trace. - * - * Value: 0x02001402 - * - * Solution: Use valid callback function to register the new trace. - */ -#define LOS_ERRNO_TRACE_FUNCTION_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_TRACE, 0x02) - -/** - * @ingroup los_trace - * Task error code: The filled size is 0 when register new trace. - * - * Value: 0x02001403 - * - * Solution: Use valid filled size to register the new trace. - */ -#define LOS_ERRNO_TRACE_MAX_SIZE_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_TRACE, 0x03) - -/** - * @ingroup los_trace - * It's the total size of trace buffer. It's in the unit of char - */ -#define LOS_TRACE_BUFFER_SIZE 1024 - -/** - * @ingroup los_trace - * It's the length of tag, filled by los_trace system - */ -#define LOS_TRACE_TAG_LENGTH sizeof(UINT32) - -/** - * @ingroup los_trace - * Stands for the trace type can be registered. - */ -typedef enum enTraceType { - LOS_TRACE_SWITCH = 0, /**< trace for task switch, 0 is reserved for taskswitch */ - LOS_TRACE_INTERRUPT = 1, /**< trace for Interrupt, 1 is reserved for interrupt */ - LOS_TRACE_TYPE_NUM = 10, /**< num for the register type, user can use 2~ LOS_TRACE_TYPE_NUM-1 */ -} TRACE_TYPE_E; - - -/** - * @ingroup los_trace - * struct to store the task switch infomation - */ -typedef struct tagTraceTaskSwitch { - UINT8 ucSrcTaskId; /**< source taskId */ - UINT8 ucDestTaskId; /**< destination taskId */ - UINT32 uwSwitchTick; /**< Time at which the task switch happens */ -} TRACE_TASKSWITCH_S; - -/** - * @ingroup los_trace - * struct to store the interrupt infomation - */ -typedef struct tagTraceInterrupt { - UINT8 ucIRQEntryExit; /**< 1 stands for that the trace is happend before interrupt function */ - /**< 0 stands for that the trace is after before interrupt function */ - UINT16 usIRQNo; /**< IRQ number which trigger the interrupt */ - UINT32 uwTick; /**< Time at which the the trace is called */ -} TRACE_INTERRUPT_S; - -/** - * @ingroup los_trace - * union struct to store the interrupt and task switch infomation - */ -typedef struct tagTrace { - union { - TRACE_TASKSWITCH_S stTraceTask; /**< It used for trace the task */ - TRACE_INTERRUPT_S stTraceInterrupt; /**< It used for trace the interrupt */ - }; -} TRACE_S; - -/** - * @ingroup los_trace - * Main struct to store the interrupt and task switch infomation - */ -typedef struct tagTraceBuffer { - UINT16 usTracePos; - UINT16 usTraceWrapPos; - UINT8 ucBuffer[LOS_TRACE_BUFFER_SIZE]; -} TRACE_BUFFER_S; - - -/** - * @ingroup los_trace - * Struct to store the trace information for each trace type - */ -typedef struct tagTraceInfo { - TRACE_TYPE_E eType; /**< trace type, selected from TRACE_TYPE_E */ - UINT16 (*pfnHook)(UINT8 *outBuffer, VOID *pInfo); /**< callback function for the specific trace type. - * This function is used to store the infomation - * which want to be traced */ -} TRACE_INFO_S; - -/** - * @ingroup los_trace - * @brief Initialize the trace when the system startup. - * - * @par Description: - * This API is used to initialize the trace for system level. - * @attention - *