--- Quote Start ---
originally posted by mjl-0708@Jun 21 2006, 05:55 AM
i do not encounter this problem when i creat a .cpp project
"unable to reach _impure_ptr (at 0x00000000) from the global pointer (at 0x04041e7c) because the offset (-67378812) is out of the allowed range, -32678 to 32767."
about this problom ,you check size of your memory
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16311)
--- quote end ---
--- Quote End ---
Are you using the eCos library installation during the compilation/link and is your
application using the iostream library?
More information:
See this link:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1000037 (
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1000037)
Quote from the bottom of the page:
------- Additional Comment# 2 From Jonathan Larmour 2003-07-31 04:13 [reply] -------
libstdc++ (which implements iostreams) is not yet supported by eCos (a lot of
the ground work is done, but funding had stopped and until it continues it will
probably stay that way alas). Even if it was, it wouldn't be supported with
synthetic target linux. At least not without a specially customised
compiler/libstdc++ implementation. The problem with synth linux specifically is
that the compiler makes assumptions that it's running with the Linux OS, when in
fact we want it to run eCos (and eCos surreptitiously makes it work with the
Linux kernel).
However, I was able to get a little farther with this problem. I had to define
_impure_ptr:
#include <sys/reent.h>
//--------------------------------------------------------------------------
// The newlib library uses an impure_data structure to keep track of global
// variables which need to be unique for each thread.
/* Note that there is a copy of this in sys/reent.h. */# ifndef __ATTRIBUTE_IMPURE_PTR__# define __ATTRIBUTE_IMPURE_PTR__# endif
# ifndef __ATTRIBUTE_IMPURE_DATA__# define __ATTRIBUTE_IMPURE_DATA__# endif
static struct _reent __ATTRIBUTE_IMPURE_DATA__ impure_data = _REENT_INIT (impure_data);
struct _reent *__ATTRIBUTE_IMPURE_PTR__ _impure_ptr = &impure_data;
and define and initialize ctype:
#define _U 01 //upper# define _L 02 //lower# define _N 04 //number# define _S 010 //space# define _P 020 //punctuation# define _C 040 //control# define _X 0100 //hex# define _B 0200 //blank
char _ctype_;
void init_ctype_()
{
int i;
// First clear all values...
for ( i = 0; i < 257; i++ )
{
_ctype_ = 0;
}
// Punctuation. This should be first so all non-punct characters have
// their values replaced.
for ( i = '!'; i <= '~'; i++ )
{
(_ctype_+1) = _P;
}
// Uppercase characters
for ( i = 'A'; i <= 'Z'; i++ )
{
(_ctype_+1) = _U;
}
// Lowercase characters
for ( i = 'a'; i <= 'z'; i++ )
{
(_ctype_+1) = _L;
}
// Numbers
for ( i = '0'; i <= '9'; i++ )
{
(_ctype_+1) = _N;
}
// Hex letters from a through f
for ( i = 'A'; i <= 'F'; i++ )
{
(_ctype_+1) |= _X;
}
for ( i = 'a'; i <= 'f'; i++ )
{
(_ctype_+1) |= _X;
}
// Space characters
(_ctype_+1) = _S | _B;
(_ctype_+1) = _S;
(_ctype_+1) = _S;
(_ctype_+1) = _S;
(_ctype_+1) = _S;
(_ctype_+1) = _S;
// Control characters, including escape
for ( i = 0; i <= 31; i++ )
{
(_ctype_+1) = _C;
}
(_ctype_+1) = _C;
}
and define __errno():
#include <errno.h>
int __errno()
{
return errno;
}
and had to provide some stub functions to get everything to link:
/*
* write (fd, buf, nbytes)
*
*/
void write(void)
{
printf("write() function is stubbed out!\n");
}
/*
* fdopen()
*
*/
int fdopen(void)
{
printf("fdopen() function is stubbed out!\n");
return -1;
}
/*
* fileno()
*
*/
int fileno(void)
{
printf("fileno() function is stubbed out!\n");
return -1;
}
/*
* read( fd, buf, nbytes )
*
*/
void read(void)
{
printf("read() function is stubbed out!\n");
}
/*
* lseek()
*
*/
int lseek(void)
{
printf("lseek() function is stubbed out!\n");
return -1;
}
/*
* fstat()
*
*/
int fstat(void)
{
printf("fstat() function is stubbed out!\n");
return -1;
}
So now, I can build an application (compile and link), but when I run it, I don't
get any of my cout output. I get printf output, but not the cout. For example,
when I execute:
printf("Hello, eCos world, printf-style!\n");
cout << "Hello, eCos world, cout-style" << endl;
printf("Hello, eCos world, printf-style!\n");
At the console, I only get:
Hello, eCos world, printf-style!
Hello, eCos world, printf-style!
Any ideas or suggestions?
Thanks for the replies!
Rennie