As Chris Kuethe wrote:

> The avr-libc stdio page is a good read. That's where I go every time I
> have to be reminded of how to use printf on an avr. But try this on
> for size:

At least, that will do the job on real hardware (which Joel is also
interested in).  Currently, I don't have an idea what simulavrxx would
do with any kind of device IO.  I think it's got an option to
commicate it through a TCP channel some way.

For the old simulavr (which I believe Joel also wants to compare),
there's a couple of #if 0 statements in the code that, when removing
them, allows for standard IO ports to print their value on stdout, so
you could write up an stdio backend like:

static int
port_putchar(char c, FILE *stream)
{
   PORTA = c;
   return 0;
}

int
main(void)
{
   DDRA = 0xff;
   stdout = &mystdout;
   printf_P(PSTR("Hello, world!\n"));

   return 0;
}

That's probably sufficient for the purpose.

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)


_______________________________________________
Simulavr-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/simulavr-devel

Reply via email to