Getting Tooled up with uVision2:- Interfacing to tools including Lint & Source Safe

The Keil IDE, uVision2, provides a lot of functionality but there are places where specialist 3rd party tools need to be integrated. The "Tools" menu in the IDE provides for this. From the bottom of the menu is the customise tools entry.

 

 The "customise" can be very useful for adding all sorts of tools. The dialogue box that appears lets you add any number of menu entries. Well I tried 15 and it would still take more. With each menu entry is the command line that you want to run. In this case the menu entry is "GREP" and the command line is the executable with full path. The application can be located with the browse button on the right of the line. Some important subtleties are that the command line does NOT have any parameters. These are entered on the arguments line below the command line. Other available options are giving an initial folder to start in and the three tick boxes. Incidentally, if no "Initial folder" is given the project directory is assumed.

Even though I have parameters in the arguments line I have ticked the "prompt for arguments box". This is so I can modify the arguments line in the dialogue box that will appear when I run the tool. "Run Minimised" is obvious but the "Run Independent" may need explanation. This means that uVision2 will launch the application and not wait for it to terminate. This is very useful where you want a background task to start and continue on its own whilst you carry on independently of uV2 for example, to launch EPROM programmer software.

Incidentally, the uVision2 "find in files" has similar functionality to GREP so I shall be retiring my GREP after many years of useful service.

Above the customise tools option are the Easy Case options. I have seen Easy Case or at least I have seen the Easy Case boxes on shelves but I have never seen it used. Apparently, it is big in Germany.

 

 

PC-Lint



Next are the PC-Lint options. The reasons why you should be using static analysis are covered in the Embedded C: Traps and Pitfalls paper . First, you have to configure PC-lint. This is really quit simple but can cause a lot of problems. Lint has to be set up on a per project basis, which makes it a bit of a nuisance for me. See the dialogue box. From the top put in the include paths. In this case the project directory and the Keil C51 include directories. NOTE there is the generic D:Keil\C51\Inc\ and the d:\Keil\C51\inc\Atmel both the generic "inc" and chip specific paths are needed.

Moving down is the path to the PC-Lint executable. This is followed by the lint configuration file entry. At this point I part company from the recommended Keil instructions. I do not use the Keil configuration file at this point (d:\keil\lint\co-kc51.lnt) I use the PC-Lint standard set up file called std.lnt. I then use this file to call the other configuration files. This gives a far more flexible and powerful system. My sdt.lnt is shown here. Notice that it calls the standard Keil C51 compiler file. NB this holds true for the C166 and 251 compilers as well. This file holds all the commands to stop PC-Lint complaining at "XDATA" and the like.

// Keil C51 compiler, -si2 -spN2 -spF4,
// Standard lint options

-"format=%(%f %l: %c: %)\s %n\s %m"
d:\keil\LINT\co-kc51.lnt
d:\keil\LINT\au-misra.lnt
d:\keil\LINT\env-keil.lnt
d:\keil\LINT\options.lnt -si2 -spN2 -spF4nt -si2 -spN2 -spF4

The following line is a new file (it's on www.gimpel.com) for formatting the output correctly in the build window in uVision2. It only contains the three lines below.

-hsb_3
-format="*** LINT: %(%f(%l) %)%t %n: %m"
-width(0,10) // Don't break lines (this is required for MicroVision)

You can either use the env-keil file or put the lines in to the options.lnt file. The next line in std.lnt is the configuration for MISRA-C checking.

The final line is the options file where I put my changes. Using the options file means that should the compiler or MISRA-C files change all I have to do is put the new ones in. I do not have to re-edit them for my changes. It also keeps all my adjustments in one place. I usually add strong type checking. There is a conformance matrix for MISRA-C on this web site.

 

My options file looks like the one below. It caters for deviations required for MISRA-C to sensibly work with Keil C51

// Please note -- this is a representative set of error suppression
// options. Please adjust to suit your own policies
// See PC-lint for C/C++ manual (chapter LIVING WITH LINT)
// for further details.

+e900
-e720
-esym(950, _gobble)
-esym(970, bool)

-d"bit=__declspec(selectany) volatile bool"
-d"sdata=__declspec(selectany) volatile unsigned int"
-d"sfr=__declspec(selectany) volatile unsigned int"
-d"sbit=__declspec(selectany) volatile bool"

 

 Version Control

One of the major, if under used, improvements in the Keil IDE is the ability to directly interface to a Version control System. The reasons why this is important are covered in the Embedded C: Traps and Pitfalls paper on the Hitex UK web site. You will get some idea by the fact that Keil have devoted a whole new menu to devoted to SRVS.


The SVCS only has to be set up once, not on a per project basis. There are, as standard, a choice of three version control systems: MS Source Safe, Intersolve PVCS and MKS Source Integrity. Hitex expect to have a ClearCase config script available shortly. However, as these template files are plain text a template can be write for virtually any command line SVCS.

Should you produce a template file for a system not currently supported please send it in to chris@isystem.ltd.uk and he will send you the legendary ASCII mug.

Having selected (or written) your template file in the topline of the dialogue you will need your user name. This is not your PC login name but your SVCS log in name. This means that your SVCS system has to have been installed and configured before you start setting up uV2 for SVCS.

The next line is the SVCS database. Again this means that you have to have created a database under the SVCS manager for uV2 to point at. For MS Source Safe this is the VSS directory. Under most SVCS systems you can have several databases. You could have one for each project, department etc or one for the whole company. Remember you are selecting a directory not a file. I selected C:\program files\Microsoft Visual SourceSafe\vss\srcsafe.ini and deleted the file name in the line in the dialogue box after selection.

The rest of the dialogue box shows the menu entries. As they are selected, the command line and any parameters are shown. These can be edited here or of course, the template file can be edited in the uV2 editor.

Having configured the SVCS and created the uV2 project with the source files you need to do the final steps to make the system operational. Firstly you should select "create project". When his has successfully completed (look in build window) select "Set Project" and then use the "add file" on each of the files. Adding the files will set the current files in the uV2 project window read only. They must then be "checked out" to be used.

As described in Embedded C: Traps and Pitfalls paper. SVCS systems can help with the file documentation! SVCS systems tend to have keyword expansion. There are many key words such as Author, Workfile, date etc. One of the more useful in Source Safe for file header blocks is "$Version: $" which when expanded gives you:

* ***************** Version 11 *****************

* User: Chris Date: 9/06/01 Time: 21:45

* Updated in $/Inst390

* cold fusion algorithm added

*

* ***************** Version 10 *****************

* User: Chris Date: 9/06/01 Time: 21:42

* Updated in $/Inst390

* Warp drive modified

Note these are only the last two entries I did not copy 1 to 9 for reasons of space. A full example of the use for key words is in the Tile Hill Embedded C Style Guide site.

 

 


Last updated 25-Jan -2003 and still under construction!
Copyright Chris A Hills 2002
The right of Chris A Hills to be identified as the author of this work has been asserted by him in accordance with the Copyright, Designs and Patents Act 1988