IAR平台FreeOS移植接口函数处理--weak属性用法
来源:互联网 发布:淘宝打包员是蹲着做吗 编辑:程序博客网 时间:2024/05/19 14:51
进行FreeOS移植的时候会遇到函数定向问题
在文件FreeRTOSConfig.h中定义如下,就不用更改system_stm32f4xx.c里面的中断函数名,
/* Definitions that map the FreeRTOS port interrupt handlers to their CMSISstandard names. */#define vPortSVCHandler SVC_Handler#define xPortPendSVHandler PendSV_Handler#define xPortSysTickHandler SysTick_Handler
但存在两个函数定义,编译会出问题,这个时候就需要做相应的处理,可以注释掉
SVC_HandlerPendSV_HandlerSysTick_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里提到:
A function with this attribute has its name emitted as a weak
symbol instead of a global name. This is primarily for the naming
of library routines that can be overridden by user code.
weak symbolHaving 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的作用可见一斑。
*/
0 0
- IAR平台FreeOS移植接口函数处理--weak属性用法
- inline函数和weak属性冲突
- 移植keil到IAR
- 关于gcc中函数或变量的weak属性
- gcc中函数或者变量的weak属性
- c语言之函数或者变量的weak属性
- C#接口中的属性用法
- libcurl用法 接口函数用法
- 接口处理函数
- weak symbol属性
- 移植IAR到 AVR GCC
- icc到iar移植日志
- IAR用法点滴
- _attribute_(weak)的用法
- 字符串处理函数用法。
- ios开发学习:生命属性时的Strong和Weak的区别及用法
- IAR平台下开发Renesas单片机-----IAR开发平台搭建
- VC++图像处理中DIB类库的用法,外部接口函数怎样使用啊?
- ion-scroll滚动到底部事件
- android新闻客户端(一)
- C++面向对象编程的基本概念及四种机制及类和对象
- 如何提高 Java 中锁的性能
- js事件流冒泡
- IAR平台FreeOS移植接口函数处理--weak属性用法
- FFmpeg滤镜使用指南
- iOS开发(OC)——UIWindow
- python -lambda表达式的用法
- VBA代码实例---个人所得税计算
- 漫谈设计模式之装饰模式(Decorator)
- mybatis根据父级编号获取所有的子级
- nginx正向代理
- python 判断参数为Nonetype类型或空