Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

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

DZone's Guide to

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

· Performance Zone ·
Free Resource

xMatters delivers integration-driven collaboration that relays data between systems, while engaging the right people to proactively resolve issues. Read the Monitoring in a Connected Enterprise whitepaper and learn about 3 tools for resolving incidents quickly.

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).

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 :-)

3 Steps to Monitoring in a Connected Enterprise. Check out xMatters.

Topics:

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}