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

Wang Cui iucgnaw@msn.com
Fri Oct 20 09:02:00 GMT 2006


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?


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