Build Giac for Cortex-M3 devices

Librairie C++ de calcul formel/ C++ symbolic computation library

Modérateur : xcasadmin

jgpeiro
Messages : 4
Inscription : lun. oct. 11, 2010 6:42 pm

Build Giac for Cortex-M3 devices

Message par jgpeiro » mar. oct. 12, 2010 11:13 am

Hi,

How I can build Giac library, and all of dependences, for ARM Cortex-M3 devices?
It is possible use Giac library without linux?

thanks

parisse
Messages : 5090
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Build Giac for Cortex-M3 devices

Message par parisse » mar. oct. 12, 2010 1:01 pm

It should. You will need a C++ compiler with the standard libraries (libc, libm, standard template libraries, exception handling). Then you must compile GMP or a functional equivalent (like MPIR or libtommath). Once it works, you can try to compile giac, and if it works, you can further try to compile other optional packages which will improve giac performances (GSL, pari, NTL, ...).
Please keep us informed of your progresses!

jgpeiro
Messages : 4
Inscription : lun. oct. 11, 2010 6:42 pm

Re: Build Giac for Cortex-M3 devices

Message par jgpeiro » mar. oct. 12, 2010 6:03 pm

You will need a C compiler with the standard libraries (libc, libm,
standard template libraries, exception handling).
I use a Sourcery G compiler for ARM. It includes standar C/C libs, but no POSIX threads, dirent.h,sysinfo.h or others SO related headers or libs.
Then you must compile GMP
I tested, I can build a GMP and GSL libs for a Cortex-M3.
Once it works, you can try to compile giac
I try to compile Giac.
First I disable some "compiler tests" at configure file. Some test in "configure" file uses "file open" o "malloc" functions. These functions uses a low level IO functions such as _open, _read... defined in syscalls.c file, and that is not included at this step.
Next run "./configure" command with some options for Cortex-M3 device.
Now I am working at loop "make, read error, goto source, remove/undefine,
make..."

In the past I compile GiNaC and CLN libs with these method, but I need
compile Giac because I think that it is a better lib.

PD: sorry for my bad english level...

PD2: when posting, if I use the word "f open" (without space) the forum crashes and show these error
"Method Not Implemented
POST to /XCAS/posting.php not supported.
Apache/2.2.0 (Fedora) Server at pcm1.e.ujf-grenoble.fr Port 80"

parisse
Messages : 5090
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Build Giac for Cortex-M3 devices

Message par parisse » mar. oct. 12, 2010 6:24 pm

Indeed, the phpbbl forum is somewhat bugged, but it is good enough (at least now).
If you find some compiling errors that seems difficult to fix, do not hesitate to post, I'll try to help you fix it. You made a good choice:-), giac is more advanced than cln+ginac for computer algebra (limit, integration, etc.) and is much faster for polynomial operations.
Is it indiscrete to ask you what kind of project/device do you want to run with giac?

jgpeiro
Messages : 4
Inscription : lun. oct. 11, 2010 6:42 pm

Re: Build Giac for Cortex-M3 devices

Message par jgpeiro » mar. oct. 12, 2010 7:52 pm

Is it indiscrete to ask you what kind of project/device do you want to run with giac?
nooo, I am only a hobbyist, a 26 years old telecomunications student. I have more than 5 years of embedded C programming, you can view an example project here: http://www.todopic.com.ar/foros/index.php?topic=25318.0

Thanks for your help. I have very problems with makefiles, configure, libs... because I am a electronic engineer, not an informatic engineer. I have experiencie with small embedded systems, but no with Windous/Linus PCs...

I trying to create a portable calculator with CAS features such as TI or HP. I use a 32-bit ARM Cortex-M3 microcontroller, QVGA LCD, RTOS, and open source and portable math library such as Giac. I tested some math libs with GiNaC+CLN, SymbolicC++, GSL and it runs fast on Cortex-M3 and assume that Giac also runs fast.

