Keil 丢失编译器版本5、内核文件core_cm3.c报错

一、Missing Compiler Version 5

1. 下载 Arm Compiler 5

链接:百度网盘 请输入提取码
提取码:zv2i

2. ARMCC

下载ARMCC.rar文件,
解压后将其中的ARMCC文件复制到keil安装目录下的ARM目录里:F:\KEIL_C51\ARM

3.Keil 配置

①打开


② Folders/Extensions
 


③添加ARMCC文件夹
 

Build started: Project: project *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin' Build target 'Target 1' Note: source file '..\Libraries\CMSIS\core_cm3.c' - object file renamed from '.\Objects\core_cm3.o' to '.\Objects\core_cm3_1.o'. Note: source file '..\Libraries\CMSIS\system_stm32f10x.c' - object file renamed from '.\Objects\system_stm32f10x.o' to '.\Objects\system_stm32f10x_1.o'. Note: source file '..\Libraries\CMSIS\core_cm3.c' - object file renamed from '.\Objects\core_cm3.o' to '.\Objects\core_cm3_1.o'. Note: source file '..\Libraries\CMSIS\system_stm32f10x.c' - object file renamed from '.\Objects\system_stm32f10x.o' to '.\Objects\system_stm32f10x_1.o'. compiling misc.c... compiling stm32f10x_adc.c... compiling stm32f10x_dac.c... compiling stm32f10x_crc.c... compiling stm32f10x_exti.c... compiling stm32f10x_cec.c... compiling stm32f10x_dbgmcu.c... compiling stm32f10x_bkp.c... compiling stm32f10x_can.c... compiling stm32f10x_dma.c... compiling stm32f10x_flash.c... compiling stm32f10x_fsmc.c... compiling stm32f10x_gpio.c... compiling stm32f10x_pwr.c... compiling stm32f10x_i2c.c... compiling stm32f10x_iwdg.c... compiling stm32f10x_rtc.c... compiling stm32f10x_sdio.c... compiling stm32f10x_rcc.c... compiling stm32f10x_usart.c... compiling stm32f10x_spi.c... compiling stm32f10x_tim.c... compiling core_cm3.c... compiling stm32f10x_wwdg.c... compiling system_stm32f10x.c... compiling Hardware.c... compiling Hardware_systick.c... compiling Soft_layer_Electronic_nutrition_scale.c... compiling Hardware_usart.c... compiling Hardware_SYS.c... compiling Hardware_GPIO.c... compiling Hardware_ADC.c... compiling Hardware_SPI.c... compiling Soft_layer.c... compiling Soft_layer_lcd.c... compiling core_cm3.c... compiling main.c... ..\main\main.c(37): error: #5: cannot open source input file "arm_math.h": No such file or directory #include "arm_math.h" ..\main\main.c: 0 warnings, 1 error compiling stm32f10x_it.c... compiling system_stm32f10x.c... compiling Soft_layer_lcd_GUI.c... ".\Objects\project.axf" - 1 Error(s), 0 Warning(s). Target not created. Build Time Elapsed: 00:00:02
09-28
08-31
# 回答 你指出的问题是:“是第二张图的 `core_cm3.c` 文件找不到”。然而,你上传的两份文件中: - 第一张为图片《cknow_20251113_233652.jpg》,展示了 Keil 工程界面。 - 第二张文件为空白(无名称、无类型、无内容),所谓“第二张图”并不存在。 因此,我们只能基于你描述的内容进行推断:你在 Keil 工程中遇到编译错误,提示 **`core_cm3.c` 文件找不到**。 --- ## 题目重述 在 Keil 工程中,编译时报错提示无法找到 `core_cm3.c` 文件,尽管该项目已包含 CMSIS 组件,为什么会这样? --- ## 详解 `core_cm3.c` 是 **CMSIS(Cortex Microcontroller Software Interface Standard)** 的核心文件之一,用于提供 Cortex-M3 内核的底层支持函数。当编译器报错“找不到 `core_cm3.c`”时,说明该文件未被正确引入工程。 ### 🔍 常见原因分析: #### 1. `core_cm3.c` 文件未添加到工程中 虽然你在工程目录中看到了 `core_cm3.c`(如图所示左侧文件树中有此文件),但 **仅存在于磁盘或未加入编译组**,IDE 不会自动编译它。 > ✅ 解决方法: 右键点击 "Source Group" → Add Files to Group… → 选择 `core_cm3.c` 文件 → 确认添加。 #### 2. 文件路径存在但未参与构建 有时文件出现在项目树中但图标为灰色,或前面没有“✔️”,表示它被排除在编译之外。 > ⚠️ 注意: 查看文件是否带有禁止符号或未勾选,确保其处于“编译状态”。 #### 3. 编译器搜索路径中缺少 CMSIS 头文件路径 即使 `.c` 文件已加入,若对应的头文件路径未设置,也可能因 `#include "core_cm3.h"` 找不到而中断编译流程。 > ✅ 解决方法: 进入: ``` Options for Target → C/C++ → Include Paths ``` 添加 CMSIS 相关路径,例如: ``` .\Libraries\CMSIS\ .\Libraries\CMSIS\Device\ST\STM32F10x\Source\Templates\ ``` #### 4. 文件被误删或路径移动 如果你是从模板复制工程,请确认 `core_cm3.c` 是否随 CMSIS 一起复制完整。常见路径为: ``` CMSIS\core_support\core_cm3.c ``` 若原始目录被删除或路径变更,自然无法访问。 #### 5. 使用了旧版启动文件或配置冲突 某些旧版 STM32 工程模板默认不包含 `core_cm3.c`,而是将其功能内联处理。强行引用会导致寻找失败。 --- ## 给出答案(带注释的说明) ```c // core_cm3.c 是 CMSIS 标准的一部分,提供 M3 内核寄存器映射和基础函数 // 必须满足以下条件才能正常编译: // 1.core_cm3.c 添加进工程(Add Files to Group) // ✔ 文件必须参与编译 // 2. 设置正确的包含路径: // #include "core_cm3.h" 需要能找到该头文件 // 因此需在 Options → C/C++ → Include Paths 中添加: // .\Libraries\CMSIS\ // 3. 确认文件真实存在且未重命名 // 默认路径示例:.\Libraries\CMSIS\core_cm3.c // 4. 不要遗漏 device 对应的系统文件 #include "system_stm32f10x.c" // 通常也需要加入工程 ``` --- ## 知识点(列出解答该问题需要的知识点) - **CMSIS 核心文件作用** `$`core_cm3.c`$` 提供 Cortex-M3 内核寄存器访问接口,必须加入编译。 - **Keil 工程文件管理机制** 文件必须手动添加至 Group,否则不在构建范围内。 - **包含路径与编译依赖关系** 即使文件存在,缺少 Include Paths 会导致头文件无法定位,中断编译。
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值