This blog describes the steps required to configure Kinetis Design Studio(KDS IDE to build run and debug example applications The helloworld demo application targeted for the FRDM-K64FFRDM-K64F Freedom hardware platform is used as an example though these steps can be applied to any example application in the KSDK
Steps involved:
1. Importing the project into workspace
2. Build and Run an example application
Preliminaries:
1. Download KW41Z Connectivity Software
The KW41Z Connectivity Software package integrates the Kinetis Software Development Kit v2.0 and all the wireless connectivity stacks required to develop your solution using IEEE 802.15.4 and/or Bluetooth Low Energy.
Click below to download the KW41Z Connectivity Software appropriate for your computer's operating system.
After installation you can find Connectivity Example Codes at below folder location:
C:\NXP\MKW41Z_ConnSw_1.0.2
2. Install Your Toolchain
NXP offers a complimentary toolchain called Kinetis Design Studio (KDS)
https://nxp.flexnetoperations.com/control/frse/download?element=7490587
The KW41Z Connectivity Software includes support for other tools such as IAR
(https://www.iar.com/iar-embedded-workbench/freescale/)
Importing the project into workspace
Open Kinetis Design Studio Version: 3.2.0, it prompts the user to select a workspace location. KDS IDE is built on top of Eclipse, which uses workspace to store information about its current configuration; you can choose your own location.
Select "File -> Import" from the KDS IDE menu. In the window that appears, expand the "Project of Projects" folder and select "Existing Projects Sets". Then, click the "Next" button.
As we have installed the KW41 connectivity software at below location: point the browse option to this location or copy the path and paste it as shown in picture
“C:\nxp\MKW41Z_ConnSw_1.0.2\boards\frdmkw41z\demo_apps\hello_world\kds”
After pointing to the correct directory, your "Import Working Sets and Projects" window should look like the figure below. Click the "Finish" button.
The workspace will look like figure shown below:
You can browse for “hello_world.c” and find below lines of codes
BOARD_InitPins(); BOARD_BootClockRUN(); BOARD_InitDebugConsole(); PRINTF("hello world.\r\n"); while (1) { ch = GETCHAR(); PUTCHAR(ch); }
The code initialises the board pins, Initialize LPUART0 pins below, Call CLOCK_Osc0Init to setup OSC clock,
Set MCG configuration, MCG includes three parts: FLL clock, PLL clock and Internal reference clock(MCGIRCLK). Initialize debug console
DbgConsole_Init(BOARD_DEBUG_UART_BASEADDR, BOARD_DEBUG_UART_BAUDRATE, BOARD_DEBUG_UART_TYPE, uartClkSrcFreq);
It uses LPUART0 and BOARD_DEBUG_UART_BAUDRATE = 115200
There are two project configurations (build targets) supported for each KSDK project:
• Debug – Compiler optimization is set to low, and debug information is generated for the executable. This target should be selected for development and debug.
• Release – Compiler optimization is set to high, and debug information is not generated. This target should be selected for final application deployment.
Choose the appropriate build target, "Debug" or "Release", by clicking the downward facing arrow next to the hammer icon, as shown below. For this example, select the "Debug" target.
Build and Run an example application
Now connect the KW41Z board to your machine USB port and click on hammer button to build the project to check whether the project is compiling and building without errors.
You can see the result in console window as shown below:
Now we will proceed to execute this project by clicking on debug configuration as shown:
Make sure to connect the development platform to your PC via USB cable between the OpenSDA USB and the PC USB connector.
Make the selection as shown
The application is downloaded to the target and automatically run to main(): You will see the execution window as shown below:
Now open an serial hyper terminal window to test this application:
My board is connected to com44 port as shown in device manager:
I am having putty serial terminal application with me, open with below set up configuration:
Now go back to the KDS execution window and Start the application by clicking the "Resume" button
The hello_world application is now running watch what appears on serial terminal