进行FreeOS移植的时候会遇到函数定向问题
在文件FreeRTOSConfig.h中定义如下,就不用更改system_stm32f4xx.c里面的中断函数名,
/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
standard names. */
#define vPortSVCHandler SVC_Handler
#define xPortPendSVHandler PendSV_Handler
#define xPortSysTickHandler SysTick_Handler
SVC_Handler
PendSV_Handler
SysTick_Handler
几个函数,但可能在ST标准库里其他地方会用到这几个函数,下面提供了一个新的方法可以借鉴,在函数前加上 --weak 修饰,编译就不会报错
__weak void SVC_Handler(void)
{
}
/**
* @brief This function handles Debug Monitor exception.
* @param None
* @retval None
*/
void DebugMon_Handler(void)
{
}
/**
* @brief This function handles PendSVC exception.
* @param None
* @retval None
*/
__weak void PendSV_Handler(void)
{
}
/**
* @brief This function handles SysTick Handler.
* @param None
* @retval None
*/
__weak void SysTick_Handler(void)
{
}
/*gcc reference里提到:
Having two or more global symbols of the same name will not cause a conflict as long as all but one of them are declared as being weak symbols. The linker ignores the definitions of the weak symbols and uses the normal global symbol definition to resolve all references, but the weak symbols will be used if the normal global symbol is not available. A weak symbol can be used to name functions and data that can be overridden by user code. A weak symbol is also referred to as a weak alias, or simply weak.
通过上面的例子(FreeOS9.0里面的IAR Demo程序),weak的作用可见一斑。
*/