EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

C language tools to use with MSP430 or ...

Started by Ing. Morra Antonio December 1, 2003
Hi to all !
I am back after some time spent on different projects.
Before I start a new design on the MSP430, I have a question for you all, 
if you care to share your experience.
What tools are you using together with a C compiler, to keep track of 
versions and the like?
Also are you using a program checker like LINT  ?
And, depending on the answer, why YES or why NOT?
It is a bit of a general question, but I would like to know what the 
experience is among MSP430 developers.
Thanks to all in advance for any clues
Regards
Antonio


Beginning Microcontrollers with the MSP430

Hi,

i'm using CVS for the versions, indent for correct design and gcc for
minimal semantic checking because the commercial compilers like the one from
IAR
are checking nearly nothing; they don't produce warnings at undefined
operations like "a= a++;" or "a[i]=i++;" or
"memmove (b, ++b, 9);" of "a ^b ^= a ^= b;",  they
accept useless/dangerous statements like "a==b;"  and
"b<<c+d" without a warning and they do no range checks and
accept "if
(char_variable < 1000)" and "if( a=b )" without a warning.
They also do
produce no warning if unused pointers/structures/arrays are used and if the
values of uninitialized variables are used or if no return type or a wrong
type is used.
The gcc finds all of these semantic errors.

Rolf F.

----- Original Message ----- 
From: "Ing. Morra Antonio" <antonio.morra@anto...>
To: <msp430@msp4...>
Sent: Monday, December 01, 2003 4:55 PM
Subject: [msp430] C language tools to use with MSP430 or ...


> Hi to all !
> I am back after some time spent on different projects.
> Before I start a new design on the MSP430, I have a question for you all,
> if you care to share your experience.
> What tools are you using together with a C compiler, to keep track of
> versions and the like?
> Also are you using a program checker like LINT  ?
> And, depending on the answer, why YES or why NOT?
> It is a bit of a general question, but I would like to know what the
> experience is among MSP430 developers.
> Thanks to all in advance for any clues
> Regards
> Antonio
>
>
>
> .
>
>
>
> ">http://docs.yahoo.com/info/terms/
>
>


Ing. Morra Antonio wrote:
> What tools are you using together with a C
compiler, to keep
> track of versions and the like?

ImageCraft ICC430 as C compiler (www.imagecraft.com).
Subversion/TortoiseSVN (subversion.tigris.org /
tortoisesvn.tigris.org) as version control.

ICC430 was purchased a while ago and does good job as compiler.
Subversion is featurefull and easy to use version control system.
TortoiseSVN is excellent frontend for subversion for windows
(integrated to shell, just like TortoiseCVS).

Indrek

-- 
  Indrek Rebane           |      Borthwick-Pignon
  Electronics Engineer    |    Tartu Science Park
  Phone: (+372) 7 302 641 | Riia 185, 51014 Tartu
  Fax:   (+372) 7 383 041 |               Estonia
  indrek@indr...        |         www.bps.co.ee


Hi Rolf!


> i'm using CVS for the versions, indent for
correct design and gcc
> for minimal semantic checking because the commercial compilers like
> the one from IAR are checking nearly nothing; they don't produce
> warnings at undefined operations like "a= a++;" or
"a[i]=i++;" or
> "memmove (b, ++b, 9);" of "a ^= b ^= a ^= b;", they
accept
> useless/dangerous statements like "a==b;" and
"b<<c+d" without a
> warning and they do no range checks and accept "if (char_variable <
> 1000)" and "if( a=b )" without a warning. They also do
produce no
> warning if unused pointers/structures/arrays are used and if the
> values of uninitialized variables are used or if no return type or a
> wrong type is used.  The gcc finds all of these semantic errors.

It sound as though you haven't had any experience with compilers "like
the one from IAR" for some quite time.  Most of the things you
addressed we do support, however, I must admit that we do not catch
all of them.  I'm sure that the other commercial compilers on the
market today also provides a good set of lint-like warnings.

While we're on the subject, I would also to point out the IAR
"--remark" option, where the compiler -- well -- remarks on a number
of things that might the a problem but not necessarily is.  Of course,
"good" remarks can easily be lifted to warnings or errors, to ensure
that you will not be drowned in remarks.

    -- Anders Lindgren, IAR Systems
