2018年9月16日 星期日

[CMSIS-RTOS RTX] How to Porting RTX on STM32F429 Discovery Board, Step by Step.

Porting Purpose:

  • Porting CMSIS-RTOS RTX on STM32F429 Discovery Board.
  • Create one startup task and two LED toggle tasks.
  • Check by Logical Analyzer.

Test Video:

Test Code:
          STM32F429_CMSIS-RTOS_RTX_LED_Toggle_Code


1. Prepare Template project for porting purpose.

  •     Download STM32F429I-Discovery example code from ST  Website.


  • Click "STSW-STM32138".
  • Click "Get Software".
  • Click "ACCEPT".
  • Click "Login/Register".
  • Then You will get the code packer(en.stsw-stm32138).

  • Unzip the code packer.
  • Enter to the "Projects" folder and remove unused code.
  • Copy the RTX source code from "your keil folder/ARM/RL/RTX" to "Template" folder.

  • remove unused code.
 
  • That's all for prepare step.


2. Porting RTX, Step by Step.
  • Open Project by Keil-MDK, Project path: Projects/Template/MDK-ARM/
  • Click "Options for Target".


  • Select "Target" and Change Operating system from "None" to "RTX Kernel".


  • Open "main.c",  include "stdio.h" and "RTL.h". 

  • Open "stm32f4xx_it.c", remove "SVC_Handler" and "PendSV_Handler" and "SysTick_Handler".
  • Add "RTX_Conf_CM.c" into Project, The "RTX_Conf_CM.c" path is "Project/Template/RTX/Config".

  • Click "RTX_Conf_CM.c" first, then you can Click "Configuration Wizard".
  • Below is the default setting.
  • Change the setting like Below.
  • Add RTX define and global register like below.
  • Add "AppTaskLED3" task and "AppTaskLED4" task.
  • Add "AppTaskCreate" function and "AppTaskStart" task.
  • Add LED3 & LED4 initial functions in main loop.
  • Add "os_sys_init_user" function in main loop.
  • That's all for porting step and you can download code to Discovery board after compiler. 

3. Check the result by Logical analyzer.
  • Connect the Logical analyzer with PG13 & PG14 on Discovery Board.
  • Check the PG13 and PG14 output signal.
  • LED3 toggle setting is 1000msec and LED4 toggle setting is 500msec.







沒有留言:

張貼留言