simulavr-devel
[Top][All Lists]
Advanced

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

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


From: Markus Hitter
Subject: [Simulavr-devel] Howto UART, howto record pin behaviour
Date: Wed, 13 Nov 2013 22:05:27 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0

While I filed a bug already, I'm new to this list, so:

Hello everybody!


The last two days I searched the net up and down to find out how I can
fit SimulAVR into my task. I found quite some stuff about installation
(http://www.nongnu.org/simulavr/ looks excellent), but almost nothing
about using SimulAVR for anything else but attaching GDB.

What I want is to simulate the stepper motor driver part of a RepRap (3D
printers!) firmware to watch and improve the timing of the steps done.
Lots of lengthy maths, lots of interrupts, performance only limited by
processing power exhaustion. Looking from the ATmega (644, 644P or
1284P) side, a motor step is simply a raising flange on one of the
digital I/O pins, so recording these would be awesome. Steps are timed
between 0 and 40 kHz realtime and done in the millions, so gdb isn't
exactly a good tool for watching these. All this should work well
without custom hardware simulation, as there are no inputs other than
the serial line.

Can I simply ask a couple of questions? Perhaps I'm missing the obvious.

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

- 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?

- 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.

- 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]

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



Thank you so much for your patience,
Markus


[1] simavr does an interesting approach here: it adds custom sections
into the ELF file for telling the simulator about what to record and
which chip is in use. These sections are ignored when uploading to the
real hardware. As a result, you always have the exactly same file for
both, simulator and hardware.

-- 
- - - - - - - - - - - - - - - - - - -
Dipl. Ing. (FH) Markus Hitter
http://www.reprap-diy.com/
http://www.jump-ing.de/



reply via email to

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