-- 
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.

Hi,

>It sound as though you haven't had any
experience with compilers "like
>the one from IAR" for some quite time.

I've got experience with the IAR Compiler and therefore i can only advise
it
as a bad example and
an obsolete compiler with a behavior which was usual 30 years ago. This bad
compiler caused a lot of sourcecode
(from other programmers) with thousends of undefined operations always
true/false comparisons and other trash,
because most programmers are not good programmers and therefore the code
quality reflects much of the quality of the compiler.

The IAR compiler has many other bugs: No includes from subdirectories (e. g.
"#include "inc/header.h" does not work), sprintf %hu or %u does
not
work "save all" does not save the project file, write access to the
project
file is attempted even when the project was unchanged and the size of
bit fields is calculated to high (reffering to ANSI C). The compiler gives
the information that he is an ANSI C compiler but that's wrong.

Another thing is upgrading from Version 1x to 2x which is more complicated
and causes more work than switching to MSPGCC.

Rolf F.


Hi Rolf,

I have used the IAR compilers for both the AVR and MSP430 families.  While I
agree that the interface and features are a little mundane and their MSP430
offering is not the best around, I have found the code generation quality to
be generally excellent.  I use the Quadravox toolset for the MSP430 on price
mostly.

I have done multiple target projects and found includes work as expected
(both "inc\globals.h" and "..\common\mydefs.h" style
includes).

There is a switch to force ANSI compliance.  Though I generally prefer
access to the extended feature set.

Maybe you can provide some example code that the IAR compiler doesn't
handle
correctly.

Regards,

Ray


  -----Original Message-----
  From: R. F. [mailto:rolf.freitag@rolf...]
  Sent: Tuesday, 2 December 2003 5:22 AM
  To: msp430@msp4...
  Subject: Re: [msp430] C language tools to use with MSP430 or ...


  Hi,

  >It sound as though you haven't had any experience with compilers
"like
  >the one from IAR" for some quite time.

  I've got experience with the IAR Compiler and therefore i can only advise
it
  as a bad example and
  an obsolete compiler with a behavior which was usual 30 years ago. This
bad
  compiler caused a lot of sourcecode
  (from other programmers) with thousends of undefined operations always
  true/false comparisons and other trash,
  because most programmers are not good programmers and therefore the code
  quality reflects much of the quality of the compiler.

  The IAR compiler has many other bugs: No includes from subdirectories (e.
g.
  "#include "inc/header.h" does not work), sprintf %hu or %u does
not
  work "save all" does not save the project file, write access to the
project
  file is attempted even when the project was unchanged and the size of
  bit fields is calculated to high (reffering to ANSI C). The compiler gives
  the information that he is an ANSI C compiler but that's wrong.

  Another thing is upgrading from Version 1x to 2x which is more complicated
  and causes more work than switching to MSPGCC.

  Rolf F.





Hi Rolf, and everyone else!


Me> It sound as though you haven't had any experience with compilers
"like
Me> the one from IAR" for some quite time.


"R. F." <rolf.freitag@rolf...> writes:

> The IAR compiler has many other bugs: No includes
from subdirectories (e. g.
> "#include "inc/header.h" does not work), sprintf %hu or %u
does not
> work "save all" does not save the project file, write access to
the project
> file is attempted even when the project was unchanged and the size of
> bit fields is calculated to high (reffering to ANSI C). The compiler gives
> the information that he is an ANSI C compiler but that's wrong.

The current compiler can handle all the things you mentioned.  And
yes, the compiler is an ANSI C compiler.

Of course, if you have a concrete example where the current compiler
(version 2) isn't ANSI compliant I'd be happy to take a look at it.


> Another thing is upgrading from Version 1x to 2x
which is more complicated
> and causes more work than switching to MSPGCC.

The background to this is that version 2 is a brand new compiler.  It
is more strict than the old compiler (isn't that what you wanted?) so
it can complain on thing that the old one accepted.  However, I expect
gcc to complain on similar things...

Other than that, basically everything that applications built using
the old compiler is provided with the new, including old-style I/O
files and our traditional pre-ANSI C library (CLib).  In addition, the
manual contains an extensive porting guide.

So, again, it sound as though you haven't had any experience with
compilers "like the one from IAR" for some quite time.

    -- Anders Lindgren, IAR Systems
-- 
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.

Hi,

> The current compiler can handle all the things you
mentioned.  And
> yes, the compiler is an ANSI C compiler.

I also tested the current compiler (ICC430 2.20A) with all warnings/errors
enabled and he produeces no warning without a return type
and no warning with a "=" inside an if-statement, e. g. "if ( a =
b) "
although this is usually a common semantik error.
The gcc does not have these disadvantages.

I also tested these undefinded operations: "memmove (b, ++b, 9);",
"a[i] i++;", "a = a++;", "a ^= b ^= a ^=
b;" and the current compiler failed
while the gcc produces correct warnings.
And there are several other errors although i've done a few simple tests
and
did not used a compiler test suite!

With a semantik checker the icc430 can be used but without a semantik
checker the icc430 is awful. The compiler from keil are significant better.


> Of course, if you have a concrete example where
the current compiler
> (version 2) isn't ANSI compliant I'd be happy to take a look at
it.

Here is one simple example which worked with the 1.26 version:

typedef unsigned char TUINT8;
typedef unsigned short int TUINT16;
typedef struct
{
  TUINT8 lP;
  TUINT8 lW;
  TUINT16 lT:8;
  TUINT16 te:5;
  TUINT16 de:3;
  TUINT16 ct;
  TUINT16 sH;
}
T_M_H_T;
#define T_M_H_T_SIZE sizeof(T_M_H_T) // Warning: The value is not 8; icc430
is no ANSI compiler!

For the icc430 it was nessisary to set  T_M_H_T_SIZE to 8 although it was
not nessisary for MS-Visual-C++.

Rolf F.


Hi!

> > Of course, if you have a concrete example
where the current compiler
> > (version 2) isn't ANSI compliant I'd be happy to take a look
at it.
>
> Here is one simple example which worked with the 1.26 version:
>
> [...]
>
> #define T_M_H_T_SIZE sizeof(T_M_H_T) // Warning: The value is not 8; icc430
> is no ANSI compiler!

I just ran this both on 1.26 and on version 2 of the compiler.  Both
specifies that the size was 8.

My guess is that you tried to use "T_M_H_T_SIZE" in another
preprocessor expression, like:

  #if T_M_H_T_SIZE == 8
    /* Do something. */
  #endif

This, however is not proper ANSI C, as the "sizeof" operator may not
be used in that context.  Of course, in order to be backward
compatible with the old compiler, the new compiler provides an option
"--migration_preprocessor_extensions" that enables this.  We have
decided that these extensions are disabled by default in order to
alert the user that non ANSI-features are used.  (This is fully
covered in the "migration" part of the manual.)

    -- Anders Lindgren, IAR Systems
-- 
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.

>What tools are you using together with a C compiler, to keep track of
>versions and the like?
>Also are you using a program checker like LINT  ?

After reading several responses, I have to strongly recommend anyone who is 
writing C code to get Lint.  For those that do not know about it, it is a 
super compiler that does not generate any code - it just checks the code for 
potential errors.  Lint has saved me many times.  I can detect if a variable 
has not been initialized, or not used, or used in an odd way.  Lint can be 
tailored to run as strict as you like, even down to the level of reporting 
incorrect indent levels.

It really is not the fault of the compiler if you are allowed to write "if 
(a = b)", after all that is not an illegal C statement.  It's immoral
but 
not illegal.  So if a compiler lets me do strange things, I have to conclude 
it is letting me write C code, and C is the problem not the compiler.  
Having said that, Lint can be configured to be the most picky compiler you 
ever saw, catching just about everything except spelling mistakes in quoted 
strings :-)

Get Lint.

I currently use an older version of PVCS for version control and I am in the 
market for a new but affordable version control program.

Lou

_________________________________________________________________
Need a shot of Hank Williams or Patsy Cline?  The classic country stars are 
always singing on MSN Radio Plus.  Try one month free!  
http://join.msn.com/?page=offers/premiumradio



The 2024 Embedded Online Conference