List Info

Thread: 16 bit cross compilation




16 bit cross compilation
user name
2006-12-29 16:27:29
  I am trying to make GMP 4.2.1 (or at least MPN) run on a
16 bit MSP430
  microcontroller, but I am having some problems:

Cool project!

  - The mp_limb_t type becomes 32 bit by default. How can I
change this to a
  16 bit type (i.e. how do I set the __GMP_SHORT_LIMB
preprocessor flag)?

There is no configuration that does that today, we just
added the
mechanism to simplify for people that wanted to do things
like this.

  - The configure script concludes that a file system is
available (probably
  because a stdio.h is available), and sets
_GMP_H_HAVE_FILE, which leeds to a
  lot of compilation errors.

Well, I don't think it is because the absense or presence of
a file
system.  If you get compilation errors, it is a bug in your
stdio.h,
or a bug in GMP.

  - When trying do fix these problems by manually editing
mp-h.in, gmp-h.in
  and configure, I get an error when compiling mpq/set_d.c
(it tries to
  compile the line 'choke me'). This is probably caused by
mp_limb_t being
  only 2 bytes long. Could this be an indication that GMP
will not run, or at
  least is not tested, on a 16 bit CPU?

In need of some porting.  The porting should not be hard,
though.

You should run into compiling things like "choke
me" and "you lose",
indicating that something needs to be addressed exactly
there.
Typically you need to fill out a table, or add some
constants.

-- 
Torbjörn
_______________________________________________
gmp-discuss mailing list
gmp-discussswox.com
http://s
wox.com/mailman/listinfo/gmp-discuss
16 bit cross compilation
user name
2007-01-02 11:06:29
 

> -----Original Message-----
> From: tegeking.swox.se [mailto:tegeking.swox.se] On Behalf Of 
> Torbjorn Granlund
> Sent: 29. desember 2006 17:27
> To: Inge.Witsoeq-free.com
> Cc: gmp-discussswox.com
> Subject: 16 bit cross compilation
> 
>>   - The configure script concludes that a file
system is available
(probably
>>   because a stdio.h is available), and sets
_GMP_H_HAVE_FILE, which leeds
to a
>>   lot of compilation errors.
> 
> Well, I don't think it is because the absense or
presence of a file
system.
> If you get compilation errors, it is a bug in your
stdio.h, or a bug in
GMP.

It seems like I left out some important information. What
happens is that
since _GMP_H_HAVE_FILE is defined (caused by the fact that
stdio.h exists),
a lot of file system related code is included when compiling
GMP. The FILE
type is not defined in the msp430 compiler. This will
generate a lot of
compilation errors when compiling gmp.h (see for instance
function
gmp_fprintf).

I also have another problem: For test purposes I have made a
16 bit
(generic) GMP library for PC, but when running it, my test
program produces
wrong results. mpn_mul_n is working fine, but mpn_tdiv_qr is
not. Do you
have any tip about where I should start looking for the
problem?

This is my procedure for making the 16 bit library (since I
am only using
MPN functions, I am doing a few shortcuts):

Change the following files:
    gmp/mp-h.in:
        Insert "#define __GMP_SHORT_LIMB" before
the mp_limb_t definition.
        Change definition of mp_limb_t and mp_limb_signed_t
from int to
short int.
    gmp/gmp-h.in:
        Insert "#define __GMP_SHORT_LIMB" before
the mp_limb_t definition.
        Change definition of mp_limb_t and mp_limb_signed_t
from int to
short int.
    gmp/mpq/set_d.c:
        Remove line 33 ("choke me").
        Remove content of function mpq_set_d.
    gmp/extract-dbl.c:
        Remove content of function __gmp_extract_double.
Execute:
    configure --disable-shared --host=none-unknown-windows
--disable-fft
    make

Inge

_______________________________________________
gmp-discuss mailing list
gmp-discussswox.com
http://s
wox.com/mailman/listinfo/gmp-discuss
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )