I have a question related to Cortex-M3 port of portENTER_CRITICAL() function. It disables interrupts, but should it also disable SysTick interrupt?
If you are looking at official FreeRTOS code then portENTER_CRITICAL() does not disable interrupts, it only masks interrupts up to a user settable priority level. The systick is the lowest priority interrupt so will always be masked inside a critical section.
So it means that SysTick won't be counted during critical section?
If a SysTick occurs inside a critical section it will be held pending by the hardware until the critical section was exited.
Typically an application will configure the tick to occur ever 10 or 100ms. Critical sections should always be kept very short, and should never be anywhere near as long as one tick period.
If you need a longer critical section then consider using scheduler locking instead (vTaskSuspendAll() and xTaskResumeAll()). Tick interrupts that occur while the scheduler is suspended are help pending in software so more than one can be pended. When the scheduler is unlocked (resumed) any pending tick interrupts are 'unwound' so you don't get any time slippage.
Thanks for clarification!
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.