Hi Klaus,

I used the -c option once, actually it's a while ago but I can remember that I had to take a look at the source as well.

I still have the details, so hopefully you don't have to look it up yourself.

The tracing option gives you the exact cpu-cycle-count at which a new value was set for a specific memory address you are interested in.

I used this to validate timing in a highly interrupt driven piece of code. This feature is very cool if you like using automated testing ;)

My command line looked like this:
$ simulavr --device atmega128 --cpufrequency 1000000 --file Firmware.elf --breakpoint abort -c vcd:tracer-input:tracer-output

"tracer-output" is a file that will be written to. I attached a PHP script that transformes it into the AVR Studio stimuli format which should be nicer to understand.

My "tracer-input" file was simple, it could be more complex but this was all I needed:
+ PORTB.PORT

You can get a valid set of options for the "trace-input" file via the -o option of simulavr:
$ simulavr --device atmega128 -o /dev/stdout

Bye, Stan.
#!/usr/bin/php
<?
if(sizeof($argv) !== 2 || !is_numeric($argv[1]) || $argv[1] <= 0) {
        fprintf(STDERR, 'Usage: '.$argv[0].' <cpu frequency in hertz>'."\n");
        exit(1);
}
$fcpu = $argv[1];

$v = file_get_contents('php://stdin');
preg_match('/\$scope module (?P<port>PORT[A-Z]) \$end/', $v, $m);
$port = $m['port'];
preg_match_all('/#(?P<nsec>\d+)'."\n".'b(?P<value>[01]{8}) \d/', $v, $ms, 
PREG_SET_ORDER);
$l = 0;
foreach($ms as $m) {
        $t = ($m['nsec'] - $l) * 1E-9 * $fcpu;
        $l = $m['nsec'];

        echo '#'.$t."\n".$port.' = 0x'.base_convert($m['value'], 2, 0x10)."\n";
}
_______________________________________________
Simulavr-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/simulavr-devel

Reply via email to