找回密码
 立即注册
搜索
查看: 336|回复: 0

MDK-ARM(Keil)使用 GCC 编译器

[复制链接]

266

主题

0

回帖

1119

积分

管理员

积分
1119
发表于 2023-12-26 00:17:09 | 显示全部楼层 |阅读模式

MDK 自带的编译器是 ARMCC 或 ARMCLANG(Arm Compiler 6),有时需要使用 GCC 编译器(例如需要使用 GCC 编译的静态库)。当然,用 GCC 不一定非要用 MDK IDE。

先去 ARM 官网下载 GNU 工具链(Arm GNU Toolchain)

Arm GNU Toolchain is a community supported pre-built GNU compiler
toolchain for Arm based CPUs.

Arm GNU Toolchain releases consists of cross toolchains for the
following host operating systems:

GNU/Linux Available for x86_64 and AArch64 host architectures
Available for bare-metal and Linux targets Windows Available for x86
host architecture only (compatible with x86_64) Available for
bare-metal and Linux targets macOS Available for x86_64 host
architecture only Available for bare-metal targets only

下载地址:
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/downloads

安装后配置 MDK:
Project > Manage > Project Items

GCC 的文件夹要选择它的根目录。

配置项目:
Project > Options for Target

Device 选择正确的器件,会产生 -mcpu=xxx

CC 配置编译相关参数,主要是定义预处理宏、头文件路径、GCC的编译参数等。

Assembler 配置汇编相关参数。

Linker 配置连接相关参数。

不过,既然要用 GCC 不如完全抛弃 MDK 😅,工程管理直接使用 cmake 就挺好的。


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

本版积分规则

Archiver|手机版|小黑屋|棱讯科技 ( 粤ICP备2024228160号-2|粤公网安备44030002003510号 )

GMT+8, 2024-7-27 19:24 , Processed in 0.017211 second(s), 3 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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