Hi Thomas,
thanks for your advice! I already tested this solution but got the
same result:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
import ex_utils
import time
mcu = "atmega2560"
freq = 8000000
# Test 1
print "First Run"
sim = ex_utils.SimulavrAdapter()
sim.dmanSingleDeviceApplication()
dev = sim.loadDevice(mcu, "blinking_LED_1.elf")
sim.doRun(10000)
del dev
del sim
# Test 2
print "Second Run"
sim = ex_utils.SimulavrAdapter()
print "Program crashes here"
sim.dmanSingleDeviceApplication()
print "... and not here"
dev = sim.loadDevice(mcu, "blinking_LED_2.elf")
sim.doRun(10000)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
▶ python evaluationFailure.py
First Run
0
Second Run
Program crashes here
FATAL: file traceval.cpp: line 615: method SetSingleDeviceApp must be
called before devices are added to DumpManager
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Obviously, it is not enough to delete the two variables? I already
included a
general delete for all variables ... but no sucess ;-(
Any ideas?
Sebastian
On 06/11/2017 05:22 PM, Thomas K wrote:
Hi Sebastian,
your code has some misunderstandings, I believe.
At first: ResetClock() does just reset the time control system, this
isn't a real core reset! If you want to rerun a program a second time
then it's better to reset the device and load the possibly different
code again and start again.
In your code (if this is, what you want to do) it would be better to
delete the entire simulation and set it up again. Background for the
exception in your code is, that if you create a device, it registers
itself on a trace system (for debugging output, vcd-Output and such)
and on 4th code line you've declared the simulation as single device
application - just one core in simulation. And on the 12th line you
create again a core without deleting the old core before! This ends
in a exception.
So, (best solution!) delete sim (means "del sim"! The garbage
collector could do this to late) for the second run and repeat 3th
and 4th line (create sim and set into single core mode) before
loadDevice()
or:
Delete dev (e.g. "del dev") for the second run before loadDevice() call.
But ... maybe it's the best to describe, what you want to get. Your
example is a little bit to minimalistic. :-)
Best regards, Thomas
Am 09.06.2017 um 10:12 schrieb zug:
Hi everyone,
thanks for providing simulavr with a Python interface, I would like
to use the simulator to evaluate automatically AVR code of my
students. Hence, I have a number of elf files and it was my
intention to run a script loading one by one
and execute some tests. But I failed to reset the simulator and the
virtual controller ...
To condense my problem I prepared the following code snippet that
should run and
rerun an elf file. For reseting the simulation I added a method
def ResetSystem(self):
self.__sc.ResetClock()
in ex_utils.py. When I excute the script
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
import ex_utils
mcu = "atmega32"
sim = ex_utils.SimulavrAdapter()
sim.dmanSingleDeviceApplication()
# Test 1
print "First Run"
dev = sim.loadDevice(mcu, "blinking_LED.elf")
sim.doRun(10000) # Execute an exemplary simulation
sim.ResetSystem() # Reset the simulation system
# Test 2
print "Second Run"
dev = sim.loadDevice(mcu, "blinking_LED.elf")
sim.doRun(10000) # Execute an examplary simulation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I got
▶ python evaluationFailure.py
First Run
Second Run
FATAL: file traceval.cpp: line 567: Can't create device name twice,
because it's a single device application
What's happened? The syncMembers vector should be empty? Why do we
have a
conflict here?
Thanks for your help
Sebastian
_______________________________________________
Simulavr-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/simulavr-devel