Replace GCC with LLVM for LiteOS-m

Signed-off-by: peshkovivan <peshkov.ivan@huawei-partners.com>
This commit is contained in:
peshkovivan 2023-10-02 13:00:07 +03:00
parent e22e8525e9
commit d7576df916
5 changed files with 105 additions and 96 deletions

View File

@ -43,25 +43,25 @@
.equ OS_CONTROL_FPCA_ENABLE, 0x4
.equ OS_CONTROL_KERNEL_MODE, 0x2
#if (LOSCFG_SECURE == 1)
.equ OS_CONTROL_USER_MODE, 0x3
.equ OS_TASK_FLAG_USER_TASK, 0x0200
#endif
.section .text
.thumb
.macro SIGNAL_CONTEXT_RESTORE
push {r12, lr}
blx OsSignalTaskContextRestore
pop {r12, lr}
cmp r0, #0
mov r1, r0
bne SignalContextRestore
.endm
.type HalStartToRun, %function
.global HalStartToRun
HalStartToRun:
.equ OS_CONTROL_USER_MODE, 0x3
.equ OS_TASK_FLAG_USER_TASK, 0x0200
#endif
.section .text
.thumb
.macro SIGNAL_CONTEXT_RESTORE
push {r12, lr}
bl OsSignalTaskContextRestore
pop {r12, lr}
cmp r0, #0
mov r1, r0
bne SignalContextRestore
.endm
.type HalStartToRun, %function
.global HalStartToRun
HalStartToRun:
.fnstart
.cantunwind
@ -153,25 +153,25 @@ ArchTaskSchedule:
.global HalPendSV
HalPendSV:
.fnstart
.cantunwind
mrs r12, PRIMASK
cpsid I
HalTaskSwitch:
SIGNAL_CONTEXT_RESTORE
push {r12, lr}
blx OsSchedTaskSwitch
pop {r12, lr}
cmp r0, #0
mov r0, lr
bne TaskContextSwitch
msr PRIMASK, r12
bx lr
TaskContextSwitch:
mov lr, r0
.cantunwind
mrs r12, PRIMASK
cpsid I
HalTaskSwitch:
SIGNAL_CONTEXT_RESTORE
push {r12, lr}
bl OsSchedTaskSwitch
pop {r12, lr}
cmp r0, #0
mov r0, lr
bne TaskContextSwitch
msr PRIMASK, r12
bx lr
TaskContextSwitch:
mov lr, r0
mrs r0, psp
stmfd r0!, {r4-r12}

View File

