Building C++ application for eCos on ARM

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Building C++ application for eCos on ARM

Jabran Bhatti
Hello,

I'm looking to build a C++ application for eCos on an ARM processor.
My program requires several standard C++ header files such as vector,
iostream, list, ...

My question is: how can I achieve this? Does anyone have any
experience building and deploying C++ applications for eCos?



When I use the arm-eabi-g++ compiler to compile the application, I get
the following error

fatal error: vector: No such file or directory

meaning that the C++ vector library is not present.

However, the arm-none-eabi-g++ compiler does include these standard
header files. I do get the following errors for '<iostream>':

========================================
In file included from
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/bits/locale_facets.h:43:0,
                 from
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/bits/basic_ios.h:39,
                 from
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/ios:45,
                 from
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/ostream:40,
                 from
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/iostream:40,

/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:44:35:
error: '_U' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:45:32:
error: '_L' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:46:32:
error: '_U' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:46:37:
error: '_L' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:47:32:
error: '_N' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:48:33:
error: '_X' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:48:38:
error: '_N' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:49:32:
error: '_S' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:50:32:
error: '_P' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:50:37:
error: '_U' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:50:42:
error: '_L' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:50:47:
error: '_N' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:50:52:
error: '_B' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:51:32:
error: '_P' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:51:37:
error: '_U' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:51:42:
error: '_L' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:51:47:
error: '_N' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:52:32:
error: '_C' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:53:32:
error: '_P' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:54:32:
error: '_U' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:54:37:
error: '_L' was not declared in this scope
/opt/arm-2010.09/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/include/c++/4.5.1/arm-none-eabi/bits/ctype_base.h:54:42:
error: '_N' was not declared in this scope

======================================

Can I use the arm-none-eabi-g++ compiler for eCos? If yes, how do I
solve these errors? If no, what should I do?

Many thanks in advance!

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

Reply | Threaded
Open this post in threaded view
|

Re: Building C++ application for eCos on ARM

John Dallaway-2
Hi Jabran

On 29/08/13 15:33, Jabran Bhatti wrote:

> I'm looking to build a C++ application for eCos on an ARM processor.
> My program requires several standard C++ header files such as vector,
> iostream, list, ...
>
> My question is: how can I achieve this? Does anyone have any
> experience building and deploying C++ applications for eCos?

Take a look at the eCos uSTL package which provides a size optimized
implementation of most aspects of the C++ STL. Ref:

  http://ecos.sourceware.org/docs-latest/ref/ustl-overview.html

I hope this helps.

John Dallaway
eCos maintainer
http://www.dallaway.org.uk/john

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

Reply | Threaded
Open this post in threaded view
|

Re: Building C++ application for eCos on ARM

Jabran Bhatti
Hi John,

Thanks for your answer, I will see what I can do with the uSTL library
and keep you posted.

Regards,

Jabran

2013/8/29 John Dallaway <[hidden email]>:

> Hi Jabran
>
> On 29/08/13 15:33, Jabran Bhatti wrote:
>
>> I'm looking to build a C++ application for eCos on an ARM processor.
>> My program requires several standard C++ header files such as vector,
>> iostream, list, ...
>>
>> My question is: how can I achieve this? Does anyone have any
>> experience building and deploying C++ applications for eCos?
>
> Take a look at the eCos uSTL package which provides a size optimized
> implementation of most aspects of the C++ STL. Ref:
>
>   http://ecos.sourceware.org/docs-latest/ref/ustl-overview.html
>
> I hope this helps.
>
> John Dallaway
> eCos maintainer
> http://www.dallaway.org.uk/john

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

Reply | Threaded
Open this post in threaded view
|

Re: Building C++ application for eCos on ARM

Jabran Bhatti
Hi,

So I had a look at the uSTL package and it indeed incorporates most
C++ STL features.
The problem is, however, that I am using an external (open source)
library. That library has been built using STL, i.e., the header and
source files are filled with STL header file includes and namespace
'std::' references. It is a rather complex task to adjust each of the
these files.

As an alternative, would it be possible to compile the STL library
using the original source code along with the eCos application? Does
anyone have any experience with compilation of the STL library from
scratch?

2013/9/2 Jabran Bhatti <[hidden email]>:

> Hi John,
>
> Thanks for your answer, I will see what I can do with the uSTL library
> and keep you posted.
>
> Regards,
>
> Jabran
>
> 2013/8/29 John Dallaway <[hidden email]>:
>> Hi Jabran
>>
>> On 29/08/13 15:33, Jabran Bhatti wrote:
>>
>>> I'm looking to build a C++ application for eCos on an ARM processor.
>>> My program requires several standard C++ header files such as vector,
>>> iostream, list, ...
>>>
>>> My question is: how can I achieve this? Does anyone have any
>>> experience building and deploying C++ applications for eCos?
>>
>> Take a look at the eCos uSTL package which provides a size optimized
>> implementation of most aspects of the C++ STL. Ref:
>>
>>   http://ecos.sourceware.org/docs-latest/ref/ustl-overview.html
>>
>> I hope this helps.
>>
>> John Dallaway
>> eCos maintainer
>> http://www.dallaway.org.uk/john

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

