MPLAB X IDE 环境中配置字的注意点

在MPLAB X IDE(芯片PIC24)中build生成程序,出现错误。

xxxxxxxxxxxxxxxxxxxxxxx
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
c:\program files (x86)\microchip\xc16\v1.31\bin\bin\..\bin/elf-ld.exe: Link Error: section .config_JTAGEN%26 02abfe -\> 02abff overlaps section . config_JTAGEN%23 02abfe -\> 02abff
c:\program files (x86)\microchip\xc16\v1.31\bin\bin\..\bin/elf-ld.exe: Link Error: section .config_IESO%27 02abfc -\> 02abfd overlaps section .config_IESO%24 02abfc -\> 02abfd
c:\program files (x86)\microchip\xc16\v1.31\bin\bin\..\bin/elf-ld.exe: Link Error: section .config_WPEND%28 02abfa -\> 02abfb overlaps section .config_WPEND%25 02abfa -\> 02abfb
c:\program files (x86)\microchip\xc16\v1.31\bin\bin\..\bin/elf-ld.exe: Link Error: section .config_JTAGEN%29 02abfe -\> 02abff overlaps section .config_JTAGEN%23 02abfe -\> 02abff
c:\program files (x86)\microchip\xc16\v1.31\bin\bin\..\bin/elf-ld.exe: Link Error: section .config_IESO%30 02abfc -\> 02abfd overlaps section .config_IESO%24 02abfc -\> 02abfd
c:\program files (x86)\microchip\xc16\v1.31\bin\bin\..\bin/elf-ld.exe: Link Error: section .config_WPEND%31 02abfa -\> 02abfb overlaps section .config_WPEND%25 02abfa -\> 02abfb
c:\program files (x86)\microchip\xc16\v1.31\bin\bin\..\bin/elf-ld.exe: Link terminated due to previous error(s).
make2: *** dist/default/production/TCOM1.X.production.hex Error 255
make1: *** .build-conf Error 2
make: *** .build-impl Error 2

BUILD FAILED (exit value 2, total time: 10s)

要解决这个问题,可以按照以下步骤进行检查和修复:

  1. 检查配置字定义:确保在代码中没有重复定义配置字。配置字应只定义一次。如果项目中有多个源文件,检查每个源文件的配置字定义,确保它们不会互相冲突。

  2. 检查链接脚本:如果使用了自定义的链接脚本,检查链接脚本中的配置,确保配置区段不会发生重叠。

  3. 使用编译器提供的工具:一些编译器提供了工具来帮助检查和设置配置字,例如Microchip的MPLAB X IDE。使用这些工具可以帮助避免配置字冲突。

  4. 参考编译器和设备文档:查阅编译器和设备的文档,了解配置字的正确设置方法和可能的限制。

  • 如何正确设置PIC24F系列微控制器的配置字:

    复制代码
    #pragma config ICS = PGx1               // ICD Pin Placement Select bits (EMUC/EMUD share PGC1/PGD1)
    #pragma config JTAGEN = OFF       

确保每个配置字只定义一次,并且没有冲突。

如果你已经检查了所有配置字定义并确保它们没有冲突,但问题仍然存在,请考虑以下步骤:

  1. 清理并重新构建项目。
  2. 更新编译工具链到最新版本。
  3. 如果使用IDE,检查IDE的项目设置,确保没有意外的配置。

解决方法:这些配置字要放在xxx.c文件内,不能放在xxx.h文件。其实若放在xxx.h文件,有上层调用代码时,不就定义了多次,的确会发生冲突。

相关推荐
国产化创客1 小时前
创客开发入门(三)Arduino IDE 开发环境
ide·单片机·嵌入式硬件·课程设计·智能硬件
CedarQR1 小时前
LubanCat-2 (RK3568) Debian 下让 H3C Magic USB 无线网卡(AIC8800)联网全记录
linux·网络·单片机·嵌入式硬件·debian·3568·h3c
T1mzhou11 小时前
ARM64 Linux 6.10内核启动流程7-ioremap和readl writel
linux·服务器·c语言
芯片人00711 小时前
纯硬件一键开关机ASIC芯片,为什么比 MCU 方案更适合更可靠
人工智能·单片机·嵌入式硬件·物联网·芯片
未来之窗软件服务16 小时前
计算机二级[英文]-C 字符串移动—东方仙盟
c语言·开发语言·仙盟创梦ide·东方仙盟
国科安芯16 小时前
面向卫星测控应答机的抗辐射MCU信号采集与定时控制研究
单片机·嵌入式硬件·mcu·架构·卫星·商业航天·抗辐射
CC城子17 小时前
EtherNet/IP I/O 丢包排查(linux系统)
linux·单片机·tcp/ip·ethernetip
新晨单片机设计17 小时前
S010A-基于STM32单片机水温控制系统(数码管显示)【Proteus仿真+Keil程序+原理图】
stm32·单片机·嵌入式硬件
事界见闻17 小时前
高性能电机控制MCU选型对比:精度、功耗与实时性如何兼得?
单片机·嵌入式硬件
Brilliantwxx18 小时前
【STM32】 初认识USART串口
linux·stm32·单片机·嵌入式硬件·架构