simulavr-devel
[Top][All Lists]
Advanced

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

Re: [Simulavr-devel] ATMega48 Crash


From: Michael N. Moran
Subject: Re: [Simulavr-devel] ATMega48 Crash
Date: Sat, 11 Apr 2009 18:26:34 -0400
User-agent: Thunderbird 2.0.0.5 (X11/20070727)

As if that wasn't verbose enough, here is some
more information. ;)

To help me debug this problem, I duplicated
the functionality in examples/atmega48/check.tcl
using C++. That allowed me to use GDB to track
down the failures.

If anyone is interested in seeing that C++ code
I'll be happy to send it to them.

Michael N. Moran wrote:
Gentlemen,

Thanks to Kurt's inspiration, I looked into the
sefaulting of the atmega48 and "solved" the problem
using this patch.

Index: hwmega48extirq.cpp
===================================================================
RCS file: /sources/simulavr/simulavrxx/src/hwmega48extirq.cpp,v
retrieving revision 1.1
diff -r1.1 hwmega48extirq.cpp
123c123
<     for (int tt =0; tt<4; tt++) {
---
 >     for (int tt =0; tt<2; tt++) {

Apparently, we were iterating beyond the bounds
of the initialized portion of the pinI vector.
It seems that only the first two slots were
initialized in the constructor for p0, and p1.

I have not, however, taken the time to understand
what the code is trying to accomplish. Therefore,
I don't know if this is a "correct" fix.

Either way, this "fixed" the segfault.

However, after this was fixed, the SPI code caused
a "crash" with the following message:

"device would be twice in cycle list"

Apparently, the HWSpi was adding itself to
the CycleList when it was already in the
cycle list. I added the following patch to
"fix" the problem. Apparently, when I originally
developed the HWSpi, the AddCycleList implementation
was not so ... picky.

Index: hwspi.cpp
===================================================================
RCS file: /sources/simulavr/simulavrxx/src/hwspi.cpp,v
retrieving revision 1.8
diff -r1.8 hwspi.cpp
99a100
 >             core->RemoveFromCycleList(this);

Basically, I (HWSpi) now removes itself from the
cycle list before adding itself. The act of removing
an element from the list does *not* fail if the element
was not already in the list.

I do not claim to actually understand the use of
the CycleList family of calls and any "documentation"/
comments is ... well ... missing. ;)

May I have *your* comments?



--
Michael N. Moran           (h) 770 516 7918
5009 Old Field Ct.         (c) 678 521 5460
Kennesaw, GA, USA 30144    http://mnmoran.org

"So often times it happens, that we live our lives in chains
 and we never even know we have the key."
"Already Gone" by Jack Tempchin (recorded by The Eagles)

The Beatles were wrong: 1 & 1 & 1 is 1




reply via email to

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