当前位置: 代码迷 >> 综合 >> 【Close】使用GCC编译运行无法完成测试用例
  详细解决方案

【Close】使用GCC编译运行无法完成测试用例

热度:9   发布时间:2024-01-20 12:12:48.0

【问题】

使用GCC编译后不能正常完成所有测试用例,在TASK TEST阶段切换任务时宕机。

[0000000000000000][0045][INFOR][ShowSystemInformation] Starting Fans-RT 0.11.1298 for board stm32-mini ...
[0000000000000000][0047][INFOR][ShowSystemInformation] Build for GCC 04.08.0003, data: Jul 19 2015, time: 14:20:05.
[0000000000000000][0049][INFOR][ShowSystemInformation] Show the size of core type for debug:
[0000000000000000][0051][INFOR][ShowSystemInformation] CHAR: 1  SHORT: 2  INT: 4  LONG: 4  LONG LONG: 8  E_STATUS: 1
[0000000000000000][0053][INFOR][ShowSystemInformation] BYTE: 1  WORD: 2  DWORD: 4  QWORD: 8  SIZE_T: 4,  LPVOID: 4
[0000000000000000][0054][INFOR][ShowSystemInformation] BOOL: 1  FLOAT:4  DOUBLE:8
[0000000000000000][0055][INFOR][ShowSystemInformation] Hardware tick max value is 71999.
[0000000000000000][0057][INFOR][ShowSystemInformation] The integer printf test: 12345678, 00000123, 20150630011218, 2013
[0000000000000000][0058][INFOR][ShowSystemInformation] The float printf test: 3.141592, 3.14, 3.142
[0000000000000000][0081][INFOR][CORE_InstallLPC] Install service 'LPC' to 6 successfully.
[0000000000000000][0175][INFOR][initCoreLocalProcedureCallManager] System call(LPC) service starting ... [OK]
[0000000000000000][0081][INFOR][CORE_InstallLPC] Install service 'SDM' to 3 successfully.
[0000000000000000][0161][INFOR][initCoreSystemDebugManager] System debug manager(SDM) starting ... [OK]
[0000000000000000][0081][INFOR][CORE_InstallLPC] Install service 'SCM' to 2 successfully.
[0000000000000000][0058][INFOR][initCoreSystemTimerManager] System clock manager(SCM) starting ... [OK]
[0000000000000000][0081][INFOR][CORE_InstallLPC] Install service 'IRQ' to 8 successfully.
[0000000000000000][0146][INFOR][initCoreInterruptServiceRoutinesManager] Interrupt request(IRQ) manager starting ... [OK]
[0000000000000000][1794][INFOR][initCoreSystemGlobalMemoryManager] system global memory manager(SMM) not install.
[0000000000000000][1189][INFOR][initCoreSystemObjectPoolManager] OBJECT0_CONTAINER: 24      OBJECT1_CONTAINER: 24.
[0000000000000000][1191][INFOR][initCoreSystemObjectPoolManager] OBJECT2_CONTAINER: 24      OBJECT3_CONTAINER: 24.
[0000000000000000][1193][INFOR][initCoreSystemObjectPoolManager] OBJECT4_CONTAINER: 24      OBJECT5_CONTAINER: 24.
[0000000000000000][1195][INFOR][initCoreSystemObjectPoolManager] OBJECT6_CONTAINER: 24      OBJECT7_CONTAINER: 24.
[0000000000000000][0103][INFOR][CORE_CreatePoolContainer] Create pool 0(0x2000097C) for 'Object0'(0x20000974), have blocks 2.
[0000000000000000][0103][INFOR][CORE_CreatePoolContainer] Create pool 0(0x200009D8) for 'Object2'(0x200009D0), have blocks 3.
[0000000000000000][0103][INFOR][CORE_CreatePoolContainer] Create pool 0(0x20000B70) for 'Object5'(0x20000B68), have blocks 1.
[0000000000000000][0081][INFOR][CORE_InstallLPC] Install service 'SOM' to 5 successfully.
[0000000000000000][1275][INFOR][initCoreSystemObjectPoolManager] System object management(SOM) service starting ... [OK]
[0000000000000000][0602][INFOR][initCoreInterProcessCommunicationManager] IPC_BASE_OBJECT:   28,   IPC_EVENT_OBJECT:     32
[0000000000000000][0604][INFOR][initCoreInterProcessCommunicationManager] IPC_MUTEX_OBJECT:  32,   IPC_SEMAPHORE_OBJECT: 32
[0000000000000000][0531][INFOR][CORE_RegisterClass] Class(EventClass-691) register to 5 ...
[0000000000000000][0562][INFOR][CORE_RegisterClass] Register class 'EventClass' to 5 successfully.
[0000000000000000][0531][INFOR][CORE_RegisterClass] Class(MutexClass-631) register to 1 ...
[0000000000000000][0562][INFOR][CORE_RegisterClass] Register class 'MutexClass' to 1 successfully.
[0000000000000000][0531][INFOR][CORE_RegisterClass] Class(SemaphoreClass-140) register to 0 ...
[0000000000000000][0562][INFOR][CORE_RegisterClass] Register class 'SemaphoreClass' to 0 successfully.
[0000000000000000][0531][INFOR][CORE_RegisterClass] Class(SemsetClass-147) register to 7 ...
[0000000000000000][0562][INFOR][CORE_RegisterClass] Register class 'SemsetClass' to 7 successfully.
[0000000000000000][0531][INFOR][CORE_RegisterClass] Class(UserStackClass-660) register to 2 ...
[0000000000000000][0562][INFOR][CORE_RegisterClass] Register class 'UserStackClass' to 2 successfully.
[0000000000000000][0531][INFOR][CORE_RegisterClass] Class(KTaskStackClass-66) register to 10 ...
[0000000000000000][0562][INFOR][CORE_RegisterClass] Register class 'KTaskStackClass' to 10 successfully.
[0000000000000000][0081][INFOR][CORE_InstallLPC] Install service 'STK' to 1 successfully.
[0000000000000000][0530][INFOR][initCoreSystemTaskStackManager] Task stack(STK) manager starting ... [OK]
[0000000000000000][0921][INFOR][initCoreSystemTaskScheduleManager] ArchContext offset of TaskContext is 64.
[0000000000000000][0922][INFOR][initCoreSystemTaskScheduleManager] Max priority is 3, Show the size of tss type for debug:
[0000000000000000][0924][INFOR][initCoreSystemTaskScheduleManager] ARCH_CONTEXT: 24  MANA_MAP_T: 1  TASK_CONTEXT: 128   KOBJECT_HEADER: 20
[0000000000000000][0925][INFOR][initCoreSystemTaskScheduleManager] TASK_STATUS: 1  TIME_SLICE_T: 2
[0000000000000000][0531][INFOR][CORE_RegisterClass] Class(TaskClass-586) register to 12 ...
[0000000000000000][0562][INFOR][CORE_RegisterClass] Register class 'TaskClass' to 12 successfully.
[0000000000000000][0081][INFOR][CORE_InstallLPC] Install service 'TSK' to 0 successfully.
[0000000000000000][0935][INFOR][initCoreSystemTaskScheduleManager] Task Schedule(TSK) service starting ... [OK]
[0000000000000000][0581][INFOR][MallocObjectFromPool] Malloc pool from 'TaskClass', Tid(2), ObjectSize(128).
[0000000000000000][0159][INFOR][CORE_PoolMallocBlock] Malloc pool 0x200009D8 Pid 0, Bid 0, Kid 0, for container 'Object2' ...
[0000000000000000][0232][INFOR][CORE_StackMalloc] Task 'Boot' no need malloc user stack.
[0000000000000000][0340][INFOR][CORE_StackInit] Task 'Boot' no need fill user stack.
[0000000000000000][0196][INFOR][CORE_StackMalloc] Malloc stack(0) buffer 0x20000000 for task 'Boot' successfully.
[0000000000000000][0264][INFOR][CORE_StackMalloc] Task 'Boot' malloc stack(0) buffer 0x20000000 for task 'Boot' successfully.
[0000000000000000][0329][INFOR][CORE_StackInit] Task 'Boot' fill stack(0) buffer 0x20000000 buttom 0x20000600 position 0x20000600.
[0000000000000000][0678][INFOR][CORE_CreateTaskEx] Crete task 'Boot' context '0x200009e8' successfully!
[0000000000000000][0581][INFOR][MallocObjectFromPool] Malloc pool from 'TaskClass', Tid(2), ObjectSize(128).
[0000000000000000][0159][INFOR][CORE_PoolMallocBlock] Malloc pool 0x200009D8 Pid 0, Bid 1, Kid 1, for container 'Object2' ...
[0000000000000000][0264][INFOR][CORE_StackMalloc] Task 'Idle' malloc stack(0) buffer 0x20000600 for task 'Idle' successfully.
[0000000000000000][0329][INFOR][CORE_StackInit] Task 'Idle' fill stack(0) buffer 0x20000600 buttom 0x20000900 position 0x200008b8.
[0000000000000000][0678][INFOR][CORE_CreateTaskEx] Crete task 'Idle' context '0x20000a68' successfully!
[0000000000000001][Line: 0127][INFOR][initSystemApplicationModulesStartup] Probe module 'Application' ...
[0000000000000010][Line: 0035][INFOR][BASE_TEST_CASE] Run 'TestCase00' ...... [SUCCESS]
[0000000000000018][Line: 0035][INFOR][FansMain] BASE_TEST_CASE .... [SUCCESS]
[0000000000000025][0581][INFOR][MallocObjectFromPool] Malloc pool from 'MutexClass', Tid(0), ObjectSize(32).
[0000000000000025][0159][INFOR][CORE_PoolMallocBlock] Malloc pool 0x2000097C Pid 0, Bid 0, Kid 0, for container 'Object0' ...
[0000000000000026][0581][INFOR][MallocObjectFromPool] Malloc pool from 'EventClass', Tid(0), ObjectSize(32).
[0000000000000026][0159][INFOR][CORE_PoolMallocBlock] Malloc pool 0x2000097C Pid 0, Bid 1, Kid 1, for container 'Object0' ...
[0000000000000027][0278][INFOR][ScheduleBegin] Will be scheduling to task '20000a68', Priority is 2, 20000f90, 20000a90, old task is 200009e8.

