This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: CYG_ASSERTCLASS() fail when use wallclock->dallas->ds1307 device driver


On Fri, 20 Oct 2006 17:02:16 +0800, Wang Cu wrote:
> Hi, all
> As I use the ds1307 driver on my target, I configure to use the
generic
> I2C API to access the ds1307 chip.
> the application failed in a assertion. I debugged it and find the
cause, see
> the call stack below:
> -cyg_hal_invoke_constructors()
> -Cyg_WallClock::Cyg_WallClock()
> -init_hw_seconds()
> -init_ds_hwclock()
> -DS_GET()
> -cyg_i2c_transaction_begin()
> -cyg_mutex_lock()
> -Cyg_Mutex::lock()
> -CYG_ASSERTCLASS( this, "Bad this pointer");
> - Cyg_Mutex::check_this()
> -line198:        if(  locked && owner == NULL ) return false;
> Here, 'owner' of the mutex is NULL, cause assertion failed.
> 
> Since the driver is initialized in class construction stage before
scheduler
> runs, there is no thread context yet, then the owner is a 'NULL'
thread.
> 
> So how to handle it?

This is the same problem discussed last year in the thread
http://sourceware.org/ml/ecos-discuss/2005-07/msg00083.html.

It appears that this problem has not been resolved, because I am also
seeing the same assertion failure for a I2C based wallclock driver that
I am writing for the Epson Rx-8025.

It seems to me that the easiest fix would be to swap the priorities of
CYG_INIT_CLOCK and CYG_INIT_IDLE_THREAD in cyg_type.h.  Is there any
other reason than inertia that this fix has not been implemented?  If
not, could one of the maintainers add this fix?

Thanks
Michael Checky

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]