ARM-software / CMSIS_5

CMSIS Version 5 Development Repository
http://arm-software.github.io/CMSIS_5/index.html
Apache License 2.0
1.33k stars 1.08k forks source link

Issue with osDelay in TC_osKernelResume_1 #1635

Open ianfield opened 1 year ago

ianfield commented 1 year ago

cmsis_rtos2_validation/Source/RV2_Kernel.c

Entry to TC_osKernelResume_1 (comes after TC_osKernelSuspend_1) the kernel is in state osKernelSuspended.

What is the expected return value for osDelay(1U). Should it be:

ASSERT_TRUE(osDelay(1U) == osError);

The comment "/ Synchronize tick /" seems out of place if the system timer is disabled at that point.

ianfield commented 1 year ago

Alternatively, if kernel is suspended on entry, would this make sense:

osKernelResume(0);

/* Synchronize tick */
ASSERT_TRUE(osDelay(1U) == osOK);
VladimirUmek commented 1 year ago

Hi, this should be open in CMSIS-RTOS2_Validation, but I guess we can also solve it here.

If you are referring to TC_osKernelSuspend_1 and TC_osKernelResume_1 then osDelay(1U) is there to set the tick counter to the start of time slice (as close as possible, hence it is synchronizing tick). It sets the initial condition to ensure correct test case flow.

Each test is independent and looking at the code, the kernel shall be running after TC_osKernelSuspend_1. The kernel is resumed and since osKernelSuspend and osKernelResume shall not be called from ISR any other call shall not suspend the kernel. TC_osKernelResume_1 is therefore called with the kernel tick running.

Does this make sense?