Now, I successful compile a Giac library for Cortex-M3, but it fails when compile a simple program... as espected, because I modify makefiles and source code without know this. Today I only try to make a first library build to see if it is really possible.

I see on makefiles, at giac/src dir, that generates 2 libs, libgiac.la libxcas.la. Tomorrow I try to delete libxcas because it uses more non-portable code such as GL.H.
I think that I xcas is only the human interface and all the math kernel with all features are implemented on giac lib, no?

parisse
Messages : 5090
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Build Giac for Cortex-M3 devices

Message par parisse » mer. oct. 13, 2010 8:29 am

jgpeiro a écrit :
Now, I successful compile a Giac library for Cortex-M3, but it fails when compile a simple program... as espected, because I modify makefiles and source code without know this. Today I only try to make a first library build to see if it is really possible.
I assume your program compiles but does not execute. Can you get a backtrace of the failure, or better can you debug your program?
I see on makefiles, at giac/src dir, that generates 2 libs, libgiac.la libxcas.la. Tomorrow I try to delete libxcas because it uses more non-portable code such as GL.H.
I think that I xcas is only the human interface and all the math kernel with all features are implemented on giac lib, no?
That's correct. But it will probably not change much for you if you delete libxcas, because it should contain nothing since HAVE_LIBFLTK is most probably not defined in config.h.
For the build system, you do not need to use the Makefile made by configure, you can adapt one of the other Makefile.* from the src directory, like the Makefile.ipaq I made some years ago to compile xcas on an ARM device (but with linux installed on it).

jgpeiro
Messages : 4
Inscription : lun. oct. 11, 2010 6:42 pm

Re: Build Giac for Cortex-M3 devices

Message par jgpeiro » jeu. oct. 14, 2010 8:59 am

I assume your program compiles but does not execute. Can you get a backtrace of the failure, or better can you debug your program?
No, the program no compiles. I can compile the giac library, but when I try to use, the compiler show some errors.

The most important errors are:

Code : Tout sélectionner

undefined reference to `giac::alpha_order(giac::aide const&, giac::aide const&)'
undefined reference to `usleep'
undefined reference to `getpwnam'
undefined reference to `giac::has_static_help(char const*, int, char const*&, char const*&, char const*&, char const*&)'
undefined reference to `giac::helpon(std::string const&, std::vector<giac::aide, std::allocator<giac::aide> > const&, int, int, bool)'
undefined reference to `giac::writehelp(giac::aide const&, int)'
undefined reference to `giac::default_helpfile'
undefined reference to `giac::readhelp(char const*, int&, bool)'
undefined reference to `giac::readhelp(std::vector<giac::aide, std::allocator<giac::aide> >&, char const*, int&, bool)'
undefined reference to `giac::isalphan(char)'
undefined reference to `giac::unlocalize(std::string const&)'
undefined reference to `giac::localize(std::string const&, int)'
I remove the help.cc and help.h files from makefiles because it uses a dirent.h or another no portable include or function. Later, I try to compile the library with these files removing only the problematic lines of code.
I can manually implement usleep an isalphan functions and search and include files with defined functions alpha_order, getpwnam, localize and unlocalize and try one more time.

This is the compile log.

Code : Tout sélectionner

