Using Keil µVision (ARM-MDK) with Processor Expert Driver Suite


The good thing with using ARM microcontroller is: there are plenty of tool choices. Even myself, I’m using multiple different tool chains. And while I’m heavily using Eclipse, there are non-Eclipse tool chains which have their advantages too.

The cool thing with CodeWarrior is that beside of Eclipse based, it comes with Processor Expert integrated. And I’m using Processor Expert a lot in my projects. But using Processor Expert does not mean I’m limited to CodeWarrior or Eclipse. So I can use CodeRed or IAR as tool chain with it. And this post is about using Processor Expert with the µVision tool chain from Keil/ARM.

Keil uVision Splash Screen

Keil uVision Splash Screen

Software Downloads

Keil is owned by ARM and of course supports ARM devices :-). Their IDE product is µVision (the current version is µVision4).

Processor Expert is available as ‘standalone’ version (called ‘Driver Suite’) from Freescale. Basically this is a stripped down Eclipse version with Processor Expert in it. It will be used to configure the drivers/components, and then things get imported and compiled by µVision (like IAR).

Keil Application Notes

Keil has several application notes available on www.keil.com/freescale. The Application Note 235 covers Processor Expert.

Software Installation

If not already installed, you need the following tools:

  1. The µVision IDE, compiler and debugger, available from http://www.keil.com/download/product/ (MDK-ARM). Current version is V4.71a
  2. Processor Expert Driver Suite, available from http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=PE_DRIVER_SUITE ‘Download’ tab. Current version is Microcontrollers Driver Suite V10.2

Processor Expert Driver Suite

First, I’m going to create a new project with Processor Expert. For this I launch eclipse:

Launching PExDrv

Launching PExDrv

If this is the first time, it asks me for a new Eclipse workspace:

Workspace Launcher

Workspace Launcher

The it shows the ‘Welcome’ view, from where I go to the workbench:

Go To Workbench

Go To Workbench

 

External Tools Configuration

From the workbench, I need to configure µVision as an external tool:

External Tools Configurations

External Tools Configurations

 

:idea: that menu is accessible as well under Run > External Tools.

Next step is to add a new external tool. For this I select the ‘Program’:

Program selected

Program selected

and press the ‘New’ button:

New Program

New Program

This creates a new configuration:

New Configuration

New Configuration

Next I configure the settings:

Export2uVision Configuration

Export2uVision Configuration

  • Name: just something useful and easy to remember.
  • Location: Browse where you have µVision installed and use the µVision executable.
  • Working directory: use ${workspace_loc:/${project_path}}
  • Arguments: use -i ProjectInfo.xml ${project_name}.uvproj

This configures to launch the µVision executable with the working directory of my (currently selected) project. It uses the -i argument to import a project. The project information are inside the ProjectInfo.xml which is generated by Processor Expert. The last argument is the project name µVision should use for when the .uvproj project does not exist yet.

Press ‘Close’ to return to the workbench.

Creating Processor Expert Project

In the next steps, I’m creating a Processor Expert project for the FRDM-KL25Z board.

To create the project, I use the menu File > New > Processor Expert Project:

New Processor Expert Project

New Processor Expert Project

I give it a name:

Project Name

Project Name

Select the device:

Selected Device

Selected Device

Using the current perspective:

Using current perspective

Using current perspective

The next step is important: I need to select the correct compiler to be used (Keil ARM C/C++ Compiler):

Selecting ARM Keil Compiler

Selecting ARM Keil Compiler

Finish, and the project gets created.

Adding Components

Now I can configure my the Processor Expert components, or add my components from GitHub. For my example, I have added a LED and Wait component to have a blinking LED:

Generating Code

To generate the code, I use the ‘Generate Code’ Button:

Generate Code

Generate Code

Processor Expert has now generated the code and created the ProjectInfo.xml file which I can export to Keil to create an MDK project:

Generated Code and ProjectInfo.xml

Generated Code and ProjectInfo.xml

 

Exporting to Keil µVision

