硬汉嵌入式论坛

 找回密码
 立即注册
查看: 2821|回复: 3
收起左侧

[技术讨论] keil compiler V6下使用cmsis_usart

[复制链接]

5

主题

179

回帖

194

积分

初级会员

积分
194
发表于 2019-12-13 00:28:59 | 显示全部楼层 |阅读模式
在编译器选择V6的情况下,使用cmsis_driver驱动会报错,DMA_STM32F10x.c文件中提示__weak 未定义。单独把串口驱动文件DMA_STM32F10x.c和GPIO_STM32F10x.c提取出来,将DMA_STM32F10x.c修改__weak为__WEAk ,重新加入工程。
报错是没有了,这样使用自带keil自带的usart驱动可行吗
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
107077
QQ
发表于 2019-12-13 20:22:26 | 显示全部楼层
可以的。

  1. /* CMSIS compiler specific defines */
  2. #ifndef   __ASM
  3.   #define __ASM                                  __asm
  4. #endif
  5. #ifndef   __INLINE
  6.   #define __INLINE                               __inline
  7. #endif
  8. #ifndef   __STATIC_INLINE
  9.   #define __STATIC_INLINE                        static __inline
  10. #endif
  11. #ifndef   __STATIC_FORCEINLINE
  12.   #define __STATIC_FORCEINLINE                   __attribute__((always_inline)) static __inline
  13. #endif
  14. #ifndef   __NO_RETURN
  15.   #define __NO_RETURN                            __attribute__((__noreturn__))
  16. #endif
  17. #ifndef   __USED
  18.   #define __USED                                 __attribute__((used))
  19. #endif
  20. #ifndef   __WEAK
  21.   #define __WEAK                                 __attribute__((weak))
  22. #endif
  23. #ifndef   __PACKED
  24.   #define __PACKED                               __attribute__((packed, aligned(1)))
  25. #endif
  26. #ifndef   __PACKED_STRUCT
  27.   #define __PACKED_STRUCT                        struct __attribute__((packed, aligned(1)))
  28. #endif
  29. #ifndef   __PACKED_UNION
  30.   #define __PACKED_UNION                         union __attribute__((packed, aligned(1)))
  31. #endif
复制代码
回复

使用道具 举报

5

主题

179

回帖

194

积分

初级会员

积分
194
 楼主| 发表于 2019-12-13 21:50:31 | 显示全部楼层

有没有简单一点的设置方法
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
107077
QQ
发表于 2019-12-13 22:44:51 | 显示全部楼层
soga238 发表于 2019-12-13 21:50
有没有简单一点的设置方法

感觉有点不科学啊,现在F4和H7的HAL库里面的小写__weak使用AC6编译都没有问题

不过他们的原始定义都是一样的:

不行你也加上个宏定义试试。
QQ截图20191213224608.jpg

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-5-17 06:46 , Processed in 0.172723 second(s), 28 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表