EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

porting uIP 1.0 to IAR

Started by ethernet777 June 6, 2007
Has anyone tried to port uIP 1.0 to the IAR compiler?

I'm getting lots of errors and warnings such as:
- function gettimeofday (or printf, etc.) declared implicitly
- function tcpip_output (or clock_time, etc.) has no prototype
- incomplete type for struct timeval (or timezone)
- integer conversion resulted in change of sign
- argument of type char* incompatible with parameter of type u8_t*
- etc.

I am using IAR EW430 KickStart V3.42A. (Yes, I know the 4KB limit
won't let me link the code, but the individual files should still
compile. We have an older 12KB Baseline version at work that I will
use later. I really don't want to have to learn another toolset, such
as CrossWorks or mspgcc or TI CCE.)

In the project options I have added various include directories for the
Preprocessor, tried various CLIB vs. DLIB settings, various Printf
formatter settings, etc., some of which reduce the number of errors and
warnings, but none eliminate them all.

My guess is that uIP was written for the GCC toolchain, and that the
IAR library include files are missing some of the information in the
GCC library include files? And/or some of my project settings are
incorrect?

The uIP 1.0 porting guidelines are rather skimpy and out-of-date.

Dave W.

Beginning Microcontrollers with the MSP430

> function gettimeofday (or printf, etc.) declared implicitly
> or clock_time, etc.) has no prototype
> incomplete type for struct timeval (or timezone)

You dont need all of that time of day stuff. All that does is derive a system tick.
Just create a timer int with a tick, and then massage it in for the timer func calls.

> I really don't want to have to learn another toolset, such
> as CrossWorks or mspgcc or TI CCE.)

Pity. I ported uIP V1.00 to CrossWorks, and added an FTP server while I was at it.
I can concurrently run HTTP, Telnet and FTP. The FTP server is to change the webpages, stored in
Atmel Data Flash. (I chucked out the script stuff and put in FAT instead)

CrossWorks has plenty of header files that make it compatible to IAR though !
You only need some minor additional things defined, such as u8_t etc.
Should be pretty straight forward.

Best Regards,
Kris

________________________________________
From: m... [mailto:m...] On Behalf Of ethernet777
Sent: Wednesday, 6 June 2007 2:40 PM
To: m...
Subject: [msp430] porting uIP 1.0 to IAR

Has anyone tried to port uIP 1.0 to the IAR compiler?

I'm getting lots of errors and warnings such as:
- function gettimeofday (or printf, etc.) declared implicitly
- function tcpip_output (or clock_time, etc.) has no prototype
- incomplete type for struct timeval (or timezone)
- integer conversion resulted in change of sign
- argument of type char* incompatible with parameter of type u8_t*
- etc.

I am using IAR EW430 KickStart V3.42A. (Yes, I know the 4KB limit
won't let me link the code, but the individual files should still
compile. We have an older 12KB Baseline version at work that I will
use later. I really don't want to have to learn another toolset, such
as CrossWorks or mspgcc or TI CCE.)

In the project options I have added various include directories for the
Preprocessor, tried various CLIB vs. DLIB settings, various Printf
formatter settings, etc., some of which reduce the number of errors and
warnings, but none eliminate them all.

My guess is that uIP was written for the GCC toolchain, and that the
IAR library include files are missing some of the information in the
GCC library include files? And/or some of my project settings are
incorrect?

The uIP 1.0 porting guidelines are rather skimpy and out-of-date.

Dave W.
Hi!

I've commented on the individual warnings you mentioned, hope this will
help!
ethernet777 wrote:

> Has anyone tried to port uIP 1.0 to the IAR compiler?
>
> I'm getting lots of errors and warnings such as:

> - function gettimeofday (or printf, etc.) declared implicitly

This is because the code uses a function without declaring it. "printf",
and all other standard functions are declared in their respective system
header file, e.g. "stdio.h".

gettimeofday is not a standard function so it must either be a function
that is part of the application, or a function that the application
assumes is present.

> - function tcpip_output (or clock_time, etc.) has no prototype

Ditto.

> - incomplete type for struct timeval (or timezone)

This is probably because the compiler has seen "struct timeval", but not
seen the declaration. Neither timeval or timezone are standard C.
> - integer conversion resulted in change of sign

Standard warning, it says that something that was signed became
unsigned, or vise versa. Primarily of interest when you write new code,
not when porting existing working code.

> - argument of type char* incompatible with parameter of type u8_t*
> - etc.

u8_t is probably an alias for "unsigned char". In C, the three types
"char", "unsigned char", and "signed char" are actually different types,
even if the underlying representation of "char" is either signed or
unsigned.

Lots of compilers does not complian when you pass mix the types, but the
IAR compiler do. (There is one exception, when you pass a string
literal, a "char const *", to something that takes an "unsigned char
const *".)

You can safely ignore this warning, add casts, or try to rework the
original source code to be correct with respect to u8_t and char:s.
-- Anders Lindgren, IAR Systems
--
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.

The 2024 Embedded Online Conference