Pumpkin, Inc.

Pumpkin User Forums

errors compiling salvomem.c with IAR compiler

For issues specific to TI's MSP430 line of ultra-low-power microcontrollers, including compilers (e.g. Quadravox AQ430), IDEs (e.g. IAR Embedded Workbench) and development tools (e.g. TI MSP-FET430 Flash Emulation Tool).

errors compiling salvomem.c with IAR compiler

Postby Dave Hohl » Tue Apr 22, 2008 5:14 am

I am using the latest version of the IAR compiler for MSP430 (4.10E). My project is configured for Embedded C++ compilation option. When I try to compile salvomem.c, I get the following errors:

salvomem.c
Error[Pe338]: more than one instance of overloaded function "memchr" has "C" linkage C:Program FilesIAR SystemsEmbedded Workbench 5.0430INCDLIBstring.h 46
Error[Pe338]: more than one instance of overloaded function "strchr" has "C" linkage C:Program FilesIAR SystemsEmbedded Workbench 5.0430INCDLIBstring.h 47
Error[Pe338]: more than one instance of overloaded function "strpbrk" has "C" linkage C:Program FilesIAR SystemsEmbedded Workbench 5.0430INCDLIBstring.h 48
Error[Pe338]: more than one instance of overloaded function "strrchr" has "C" linkage C:Program FilesIAR SystemsEmbedded Workbench 5.0430INCDLIBstring.h 49
Error[Pe338]: more than one instance of overloaded function "strstr" has "C" linkage C:Program FilesIAR SystemsEmbedded Workbench 5.0430INCDLIBstring.h 50
Error[Pe338]: more than one instance of overloaded function "abs" has "C" linkage C:Program FilesIAR SystemsEmbedded Workbench 5.0430INCDLIBstdlib.h 209
Error[Pe338]: more than one instance of overloaded function "div" has "C" linkage C:Program FilesIAR SystemsEmbedded Workbench 5.0430INCDLIBstdlib.h 210
Error while running C/C++ compiler

Done. 7 error(s), 0 warning(s)


The tutorial program builds without any problem, so I suspect the issue has to do with my using C++ instead of C. Any idea what I can do to fix this?

Thanks.

Dave Hohl
 
Posts: 24
Joined: Wed Apr 02, 2008 11:00 pm
Location: Sunnyvale, CA, USA

Re: errors compiling salvomem.c with IAR compiler

Postby aek » Tue Apr 22, 2008 7:05 am

Which Salvo release?

The latest has a C++-style "header", and compiles in IAR fine (last time I checked).

--Andrew

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: errors compiling salvomem.c with IAR compiler

Postby Dave Hohl » Wed Apr 23, 2008 8:18 am

I am using salvo-pro-msp430-4.1.2-rc0.

I had previously installed the lite version, so just in case there was some confilct, this morning I uninstalled everything and reinstalled just the pro. I then tried compiling salvomem in the tutorial project. It compiles fine when I use the default setting -- C compiler. But if I change the project options to Embedded C++, I get the compile errors.

Dave Hohl
 
Posts: 24
Joined: Wed Apr 02, 2008 11:00 pm
Location: Sunnyvale, CA, USA

Re: errors compiling salvomem.c with IAR compiler

Postby aek » Wed Apr 23, 2008 8:30 am

Hmmm .. then I don;t know. I know that we have some users of IAR EWARM + Salvo doing C++, and have not heard of this problem.

You can experiment by changing the "encapsulation" in salvomem.c to see if the error goes away ... what is odd in the error message is that salvomem.c does not reference any of those functions ... but it may be the header file(s) that are being pulled in by salvomem.c that are the problem -- not the contents of salvomem.c itself.

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: errors compiling salvomem.c with IAR compiler

Postby Dave Hohl » Wed Apr 23, 2008 9:02 am

I created a new file -- temp.c -- that consists of a single line of code:

#include <salvo.h>

Compiling this with C++ generates the same errors. I tracked down where the offending statements are. salvo.h includes salvopsh.h, which in turn includes salvoportiarmsp430.h, which includes string.h et al. If I comment out the include statements in salvoportiarmsp430.h, temp.c will compile correctly.

I am not sure how to proceed from here. The include statements in salvoportiarmsp430.h must be there for a reason, so if I just comment them out I will likely experience a problem somewhere later on.

It seems to me that you should be able to readily reproduce this problem and determine a fix or temporary workaround. I am pretty much dead in the water at this point.

Thanks for your help!

Dave Hohl
 
Posts: 24
Joined: Wed Apr 02, 2008 11:00 pm
Location: Sunnyvale, CA, USA

Re: errors compiling salvomem.c with IAR compiler

Postby aek » Wed Apr 23, 2008 9:19 am

Salvo does not currently support C++, so I can't do much for you other than to observe the following ...

Most (but not all) of the various include files in salvoportiar430.h (and all of the target-specific Salvo header files) are there for features that are enabled with some of the advanced configuration options (e.g. OSLOGGING, OSRpt(), etc.). So if you can get a source-code project to build with one or more of those header files disabled, then that should be fine.

IOW, if you can get a Salvo project to build in C++ just by disabling some of those #include directives, then you should be fine.

We'll be happy to integrate anything you find into the distribution ...

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: errors compiling salvomem.c with IAR compiler

Postby Dave Hohl » Wed Apr 23, 2008 10:00 am

OK, I commented out the offending lines and was able to build the tutorial project and run on on my hardware, so I expect things should work fine when I integrate Salvo into my existing project.

It would be nice, though, if Pumpkin fully supported the C++ compiler. It doesn't seem like it should be that much trouble. But, that's easy for me to say! :-)

Thanks again for your prompt replies to my questions.

Dave Hohl
 
Posts: 24
Joined: Wed Apr 02, 2008 11:00 pm
Location: Sunnyvale, CA, USA

Re: errors compiling salvomem.c with IAR compiler

Postby Dave Hohl » Fri Apr 25, 2008 2:33 am

I managed to get Salvo to run in the C++ environment. Because I am using the medium data model, I had to do a source build rather than library build. There were two areas that needed fixing to get things to work.

First, there are numerous places in the code where either a tcb pointer or ecb pointer is assigned a value of NULL. Since you define NULL as (void *)0, the C++ compiler complained about the implicit cast. I guess the C compiler is more forgiving. An explicit cast did the trick here.

Second, I removed the extern "C" block from salvo.h, and moved it into salvoctx.h, since the latter is the only include file that defines assembly lanugage functions.

Also, since I did a source build, I was able to uncomment the #includes in salvoportiar430.h that had previously given me a problem.

[This message has been edited by Dave Hohl (edited April 25, 2008).]

Dave Hohl
 
Posts: 24
Joined: Wed Apr 02, 2008 11:00 pm
Location: Sunnyvale, CA, USA

Re: errors compiling salvomem.c with IAR compiler

Postby aek » Fri Apr 25, 2008 2:38 am

So, what did you end up doing for NULL?

I'd like to resolve that elegantly, but various compilers mess with NULL in non-standard ways ...

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: errors compiling salvomem.c with IAR compiler

Postby Dave Hohl » Fri Apr 25, 2008 5:02 am

To fix the NULL problem I had to edit all of the source files that assigned it to a tcb or ecb pointer and add an explicit cast. For example, I changed

ecbP->tcbP = NULL;

to

ecbP->tcbP = (tcb *)NULL;

Dave Hohl
 
Posts: 24
Joined: Wed Apr 02, 2008 11:00 pm
Location: Sunnyvale, CA, USA

Next

Return to TI's MSP430

Who is online

Users browsing this forum: No registered users and 1 guest

cron