EmbDev.net

Forum: ARM programming with GCC/GNU tools Can I use newlib in WinARM to make a .lib file?


Author: Pitt (Guest)
Posted on:

Rate this post
0 useful
not useful
Dear all:
     I am newbie to winarm and embedded system.
     For some purpose, I need rewite C++ code in win32 to wince.
     I am trying to find the unsupport header file, ex stdint.h ..
  by newlib.
     How sould I do to use WinARM to cross compiler the newlib into C++
  library for winCE?
     please help me and thanks a lot.

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 useful
not useful
>      I am trying to find the unsupport header file, ex stdint.h ..
>   by newlib.
I am not sure I understand what you are saying. Try posting in your
native language. WinARM includes stdint.h

>      How sould I do to use WinARM to cross compiler the newlib into C++
>   library for winCE?

1) Newlib is a C library not a C++ library. Make sure that you compile
it as C and not C++ otherwise it will not link correctly with C code.

2) The Newlib distribution includes makefile to rebuild the library; but
in general, modules are compiled then rather than linking as you would
an exeutable, they are 'archived' into a library (or archive) using the
ar.exe utiliity (part of binutils).

3) WinARM is targetted primarily at stand-alone ARM hardware (i.e. no
OS), and I would suggest that it is not entirely suitable for WinCE
development (for starters it uses the ELF object file format rather than
COFF). There are easier methods. http://cegcc.sourceforge.net/ (which
included Newlib) for example.

Author: Pitt (Guest)
Posted on:

Rate this post
0 useful
not useful
Dear Clifford :
     Thanks for your kindly reply. Let me explain a little bit of the
code I am writting now. I am trying to port the code on windows to
wince. But some of the headers in the original code are not being
supported by wince. So I would like to find a proper cross compiler
toolchain to get C libary for wince.
     Is this the best way to solve the problem or there is any other
better idea?
Thanks in advince for your reply.

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 useful
not useful
Pitt wrote:
> Thanks for your kindly reply. Let me explain a little bit of the
> code I am writting now. I am trying to port the code on windows to
> wince. But some of the headers in the original code are not being
> supported by wince. So I would like to find a proper cross compiler
> toolchain to get C libary for wince.
>      Is this the best way to solve the problem or there is any other
> better idea?

I think you are going about this problem the hard way! You are also not
being very clear. And you are probably asking the wrong question on the
wrong forum.

First of all some counter-questions, to be precisely clear:

1) What was the orignal Win32 code built with? (toolchain and version)
2) What are you using to build the WinCE code? (toolchain and version)
3) Which headers exactly do you believe are missing?

Next let's be clear (forgive me if you know this, but I sense some
misunderstanding); a header file may contain several types of
information, typically macros, typedefs, structures, enums, function
prototypes, and global data declarations. If a header only contains the
first four of these, it can stand alone. Function prototypes and data
declarations however require a corresponding definition, provided by
external object modules usually either built from source or provided by
a library. So if a header declares functions or data, the header alone
is not sufficient.

Now some headers, such as stdint.h do stand alone and have no
corresponding object code. stdint.h is defined by the ISO C99 standard
and may not be included if your compiler only supportd C89 or C++. That
said stdint.h is trivial and easily implemented, you probably don't even
need to implement all of it to get your code to build,some of the types
defined are seldom used.

Another thing to consider is that Newlib is purely an ISO C standard
library, if you WinCE toolchain does not contain the headers you need,
they are probably either not ISO headers (in which case Newlib would be
of no help), or they are C99 headers not implemented in your tool. The
differences between C89 and C99 (especially in respect to the library)
are mostly trivial and can easily be reimplemented as needed, or the
code modified to avoid the dependency. So a simpler (and safer) approach
to porting this code would be to identify what code depends on such
headers and reimplement it. If you are not sure how, get help (but this
forum may not be the appropriate place, try
http://forums.devshed.com/c-programming-42 for example).

Another approach would be to update your WinCE toolchain to a version
that is more modern (if that is indeed the problem - whic is why I asked
the questions above).

Clifford

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.