To export it to Keil µVision, I launch the external tool I have configured before. As this is the first time, I do not have a launch history :-(. So I first select the project (or the ProcessorExpert.pe file in the project), and then use ‘External Tools Configurations…’ again:

Running external tool the first time with no launch history

Running external tool the first time with no launch history

Next, I select the Program I want to run and press ‘Run’:

Run the External Program

Run the External Program

:!: Note: I need to have project (or ProcessorExpert.pe of that project) selected. Otherwise I get an error “Variable references empty selection: …” as my project variable is not defined:

Variable references empty selection

Variable references empty selection

Now as I have it launched once, it is present in the recent launch list and I can execute it directly with a click:

Export2uVision with recent launch

Export2uVision with recent launch

 

:idea: It is important to have a current project selected. So make sure you select the project folder or the ProcessorExpert.pe file inside the project.

This has created a µVision project based on the ProjectInfo.xml:

uVision Project Created

uVision Project Created

 

Launching µVision from Processor Expert Project

Eclipse is able to launch an application based on the file extension. As the .uvproj file extension is associated with µVision, I can double-click on the .uvproj file inside the Eclipse project explorer view:

Launching uVision Project from Eclipse

Launching uVision Project from Eclipse

 

:idea: In case the .uvproj file is not shown in the project view, use ‘Refresh’ context menu on it or hit the ‘F5′ key.

:!: Note that if I double-click again, it will create another µVision IDE.

Open Project in µVision

And I can load that project from the Keil IDE too. In µVision I use Project > Open Project menu and browse to the .uvproj created in previous step:

Open Project in uVision

Open Project in uVision

Now I have the project loaded:

Loaded Processor Expert Project

Loaded Processor Expert Project

F7 performs the build of the project:

Building the Project

Building the Project

 

Changing Components

Whenever I change components (add, remove or change) in Processor Expert I need

  1. Generate Code in Processor Expert Driver Suite
  2. Run the external tool to import the changed files/settings into µVision (run my Export2uVision)
  3. Switch to µVision to confirm to reload the changes:

    Confirm to reload changed settings

    Confirm to reload changed settings

Debugging the FRDM-KL25Z

Now that I have compiled my application, I want to debug it on the FRDM-KL25Z. µVision does not (seem) to support the P&E OpenSDA, but it has support for CMSIS-DAP (ARM is driving the CMSIS initiative). So I loaded my FRDM-KL25Z with the CMSIS-DAP firmware as described in this post. The debugger settings in µVision have one gotcha:

First I need to set it for CMSIS-DAP Debugger in the Project options:

Project Options for CMSIS-DAP Debugger

Project Options for CMSIS-DAP Debugger

Next to verify that it is using SWD (and not JTAG) in the settings:

SWJ SWD Settings

SWJ SWD Settings

First I thought: that’s it!

However, when I wanted to debug, I had “No ULINK Device found”:

No ULINK Device found

No ULINK Device found

The gotcha is that I missed to set the CMSIS-DAP debugger in the Utilities tab too :-(:

CMSIS-DAP Debugger in Utilities

CMSIS-DAP Debugger in Utilities

After that, I was able to debug the application on the FRDM-KL25Z:

Debugging the Processor Expert Application

Debugging the Processor Expert Application

:-)

Summary

Processor Expert is not limited to CodeWarrior or Eclipse, it can be used as ‘Driver Suite’ with external tools like IAR or Keil. It is not as integrated with Eclipse based solutions, but still it allows to use the power of Processor Expert.

I wish µVision would implement something like in IAR to automatically reload the new files, so this is for sure something which would make µVision+Processor Expert an even better combination.

Happy Keiling :-)

About these ads

21 thoughts on “Using Keil µVision (ARM-MDK) with Processor Expert Driver Suite

  1. Pingback: FreeRTOS V7.5.0 released | MCU on Eclipse

  2. hi,

    i have a question,
    if i have already have an API developed in KEIL uVision4 and i have imported it into Processor Expert Driver Suite. how to go about adding new components to this exsisting keil project ??

    thank you
    Pradyumna

    • Hi Pradyumna,
      Do you mean you have an existing project with Keil, and now you want to add Processor Expert to it? The easiest way would be to create a new Processor Expert project as described in this tutorial, then add the sources of your existing Keil projects.
      If the question is about how to add additional components: in the Processor Expert driver suite there is a view named ‘Components Library’ you can use for this.
      I hope this helps,
      Erich

      • Thank you Erich for your reply…

        yes i already finished with most of my project usin Keil MDK experiencing a hard fault reset due to an infinite loop and while searching how to solve that i found your page where i could write a function for hardfault reset and solve it … so i was figuring how i can import my keil project into eclipse and add hardfault component.. I’m also not familiar with writing my program using processor expert. if you can throw some light on how i can create and add my sources in eclipse and add components from Library.

        Thank you
        Pradyumna

  3. Pingback: DIY Free Toolchain for Kinetis: Part 4 – Processor Expert for Eclipse | MCU on Eclipse

  4. Pingback: A new Freedom Board: FRDM-KL46Z | MCU on Eclipse

  5. Pingback: Tutorial: FreeMASTER Visualization and Run-Time Debugging | MCU on Eclipse

  6. Pingback: Tutorial: Using a Terminal Input and Output; *without* printf() and scanf() | MCU on Eclipse

  7. Hi, I use Keil 4.7 and it has the CMSIS-DAP firmware already, but i don’t know how it works for the board since when i plug the baord to the PC it just not recognize the SWD. So probably I just do the primitive way for just move the SREC file to the disk.
    I notice that there is no SREC or BIN file generated from the project, so can i just enter #K\ARM\ARMCC\bin\fromelf.exe –m32combined –output=.\UV4Build\@L.srec !L in the Run#1 User Option in the Properties? But sounds like the LED not really blink.

  8. Pingback: Processor Expert Driver Suite V10.3 Available | MCU on Eclipse

  9. I realized that for downloading the IDE, it is necessary to fill a form with personal information. But in the field of Stat/province, there are only values for USA and Canada. That means that is not possible for other countries?

  10. Hi Erich

    ExitCritical and EnterCritical are causing errors after creating the uVision project. I think because they are not defined anywhere in the project. Where do we find the file to add? Also, in trying to live with your philosophy of no warnings allowed, I am getting warnings for all my interrupts ‘attribute “interrupt” ignored’. Any ideas? Thanks again for everything you do.

  11. Pingback: Processor Expert (Driver Suite/Plugins/KDS) V10.4 with new Component Inspector | MCU on Eclipse

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s