Build target 'MCBSTM32'
assembling STM32F10x.s...
compiling Syscalls.c...
compiling Serial.c...
compiling STM32_Init.c...
compiling Blinky.cpp...
compiling main_gmp.cpp...
compiling main_giac.cpp...
linking...
C:/.../arm-none-eabi/lib/thumb2\libcs3unhosted.a(unhosted-_gettimeofday.o): warning: IO function '_gettimeofday' used
C:/.../arm-none-eabi/lib/thumb2\libcs3unhosted.a(unhosted-isatty.o): warning: IO function '_isatty' used
C:/.../arm-none-eabi/lib/thumb2\libcs3unhosted.a(unhosted-_stat.o): warning: IO function '_stat' used
C:/.../arm-none-eabi/lib/thumb2\libcs3unhosted.a(unhosted-_system.o): warning: IO function '_system' used
C:/.../arm-none-eabi/lib/thumb2\libcs3unhosted.a(unhosted-_times.o): warning: IO function '_times' used
d:/archivos de programa/coocox/coide/gcc/sourcery g++ lite/bin/../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/bin/ld.exe: ./obj/Blinky.elf section `.text' will not fit in region `rom'
d:/archivos de programa/coocox/coide/gcc/sourcery g++ lite/bin/../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/bin/ld.exe: region `rom' overflowed by 2131136 bytes
C:/.../arm-none-eabi/lib/thumb2\libgiac.a(global.o): In function `global constructors keyed to giac::PARENTHESIS_NWAIT':
global.cc:(.text+0x5ac0): undefined reference to `sysconf'
C:/.../arm-none-eabi/lib/thumb2\libgiac.a(global.o): In function `T.2809':
global.cc:(.text+0x8496): undefined reference to `giac::alpha_order(giac::aide const&, giac::aide const&)'
global.cc:(.text+0x8658): undefined reference to `giac::alpha_order(giac::aide const&, giac::aide const&)'
C:/.../arm-none-eabi/lib/thumb2\libgiac.a(global.o): In function `T.2810':
global.cc:(.text+0x8718): undefined reference to `giac::alpha_order(giac::aide const&, giac::aide const&)'
global.cc:(.text+0x87c0): undefined reference to `giac::alpha_order(giac::aide const&, giac::aide const&)'
C:/.../arm-none-eabi/lib/thumb2\libgiac.a(global.o): In function `T.2799':
global.cc:(.text+0x88fa): undefined reference to `giac::alpha_order(giac::aide const&, giac::aide const&)'
C:/.../arm-none-eabi/lib/thumb2\libgiac.a(global.o):global.cc:(.text+0x8908): more undefined references to `giac::alpha_order(giac::aide const&, giac::aide const&)' follow
C:/.../arm-none-eabi/lib/thumb2\libgiac.a(global.o): In function `giac::add_language(int)':
global.cc:(.text+0x8ef4): undefined reference to `giac::readhelp(std::vector<giac::aide, std::allocator<giac::aide> >&, char const*, int&, bool)'
global.cc:(.text+0x92da): undefined reference to `giac::alpha_order(giac::aide const&, giac::aide const&)'
C:/.../arm-none-eabi/lib/thumb2\libgiac.a(plot.o): In function `giac::gnuplot_wait(int, __sFILE*, int)':
plot.cc:(.text+0x2688): undefined reference to `usleep'
C:/.../arm-none-eabi/lib/thumb2\libgiac.a(prog.o): In function `giac::_Pause(giac::gen const&, giac::context const*)':
prog.cc:(.text+0x188e): undefined reference to `usleep'
C:/.../arm-none-eabi/lib/thumb2\libgiac.a(prog.o): In function `giac::debug_loop(giac::gen const&, giac::context const*)':
prog.cc:(.text+0x12c3e): undefined reference to `usleep'
C:/.../arm-none-eabi/lib/thumb2\libgiac.a(prog.o): In function `giac::_cd(giac::gen const&, giac::context const*)':
prog.cc:(.text+0x19310): undefined reference to `getpwnam'
C:/.../arm-none-eabi/lib/thumb2\libgiac.a(prog.o): In function `giac::_findhelp(giac::gen const&, giac::context const*)':
prog.cc:(.text+0x30dde): undefined reference to `giac::has_static_help(char const*, int, char const*&, char const*&, char const*&, char const*&)'
prog.cc:(.text+0x31144): undefined reference to `giac::helpon(std::string const&, std::vector<giac::aide, std::allocator<giac::aide> > const&, int, int, bool)'
prog.cc:(.text+0x31150): undefined reference to `giac::writehelp(giac::aide const&, int)'
prog.cc:(.text+0x312e6): undefined reference to `giac::readhelp(char const*, int&, bool)'
prog.cc:(.text+0x31378): undefined reference to `giac::default_helpfile'
prog.cc:(.text+0x3137c): undefined reference to `giac::default_helpfile'
prog.cc:(.text+0x3138a): undefined reference to `giac::readhelp(char const*, int&, bool)'
prog.cc:(.text+0x313ca): undefined reference to `giac::readhelp(char const*, int&, bool)'
C:/.../arm-none-eabi/lib/thumb2\libgiac.a(gen.o): In function `giac::find_left(std::string const&, int&, int&)':
gen.cc:(.text+0x56a): undefined reference to `giac::isalphan(char)'
gen.cc:(.text+0x57e): undefined reference to `giac::isalphan(char)'
gen.cc:(.text+0x6e2): undefined reference to `giac::isalphan(char)'
gen.cc:(.text+0x6fc): undefined reference to `giac::isalphan(char)'
C:/.../arm-none-eabi/lib/thumb2\libgiac.a(gen.o): In function `giac::find_right(std::string const&, int&, int&)':
gen.cc:(.text+0xbae): undefined reference to `giac::isalphan(char)'
C:/.../arm-none-eabi/lib/thumb2\libgiac.a(gen.o):gen.cc:(.text+0xbd4): more undefined references to `giac::isalphan(char)' follow
C:/.../arm-none-eabi/lib/thumb2\libgiac.a(gen.o): In function `giac::gen::print(giac::context const*) const':
gen.cc:(.text+0x1c3cc): undefined reference to `giac::localize(std::string const&, int)'
C:/.../arm-none-eabi/lib/thumb2\libgiac.a(input_lexer.o): In function `giac_yylex(giac::gen*, void*)':
input_lexer.cc:(.text+0x14e28): undefined reference to `giac::unlocalize(std::string const&)'
C:/.../arm-none-eabi/lib/thumb2\libgiac.a(ti89.o): In function `giac::printassialorssinon(giac::gen const&, std::string const&, giac::context const*)':
ti89.cc:(.text+0x7d0a): undefined reference to `giac::localize(std::string const&, int)'
ti89.cc:(.text+0x7dca): undefined reference to `giac::localize(std::string const&, int)'
ti89.cc:(.text+0x7e90): undefined reference to `giac::localize(std::string const&, int)'
ti89.cc:(.text+0x7f94): undefined reference to `giac::localize(std::string const&, int)'
ti89.cc:(.text+0x8060): undefined reference to `giac::localize(std::string const&, int)'
C:/.../arm-none-eabi/lib/thumb2\libgiac.a(ti89.o):ti89.cc:(.text+0x84ea): more undefined references to `giac::localize(std::string const&, int)' follow
C:/.../arm-none-eabi/lib/thumb2\libgiac.a(ti89.o): In function `giac::_CyclePic(giac::gen const&, giac::context const*)':
ti89.cc:(.text+0xc66c): undefined reference to `usleep'
ti89.cc:(.text+0xc698): undefined reference to `usleep'
ti89.cc:(.text+0xc6ea): undefined reference to `usleep'
ti89.cc:(.text+0xc840): undefined reference to `usleep'
ti89.cc:(.text+0xc89e): undefined reference to `usleep'
C:/.../arm-none-eabi/lib/thumb2\libgiac.a(ti89.o):ti89.cc:(.text+0xc8be): more undefined references to `usleep' follow
collect2: ld returned 1 exit status
Target not created

parisse
Messages : 5090
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Build Giac for Cortex-M3 devices

Message par parisse » jeu. oct. 14, 2010 10:05 am

Try to #define GNUWINCE (and remove #include<dirent.h>) while compiling help.cc, after that I hope help.cc will compile.

Répondre