Microchip对usb_device.c文件的问题,得到错误我无法解决

问题描述 投票:0回答:1

那么问题就是这些错误

我没有触及这些文件,只是下载了传统的mla并使用了这些文件。所以我假设我的目录在某种程度上存在问题。我有微芯片/包含文件的路径和一些代码工作。所以现在当我构建项目时遇到了这些问题。我已经尝试使用链接器文件夹更改路径,但似乎没有任何工作。

我知道函数在usb_device_local.h文件中并包含但仍然没有

即时通讯使用mplabx v5.15和xc32编译器v2.15。也是一个较旧的pic32mx

build/default/production/_ext/2021492214/usb_device.o: In function `_USB1Interrupt':
c:/microchip_solutions_v2013-06-15/microchip/usb/usb_device.c:887: undefined reference to `USER_USB_CALLBACK_EVENT_HANDLER'
c:/microchip_solutions_v2013-06-15/microchip/usb/usb_device.c:937: undefined reference to `USER_USB_CALLBACK_EVENT_HANDLER'
c:/microchip_solutions_v2013-06-15/microchip/usb/usb_device.c:995: undefined reference to `USER_USB_CALLBACK_EVENT_HANDLER'
build/default/production/_ext/2021492214/usb_device.o: In function `USBStdSetCfgHandler':
c:/microchip_solutions_v2013-06-15/microchip/usb/usb_device.c:2180: undefined reference to `USER_USB_CALLBACK_EVENT_HANDLER'
build/default/production/_ext/2021492214/usb_device.o: In function `USBStdGetDscHandler':
c:/microchip_solutions_v2013-06-15/microchip/usb/usb_device.c:2218: undefined reference to `device_dsc'
c:/microchip_solutions_v2013-06-15/microchip/usb/usb_device.c:2218: undefined reference to `device_dsc'
c:/microchip_solutions_v2013-06-15/microchip/usb/usb_device.c:2226: undefined reference to `USB_CD_Ptr'
c:/microchip_solutions_v2013-06-15/microchip/usb/usb_device.c:2226: undefined reference to `USB_CD_Ptr'
c:/microchip_solutions_v2013-06-15/microchip/usb/usb_device.c:2242: undefined reference to `USB_SD_Ptr'
c:/microchip_solutions_v2013-06-15/microchip/usb/usb_device.c:2242: undefined reference to `USB_SD_Ptr'
build/default/production/_ext/2021492214/usb_device.o: In function `USBSuspend':
c:/microchip_solutions_v2013-06-15/microchip/usb/usb_device.c:2437: undefined reference to `USER_USB_CALLBACK_EVENT_HANDLER'
build/default/production/_ext/2021492214/usb_device.o: In function `USBWakeFromSuspend':
c:/microchip_solutions_v2013-06-15/microchip/usb/usb_device.c:2463: undefined reference to `USER_USB_CALLBACK_EVENT_HANDLER'
build/default/production/_ext/2021492214/usb_device.o: In function `USBCtrlTrfSetupHandler':
c:/microchip_solutions_v2013-06-15/microchip/usb/usb_device.c:2657: undefined reference to `USER_USB_CALLBACK_EVENT_HANDLER'
build/default/production/_ext/2021492214/usb_device.o: In function `USBCheckStdRequest':
c:/microchip_solutions_v2013-06-15/microchip/usb/usb_device.c:2879: undefined reference to `USER_USB_CALLBACK_EVENT_HANDLER'
build/default/production/_ext/2021492214/usb_device.o: In function `USBStdFeatureReqHandler':
c:/microchip_solutions_v2013-06-15/microchip/usb/usb_device.c:3041: undefined reference to `USER_USB_CALLBACK_EVENT_HANDLER'
build/default/production/_ext/2021492214/usb_device.o:c:/microchip_solutions_v2013-06-15/microchip/usb/usb_device.c:3071: more undefined references to `USER_USB_CALLBACK_EVENT_HANDLER' follow
collect2.exe: error: ld returned 255 exit status
c pic microchip
1个回答
1
投票

查看您正在使用的编译器以及本教程的编写日期让我相信教程的某些内容不仅过时,而且主/中断代码与您的PIC类型和编译器不兼容使用。 (所以,即使你能摆脱这些错误,除非你知道自己在做什么,否则你会得到更多!)

但是,如果您正确地按照教程并添加了教程中的HardwareProfile.husb_device.cusb_descriptors.cmain.c文件(interrupt中的#configmain.c除了它们将与PIC32不兼容),它应该成功构建,尽管有一堆无关的PLIB警告。

文件结构应如下所示:

File structure

qazxsw poi,qazxsw poi,qazxsw poi,qazxsw poi都应该是你自己创建的.c文件,通过usb_descriptors.c到你的项目并添加教程中的代码。这些应该存在于您的项目文件夹中。

main.cHardwareProfile.h应该来自微芯片mla文件夹

正如教程所述,尽管不是很清楚,但您必须正确设置包含目录。

要执行此操作,请转到项目选项:

usb_config.h

设置以下内容:

New --> C Source File

(无论在哪里安装MLA,我的可能都是不同的版本)

并做同样的事情

usb_device.c

usb_function_cdc.c

Microchip推荐使用xc32 (Global Options) --> Common include dirs Include Directories。如果您使用的是PICMM,那么我建议使用最新版本的MLA,而不是2013版本,您可以在xc32-as General --> Preprocessor Include directories页面上找到。如果不是,我建议学习他们的xc32-as General --> Assembler Include directories

© www.soinside.com 2019 - 2024. All rights reserved.