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

Laurie Gellatly laurie.gellatly@netic.com
Tue Nov 14 19:48:00 GMT 2006


Hi,
Had exactly this issue in the last month as I developed my variant to the
1307.
After some advice from eCosCentric, what I had to do was change the I2C
driver to recognise that interrupts were off and then poll the I2C by
calling the ISR and when interrupts are in use I wait for the ISR to run.

			...Laurie:{)

-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org]On Behalf Of Checky,
Michael (NE)
Sent: Wednesday, 15 November 2006 5:56 AM
To: ecos-discuss@sourceware.org
Subject: [ECOS] 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


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



More information about the Ecos-discuss mailing list