arm7tdmi - NXP LPC2468 - gcc/g++/libstdc++, it's possible?

Jorge Pereira jpereiran at gmail.com
Fri Mar 7 16:26:03 UTC 2008


hi!

so, i am trying running a simple app using c++, below following a code
example.

*jjpn at campinho hello$ *cat -n testecpp.cpp
     1  #include <stdio.h>
     2  #include <stdlib.h>
     3  #include <iostream>
     4
     5  using namespace std;
     6
     7  class Teste {
     8          private:
     9          char texto[32];
    10
    11          public:
    12                  Teste(void);
    13                  ~Teste(void);
    14                  static Teste *get(void);
    15                  void setTexto(const char *texto);
    16                  const char *getTexto(void);
    17  };
    18
    19  Teste::Teste(void)
    20  {
    21
    22  }
    23
    24  Teste::~Teste(void)
    25  {
    26
    27  }
    28
    29  Teste *Teste::get(void)
    30  {
    31          static Teste singleton;
    32          return &singleton;
    33  }
    34
    35  void Teste::setTexto(const char *texto)
    36  {
    37          strncpy(&this->texto[0], texto, sizeof(this->texto));
    38  }
    39
    40  const char *Teste::getTexto(void)
    41  {
    42          return &this->texto[0];
    43  }
    44
    45  int main(int main, char *argv[])
    46  {
    47          Teste   teste;
    48          Teste *pteste = new Teste();
    49
    50          Teste::get()->setTexto("Jorge Pereira: singleton");
    51          pteste->setTexto("Jorge Pereira: pointer");
    52          teste.setTexto("Jorge Pereira: static");
    53
    54          cout << "Nome: singleton = " << Teste::get()->getTexto() <<
endl;
    55          cout << "Nome: pointer   = " << pteste->getTexto()       <<
endl;
    56          cout << "Nome: static    = " << teste.getTexto()         <<
endl;
    57
    58          printf("Hello World utilizando printf()\n");
    59
    60          delete pteste;
    61
    62          return 0;
    63  }
    64
*jjpn at campinho hello$*

i am using a gcc/g++ below.
*jjpn at campinho hello$* arm-uclinuxeabi-g++ -v
Using built-in specs.
Target: arm-uclinuxeabi
Configured with: /scratch/paul/lite/uclinux/src/gcc-4.2/configure
--build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-uclinuxeabi
--enable-threads --disable-libmudflap --disable-libssp --disable-libgomp
--disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --enable-languages=c,c++
--disable-shared --with-pkgversion=CodeSourcery Sourcery G++ Lite 2007q3-51
--with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls
--prefix=/opt/codesourcery
--with-sysroot=/opt/codesourcery/arm-uclinuxeabi/libc
--with-build-sysroot=/scratch/paul/lite/uclinux/install/arm-uclinuxeabi/libc
--enable-poison-system-directories
--with-build-time-tools=/scratch/paul/lite/uclinux/install/arm-uclinuxeabi/bin
--with-build-time-tools=/scratch/paul/lite/uclinux/install/arm-uclinuxeabi/bin
Thread model: single
gcc version 4.2.1 (CodeSourcery Sourcery G++ Lite 2007q3-51)
*jjpn at campinho hello$*

compiling...

*jjpn at campinho hello$* arm-uclinuxeabi-g++ -Os -pipe -fno-common
-fno-builtin -Wall -nostdinc++ -I/opt/uClibc++/include
-l:/opt/uClibc++/lib/libuClibc++.a -L/opt/uClibc++/lib/ -o testecpp.bin
testecpp.cpp -Wl,-elf2flt="-r"
*jjpn at campinho hello$ *file testecpp.bin
testecpp.bin: BFLT executable - version 4 ram
*jjpn at campinho hello$ *ls -lh testecpp.bin
-rw-r--r-- 1 jjpn jjpn 61K 2008-03-07 13:19 testecpp.bin
*jjpn at campinho hello$*

when a try execute a BIN on board (LPC2468 from embedded artistis) a receive
this message

*#* cat /proc/version
Linux version 2.6.11.8-hsc0BEIJING (user at eadevenv) (gcc version
2.95.320010315 (release)(ColdFire patches - 20010318 from
http://fiddes.net/coldfire/)(uClinux<http://fiddes.net/coldfire/%29%28uClinux>XIP
and shared lib patches from
http://www.snapgear.com/) <http://www.snapgear.com/%29>) #189 Wed Dec 26
16:06:12 CET 2007
*#* ./testecpp.bin
Illegal instruction
*#*

Questions!!

1) why this message appear?
2) exist any form to "running a c++ app in this board LPC2468 from embedded
artists??

My priority is compile using gcc/g++/threads 3.4 or better.

thankz a lot!
[]s



On Fri, Mar 7, 2008 at 12:16 PM, Martin Guy <martinwguy at yahoo.it> wrote:

> Hi!
>   linux-arm is the list for linux kernel developers, not compilers or
> cross-compilers.
> What exactly are you trying to do? On what machine do you want to run
> the compiler? On the arm board itself?
>
>   M
>



-- 
Regards,
+
---------------------------------------------------------------------------------+
Jorge Pereira, From: Olinda/Pe/Brazil
Home:  http://www.jorgepereira.com.br/
E-mail:  jpereiran at gmail.com, jorge at jorgepereira.com.br
Mobile: +55 (81) 8833-2484
My Public Key: http://www.jorgepereira.com.br/public.pgp
+
---------------------------------------------------------------------------------+
   "Se você ama alguma coisa, liberte-a;
  Se ela não voltar a ti, cace-a e mate-a."
+----------------------------------------------------------------------------------+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.busybox.net/pipermail/uclibc/attachments/20080307/a785dd54/attachment-0002.htm 


More information about the uClibc mailing list