@ -118,42 +118,42 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsCpupGuardCreator(VOID)
(VOID)LOS_SwtmrStart(cpupSwtmrID);
return LOS_OK;
}
#endif
/*****************************************************************************
Function : OsCpupDaemonInit
Description: initialization of CPUP Daemon
Input : None
Return : LOS_OK or Error Information
*****************************************************************************/
LITE_OS_SEC_TEXT_INIT UINT32 OsCpupDaemonInit()
{
#if (LOSCFG_BASE_CORE_SWTMR == 1)
(VOID)OsCpupGuardCreator();
g_irqCpupInitFlg = 1;
#endif
return LOS_OK;
}
#endif
/*****************************************************************************
Function : OsCpupInit
Description: initialization of CPUP
Input : None
Return : LOS_OK or Error Information
*****************************************************************************/
LITE_OS_SEC_TEXT_INIT UINT32 OsCpupInit()
{
UINT32 size;
CHAR *cpupMem = NULL;
size = g_taskMaxNum * sizeof(OsCpupCB);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
size += LOSCFG_PLATFORM_HWI_LIMIT * sizeof(OsIrqCpupCB);
#endif
}
#endif
/*****************************************************************************
Function : OsCpupDaemonInit
Description: initialization of CPUP Daemon
Input : None
Return : LOS_OK or Error Information
*****************************************************************************/
LITE_OS_SEC_TEXT_INIT UINT32 OsCpupDaemonInit(void)
{
#if (LOSCFG_BASE_CORE_SWTMR == 1)
(VOID)OsCpupGuardCreator();
g_irqCpupInitFlg = 1;
#endif
return LOS_OK;
}
#endif
/*****************************************************************************
Function : OsCpupInit
Description: initialization of CPUP
Input : None
Return : LOS_OK or Error Information
*****************************************************************************/
LITE_OS_SEC_TEXT_INIT UINT32 OsCpupInit(void)
{
UINT32 size;
CHAR *cpupMem = NULL;
size = g_taskMaxNum * sizeof(OsCpupCB);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
size += LOSCFG_PLATFORM_HWI_LIMIT * sizeof(OsIrqCpupCB);
#endif
cpupMem = LOS_MemAlloc(m_aucSysMem0, size);
if (cpupMem == NULL) {
return LOS_ERRNO_CPUP_NO_MEMORY;

View File

@ -199,26 +199,25 @@ static UINT32 Testcase(VOID)
}
}
ret = LOS_EventDestroy(&g_eventCB1);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_EventDestroy(&g_eventCB2);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_EventDestroy(&g_eventCB3);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
return LOS_OK;
EXIT:
LOS_SwtmrDelete(g_swtmrId3);
LOS_SwtmrDelete(g_swtmrId2);
LOS_SwtmrDelete(g_swtmrId1);
LOS_TaskDelete(g_testTaskID02);
LOS_TaskDelete(g_testTaskID03);
return LOS_OK;
}
ret = LOS_EventDestroy(&g_eventCB1);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_EventDestroy(&g_eventCB2);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_EventDestroy(&g_eventCB3);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
// cleanup resources after tests
EXIT:
LOS_SwtmrDelete(g_swtmrId3);
LOS_SwtmrDelete(g_swtmrId2);
LOS_SwtmrDelete(g_swtmrId1);
LOS_TaskDelete(g_testTaskID02);
LOS_TaskDelete(g_testTaskID03);
return LOS_OK;
}
VOID ItLosSwtmr035(VOID) // IT_Layer_ModuleORFeature_No
{

View File

@ -119,9 +119,19 @@ LITE_TEST_CASE(PosixMathFuncTestSuite, testMathAbs001, Function | MediumTest | L
*/
LITE_TEST_CASE(PosixMathFuncTestSuite, testMathAbs002, Function | MediumTest | Level1)
{
// the first case ( abs(-2147483648) ) is UB
// quote from "man abs": "Trying to take the absolute value of the most negative integer is not defined."
// so this case is disabled for non-GCC toolchains
#ifdef LOSCFG_COMPILER_GCC
const int testCount = 3;
int testValues[] = {-2147483648, -2147483647, 2147483647};
int expected[] = {-2147483648, 2147483647, 2147483647};
#else
const int testCount = 2;
int testValues[] = {-2147483647, 2147483647};
int expected[] = {2147483647, 2147483647};
#endif
int ret;
for (int i = 0; i < testCount; ++i) {
ret = abs(testValues[i]);

View File

@ -355,7 +355,7 @@ LITE_TEST_CASE(MqueueFuncTestSuite, TestMqOpenENOSPC, Function | MediumTest | Le
*/
LITE_TEST_CASE(MqueueFuncTestSuite, TestMqCloseEBADF, Function | MediumTest | Level2)
{
ICUNIT_TRACK_EQUAL(mq_close(NULL), -1, -1);
ICUNIT_TRACK_EQUAL(mq_close((mqd_t)NULL), -1, -1);
ICUNIT_TRACK_EQUAL(errno, EBADF, errno);
return 0;
}
@ -411,7 +411,7 @@ LITE_TEST_CASE(MqueueFuncTestSuite, TestMqSendEBADFEMSGSIZE, Function | MediumTe
queue = mq_open(qName, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &attr);
ICUNIT_ASSERT_NOT_EQUAL(queue, (mqd_t)-1, queue);
ret = mq_send(NULL, MQ_MSG, 1, MQ_MSG_PRIO);
ret = mq_send((mqd_t)NULL, MQ_MSG, 1, MQ_MSG_PRIO);
ICUNIT_TRACK_EQUAL(ret, -1, ret);
ICUNIT_TRACK_EQUAL(errno, EBADF, errno);