Keil的例程移植是个重点 以上海灵动的FTHR-G0001为例 首先要有手册、例程 d82d10de-e278-465f-8282-9f98dabfa4be.zip 打开例程后发现总是少文件,还有因为路径问题报错 先看一下最终排除错误后的结果: file:///C:/Users/Administrator/AppData/Local/Temp/ksohtml2760/wps1.jpg 为力求真实,我从头开始截图说明: 打开Keil压缩包,把其中的文件夹 点右键 复制到 另一个位置, 从另一个位置的文件夹里打开KEIL文件, 以上说的是,不要再压缩文件中打开KEIL例程,会加载路径错误。 点开: file:///C:/Users/Administrator/AppData/Local/Temp/ksohtml2760/wps2.jpg 点开 file:///C:/Users/Administrator/AppData/Local/Temp/ksohtml2760/wps3.jpg 点开,默认读者知晓KEIL安装,并装好keil v5 file:///C:/Users/Administrator/AppData/Local/Temp/ksohtml2760/wps4.jpg 编译: file:///C:/Users/Administrator/AppData/Local/Temp/ksohtml2760/wps5.jpg 编译版本报错: file:///C:/Users/Administrator/AppData/Local/Temp/ksohtml2760/wps6.jpg 解决方式: 更换V6.2.1 file:///C:/Users/Administrator/AppData/Local/Temp/ksohtml2760/wps7.jpg 重新编译:33个错误 file:///C:/Users/Administrator/AppData/Local/Temp/ksohtml2760/wps8.jpg 用讯飞星火查询报错原因: Build started: Project: USART_Interrupt *** Using Compiler 'V6.21', folder: 'D:\Keil_v5\ARM\ARMCLANG\Bin' Build target 'USART_Interrupt' compiling main.c... ../main.c(33): warning: In file included from... ../platform.h:38:10: fatal error: 'hal_conf.h' file not found 38 | #include "hal_conf.h" | ^~~~~~~~~~~~ 1 error generated. compiling mm32g0001_it.c... ../mm32g0001_it.c(33): warning: In file included from... ../platform.h:38:10: fatal error: 'hal_conf.h' file not found 38 | #include "hal_conf.h" | ^~~~~~~~~~~~ 1 error generated. compiling usart_interrupt.c... ../usart_interrupt.c(34): warning: In file included from... ../platform.h:38:10: fatal error: 'hal_conf.h' file not found 38 | #include "hal_conf.h" | ^~~~~~~~~~~~ 1 error generated. compiling platform.c... ../platform.c(34): warning: In file included from... ../platform.h:38:10: fatal error: 'hal_conf.h' file not found 38 | #include "hal_conf.h" | ^~~~~~~~~~~~ 1 error generated. compiling hal_adc.c... ArmClang: error: no such file or directory: '../../../../../Device/MM32G0001/HAL_Lib/src/hal_adc.c' ArmClang: error: no input files compiling hal_crc.c... ArmClang: error: no such file or directory: '../../../../../Device/MM32G0001/HAL_Lib/src/hal_crc.c' ArmClang: error: no input files compiling hal_dbg.c... ArmClang: error: no such file or directory: '../../../../../Device/MM32G0001/HAL_Lib/src/hal_dbg.c' ArmClang: error: no input files compiling hal_exti.c... ArmClang: error: no such file or directory: '../../../../../Device/MM32G0001/HAL_Lib/src/hal_exti.c' ArmClang: error: no input files compiling hal_flash.c... ArmClang: error: no such file or directory: '../../../../../Device/MM32G0001/HAL_Lib/src/hal_flash.c' ArmClang: error: no input files compiling hal_gpio.c... ArmClang: error: no such file or directory: '../../../../../Device/MM32G0001/HAL_Lib/src/hal_gpio.c' ArmClang: error: no input files compiling hal_i2c.c... ArmClang: error: no such file or directory: '../../../../../Device/MM32G0001/HAL_Lib/src/hal_i2c.c' ArmClang: error: no input files compiling hal_iwdg.c... ArmClang: error: no such file or directory: '../../../../../Device/MM32G0001/HAL_Lib/src/hal_iwdg.c' ArmClang: error: no input files compiling hal_misc.c... ArmClang: error: no such file or directory: '../../../../../Device/MM32G0001/HAL_Lib/src/hal_misc.c' ArmClang: error: no input files compiling hal_pwr.c... ArmClang: error: no such file or directory: '../../../../../Device/MM32G0001/HAL_Lib/src/hal_pwr.c' ArmClang: error: no input files compiling hal_rcc.c... ArmClang: error: no such file or directory: '../../../../../Device/MM32G0001/HAL_Lib/src/hal_rcc.c' ArmClang: error: no input files compiling hal_spi.c... ArmClang: error: no such file or directory: '../../../../../Device/MM32G0001/HAL_Lib/src/hal_spi.c' ArmClang: error: no input files compiling hal_tim.c... ArmClang: error: no such file or directory: '../../../../../Device/MM32G0001/HAL_Lib/src/hal_tim.c' ArmClang: error: no input files compiling hal_uid.c... ArmClang: error: no such file or directory: '../../../../../Device/MM32G0001/HAL_Lib/src/hal_uid.c' ArmClang: error: no input files compiling hal_usart.c... ArmClang: error: no such file or directory: '../../../../../Device/MM32G0001/HAL_Lib/src/hal_usart.c' ArmClang: error: no input files compiling system_mm32g0001.c... ArmClang: error: no such file or directory: '../../../../../Device/MM32G0001/Source/system_mm32g0001.c' ArmClang: error: no input files assembling startup_mm32g0001_keil.s... startup_mm32g0001_keil.s: error: A1023E: File "..\..\..\..\..\Device\MM32G0001\Source\KEIL_StartAsm\startup_mm32g0001_keil.s" could not be opened: No such file or directory ".\Objects\USART_Interrupt.axf" - 33 Error(s), 0 Warning(s). Target not created. Build Time Elapsed: 00:00:19 注释: 从编译错误信息来看,主要问题有以下几点: 1. 找不到头文件 "hal_conf.h"。请确保该头文件存在于正确的路径下,并在项目中正确引用。 2. 找不到源文件 "../../../../../Device/MM32G0001/HAL_Lib/src/hal_adc.c" 等。请确保这些源文件存在于正确的路径下,并在项目中正确引用。 3. 找不到汇编文件 "startup_mm32g0001_keil.s"。请确保该文件存在于正确的路径下,并在项目中正确引用。 请检查项目设置和文件路径,确保所有文件都存在于正确的位置,并在项目中正确引用。 从这个例程中移植 hal_conf.h : 41d52245-d97f-4fd6-820a-49cbe5a16954.zip 注意解压缩成文件夹再用,注意路径: file:///C:/Users/Administrator/AppData/Local/Temp/ksohtml2760/wps9.jpg移植过程: 复制: file:///C:/Users/Administrator/AppData/Local/Temp/ksohtml2760/wps10.png
|