Keil Logo

CMSIS: How to add a new User Code Template

Information in this knowledgebase article applies to:

  • MDK-ARM v5.x
  • CMSIS-Pack


When adding new item (source code etc.) to my existing project in µVision, I can select some pre-defined User Code Templates from a CMSIS Software packs like CMSIS-RTOS or Middleware, as shown in this screenshot:

Is it possible to define and add my own User Code Templates to be used in µVision?


Basically you have two options to define and add your own User Code Templates to be selected in µVision.

Add a User Code Template to an Existing CMSIS Software Pack

If you want to define and add a new User Code Template into an existing CMSIS-RTOS Software Pack:

  1. Open the directory of your CMSIS pack in your PC C:\Keil_V5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\RTOS\RTX\UserCodeTemplates\. Inside this directory you can find all existing User Code Templates. 
  2. Create a new User Code Template file "TEST.c" here in the same directory. 
  3. Go back to the directory C:\Keil_V5\ARM\PACK\ARM\CMSIS\5.0.1\ , remove the "read-only" attribute of the "ARM.CMSIS.pdsc" file, use any text editor to open it.
  4. Add the following line: 
      ‹file category="source" attr="template" name="CMSIS/RTOS/RTX/UserCodeTemplates/TEST.c" select="For testing user-defined code template"›
    to the section: ‹!––RTX templates ––› . 
  5. Restart µVision. You will see "TEST.c" template in "User Code Template - CMSIS"

You can use the same way to add your own User Code Template into other existing CMSIS Software Pack. The important thing here is that the corresponding *.pdsc file inside such a Software Pack is modified properly.

Add a User Code Template to a New CMSIS Software Pack

Follow this web page to create your own CMSIS Software Pack, where you can define your own User Code Templates to be part of your CMSIS Pack, as described here 

In this way you can easily populate and share your User Code Templates to other team members via such a CMSIS Software Pack.

Last Reviewed: Wednesday, June 28, 2017

Did this article provide the answer you needed?
Not Sure
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.