Simulation of amforth in simulavr - SOLVED

Nov 04, 2010 0 Replies

A few times I have sent questions to different groups regarding possibilities to simulate the amforth (

formatting link
) 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://git.savannah.nongnu.org/simulavr.git



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

formatting link



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



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:

formatting link
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


Regards, Wojtek Zabolotny wzb@ise.pw.edu.pl

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required