Reply | Threaded
Open this post in threaded view
|

Re: Building C++ application for eCos on ARM

John Dallaway-2
Hi Jabran

On 10/09/13 20:13, Jabran Bhatti wrote:

> So I had a look at the uSTL package and it indeed incorporates most
> C++ STL features.
> The problem is, however, that I am using an external (open source)
> library. That library has been built using STL, i.e., the header and
> source files are filled with STL header file includes and namespace
> 'std::' references. It is a rather complex task to adjust each of the
> these files.

You might consider a scripted global string substitution "std::" ->
"ustl::" as part of your build system. Otherwise, I suggest you look at
Erik Aagaard Knudsen's work on libstdc++ for eCos. Ref:

  http://ecos.sourceware.org/ml/ecos-discuss/2011-09/msg00023.html

I hope this helps...

John Dallaway
eCos maintainer
http://www.dallaway.org.uk/john

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

Reply | Threaded
Open this post in threaded view
|

Re: Building C++ application for eCos on ARM

cetoni GmbH - Uwe Kindler
In reply to this post by Jabran Bhatti
Hi,

we also had an own library that uses stl and we managed to build it for
eCos uSTL. We did the following

1.
We created an stl compatibility layer: a folder that contains the stl
include files for eCos:
vector
string
map
...

2.
Each of these include files contains the same content - it simply
includes ustl_compat.h file

#ifndef ustl_compat_vectorH
#define ustl_compat_vectorH
#include "ustl_compat.h"

#endif

3.
The ustl_compat.h file contains the following code:

#ifndef ustl_compatH
#define ustl_compatH
#include <ustl.h>

#define std ustl

#endif // ustl_compatH


So it simply includes the ustl.h header file and defines the
preprocessor macro std. So each occurence of std::vector will be
replaced by ustl::vector

This worked for us and we could compile the library.






--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

Reply | Threaded
Open this post in threaded view
|

Re: Building C++ application for eCos on ARM

Jabran Bhatti
Hello John/cetoni,

Thanks for your replies.

* I tried the stl compatibility layer solution and all goes well until
I get the following error:

/usr/local/include/ptlib/critsec.h:37:30: fatal error:
ext/atomicity.h: No such file or directory

It appears that the ptlib library also requires header files that are
actually extensions of STL (header files in the folder ext/). These
extensions are not defined in ustl, which means this solution will not
work. Am I right?

* I also tried to build a toolchain including Erik Aagaard Knudsen's
libstdc++ for eCos (as described in the file
eCos_libstdcxx_compatibility/libstdcxx_compatibility.eak). Here, I
encountered the following problem:  when configuring GCC (4.3.2.), I
get a warning that most of the options such as --enable-languages,
--with-gnu-as, --with-gnu-ld, --with-newlib,... are not recognized.
When i try to build and install GCC next, I get a whole bunch of
assembler messages as follows:

/usr/src/gcc-4.3.2/libiberty/regex.c: In function ‘xregerror’:

/usr/src/gcc-4.3.2/libiberty/regex.c:8089: warning: implicit
declaration of function ‘mempcpy’

/usr/src/gcc-4.3.2/libiberty/regex.c:8089: warning: incompatible
implicit declaration of built-in function ‘mempcpy’

/tmp/ccNe5Dme.s: Assembler messages:

/tmp/ccNe5Dme.s:5991: Error: r13 not allowed here -- `lsr r3,sp,#3'

/tmp/ccNe5Dme.s:6498: Error: r13 not allowed here -- `rsb sp,r3,sp'

/tmp/ccNe5Dme.s:6500: Error: r13 not allowed here -- `lsr r0,sp,#3'

I think these errors might be caused by a conflict between my native
GCC compiler (4.8) and gcc-4.3.2.
So I tried to install gcc-4.3.2 on my machine (32-bit ubuntu 12.04)
from source (since it's no longer available on aptitude). Here, I
encountered a known bug in the linker step
(https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/738098). The
workaround described here didn't work for me.

What do you guys think?

2013/9/17 cetoni GmbH - Uwe Kindler <[hidden email]>:

> Hi,
>
> we also had an own library that uses stl and we managed to build it for eCos
> uSTL. We did the following
>
> 1.
> We created an stl compatibility layer: a folder that contains the stl
> include files for eCos:
> vector
> string
> map
> ...
>
> 2.
> Each of these include files contains the same content - it simply includes
> ustl_compat.h file
>
> #ifndef ustl_compat_vectorH
> #define ustl_compat_vectorH
> #include "ustl_compat.h"
>
> #endif
>
> 3.
> The ustl_compat.h file contains the following code:
>
> #ifndef ustl_compatH
> #define ustl_compatH
> #include <ustl.h>
>
> #define std ustl
>
> #endif // ustl_compatH
>
>
> So it simply includes the ustl.h header file and defines the preprocessor
> macro std. So each occurence of std::vector will be replaced by ustl::vector
>
> This worked for us and we could compile the library.
>
>
>
>
>

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

Reply | Threaded
Open this post in threaded view
|

Re: Building C++ application for eCos on ARM

Uwe Kindler-2
Hi,

ext/atomicity.h is a GCC specific extension of the STL library - so it is not supported by ustl. You could try to implement the functionality provided by atomicity.h header by yourself - but most likely you will run into the next error afterwards caused by the next missing file that is GCC specific.

Maybe you should switch to an embedded Linux instead of eCos if this is possible. Then you have full STL support. If you do not develop a consumer product where every cent counts, a Linux might be the better choice?

Kind regards, Uwe



Am 18.09.2013 15:18, schrieb Jabran Bhatti:

> Hello John/cetoni,
>
> Thanks for your replies.
>
> * I tried the stl compatibility layer solution and all goes well until
> I get the following error:
>
> /usr/local/include/ptlib/critsec.h:37:30: fatal error:
> ext/atomicity.h: No such file or directory
>
> It appears that the ptlib library also requires header files that are
> actually extensions of STL (header files in the folder ext/). These
> extensions are not defined in ustl, which means this solution will not
> work. Am I right?
>
> * I also tried to build a toolchain including Erik Aagaard Knudsen's
> libstdc++ for eCos (as described in the file
> eCos_libstdcxx_compatibility/libstdcxx_compatibility.eak). Here, I
> encountered the following problem:  when configuring GCC (4.3.2.), I
> get a warning that most of the options such as --enable-languages,
> --with-gnu-as, --with-gnu-ld, --with-newlib,... are not recognized.
> When i try to build and install GCC next, I get a whole bunch of
> assembler messages as follows:
>
> /usr/src/gcc-4.3.2/libiberty/regex.c: In function ‘xregerror’:
>
> /usr/src/gcc-4.3.2/libiberty/regex.c:8089: warning: implicit
> declaration of function ‘mempcpy’
>
> /usr/src/gcc-4.3.2/libiberty/regex.c:8089: warning: incompatible
> implicit declaration of built-in function ‘mempcpy’
>
> /tmp/ccNe5Dme.s: Assembler messages:
>
> /tmp/ccNe5Dme.s:5991: Error: r13 not allowed here -- `lsr r3,sp,#3'
>
> /tmp/ccNe5Dme.s:6498: Error: r13 not allowed here -- `rsb sp,r3,sp'
>
> /tmp/ccNe5Dme.s:6500: Error: r13 not allowed here -- `lsr r0,sp,#3'
>
> I think these errors might be caused by a conflict between my native
> GCC compiler (4.8) and gcc-4.3.2.
> So I tried to install gcc-4.3.2 on my machine (32-bit ubuntu 12.04)
> from source (since it's no longer available on aptitude). Here, I
> encountered a known bug in the linker step
> (https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/738098). The
> workaround described here didn't work for me.
>
> What do you guys think?
>
> 2013/9/17 cetoni GmbH - Uwe Kindler <[hidden email]>:
>> Hi,
>>
>> we also had an own library that uses stl and we managed to build it for eCos
>> uSTL. We did the following
>>
>> 1.
>> We created an stl compatibility layer: a folder that contains the stl
>> include files for eCos:
>> vector
>> string
>> map
>> ...
>>
>> 2.
>> Each of these include files contains the same content - it simply includes
>> ustl_compat.h file
>>
>> #ifndef ustl_compat_vectorH
>> #define ustl_compat_vectorH
>> #include "ustl_compat.h"
>>
>> #endif
>>
>> 3.
>> The ustl_compat.h file contains the following code:
>>
>> #ifndef ustl_compatH
>> #define ustl_compatH
>> #include <ustl.h>
>>
>> #define std ustl
>>
>> #endif // ustl_compatH
>>
>>
>> So it simply includes the ustl.h header file and defines the preprocessor
>> macro std. So each occurence of std::vector will be replaced by ustl::vector
>>
>> This worked for us and we could compile the library.
>>
>>
>>
>>
>>

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss