Simulation of amforth in simulavr - SOLVED

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

A few times I have sent questions to different groups regarding
possibilities to simulate the amforth ( )
in different simulators (e.g. VMLAB, or the new simavr ).
Unfortunately I didn't succeed with it. I have even refreshed
my Windows partition and installed AVR studio - but the simulation
was awfully slow.

Last time I have discovered, that the old simulavr simulator
is actively developed (even though the released versions are
very old), and I've found a way to successfully simulate amforth in it.

To simulate amforth, you need a newest version from git repository:

git clone git://

Then you should modify the src/python/pysimulavr.i and
examples/python/ files as described in

and compile it:
./configure --prefix=/your/install/directory --enable-python

To prepare amforth for simulation in simulavr one needs to convert
the hex files generated by avrasm2 into the elf format.
Assuming, that you've generated amforth from the template,
you can do it using the following commands:

srec_cat template.eep.hex -Intel \
 -fill 0xFF 0x00 -maximum-address template.eep.hex -Intel \
 -multiple  -Output eeprom.bin -Binary
srec_cat template.hex -Intel \
 -fill 0xFF 0x00 -maximum-address template.hex -Intel \
 -multiple  -Output code.bin -Binary
avr-objcopy --rename-section .data=.text,CONTENTS,ALLOC,LOAD,READONLY,CODE \
  --set-section-flags .eeprom=CONTENTS,ALLOC,LOAD,READONLY \
  --add-section .eeprom=eeprom.bin \
  --change-section-vma .eeprom=0x810000 \
  -I binary  code.bin  -O elf32-avr code.elf

Then you should copy the resulting code.elf file into
the examples/python directory to the compiled simulavr.

The rest of the process (with necessary modifications of some
simulavr files) is described here:
so I won't duplicate it.

The nice thing is that simulavr allows you to tightly interface your
simulated AVR with environment/testbench implemented in Python or Verilog
(I haven't tested yet the VPI functionality however).

I hope, that the above info may be usefull for someone
Wojtek Zabolotny
We've slightly trimmed the long signature. Click to see the full one.

Site Timeline