Creating a MAPS-K22 FreeRTOS demo

Document created by jeremyzhou Employee on Sep 24, 2015Last modified by ebiz_ws_prod on Dec 13, 2017
Version 6Show Document
  • View in full screen mode

       FreeRTOS is a high quality, risk free, supported, free RTOS, and now it is already successful to porting more 35 architectures. As a popular RTOS, more and more embedded engineers considering it for their next project.

       Next, I’m going to show you the steps of creating a MAPS-K22 FreeRTOS demo by IAR and I’ve also attached a template demo and FreeRTOS source code (Fig 1).



Fig 1 FreeRTOS source code directories and files


    1. Copy the FreeRTOS source code to ~\MAPSK22_SC\Libraries

    2. Create FreeRTOS_Source group in the workspace, then add the source code (Fig 2)


Fig 2


3. Add an application code in the main.c

This is a very simple configuration. It creates two tasks, one software timer, and also uses a button interrupt.

The two tasks communicate via a queue. The receiving task toggles the LED3 each time a value is received.

Pressing user button K5 generates an interrupt. The interrupt service routine for which resets a software timer, then turn the LED1 on. The software timer has a five second period. The timer will expire when K5 has not been pressed again for a full five seconds. The callback function that executes when the timer expires simply turn the LED1 on again. Therefore, pressing K5 will turn the LED1 on, and the LED1 will remain on until a full five seconds pass without the button being pressed again.


4. Modify the Include Directories




5. Run the FreeRTOS demo

After build the modified application code, then run it on MAPS-K22 board (Fig 3)


Fig 3

IMPORTANT! Cortex-M FreeRTOS port specific configuration

Configuration items specific to this demo are contained in ~\MAPSK22_SC\Libraries\RTOS\config\K22F51212\iar. The constants defined in this file can be edited to suit your application. In particular

  • configTICK_RATE_HZ

This sets the frequency of the RTOS tick interrupt. The supplied value of 1000Hz is useful for testing the RTOS kernel functionality but is faster than most applications require. Lowering this value will improve efficiency.


See the RTOS kernel configuration documentation for full information on these configuration constants.


These are equivalents to configKERNEL_INTERRUPT_PRIORITY and configMAX_SYSCALL_INTERRUPT_PRIORITY, but presented in a form suitable for passing into the Freescale NVIC_SetPriority() library function. The NVIC_SetPriority() function expects priorities to be in the range of 0 to 15 - 0 being the highest priority and 15 being the lowest priority.

Original Attachment has been moved to:

Original Attachment has been moved to:

Original Attachment has been moved to: