This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: printf(), outbyte(), ...


printf is probably calling _write (one underscore). Try that.

Cheers,
Shaun

On 6/2/06, Torsten Mohr <tmohr@s.netic.de> wrote:
Hi,

thanks for that hint.  Ok, i also tried that before.  I copied
write from write.c:

int _DEFUN (write, (fd, buf, nbytes), int fd _AND char *buf _AND int nbytes) {
  int i;

outbyte('j');

  for (i = 0; i < nbytes; i++) {
    if (*(buf + i) == '\n') outbyte ('\r');

    outbyte (*(buf + i));
  }

  return nbytes;
}

If i call it directly from main() i can see an output:
write(1, "Hi world\n", 9);  // works fine

But printf("Hello world\n") does not work at all.

I've also generated a complete listing of my ELF file:
v850e-unknown-elf-objdump -D file.elf >file.list

In there i can see that there is a second __write.  Also when
i overwrite this one i don't get no output.

I've also overwritten some other functions and output a character
to see if they get called.  None of them does.  Here's a list:
close, fstat, getpid, isatty, kill, lseek, open, read, stat, unlink
and write.

I wonder if i need to initialise them somehow?

Best regards,
Torsten.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]