❗ This article has been written for the version 4 of µVision. There is an update for version 5 of µVision here: “Using Keil μVision 5 with Processor Expert“
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.
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:
- The µVision IDE, compiler and debugger, available from http://www.keil.com/download/product/ (MDK-ARM). Current version is V4.71a
- 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:
If this is the first time, it asks me for a new Eclipse workspace:
The it shows the ‘Welcome’ view, from where I go to the workbench (click on ‘Go to workbench’ icon):
External Tools Configuration
From the workbench, I need to configure µVision as an external tool:
💡 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’:
and press the ‘New’ button:
This creates a new configuration:
Next I configure the settings:
- 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:
I give it a name:
Select the device, then press Next:
Using the current perspective (default):
The next step is important: I need to select the correct compiler to be used (Keil ARM C/C++ 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:
Processor Expert has now generated the code and created the ProjectInfo.xml file which I can export to Keil to create an MDK project:
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:
💡 Eclipse has the concept of ‘current selected project’. This is the project (root) folder you have selected in the Project/Project Explorer view. Or it is the project of the currently selected file.
Next, I select the Program I want to run and press ‘Run’:
C:\Freescale\Keil_v4.71a\UV4\UV4.exe ${workspace_loc:/${project_path}} -i ProjectInfo.xml ${project_name}.uvproj
❗ 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:
Now as I have it launched once, it is present in the recent launch list and I can execute it directly with a click:
💡 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:
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:
💡 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:
Now I have the project loaded:
F7 performs the build of the project:
Changing Components
Whenever I change components (add, remove or change) in Processor Expert I need
- Generate Code in Processor Expert Driver Suite
- Run the external tool to import the changed files/settings into µVision (run my Export2uVision)
- Switch toµVision to confirm to reload the changes:
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:
Next to verify that it is using SWD (and not JTAG) in the settings:
First I thought: that’s it!
However, when I wanted to debug, I had “No ULINK Device found”:
The gotcha is that I missed to set the CMSIS-DAP debugger in the Utilities tab too :-(:
After that, I was able to debug the application on the FRDM-KL25Z:
🙂
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 🙂
Pingback: FreeRTOS V7.5.0 released | MCU on Eclipse
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
LikeLike
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
LikeLike
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
LikeLike
Pingback: DIY Free Toolchain for Kinetis: Part 4 – Processor Expert for Eclipse | MCU on Eclipse
Pingback: A new Freedom Board: FRDM-KL46Z | MCU on Eclipse
Pingback: Tutorial: FreeMASTER Visualization and Run-Time Debugging | MCU on Eclipse
Pingback: Tutorial: Using a Terminal Input and Output; *without* printf() and scanf() | MCU on Eclipse
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.
LikeLike
Hi,
have you loaded the CMSIS-DAP OpenSDA on your FRDM board? See https://mcuoneclipse.com/2013/05/17/cmsis-dap-with-iar-and-the-kl25z-freedom-board/
LikeLike
Even i load the cmsis-dap opensda, it shows PEMicro/Freescale – CDC Serial Port, but not CMSIS-DAP
LikeLike
Yes, that’s as it should be: CMSIS-DAP is a firmware on top of PEmicro. CMSIS-DAP does not implement its own USB device class, it is still the PEMicro OpenSDA one. So you will not see a ‘CMSIS-DAP’ in your Windows device manager.
LikeLike
Oh, found it! I just forget that i cannot directly drag the SDA file from the zip file to the FRDM disk. After I move the SDA file to the desktop, and then move to the FRDM disk, it is recognized now!
LikeLike
ah, yes, that’s a common mistake! You cannot drag it out of a zip file.
LikeLike
Pingback: Processor Expert Driver Suite V10.3 Available | MCU on Eclipse
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?
LikeLike
I do not remember the details of that dialog, but it was not a problem for me to do this from EMEA.
I think for sure it should be possible.
LikeLike
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.
LikeLike
Hi Justin,
I admit that I’m not using uVision much because it has 32 KByte limitation. I realize that my CriticalSection component only has GCC assembly in it (see https://mcuoneclipse.com/2014/01/26/entercritical-and-exitcritical-why-things-are-failing-badly/ and https://mcuoneclipse.com/2014/02/08/criticalsection-component/. I need to check the implementation if I could use for uVision. It is already late night here, so I need to come back to you on this tomorrow. I appologize for this :-(. About the warnings: could you provide some details where you get those?
LikeLike
Hi Justin,
have you loaded the latest PEupd files? I checked my local project, and with the CriticalSection component things are compiling fine on my side?
LikeLike
Pingback: Processor Expert (Driver Suite/Plugins/KDS) V10.4 with new Component Inspector | MCU on Eclipse
Thanks Erich, I can generate code from your components now.
LikeLike
Pingback: Using Keil μVision 5 with Processor Expert | MCU on Eclipse
Thank you for your tutorial , if someone is interested you can check eagerlearning.org/microcontrollers/theory/uvision-configuration/ for Uvision Configurations
LikeLike
Thank you for that link, very useful for everyone using Keil MDK tools.
LikeLiked by 1 person
Pingback: USB with the TWR-K60F120M and TWR-K70F120M | MCU on Eclipse