How to add USB Middleware on my KDS+KSDK Project

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to add USB Middleware on my KDS+KSDK Project

1,468 Views
GiulianoLeitede
Contributor II

Hello guys,

 

I'm not an expert on KSDK + KDS, I use to be a user of Codewarrior + Processor Expert when working on my own projectcs. Recently I was assigned to work on professional project and we are using KSDK 2.0 over KDS IDE. I read all documents that I could regarding SDK2.0 and I avoided to use any document from previous ksdk version since 2.0 seems to be changed a lot and many subjects doesn't fit at all.

 

One difficult that I had was to add USB middleware support to our board project. I did run the USB examples and they have worked fine (fyi, I just focused on CDC). So, the problem wasn't to run the USB itself but bring it to my project (which is a pure KSDK 2.0). It seems to be simple to put other drivers to work but I didn't find any instructions of how to add USB or other middleware like FATFS, MMCAU, etc. At end of day, after hours and hours I brought it to my project after setting project properties and hacking meta file .project (reason? setup by project properties, to create virtual folder, linked file, etc, was a awful and tremendously slow). So, I would like to make sure that I'm doing something wrong, I would like to check whether there is a better way to add a middleware support. Can anyone tell me what is the correc/best way to do this?

 

Thank you guys,

Labels (1)
Tags (1)
0 Kudos
5 Replies

961 Views
GiulianoLeitede
Contributor II

Hello Jorge,

Thanks for your reply. That was my first try when I started trying to bring USB CDC to my code (I have included USB Middleware to my project, in my case I've used absolute path to my KSDK location and I have copied the usb files specific to project to my project - usd_device_cdc_acm.c/h, usb_device_ch9.c/h ...). I also needed to included  a SYMBOL "USB_STACK_BM" since I'm not using any SO and make the necessary included of code into my main file. All of this was pretty straight and compiled fine, but the problems started with Linker! The Linker can't find object code from USB Stack unless I create a virtual reference to them into my project and that where I thought I was doing something odd. Observe that the simple fact of include USB middleware doesn't create the USB folder structure that you pointed into your first picture.

usb_setting_01.png

usb_setting_02.png

By the issue reported by Linker it seems that USB stack object code couldn't be found.

Again, the only way that I could solve it was creating a virtual reference to OSA and some USB files from stack. When I did it, the folder is showed on my structure (with a while little square on its icon) and the object code was created and linked fine.

Best Regards

0 Kudos

961 Views
gerhardheinzel
Contributor I

Hi,

is this solved now? I have exactly the same problem. After including the include paths

and setting the variable I am still missing source files in my project. The example has the following:

dump12.jpg

How do I get these into my project?

Thanks,

Gerhard

0 Kudos

961 Views
gerhardheinzel
Contributor I

A little progress:

I managed to get the necessary source files into my project with the KDS "Export.. file system" function.

However, even after I set the numerous include paths (the header files are spread over many directories! :-(( , the USB would still not function. I have one hint now: In the example project there are quite a few special toolchain settings, like

--STARTUP_CLEAR_BSS,

-mapcs,

-DUSB_STACK_BM

etc.etc.

How can I get these into my existing project without writing them down on paper one by one and re-entering them in corresponding fields in my own project settings? I looked at the ".cproject" XML file, but it seems not feasible to edit it directly.

Any idea is very welcome

Thanks,

Gerhard

0 Kudos

961 Views
gerhardheinzel
Contributor I

 Below are some of the settings of the working example project that differ from the standard settings of a new SDK2.0 project.

Some of them seem essential to get the USB to run.

It took me a long time to find this out; it would be very helpful is this were written somewhere, e.g. in the README file of the example project.

dump14.jpgdump16.jpgdump17.jpgdump18.jpgdump19.jpgdump21.jpgdump22.jpg

0 Kudos

961 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Giuliano Vitor

You need to include the middleware in your project configuration, you could use the example code as reference, I will use the kl26z to show how to do it. Next image show the structure and the needed files for usb cdc vcom example:

pastedImage_1.png

Some of them can be found in the middleware and others are more app specific so are located in the example path.

In the example project properties->C/C++ Build->Settings->C Compiler-> includes you can see the needed paths for the usb example are:

pastedImage_6.png

these "../../../" are relative paths for the location of the example project, but in your case you can use something like {your_path_SDK_2.0_FRDM-KL26Z}\middleware\usb_1.1.0

If you check the example code location:

{SDK_2.0_FRDM-KL26Z_paths}\boards\frdmkl26z\usb_examples\usb_device_cdc_vcom\bm

you can find the other files that you need:

pastedImage_3.png

so you will also need add them to the includes paths, I recommend you to copy this files and place them into your project path and then include them in your paths.

Hope this could help you
Have a great day,
Jorge Alcala

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos