How to create copy of KSDK example in KDS

Showing results for 
Search instead for 
Did you mean: 

How to create copy of KSDK example in KDS

No ratings

How to create copy of KSDK example in KDS

Because of proliferating questions to “how can I work with copy of KSDK example” or “I am not successful with creation new MQX project with SDK, what I do wrong?”


I decided to do this this short step by step tutorial.


To do this procedure is needed the script, which creates Anthony Huereca and bat file created by me.

Thanks to it is possible to create copy of any example which is based on KSDK.

This script allows to work with real copy of KSDK example, which is choosen.

It can be called like working copy. It is possible to edit any example and  build on this demo user´s own application.

It is also much easier than e.g. creating new MQX project, which is quite lengthy process – always must think of correct settings paths, including libraries etc. In this situation is everything copyied (compiler settings, linker, preprocessor…)

First of all is describe the utilization of the script. The script renames the original name of the demo to new one. So, user gets full-fledged copy.

The main essence of the matter is that the script must be in location with other examples.

I hope it helps a lot of us.


Labels (1)


Your method is good, easier, faster and less prone to errors rather than creating a new project from zero.

I would like to share with you a workaround I found in order not to mess with the original boards/frdmk64f folder files like gpio_pins.c, board.h, etc and get free to change them to meet my application needs. It may be helpful to other people in the Community.

1) I cloned (Ctl + C, Ctl + V) the "C:/Freescale/KSDK_1.1.0/board/frdmk64f" folder and renamed it, in my case, to "myboard_k64f" in the same directory, keeping the files inside with the same name:


2) Then, I created a virtual folder and named it "KSDK_Files" and included the linked files inside that folder. To do it, I right clicked on project's name, "New", "Folder". I filled the "Folder name" field with "KSDK_Files", clicked on "Advanced", checked on the option "Folder is not located in the file system (Virtual Folder)" and clicked on "Finish":



3) Right click on "KSDK_Files" folder. Select New / File / Advanced and mark the option "Link to File in File System". Click on "Browse" button and point to "board.h" file inside recently created "myboard_k64f" folder and click on "Open" to confirm:


4) Repeat the same procedure above in order to link to the other files: "gpio_pins.c", "gpio_pins.h", "hardware_init.c", "pin_mux.c" and "pin_mux.h". Do not link to "frdmk64f.peb" file. We won't use it in our case.

5) Now it is necessary to change the path which points to "frdmk64f" folder to "myboard_k64f" folder in "Compiler / Includes" and "Assembler / Includes" Settings:

5.1) First, go to "Project / Settings / Cross ARM GNU Assembler / Includes". Double click on the "...boards/frdmk64f" folder path and change it to "...boards/myboard_k64f". Click on "OK" and "Apply":


Repeat the same procedure above in "Project / Settings / Cross ARM C Compiler / Includes", rebuild the project and it is finished. Now you have you own board configuration files to do change acording to your board setup, without messing with the original ones.

Best regards,

Marco Coelho

I tried using this method with the sdcard demo in the mfs. Rather than uploading individual projects, I loaded in the working sets for the example. First I ran into a funny problem:

sdcard.h is a library name and not a project name, so the tool changed all references in the example project and I had to change them back.

Second, I'm getting "Undefined reference to `_start'" and "undefined reference to `toolchain_startup'" for both the sdcard_frdmk64f and TESTPro_frdmk64f(the example project.

EDIT: Tried again with the default sdcard example, and it also doesn't compile normally.

I fixed the "Undefined reference" problems by repairing the KSDK. However. the sdcard example is still a bit tricky with this tool since it renames instances of "sdcard" in actual MQX functions to your new project name, just because it's finding all references to the generic example name.

Hello Iva

Very nice idea. Really appreciate being able to pull into KDS3

I tried it with


specifiy "make_new_ksdk_project.exe cdc_serial" and entering uhMsdFatfs

With KDS3 I selected a new workspace, and then on import pointed it at


I selected version with KDS and FreeRTOS and it built a project within KDS3


On building the project (I think I had to do it a couple of times) it ended up with an error

No rule to make target `C:/Freescale/KSDK_1.2.0/examples/frdmk64f/demo_apps/usb/host/msd/uhMsdFatfs/freertos/kds/../../../../../../../../../usb/usb_core/host/build/kds/usbh_sdk_frdmk64f_freertos/debug/libusbh_freertos.a', needed by `host_uhMsdFatfs_frdmk64f_freertos_frdmk64f.elf'.

so I think your document glossed over making the libs and I'm looking around for that.

I'm trying to import the libs into the workspace - as need to be able to manage the quality of the code - but haven't had much luck yet.

Many thanks for any suggestions.

Hi Iva,

I solved my problem above - I had seen the answer somewhere before, and sorry it was a basic question - and I figured out the answer.

I've used it on KSDK1.2/examples/frdm64f/demo_apps/usb/host/msd_fatfs - and it worked on a USB flash drive. However my real target is usb/host/cdc/cdc_serial - and it had some CC issues

This morning I downloaded the new candy store KSDK1.3 and built all the frdm64f/demo_apps/usb per the KSDK13GSUG Rev0 - which builds them in the c:\Freescale\KDSK_1.3.0 tree and they all built.


I downloaded and started the host_cdc_serial_freertos_frddml64f - on the serial port it came up with expected instructions

Then I plugged in a USB serial display matix Orbital LK162B and it said "unsupported device attached" - hmm

So I need to create a KDS300 project where I can track and manage the sources from


I copied the make_new_ksdk_project.exe into the directory - updated script.bat "make_new_ksdk_project.exe cdc_serial" and ran it creating a new project


I then imported this project and compiled it and came up with

'usbhCdc_init_t' undeclared (first use in this function)usb_host_cdc_io.c/host_usbhCdc_freertos_frdmk64f/sourcesline 765

If I replace usbhCdc_init_t with cdc_serial_init_t  - it compiles

That having done - now I need to understand how to pull in the usb_core tree to my project be able to debug why I'm getting

"unsupported device attached"

which seems to being printed in usb\usb_core\host\sources\controller\usb_host_ch9.c

Hi Iva,

I downloaded you program and batch file and they worked well in the KSDK_1.2.0 scheme of things where the directory structure was :


where the main.c code was located in the msd_fatfs directory.

Will this same script work in the KSDK_2 scheme where the directory structure is:


where the main.c code is in the freertos directory?

Note the change in the level involved.


Hi David.

main.c you can find as app.c in sources folder.


Anyway, for cloning and creating examples we have Project Generator Tool, please see Software Development Kit for Kinetis MCUs|NXP

But cloning examples is very limited in number of examples - it is possible to clone only demo_apps examples not usb examples.


I hope this helps.

Best Regards,


Hi Iva,

Thanks to the pointer to the Project Generator. I was not aware of it, but will try it out.

To answer my original question, the script that you gave in the first post did work for me. Also, it was for one of the USB demos, so I am pleased with the result.

Just for your understanding, the method I use is to find an example that has some core functionality with my intended project. I'll clone that and then start expanding from there. So far, I like what I have found with the new KSDK2!



Version history
Revision #:
1 of 1
Last update:
‎03-16-2015 08:15 AM
Updated by: