public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* Re: [ECOS] Howto get basic STL running
@ 2004-01-20  7:21 eibach
  2004-01-20 15:48 ` Giovanni Perbellini
  0 siblings, 1 reply; 6+ messages in thread
From: eibach @ 2004-01-20  7:21 UTC (permalink / raw)
  To: ecos-discuss

Hello,
 
> Hello Dirk,
> would you be so kind to post an how-to for the community?
> 
> Thanks in advance.
> Giovanni P.

You just have to download STLPort library for www.stlport.org 

Then include it into your project.

I have made some hacks, so that it compiles. Most of them are quick and dirty, but they work fine for me. Hopefully someone more gifted than me can improve them and feed them back to the list.
I have attached a patch (against STLPort 4.6).

Regards,
Dirk


diff -Naur stlport_4_6/stlport/cstdio stlport_ecos/stlport/cstdio
--- stlport_4_6/stlport/cstdio	2003-07-21 04:36:42.000000000 +0200
+++ stlport_ecos/stlport/cstdio	2003-12-05 15:13:15.966081600 +0100
                   
 using _STLP_VENDOR_CSTD::perror;
 using _STLP_VENDOR_CSTD::printf;
 using _STLP_VENDOR_CSTD::puts;
+#  if (!defined (__ECOS__))
 using _STLP_VENDOR_CSTD::remove;
 using _STLP_VENDOR_CSTD::rename;
+#  endif
 using _STLP_VENDOR_CSTD::rewind;
 using _STLP_VENDOR_CSTD::scanf;
 using _STLP_VENDOR_CSTD::setbuf;
 using _STLP_VENDOR_CSTD::setvbuf;
 using _STLP_VENDOR_CSTD::sprintf;
 using _STLP_VENDOR_CSTD::sscanf;
+#  if (!defined (__ECOS__))
 using _STLP_VENDOR_CSTD::tmpfile;
 using _STLP_VENDOR_CSTD::tmpnam;
+#endif
 using _STLP_VENDOR_CSTD::ungetc;
 using _STLP_VENDOR_CSTD::vfprintf;
 using _STLP_VENDOR_CSTD::vprintf;
diff -Naur stlport_4_6/stlport/new.h stlport_ecos/stlport/new.h
--- stlport_4_6/stlport/new.h	2003-10-09 06:30:02.000000000 +0200
+++ stlport_ecos/stlport/new.h	2004-01-19 15:59:02.767190400 +0100
                  
 #  define _STLP_DONT_POP_0x848
 # endif
 
+#ifdef __ECOS__
+// Default placement versions of operator new.
+inline void* operator new(size_t, void* __p) throw() { return __p; }
+inline void* operator new[](size_t, void* __p) throw() { return __p; }
+
+// Default placement versions of operator delete.
+inline void  operator delete  (void*, void*) throw() { };
+inline void  operator delete[](void*, void*) throw() { };
+#else
 # ifndef _STLP_WINCE
 # if defined (__BORLANDC__)
 #  include <new.>
                 
 #   include _STLP_NATIVE_CPP_RUNTIME_HEADER(new.h)
 #  endif
 # endif
-# endif /* STL_WINCE */
+# endif 
+#endif // __ECOS__
 
 # if (_STLP_OUTERMOST_HEADER_ID == 0x848)
 #  if ! defined (_STLP_DONT_POP_0x848)
diff -Naur stlport_4_6/stlport/stl/_alloc.h stlport_ecos/stlport/stl/_alloc.h
--- stlport_4_6/stlport/stl/_alloc.h	2003-10-21 06:45:48.000000000 +0200
+++ stlport_ecos/stlport/stl/_alloc.h	2003-12-08 08:22:51.570681600 +0100
                   
   }
 };
 
-
+#ifndef __ECOS__
 // New-based allocator.  Typically slower than default alloc below.
 // Typically thread-safe and more storage efficient.
 class _STLP_CLASS_DECLSPEC __new_alloc {
                   
   static void* _STLP_CALL  allocate(size_t __n) {  return __stl_new(__n); }
   static void _STLP_CALL deallocate(void* __p, size_t) { __stl_delete(__p); }
 };
-
+#endif
 
 // Allocator adaptor to check size arguments for debugging.
 // Reports errors using assert.  Checking can be disabled with
diff -Naur stlport_4_6/stlport/stl/_config.h stlport_ecos/stlport/stl/_config.h
--- stlport_4_6/stlport/stl/_config.h	2003-11-01 00:53:48.000000000 +0100
+++ stlport_ecos/stlport/stl/_config.h	2003-12-08 08:43:41.457931200 +0100
                   
 /* if using stlport:: namespace or if C library stuff is not in vendor's std::,
  * try importing 'em.
  * MSVC has ambiguity problem when we try to import C-style std:: stuff back into global namespace */
-#  if defined (_STLP_USE_NAMESPACES) && /* ! defined (_STLP_OWN_IOSTREAMS) && */ \
+#  if defined (_STLP_USE_NAMESPACES) && /* ! defined (_STLP_OWN_IOSTREAMS) && */ !defined (__ECOS__) &&\
    ( defined(_STLP_USE_OWN_NAMESPACE) || defined (_STLP_VENDOR_GLOBAL_CSTD))
 #    define  _STLP_IMPORT_VENDOR_CSTD 1
 #  endif
diff -Naur stlport_4_6/stlport/stl/_threads.h stlport_ecos/stlport/stl/_threads.h
--- stlport_4_6/stlport/stl/_threads.h	2003-10-22 20:59:00.000000000 +0200
+++ stlport_ecos/stlport/stl/_threads.h	2003-12-08 08:18:43.113417600 +0100
                 
 # else 
 # if defined (_STLP_USE_NAMESPACES) && ! defined (_STLP_VENDOR_GLOBAL_CSTD)
 // using _STLP_VENDOR_CSTD::size_t;
-using namespace _STLP_VENDOR_CSTD;
+//using namespace _STLP_VENDOR_CSTD;
 # endif
   typedef size_t __stl_atomic_t;
 #endif  
diff -Naur stlport_4_6/stlport/stl_user_config.h stlport_ecos/stlport/stl_user_config.h
--- stlport_4_6/stlport/stl_user_config.h	2003-07-23 22:51:52.000000000 +0200
+++ stlport_ecos/stlport/stl_user_config.h	2004-01-05 15:19:22.164264000 +0100
                 
  * Use this switch for embedded systems where no iostreams are available
  * at all. STLport own iostreams will also get disabled automatically then.
  */
-// # define _STLP_NO_IOSTREAMS 1
+# define _STLP_NO_IOSTREAMS 1
 
 /* 
  * Set _STLP_DEBUG to turn the "Debug Mode" on.
                 
  * Please do not forget to link proper STLport library flavor
  * (e.g libstlport_gcc_stldebug.a) when you set this flag in STLport iostreams mode.
  */
-//#define   _STLP_DEBUG 1
+// #define   _STLP_DEBUG 1
 
 
 /* 
                    
 
 //==========================================================
 
+#define __ECOS__
+#define __CYGWIN__
+#define _STLP_NO_NEW_C_HEADERS
+#define _STLP_NO_NEW_NEW_HEADER
+#define _STLP_NO_OWN_NAMESPACE
+#define _STLP_USE_MALLOC
+#define _STLP_NODE_ALLOC_USE_MALLOC
+#define _STLP_NO_WCHAR_T
+//#define _STLP_DEBUG_ALLOC
+
 // Local Variables:
 // mode:C++
 // End:


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ECOS] Howto get basic STL running
  2004-01-20  7:21 [ECOS] Howto get basic STL running eibach
@ 2004-01-20 15:48 ` Giovanni Perbellini
  0 siblings, 0 replies; 6+ messages in thread
