21ic问答首页 - stm32cubemx中freertosV10.0.1与cmsis_v2配合是否有问题
stm32cubemx中freertosV10.0.1与cmsis_v2配合是否有问题
xsq21dz2021-06-03
在cmsis_os2.c中有:#if defined(SysTick)
/* FreeRTOS tick timer interrupt handler prototype */
extern void xPortSysTickHandler (void);
/*
SysTick handler implementation that also clears overflow flag.
*/
void SysTick_Handler (void) {
/* Clear overflow flag */
SysTick->CTRL;
/* Call tick handler */
xPortSysTickHandler();
}
#endif /* SysTick */
在FreeRTOSConfig.h有#define xPortSysTickHandler SysTick_Handler
在port.c
void xPortSysTickHandler( void )
{
/* The SysTick runs at the lowest interrupt priority, so when this interrupt
executes all interrupts must be unmasked. There is therefore no need to
save and then restore the interrupt mask value as its value is already
known. */
portDISABLE_INTERRUPTS();
{
/* Increment the RTOS tick. */
if( xTaskIncrementTick() != pdFALSE )
{
/* A context switch is required. Context switching is performed in
the PendSV interrupt. Pend the PendSV interrupt. */
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
}
}
portENABLE_INTERRUPTS();
}
/* FreeRTOS tick timer interrupt handler prototype */
extern void xPortSysTickHandler (void);
/*
SysTick handler implementation that also clears overflow flag.
*/
void SysTick_Handler (void) {
/* Clear overflow flag */
SysTick->CTRL;
/* Call tick handler */
xPortSysTickHandler();
}
#endif /* SysTick */
在FreeRTOSConfig.h有#define xPortSysTickHandler SysTick_Handler
在port.c
void xPortSysTickHandler( void )
{
/* The SysTick runs at the lowest interrupt priority, so when this interrupt
executes all interrupts must be unmasked. There is therefore no need to
save and then restore the interrupt mask value as its value is already
known. */
portDISABLE_INTERRUPTS();
{
/* Increment the RTOS tick. */
if( xTaskIncrementTick() != pdFALSE )
{
/* A context switch is required. Context switching is performed in
the PendSV interrupt. Pend the PendSV interrupt. */
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
}
}
portENABLE_INTERRUPTS();
}
您需要登录后才可以回复 登录 | 注册