【根因】

函数 CORE_ActiveSwitchIRQ 写 PendSV 激活标志位时,地址寄存器写错(将[R5]错写成[R4]):

CORE_ActiveSwitchIRQ:PUSH    {R4, R5}LDR     R4,     =NVIC_CONTROLLDR     R5,     =NVIC_PEND_SETSTR     R5,     [R5]ISBPOP     {R4, R5}BX      LRNOP

修改后:

CORE_ActiveSwitchIRQ:PUSH    {R4, R5}LDR     R4,     =NVIC_CONTROLLDR     R5,     =NVIC_PEND_SETSTR     R5,     [R4]ISBPOP     {R4, R5}BX      LRNOP


修改后全部测试用例运行通过:

[0000000000000000][0045][INFOR][ShowSystemInformation] Starting Fans-RT 0.11.1300 for board stm32-mini ...
[0000000000000000][0047][INFOR][ShowSystemInformation] Build for GCC 04.08.0003, data: Jul 21 2015, time: 00:24:17.
[0000000000000000][0049][INFOR][ShowSystemInformation] Show the size of core type for debug:
[0000000000000000][0051][INFOR][ShowSystemInformation] CHAR: 1  SHORT: 2  INT: 4  LONG: 4  LONG LONG: 8  E_STATUS: 1
[0000000000000000][0053][INFOR][ShowSystemInformation] BYTE: 1  WORD: 2  DWORD: 4  QWORD: 8  SIZE_T: 4,  LPVOID: 4
[0000000000000000][0054][INFOR][ShowSystemInformation] BOOL: 1  FLOAT:4  DOUBLE:8
[0000000000000000][0055][INFOR][ShowSystemInformation] Hardware tick max value is 71999.
[0000000000000000][0057][INFOR][ShowSystemInformation] The integer printf test: 12345678, 00000123, 20150630011218, 2013
[0000000000000000][0058][INFOR][ShowSystemInformation] The float printf test: 3.141592, 3.14, 3.142
[0000000000000000][0081][INFOR][CORE_InstallLPC] Install service 'LPC' to 6 successfully.
[0000000000000000][0175][INFOR][initCoreLocalProcedureCallManager] System call(LPC) service starting ... [OK]
[0000000000000000][0081][INFOR][CORE_InstallLPC] Install service 'SDM' to 3 successfully.
[0000000000000000][0161][INFOR][initCoreSystemDebugManager] System debug manager(SDM) starting ... [OK]
[0000000000000000][0081][INFOR][CORE_InstallLPC] Install service 'SCM' to 2 successfully.
[0000000000000000][0058][INFOR][initCoreSystemTimerManager] System clock manager(SCM) starting ... [OK]
[0000000000000000][0081][INFOR][CORE_InstallLPC] Install service 'IRQ' to 8 successfully.
[0000000000000000][0146][INFOR][initCoreInterruptServiceRoutinesManager] Interrupt request(IRQ) manager starting ... [OK]
[0000000000000000][1794][INFOR][initCoreSystemGlobalMemoryManager] system global memory manager(SMM) not install.
[0000000000000000][1189][INFOR][initCoreSystemObjectPoolManager] OBJECT0_CONTAINER: 24      OBJECT1_CONTAINER: 24.
[0000000000000000][1191][INFOR][initCoreSystemObjectPoolManager] OBJECT2_CONTAINER: 24      OBJECT3_CONTAINER: 24.
[0000000000000000][1193][INFOR][initCoreSystemObjectPoolManager] OBJECT4_CONTAINER: 24      OBJECT5_CONTAINER: 24.
[0000000000000000][1195][INFOR][initCoreSystemObjectPoolManager] OBJECT6_CONTAINER: 24      OBJECT7_CONTAINER: 24.
[0000000000000000][0103][INFOR][CORE_CreatePoolContainer] Create pool 0(0x2000097C) for 'Object0'(0x20000974), have blocks 2.
[0000000000000000][0103][INFOR][CORE_CreatePoolContainer] Create pool 0(0x200009D8) for 'Object2'(0x200009D0), have blocks 3.
[0000000000000000][0103][INFOR][CORE_CreatePoolContainer] Create pool 0(0x20000B70) for 'Object5'(0x20000B68), have blocks 1.
[0000000000000000][0081][INFOR][CORE_InstallLPC] Install service 'SOM' to 5 successfully.
[0000000000000000][1275][INFOR][initCoreSystemObjectPoolManager] System object management(SOM) service starting ... [OK]
[0000000000000000][0602][INFOR][initCoreInterProcessCommunicationManager] IPC_BASE_OBJECT:   28,   IPC_EVENT_OBJECT:     32
[0000000000000000][0604][INFOR][initCoreInterProcessCommunicationManager] IPC_MUTEX_OBJECT:  32,   IPC_SEMAPHORE_OBJECT: 32
[0000000000000000][0531][INFOR][CORE_RegisterClass] Class(EventClass-691) register to 5 ...
[0000000000000000][0562][INFOR][CORE_RegisterClass] Register class 'EventClass' to 5 successfully.
[0000000000000000][0531][INFOR][CORE_RegisterClass] Class(MutexClass-631) register to 1 ...
[0000000000000000][0562][INFOR][CORE_RegisterClass] Register class 'MutexClass' to 1 successfully.
[0000000000000000][0531][INFOR][CORE_RegisterClass] Class(SemaphoreClass-140) register to 0 ...
[0000000000000000][0562][INFOR][CORE_RegisterClass] Register class 'SemaphoreClass' to 0 successfully.
[0000000000000000][0531][INFOR][CORE_RegisterClass] Class(SemsetClass-147) register to 7 ...
[0000000000000000][0562][INFOR][CORE_RegisterClass] Register class 'SemsetClass' to 7 successfully.
[0000000000000000][0531][INFOR][CORE_RegisterClass] Class(UserStackClass-660) register to 2 ...
[0000000000000000][0562][INFOR][CORE_RegisterClass] Register class 'UserStackClass' to 2 successfully.
[0000000000000000][0531][INFOR][CORE_RegisterClass] Class(KTaskStackClass-66) register to 10 ...
[0000000000000000][0562][INFOR][CORE_RegisterClass] Register class 'KTaskStackClass' to 10 successfully.
[0000000000000000][0081][INFOR][CORE_InstallLPC] Install service 'STK' to 1 successfully.
[0000000000000000][0530][INFOR][initCoreSystemTaskStackManager] Task stack(STK) manager starting ... [OK]
[0000000000000000][0921][INFOR][initCoreSystemTaskScheduleManager] ArchContext offset of TaskContext is 64.
[0000000000000000][0922][INFOR][initCoreSystemTaskScheduleManager] Max priority is 3, Show the size of tss type for debug:
[0000000000000000][0924][INFOR][initCoreSystemTaskScheduleManager] ARCH_CONTEXT: 24  MANA_MAP_T: 1  TASK_CONTEXT: 128   KOBJECT_HEADER: 20
[0000000000000000][0925][INFOR][initCoreSystemTaskScheduleManager] TASK_STATUS: 1  TIME_SLICE_T: 2
[0000000000000000][0531][INFOR][CORE_RegisterClass] Class(TaskClass-586) register to 12 ...
[0000000000000000][0562][INFOR][CORE_RegisterClass] Register class 'TaskClass' to 12 successfully.
[0000000000000000][0081][INFOR][CORE_InstallLPC] Install service 'TSK' to 0 successfully.
[0000000000000000][0935][INFOR][initCoreSystemTaskScheduleManager] Task Schedule(TSK) service starting ... [OK]
[0000000000000000][0581][INFOR][MallocObjectFromPool] Malloc pool from 'TaskClass', Tid(2), ObjectSize(128).
[0000000000000000][0159][INFOR][CORE_PoolMallocBlock] Malloc pool 0x200009D8 Pid 0, Bid 0, Kid 0, for container 'Object2' ...
[0000000000000000][0232][INFOR][CORE_StackMalloc] Task 'Boot' no need malloc user stack.
[0000000000000000][0340][INFOR][CORE_StackInit] Task 'Boot' no need fill user stack.
[0000000000000000][0196][INFOR][CORE_StackMalloc] Malloc stack(0) buffer 0x20000000 for task 'Boot' successfully.
[0000000000000000][0264][INFOR][CORE_StackMalloc] Task 'Boot' malloc stack(0) buffer 0x20000000 for task 'Boot' successfully.
[0000000000000000][0329][INFOR][CORE_StackInit] Task 'Boot' fill stack(0) buffer 0x20000000 buttom 0x20000600 position 0x20000600.
[0000000000000000][0678][INFOR][CORE_CreateTaskEx] Crete task 'Boot' context '0x200009e8' successfully!
[0000000000000000][0581][INFOR][MallocObjectFromPool] Malloc pool from 'TaskClass', Tid(2), ObjectSize(128).
[0000000000000000][0159][INFOR][CORE_PoolMallocBlock] Malloc pool 0x200009D8 Pid 0, Bid 1, Kid 1, for container 'Object2' ...
[0000000000000000][0264][INFOR][CORE_StackMalloc] Task 'Idle' malloc stack(0) buffer 0x20000600 for task 'Idle' successfully.
[0000000000000000][0329][INFOR][CORE_StackInit] Task 'Idle' fill stack(0) buffer 0x20000600 buttom 0x20000900 position 0x200008b8.
[0000000000000000][0678][INFOR][CORE_CreateTaskEx] Crete task 'Idle' context '0x20000a68' successfully!
[0000000000000001][Line: 0127][INFOR][initSystemApplicationModulesStartup] Probe module 'Application' ...
[0000000000000010][Line: 0035][INFOR][BASE_TEST_CASE] Run 'TestCase00' ...... [SUCCESS]
[0000000000000018][Line: 0035][INFOR][FansMain] BASE_TEST_CASE .... [SUCCESS]
[0000000000000025][0581][INFOR][MallocObjectFromPool] Malloc pool from 'MutexClass', Tid(0), ObjectSize(32).
[0000000000000025][0159][INFOR][CORE_PoolMallocBlock] Malloc pool 0x2000097C Pid 0, Bid 0, Kid 0, for container 'Object0' ...
[0000000000000026][0581][INFOR][MallocObjectFromPool] Malloc pool from 'EventClass', Tid(0), ObjectSize(32).
[0000000000000026][0159][INFOR][CORE_PoolMallocBlock] Malloc pool 0x2000097C Pid 0, Bid 1, Kid 1, for container 'Object0' ...
[0000000000000027][0278][INFOR][ScheduleBegin] Will be scheduling to task '20000a68', Priority is 2, 20000f90, 20000a90, old task is 200009e8.
[0000000000001028][0278][INFOR][ScheduleBegin] Will be scheduling to task '200009e8', Priority is 1, 20000f88, 20000a10, old task is 20000a68.
[0000000000001029][Line: 0322][ERROR][TASK_TEST_CASE] TASK_TEST_CASE00 .... [SUCCESS]
[0000000000001037][Line: 0322][ERROR][TASK_TEST_CASE] TASK_TEST_CASE01 .... [SUCCESS]
[0000000000001044][0581][INFOR][MallocObjectFromPool] Malloc pool from 'TaskClass', Tid(2), ObjectSize(128).
[0000000000001044][0159][INFOR][CORE_PoolMallocBlock] Malloc pool 0x200009D8 Pid 0, Bid 2, Kid 2, for container 'Object2' ...
[0000000000001045][0232][INFOR][CORE_StackMalloc] Task 'Task02' no need malloc user stack.
[0000000000001046][0340][INFOR][CORE_StackInit] Task 'Task02' no need fill user stack.
[0000000000001047][0581][INFOR][MallocObjectFromPool] Malloc pool from 'UserStackClass', Tid(5), ObjectSize(1024).
[0000000000001047][0159][INFOR][CORE_PoolMallocBlock] Malloc pool 0x20000B70 Pid 0, Bid 0, Kid 0, for container 'Object5' ...
[0000000000001047][0264][INFOR][CORE_StackMalloc] Task 'Task02' malloc stack(0) buffer 0x20000B80 for task 'Task02' successfully.
[0000000000001048][0329][INFOR][CORE_StackInit] Task 'Task02' fill stack(0) buffer 0x20000b80 buttom 0x20000f80 position 0x20000f38.
[0000000000001058][0278][INFOR][ScheduleBegin] Will be scheduling to task '20000ae8', Priority is 1, 20000f88, 20000b10, old task is 200009e8.
[0000000000001068][0278][INFOR][ScheduleBegin] Will be scheduling to task '200009e8', Priority is 1, 20000f88, 20000a10, old task is 20000ae8.
[0000000000001069][0278][INFOR][ScheduleBegin] Will be scheduling to task '20000ae8', Priority is 1, 20000f88, 20000b10, old task is 200009e8.
[0000000000001070][Line: 0135][INFOR][TASK_TEST_THREAD02] The test task 'Task02' exiting...
[0000000000001078][0278][INFOR][ScheduleBegin] Will be scheduling to task '20000a68', Priority is 2, 20000f90, 20000a90, old task is 20000ae8.
[0000000000002069][0278][INFOR][ScheduleBegin] Will be scheduling to task '200009e8', Priority is 1, 20000f88, 20000a10, old task is 20000a68.
[0000000000002070][Line: 0322][ERROR][TASK_TEST_CASE] TASK_TEST_CASE02 .... [SUCCESS]
[0000000000002078][0990][INFOR][CORE_FreeObject] Object 'TASKMTX' call free in the class 'MutexClass' successfully.
[0000000000002079][0990][INFOR][CORE_FreeObject] Object 'TASKEVT' call free in the class 'EventClass' successfully.
[0000000000002080][Line: 0035][INFOR][FansMain] TASK_TEST_CASE .... [SUCCESS]
[0000000000002087][Line: 0035][INFOR][FansMain] LSOT_TEST_CASE .... [SUCCESS]
[0000000000002094][Line: 0039][INFOR][FansMain] The all testcase finished !



  相关解决方案