simulavr-devel
[Top][All Lists]
Advanced

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

Re: [Simulavr-devel] Howto UART, howto record pin behaviour


From: ThomasK
Subject: Re: [Simulavr-devel] Howto UART, howto record pin behaviour
Date: Thu, 14 Nov 2013 07:11:11 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130330 Thunderbird/17.0.5

Hi Markus,

there are possibilities to fit your task. I use GDB very seldom for avr development. Mostly I use the script extensions, in my case python. For example for virtually running amforth :-) or the simulation a LIN network on AVR. But this needs too knowledge in python programming. Other script estension, which is possible, is TCL. But (my opinion) not often used and maybe you'll miss some parts there. (but this is possible to fix)

Of course, you can do the job also in C++ programming. But there you have a lot of work more to do. Advantage would be a higher performance.

If you want to use python, then a first start could be to look for the regression test suite and on the examples in examples directory. (but this is just a starter ... :-) )

- Is installation of SimulAVR a requirement or is it fine to run it off
the build location?

Yes, you can run it anywhere. Installation isn't necessary, but sometimes it's good to have a clean release independent on your simulavr workarea, where you, maybe, try something else!

- Is SimulAVR reasonably cycle-accurate? Like if two pin changes are
recorded 835 clock cycles apart, does this reasonably reliably mean the
same happens on the real hardware at a time distance of 835 * 20 MHz =
41.75 us?

It should cycle-accurate! :-) But there are some exeptions, where it's not simple possible to fullfill all conditions. But a comparison between simulation and real hardware with logic analyser has showed up a good result. Timer output should be precise.

- How would I set up a connection between the UART and a serial
terminal/another application, using the (interrupt based) UART handling
code of the firmware? UART interrupts can undoubtly have an influence on
smooth operations on the real hardware, so this should be part of the
simulation.

See above. There is also a UART simulation module for TCL extension, (in src/ui), maybe as a template for you. But hold in mind, that TCL extension isn't really bug-free.

- I see the usage of special_output_port and similar things in
http://www.nongnu.org/simulavr/intro.html#simple-example . Does this
change the actual code, like in "this requires distinct compilations for
the simulator and for the real hardware" or like in "this can change the
firmwares' behaviour or timing"?[1]

This special output ports are ports, which not really exist. It's a good help to try or check some special cases, but useless, if you try to simulate production code! The mechanism there is to detect a port access and do something special, which is impossible in real world! So it changes your code and also timing.

- Last, not least, how would I record I/O pin changes into a .vcd file?
How would I define which pins are recorded?

Possible, see also timertests in regress directory. This could be a help to find out how.

cu, Thomas



reply via email to

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