Hello,
I am working on a project in which I am using a FDRM KL25z development board to drive an HID keyboard device. In order to create this device, I am adapting the KL25z SDK HID example code to my own project.
I started out by reading over and understanding the code, then I copied over all the components from the example that was needed in as similar of a directory hierarchy as I could. In the project settings, I made sure to add the USB source includes in the same manner as the example project. When I try to build, it fails on undefined references to several functions in the USB source.
In trying to debug, I found that the generated makefile lacks the USB directories I specified in the include, in the same method I used for other source files that needed to be located. In the image below, the left hand side is my new project, and the right hand side is the example project.
I have tried to configure the MCU C compiler includes in the same manner as the example as well, with these two screenshots from the MCU C compiler includes settings in the same order as above. Note I originally tried with the workspace referenced include similar to the CMSIS, osa, and sources include, but then tried the direct path similar to the example.
The "/#includes" in the source are correct, with the only difference being that the "main" entrypoint is in source/typewriterKeyboard.c rather that /sources/composite.c like in the example. I'm not sure what difference that would make as the Makefile is not including the usb directories regardless.
This problem has been confusing me for several hours. I usually write C in plain text editors so I'm not used to these automatic build and configuration tools, and I only think I'm doing this correct.
Any help would be greatly appreciated.
--Matt
已解决! 转到解答。
I would guess that you have created your USB directories a a 'folder' rather than 'source folder' - the IDE will ignore anything placed in 'folders'. You can check this by looking at the icon for the folder if it has a small 'c' overplayed on the picture, it is a source folder - if not, it is s folder. You can convert it to a source folder by right-clicking on the project, selecting New->Source Folder and type the name of the folder that you want to change.
I would guess that you have created your USB directories a a 'folder' rather than 'source folder' - the IDE will ignore anything placed in 'folders'. You can check this by looking at the icon for the folder if it has a small 'c' overplayed on the picture, it is a source folder - if not, it is s folder. You can convert it to a source folder by right-clicking on the project, selecting New->Source Folder and type the name of the folder that you want to change.
That seemed to do the trick, but now it's just getting hung up on a file in a sub-directory, it should be recursive correct? I wonder what could be going wrong. Could it be a build order? It cannot find usb_device_khci.h but then builds the source file for usb_device_khci.c