From: Giovanni Perbellini @ 2004-01-20 15:48 UTC (permalink / raw)
  To: ecos-discuss, eibach

Hello Dirk,

>You just have to download STLPort library for www.stlport.org
>
>Then include it into your project.
>
>I have made some hacks, so that it compiles. Most of them are quick and
dirty, but they work fine for me. Hopefully someone more >gifted than me can
improve them and feed them back to the list.
>I have attached a patch (against STLPort 4.6).

thanks so much. Question: are you using a GCC-3.x or GCC-2.95.x based
toolchain?

Regards.
Giovanni


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ECOS] Howto get basic STL running
       [not found] <1074669063.16438.ezmlm@sources.redhat.com>
@ 2004-01-21 12:43 ` Øyvind Harboe
  0 siblings, 0 replies; 6+ messages in thread
From: Øyvind Harboe @ 2004-01-21 12:43 UTC (permalink / raw)
  To: ecos-discuss, eibach

[-- Attachment #1: Type: text/plain, Size: 2761 bytes --]

> You just have to download STLPort library for www.stlport.org
> 
> Then include it into your project.
> 
> I have made some hacks, so that it compiles. Most of them are quick and dirty,
>  but they work fine for me. Hopefully someone more gifted than me can improve
>  them and feed them back to the list.
> I have attached a patch (against STLPort 4.6).

I've applied the patch(there was a small bump in the road, since my
patch command didn't grok the patch format, fixed patch attached), but I
run into problems with include files which I don't understand.

From my toolchain:

./ecos/gnutools/arm-elf/arm-elf/include/bits/functexcept.h
./ecos/gnutools/arm-elf/arm-elf/include/exception
./ecos/gnutools/arm-elf/arm-elf/include/exception_defines.h
./ecos/gnutools/arm-elf/arm-elf/include/stdexcept

Here is the error messsage:

arm-elf-g++ -MP -MT 'output/stlport/stl/_vector.o' -MT
'output/stlport/stl/_vector.d' -M -MF output/stlport/stl/_vector.d
-I/cygdrive/c/e21/workspace/firmware/stlport -I../romapp/install/include
-I. -mcpu=arm7tdmi -mno-short-load-words -Wall -Wpointer-arith
-Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2
-ffunction-sections -fdata-sections -fno-rtti -fno-exceptions
-fvtable-gc -finit-priority  -O0 -fexceptions -fno-vtable-gc 
-I../gnutools/arm-elf/arm-elf/include stlport/stl/_vector.c
In file included from
/cygdrive/c/e21/workspace/firmware/stlport/config/stlcomp.h:54,
                 from
/cygdrive/c/e21/workspace/firmware/stlport/stl/_config.h:74,
                 from
/cygdrive/c/e21/workspace/firmware/stlport/stl/_prolog.h:10,
                 from
/cygdrive/c/e21/workspace/firmware/stlport/cstddef:23,
                 from
/cygdrive/c/e21/workspace/firmware/stlport/stl/_algobase.h:35,
                 from
/cygdrive/c/e21/workspace/firmware/stlport/stl/_vector.h:36,
                 from stlport/stl/_vector.c:30:
/cygdrive/c/e21/workspace/firmware/stlport/config/stl_gcc.h:266:34:
warning: "__APPLE__" is not defined
In file included from
/cygdrive/c/e21/workspace/firmware/stlport/stl/_alloc.h:68,
                 from
/cygdrive/c/e21/workspace/firmware/stlport/stl/_vector.h:40,
                 from stlport/stl/_vector.c:30:
/cygdrive/c/e21/workspace/firmware/stlport/stl/_construct.h:57:6:
warning: "_MSC_VER" is not defined
In file included from
/cygdrive/c/e21/workspace/firmware/stlport/stdexcept:37,
                 from
/cygdrive/c/e21/workspace/firmware/stlport/stl/_range_errors.h:47,
                 from
/cygdrive/c/e21/workspace/firmware/stlport/stl/_vector.h:52,
                 from stlport/stl/_vector.c:30:
/cygdrive/c/e21/workspace/firmware/stlport/exception:58:56:
../3.2.1/exception.h: No such file or directory
make: *** [output/stlport/stl/_vector.d] Error 1




[-- Attachment #2: stlpatch.txt --]
[-- Type: text/x-patch, Size: 4682 bytes --]

diff -aur ../STLport-4.6/stlport/cstdio stlport/cstdio
--- ../STLport-4.6/stlport/cstdio	2003-07-21 03:36:41.000000000 +0200
+++ stlport/cstdio	2004-01-21 10:41:45.275408000 +0100
@@ -98,16 +98,20 @@
 using _STLP_VENDOR_CSTD::perror;
 using _STLP_VENDOR_CSTD::printf;
 using _STLP_VENDOR_CSTD::puts;
+#  if (!defined (__ECOS__))
 using _STLP_VENDOR_CSTD::remove;
 using _STLP_VENDOR_CSTD::rename;
+#  endif
 using _STLP_VENDOR_CSTD::rewind;
 using _STLP_VENDOR_CSTD::scanf;
 using _STLP_VENDOR_CSTD::setbuf;
 using _STLP_VENDOR_CSTD::setvbuf;
 using _STLP_VENDOR_CSTD::sprintf;
 using _STLP_VENDOR_CSTD::sscanf;
+#  if (!defined (__ECOS__))
 using _STLP_VENDOR_CSTD::tmpfile;
 using _STLP_VENDOR_CSTD::tmpnam;
+#endif
 using _STLP_VENDOR_CSTD::ungetc;
 using _STLP_VENDOR_CSTD::vfprintf;
 using _STLP_VENDOR_CSTD::vprintf;
diff -aur ../STLport-4.6/stlport/new.h stlport/new.h
--- ../STLport-4.6/stlport/new.h	2003-10-09 05:30:02.000000000 +0200
+++ stlport/new.h	2004-01-21 10:51:47.691640000 +0100
@@ -21,6 +21,17 @@
 #  define _STLP_DONT_POP_0x848
 # endif
 
+
+
+#ifdef __ECOS__
+// Default placement versions of operator new.
+inline void* operator new(size_t, void* __p) throw() { return __p; }
+inline void* operator new[](size_t, void* __p) throw() { return __p; }
+
+// Default placement versions of operator delete.
+inline void  operator delete  (void*, void*) throw() { };
+inline void  operator delete[](void*, void*) throw() { };
+#else
 # ifndef _STLP_WINCE
 # if defined (__BORLANDC__)
 #  include <new.>
@@ -33,7 +44,9 @@
 #   include _STLP_NATIVE_CPP_RUNTIME_HEADER(new.h)
 #  endif
 # endif
-# endif /* STL_WINCE */
+# endif 
+#endif // __ECOS__
+
 
 # if (_STLP_OUTERMOST_HEADER_ID == 0x848)
 #  if ! defined (_STLP_DONT_POP_0x848)
diff -aur ../STLport-4.6/stlport/stl/_alloc.h stlport/stl/_alloc.h
--- ../STLport-4.6/stlport/stl/_alloc.h	2003-10-21 05:45:48.000000000 +0200
+++ stlport/stl/_alloc.h	2004-01-21 10:45:03.079836800 +0100
@@ -119,7 +119,7 @@
   }
 };
 
-
+#ifndef __ECOS__
 // New-based allocator.  Typically slower than default alloc below.
 // Typically thread-safe and more storage efficient.
 class _STLP_CLASS_DECLSPEC __new_alloc {
@@ -134,7 +134,7 @@
   static void* _STLP_CALL  allocate(size_t __n) {  return __stl_new(__n); }
   static void _STLP_CALL deallocate(void* __p, size_t) { __stl_delete(__p); }
 };
-
+#endif
 
 // Allocator adaptor to check size arguments for debugging.
 // Reports errors using assert.  Checking can be disabled with
diff -aur ../STLport-4.6/stlport/stl/_config.h stlport/stl/_config.h
--- ../STLport-4.6/stlport/stl/_config.h	2003-11-01 00:53:47.000000000 +0100
+++ stlport/stl/_config.h	2004-01-21 10:45:59.751326400 +0100
@@ -471,7 +471,7 @@
 /* if using stlport:: namespace or if C library stuff is not in vendor's std::,
  * try importing 'em.
  * MSVC has ambiguity problem when we try to import C-style std:: stuff back into global namespace */
-#  if defined (_STLP_USE_NAMESPACES) && /* ! defined (_STLP_OWN_IOSTREAMS) && */ \
+#  if defined (_STLP_USE_NAMESPACES) && /* ! defined (_STLP_OWN_IOSTREAMS) && */ !defined (__ECOS__) &&\
    ( defined(_STLP_USE_OWN_NAMESPACE) || defined (_STLP_VENDOR_GLOBAL_CSTD))
 #    define  _STLP_IMPORT_VENDOR_CSTD 1
 #  endif
diff -aur ../STLport-4.6/stlport/stl/_threads.h stlport/stl/_threads.h
--- ../STLport-4.6/stlport/stl/_threads.h	2003-10-22 19:58:59.000000000 +0200
+++ stlport/stl/_threads.h	2004-01-21 10:46:39.117932800 +0100
@@ -52,7 +52,7 @@
 # else 
 # if defined (_STLP_USE_NAMESPACES) && ! defined (_STLP_VENDOR_GLOBAL_CSTD)
 // using _STLP_VENDOR_CSTD::size_t;
-using namespace _STLP_VENDOR_CSTD;
+//using namespace _STLP_VENDOR_CSTD;
 # endif
   typedef size_t __stl_atomic_t;
 #endif  
diff -aur ../STLport-4.6/stlport/stl_user_config.h stlport/stl_user_config.h
--- ../STLport-4.6/stlport/stl_user_config.h	2003-07-23 21:51:51.000000000 +0200
+++ stlport/stl_user_config.h	2004-01-21 12:43:02.940176000 +0100
@@ -62,7 +62,7 @@
  * Use this switch for embedded systems where no iostreams are available
  * at all. STLport own iostreams will also get disabled automatically then.
  */
-// # define _STLP_NO_IOSTREAMS 1
+# define _STLP_NO_IOSTREAMS 1
 
 /* 
  * Set _STLP_DEBUG to turn the "Debug Mode" on.
@@ -197,6 +197,19 @@
 
 //==========================================================
 
+#define __ECOS__
+#define __CYGWIN__
+#define _STLP_NO_NEW_C_HEADERS
+#define _STLP_NO_NEW_NEW_HEADER
+#define _STLP_NO_OWN_NAMESPACE
+#define _STLP_USE_MALLOC
+#define _STLP_NODE_ALLOC_USE_MALLOC
+#define _STLP_NO_WCHAR_T
+//#define _STLP_DEBUG_ALLOC
+//#define __INTEL_COMPILER 0
+//#define __APPLE__ 0
+
+
 // Local Variables:
 // mode:C++
 // End:


[-- Attachment #3: Type: text/plain, Size: 146 bytes --]

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ECOS] Howto get basic STL running
@ 2004-01-20 16:13 eibach
  0 siblings, 0 replies; 6+ messages in thread
From: eibach @ 2004-01-20 16:13 UTC (permalink / raw)
  To: perbellini, ecos-discuss

> thanks so much. Question: are you using a GCC-3.x or GCC-2.95.x based
> toolchain?

I am using gcc version 3.2.1

Regards,
Dirk

To: perbellini@sci.univr.it
    ecos-discuss@sources.redhat.com


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ECOS] Howto get basic STL running
@ 2004-01-19  7:14 eibach
  0 siblings, 0 replies; 6+ messages in thread
From: eibach @ 2004-01-19  7:14 UTC (permalink / raw)
  To: oyvind.harboe; +Cc: ecos-discuss

Hello,

> I get the impression that there are people out there that use STL
> w/eCos. There are numerous posts that hint as much in ecos-discuss, but
> I didn't find any "howto".

All the people I know (including me) use STLPort (www.stlport.org) without streams as their STL implementation. It can be configured to work with ecos, but it's a bit tricky in some places. Give it a try.

Regards,
Dirk

To: oyvind.harboe@zylin.com
Cc: ecos-discuss@sources.redhat.com


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ECOS] Howto get basic STL running
@ 2004-01-16 15:17 Øyvind Harboe
  0 siblings, 0 replies; 6+ messages in thread
From: Øyvind Harboe @ 2004-01-16 15:17 UTC (permalink / raw)
  To: ecos-discuss

I get the impression that there are people out there that use STL
w/eCos. There are numerous posts that hint as much in ecos-discuss, but
I didn't find any "howto".



Specifically I'm interested in "class string".




This is how far I got:


--- test app ---

#include <stdio.h>
void remove();
void rename();
void tmpfile();
void tmpnam();
#include <memory>
#include <string>

void test()
{
	std::string xx="abc";
//	string yy=xx+"kljasdf";
}


--- test app ---

Once I twisted the arm of GCC to compile the thing, I got these linking
errors:

---- linking errors ----

output/./xxx.o: In function `test()':
/cygdrive/c/e21/workspace/firmware/xxx.cc:13: undefined reference to
`std::allocator<char>::allocator[in-charge]()'
/cygdrive/c/e21/workspace/firmware/xxx.cc:13: undefined reference to
`std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::basic_string[in-charge](char const*, std::allocator<char> const&)'
/cygdrive/c/e21/workspace/firmware/xxx.cc:13: undefined reference to
`std::allocator<char>::~allocator [in-charge]()'
/cygdrive/c/e21/workspace/firmware/xxx.cc:13: undefined reference to
`std::allocator<char>::~allocator [in-charge]()'
/cygdrive/c/e21/workspace/firmware/xxx.cc:13: undefined reference to
`std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::~basic_string [in-charge]()'
collect2: ld returned 1 exit status
make: *** [output/rimi.bin] Error 1

---- linking errors ----


After a bit of googling, I discovered that I was missing various things
in libstdc++ that explicitly instantiates templates, e.g.:


http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/gcc/gcc/libstdc++-v3/src/allocator-inst.cc?rev=HEAD&content-type=text/plain


Although I could make some linker errors disappear as I pasted in bits
of code from the savannah CVS, I was always left with a couple of more
linker errors...


Øyvind



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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-01-21 12:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-20  7:21 [ECOS] Howto get basic STL running eibach
2004-01-20 15:48 ` Giovanni Perbellini
     [not found] <1074669063.16438.ezmlm@sources.redhat.com>
2004-01-21 12:43 ` Øyvind Harboe
  -- strict thread matches above, loose matches on Subject: below --
2004-01-20 16:13 eibach
2004-01-19  7:14 eibach
2004-01-16 15:17 Øyvind Harboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).