different behaviour in simulator

Torsten Mohr tmohr@s.netic.de
Wed Jun 14 08:24:00 GMT 2006


Hi,

i use newlib-1.14.0 for target v850e-unknown-elf.

I tried to get printf() to work, which works fine in
the simulator (insight-weekly-6.5.50).

I tracked one problem down to a different behaviour of
the #define cantwrite(fp)

It is defined in newlib/libc/stdio/local.h:

#define	cantwrite(fp) \
  ((((fp)->_flags & __SWR) == 0 || (fp)->_bf._base == NULL) && \
   __swsetup(fp))

With some testcode i found that the called _VFPRINTF_R returns
EOF in file vfprintf.c when run in the real target:

if (cantwrite (fp)) {
  if(((fp)->_flags & __SWR) == 0) {
    outbyte('G');  //////// is printed
  }

  if((fp)->_bf._base == NULL) {
    outbyte('H');
  }

  if(__swsetup(fp)) {
    outbyte('J'); //////// is printed
  }

  _funlockfile (fp);
  return (EOF);
....

I think if stdout is not writable something went terribly wrong.

Can anybody please give me a hint where it is initialised?

My startupcode initialises .bss, .data and calls crt1.c::__main,
is that enough for me to do?

As the code runs in the simulator but not in the real target i
wonder what's wrong.


Best regards,
Torsten.



More information about the Newlib mailing list