How To: Create an MQX RTOS for KSDK project with Processor Expert in Kinetis Design Studio IDE

Document created by Maclain Lobdell Employee on Jan 22, 2015Last modified by Maclain Lobdell Employee on Feb 27, 2015
Version 2Show Document
  • View in full screen mode

How To: Create an MQX RTOS project with Processor Expert in Kinetis Design Studio IDE

 

(This is an update and extension of Derek Snell's post:MQX with KSDK and Processor Expert.  Thanks Derek!)

 

There are a few different methods to get started with MQX RTOS for Kinetis SDK.  One of which is using Kinetis Design Studio with Processor Expert.  Processor Expert provides a graphical interface for configuring your project and adding useful software components.

 

Important Note #1:  In the past, Processor Expert included MQX Lite and MQX components.  With the release of the Kinetis SDK, there is a new MQX_KSDK component that is suitable for configuring the version of MQX RTOS that comes with the Kinetis SDK.    Be sure to use the new component! 

 

Important Note #2: New Kinetis Design Studio projects enabled with Kinetis SDK and Processor Expert use an Operating System Abstraction (OSA) component which is used to select which RTOS (or no RTOS – baremetal) option you are using.  The OSA component will inherit in the selected RTOS component for you. So, don’t add in MQX_KSDK yourself. Let the OSA do it.          

 

The following instructions are based on Kinetis SDK v1.1 and Kinetis Design Studio IDE v2.0

Steps


Install Updates

See section 5.2 in the Getting Started with Kinetis SDK guide.


Create a New Kinetis Design Studio Project

image001.png

 

Name it.

image002.png

Click Next.

Select a Board (or Processor if you prefer - this changes the steps slightly.)

image003.png

 

Click Next.

Choose Kinetis SDK and Processor Expert

image004.png

Click Finish.

Now you have a new Kinetis SDK project that is ready to be configured with Processor Expert.

image005.png

 

In the Components window, under Components, open the OSA component

image006.png

The Component Inspector window will now show you the Properties and Methods for that component.

 

From the OS dropdown list, choose MQX_KSDK as your OS

image007.png

 

Now you need to set up the MQX_KSDK component for use in your project.

 

Open the MQX_KSDK component (inherited by the OSA component)

image008.png

 

Select the Configuration parameters tab

 

In the Configuration set, you have the choice of MQX Lite and MQX Standard.

For this first example, I will chose MQX Lite.

MQX Lite is a light weight configuration of MQX RTOS offering a subset of capabilities.  MQX Lite uses static memory allocation by default.  If you want to use the RTCS TCP/IP stack, MFS file system, dynamic memory allocation, or some of the advanced features of MQX RTOS, use MQX Standard.

image009.png

Now select the Shared components tab.  You can see that it uses the DbgCs1 component for serial communications.

image010.png

image011.png

Click on the DbgCs1 component

You need to tell it which UART should be used for the DbgCs1 component (default serial port).

On the FRDM-K64F, UART 0 connects to the on-board debug circuit for virtual com port to the host PC. It is a bit confusing, but the signal names on the schematic, on the debug circuit side, say UART1_RX_TRGMCU and UART1_TX_TRGMCU

For Device, choose UART0. Then pick a baud rate – I chose 115200.  Then select the Pins to be used.  This uses the net names for the signals on the schematic.

image012.png

 

For the selected baud rate 115200, I get an error that says that not all of the clock configurations of the system can support it.

Timing setting failed in Clock configuration 3 – it is impossible to set the following items: selected value

The CPU component comes pre-configured with 4 clock configurations that can be utilized in your system.  These are very useful for switching between different clock modes in your application for power savings.

One of these clock configurations can’t do 115200, so I need to either change the baud rate or change the clock configuration.  For this example, I am just going to delete the clock configuration because I am not going to use it.

Click the Cpu component.

image013.png

Click Clock configurations

image014.png

Then select Clock configuration 3.  Click the down arrow v to lower it to the bottom of the list.

image015.png

Then click to remove.

image016.png

There is one more configuration required in the DbgCs1 component.   It is related to its inherited component, the fsl_uart_hal (hardware abstraction layer for the UART).

Click on the DbgCs1 component again.

 

image011.png

Click on the arrow next to fsl_uart_hal.

image017.png

And choose UART 0

image018.png

Now you should have no errors.

 

Now, add some tasks.  Processor Expert provides an OS_Task Component that will configure and generate the code framework for tasks.

Click Components Library.

image019.png

Under Operating Systems, double click OS_Task to add tasks.

image020.png

Click on the task components to configure them.

image021.png

image022.png

Click the Generate Processor Expert Code button.

image023.png

The code will generate (update the configuration files for the Kinetis SDK).  Wait until that finishes.

image024.png

 

The MQX source code is here.

image025.png

The task code is here.

image026.png

Write your tasks!  You can write native MQX RTOS function calls as well as Kinetis SDK driver and HAL calls.  Just make sure to include the appropriate header file for the MQX or KSDK feature you use and add to the paths if necessary.

image027.png

Now click the build button

image028.png

Your new project will compile and link into a file for downloading and debugging on the target.

image029.png

Hope this helps!  Send me your feedback!

Mac L

3 people found this helpful

Attachments

    Outcomes