How To: Get Started with MQX RTOS for Kinetis SDK v1.1

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

How To: Get Started with MQX RTOS for Kinetis SDK v1.1

1,590 Views
macl
Senior Contributor I

Getting Started with MQX RTOS for Kinetis SDK: Building Libraries and Examples

Ready to check out MQX RTOS example applications within the new Kintetis SDK-based architecture?

Don’t worry, its easy!  MQX RTOS for Kinetis SDK comes with many working examples that are easy to build and try out.

Note: If it seems like a tortuous process to build an example, then you might need to back up and check to be sure you followed the basic steps.  These are all documented in getting started guides, one for each supported toolchain.  See below.

Okay, let’s do it.   I’m going to show a shortened version of the Getting Started Guide for Kinetis Design Studio IDE using FRDM-K64F, but this should be very similar for other toolchains and boards.

Basic Steps

1.       Install a supported toolchain if you don’t already have one.

For Kinetis SDK v1.1, these are:  

Kinetis Development Studio version 2.0.0

IAR Embedded Workbench for ARM® Version 7.20.2

ARM-MDK - Keil® μVision® version 5.11.0

Atollic® TrueSTUDIO® for ARM version 5.2.0

Cmake version 3.0 support for GCC compiler revision 4.8.3 2014q2 from ARM Embedded

This information is also in the MQX release notes at MQX RTOS for Kinetis SDK v1.1 Release Notes (along with other good information).

2.       Download Kinetis SDK v1.1.0 with MQX RTOS at www.freescale.com/ksdk

IMPORTANT NOTE:  As of Kinetis SDK v1.1, MQX RTOS is now available in the Kinetis SDK installer.  It is NOT a separate download.  If you want to create a MQX RTOS-based project, then use the version of MQX RTOS that comes in Kinetis SDK v1.1 (or later).

Click Download.

image001.png

Choose the appropriate Kinetis SDK v1.1.0 installer for your operating system, then download and install it.

image002.png

3.       Grab the MQX Getting Started Guide for your selected toolchain

These are available within the KSDK source tree at <Kinetis SDK>\rtos\mqx\doc\tools, or online at the links below.)

Note: <Kinetis SDK> is my notation for the directory that you installed the Kinetis SDK.  On Windows, the default directory is C:\Freescale\KSDK_1.1.0\)

Links to the guides:

MQX Getting Started Guide for Kinetis Design Studio IDE

MQX Getting Started Guide for IAR Embedded Workbench

MQX Getting Started Guide for MDK-ARM Keil μVision4

MQX Getting Started Guide for Atollic TrueSTUDIO for ARM

MQX Getting Started Guide for ARM GCC

Also you might want to check out the general Getting Started Guide for additional details.

Getting Started with Freescale MQX™ RTOS for Kinetis SDK - User's Guide

For Kinetis Design Studio v2.0, the steps continue like this:

4. Install the Eclipse updates and plugins for Kinetis Design Studio as described in section 2 of the MQX Guide for Kinetis Design Studio IDE.

5. Import an example project working set.

Go to File… Import, …

image003.png

Then expand the MQX category (in the future this is planned to be called “Project of Projects”), then choose Import Working Sets

image004.png

IMPORTANT NOTE:  Be sure to import the working set, not an individual project.  Every example comes with a working set file that has all the library projects required by the application project.  Everything you need will get conveniently imported to your workspace – so use the working sets!  

In the next window, click Browse.  Find the MQX examples in the MQX examples folder!  This is in <Kinetis SDK>\rtos\mqx\mqx

image005.png

In this case I am opening the hello world example for FRDM-K64F.  The full path to the working set file is at:

C:\Freescale\KSDK_1.1.0\rtos\mqx\mqx\examples\hello\build\kds\hello_frdmk64f

image006.png

Click Finish.

image007.png

Now you will have the application project and all the library projects used by the application imported into your workspace.

image008.png

6. Now build the projects!

Go to ProjectBuild All.

Note: the default target build configuration (called “debug”) does not have all possible compiler optimizations enabled.   This makes debugging code easier, but results in larger code size.  So, if you are looking for small code size, set it up for the “Release” target config as noted in the MQX Guide for Kinetis Design Studio IDE.

image009.png

The projects will now start to build.

image010.png

Wait until the build is complete.

image011.png

7. Now run the example application.

Make sure the target board is plugged in to the USB for the debug connection.  (Marked “SDA USB” on FRDM-K64F).

Select the hello_frdmk64f project, and click on the arrow next to the image of the Bug and select Debug Configurations

image012.png

Choose the debug connection programmed in your board’s debug firmware.  (Default for FRDM-K64F is GDB Open OCD)

image013.png

Select the debug target debug configuration (if you build with the default setup, or release if you switched to the release configuration)

image014.png

Choose Debug

image015.png

Wait while the download fully completes.

image016.png

When the download is finished, the IDE will then switch to the debug view and stop at the mqx rtos main function.  Click the Resume button.

image017.png

Open up the terminal program of your choice.  Select the COM port provided by the board.  For the default debug firmware (cmsis-dap) it will enumerate as mbed Serial Port (COM:xx).  Select 115200 baud rate.

image018.png

You’re done!


But wait, there is more!

8. Be aware that several examples demonstrate non-core features of MQX RTOS that are not enabled in the MQX library by default.  To build and run these demos, you need to enable the feature to be compiled into the MQX library.

For example, if you import the semaphore example from C:\Freescale\KSDK_1.1.0\rtos\mqx\mqx\examples\sem\build\kds\sem_frdmk64f

image019.png

Note: sem is the full-featured semaphore with advanced options like priority inheritance – not to be confused with lightweight semaphores lwsem

Then try to build it.  You will get this result.

image020.png

Read carefully and it tells you this:

#error SEMAPHORE component is currently disabled in MQX kernel. Please set MQX_USE_SEMAPHORES to 1 in mqx_sdk_config.h and recompile kernel.

To enable semaphores, open the MQX library project and expand Config_Files.

Open mqx_sdk_config.h

image021.png

Add the line:   

#define  MQX_USE_SEMAPHORES   1

image022.png

Now build the MQX library.

Then build your application project (sem_frdmk64f) again.

image023.png

Success!

Note: This entire process is very similar for RTCS examples (MQX TCP/IP stack)!  You will find these at <Kinetis SDK>\tcpip\rtcs\examples

Best of luck with your development projects.  Please send me your feedback.

Thanks,
Mac Lobdell

0 Replies