[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Simulavr-devel] Getting Started with simulavrxx

From: Klaus Rudolph
Subject: Re: [Simulavr-devel] Getting Started with simulavrxx
Date: Mon, 23 Feb 2009 10:38:01 +0100
User-agent: Thunderbird (X11/20081227)

Hi again,

> address@hidden anacomp]$ tclsh check.tcl
> couldn't load file "../../src/": ../../src/
> undefined symbol: inflateInit_
>    while executing
> "load ../../src/"
>    (file "check.tcl" line 8)

I could not reproduce this problem.

> OK not I have it trying to run but as you can see from above there
> are other issues.  Apparently it needs other .so files.
>>> =====================
>>> #include <stdio.h>
>>> int main() {
>>>  puts( "hello\n" );
>>> }
>>> ======================
>> main.c
>> OK!
>>> ....../simulavr -f hello -d atmega128 -Texit
>> OK!
>>> If so, where does the output go?  I see nothing but the program
>>> appears to run correctly according to the trace file.
>> There is no output :-)
>> You have not asked anything to print out.
> Huh? I used stdout via puts.  Where did that go?

Oh yes, look on the screen inside the controller :-)

I have no idea where stdio goes with libc. But I dig in the examples of
libc an could give you the example from libc:
  2 #include <stdio.h>
  3 char* port=0x67;
  5 static int uart_putchar(char c, FILE *stream);
  7 static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL,
  8       _FDEV_SETUP_WRITE);
 10    static int
 11 uart_putchar(char c, FILE *stream)
 12 {
 14    *port=c;
 15    return 0;
 16 }
 18    int
 19 main(void)
 20 {
 21    stdout = &mystdout;
 22    printf("Hello, world!\n");
 24    return 0;
 25 }

The original example goes to uart port, but I will show how to insert a
new special pipe register. I use these pipes to do printf debugging.
The atmega128 has at 0x67 no register (reserved) so we could place here
a pipe without disturbing any other functionality of the core.

The simulation now runs with:
simulavr -W 0x67,/dev/stdout -datmega128 -f hello -Texit -ttrace
simulavr -W 0x67,- -datmega128 -f hello -Texit -ttrace

-W is "Write to pipe" with register offset in avr memory space. After
seperator ',' the filename is given and a '-' ist stdout as normal with
other linux shell commands.

If you have a bit spare time you could add this to the texi doc file :-)
Your English could be much better than mine :-)

> Where does the UART go?

Simply to the uart port pins if setup the uart as uart! If not, you will
see nothing n the pins because default is port configuration and not uart.

> I see mention of this in the command line help:
> -u              run with user interface for external pin handling at
> port 7777
> Does this mean I can see the pins changing when the GUI runs?

Yes, and you can modify them from gui and you can add special components
like a pc keyboard or a lcd for example.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]