Using PC-Lint with IAR EWAVR

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does anybody out there have a .lnt script that will persuade Gimpel's PC-Lint to check source code written with IAR's EWAVR without generating a zillion errors from the functions, procedures, etc. provided by IAR? Specifically, the problem is occurring with the numerous special function register definitions, and despite putting some of my own defines into the lint script to override the 'strange' compiler defines, I can't stop errors being reported.

Any hints would be appreciated; if you are sufficiently lint-savvy that you could comment on my lint script, I've included it here as an attachment. Line 73 is my attempt to overcome the problems I'm seeing with 16 bit register definitions, but it's not quite getting me there; NameHere isn't being substituted in the declaration when the define is expanded.

Regards,

Colin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm not sure if this will work but around the #include of the library .h files you might try something like:

/*lint -elib(???) */
#include 
#include 
/*lint +elib(???) */
... your code

PS I was going to suggest you post the question on the Gimpel discussion board but I see you already did!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
if you are sufficiently lint-savvy that you could comment on my lint script, I've included it here as an attachment.

I did not see any attachment. I am not really lint-savvy, but I am interested. I use IAR EW and also TI Code Composer. My boss suggested that we buy and use Gimple Lint.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm not sure where the attachment went. There should be one attached now. I've changed the file extension to .txt for posting here; it would normally be .lnt.

Regards,

Colin

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, I don't have any lint files in my new company, we are using a different compiler, but I remenber looking for tthose files in gimpel.com website.

http://gimpel.com/html/ptch80.htm search for IAR 78 or IAR 80.

---
ARod

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alejmrm wrote:

http://gimpel.com/html/ptch80.htm search for IAR 78 or IAR 80.

PC-Lint comes with various lint scripts for various compilers, IAR included. The ones you have listed are for the 78k0 and the Z80, and there is also a generic one. Unfortunately, the compilers, and their mechanisms for defining special registers on different processors, vary significantly, so Gimpel's scripts don't work.

Regards,

Colin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

so use the generic... I don't remember having so much problems using one of those lint files... I might modified the generic file, but I don't remember! =(

---
ARod

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Speaking of lints.. Does anyone use splint with gcc? I tried it quickly, but it shoots way too many errors..

The Dark Boxes are coming.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alejmrm wrote:
so use the generic... I don't remember having so much problems using one of those lint files... I might modified the generic file, but I don't remember! =(

Needless to say, if the generic script worked, I'd be using it. I have a number of groups and colleagues looking at this, and no one has cracked it yet, so I'm reasonably confident it's not me being even more dense than usual.

If I get the problem nailed, I'll post a solution here, though from the number of responses, it's obvious that the AVR community doesn't engage in a lot of static analysis!

Regards,

Colin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

svofski wrote:
I tried it quickly, but it shoots way too many errors..

Ah but that's the nature of the beast!

The fact is that lint style code analysers spot not just the basic things that a compiler will warn you about but "questionable" programming syntax which maybe what you intended, but, as often as not, is actually the potential source of a bug you hadn't seen. So you tend to get about 10 lint warnings for every compiler warning. That's why it's worth persevering to clear all lint warnings/errors too - though I have to admit that sometimes I can't see an alternative way of coding things so I just add a localised lint comment to turn off that lint error for the next couple of lines.

I actually got interested in using lint as a result of one of the sub-contract companies we've used in the past. They actually had their makefiles set so that the C compiler itself was never invoked until a .C file had passed through lint and come out the other end with ERRORLEVEL==0 so you either had to write code to be totally lintable or hack into their complicated makefile system to defeat the linting step (not that I ever would of course!)

Cliff