This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
CYG_ASSERTCLASS() fail when use wallclock->dallas->ds1307 device driver
- From: "Wang Cui" <iucgnaw at msn dot com>
- To: <ecos-discuss at ecos dot sourceware dot org>
- Date: Fri, 20 Oct 2006 17:02:16 +0800
- Subject: [ECOS] CYG_ASSERTCLASS() fail when use wallclock->dallas->ds1307 device driver
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