From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17345 invoked by alias); 2 Mar 2006 10:47:22 -0000 Received: (qmail 17337 invoked by uid 22791); 2 Mar 2006 10:47:21 -0000 X-Spam-Check-By: sourceware.org Received: from bnls261a.siemens.co.uk (HELO bnls261a.sni.co.uk) (217.33.204.17) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 02 Mar 2006 10:47:19 +0000 Received: from bnls902a (bnls902a.sni.co.uk [10.10.10.70]) by bnls261a.sni.co.uk (Switch-3.1.2/Switch-3.1.2) with ESMTP id Y22A2CHKS00000644 for ; Thu, 02 Mar 2006 10:48:17 GMT Received: from ples507a.stcl.siemens.co.uk ([137.223.44.136]) by bnls902a with InterScan Messaging Security Suite; Thu, 02 Mar 2006 10:47:16 -0000 Received: from ples506a.stcl.siemens.co.uk ([137.223.44.153]) by ples507a.stcl.siemens.co.uk with Microsoft SMTPSVC(6.0.3790.1830); Thu, 2 Mar 2006 10:47:14 +0000 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Date: Thu, 02 Mar 2006 10:47:00 -0000 Message-ID: From: "Retallack, Mark" To: X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: [ECOS] Problem found with flash driver X-SW-Source: 2006-03/txt/msg00010.txt.bz2 Hello everyone, I think I have found a minor problem with the io layer of the flash driver and before I continue with my fix, I just thought that I would ask if anyone else has seen it.=20 I am using JFFS2 over a flash bank that I am not running code from, so interrupts can be enabled during flash access. The processor is an MPC850.=20 With the virgin eCos flash.c code (from CVS), the system crashes with a random memory corruption, I have tracked it down to a context switch within the flash_program function in flash.c. After looking through the file and the eCos mailing list I found that the HAL_FLASH_CACHES_OFF define states that interrupts must be disabled.=20 After modding the code to disable interrupts before flushing and disabling the cache, the system works correctly with no problems.=20=20 I have not created a patch because the HAL_FLASH_CACHES_OFF define in flash.h looks very generic and I cannot test the mod. But this is what I have done: // Note: the ucache code has not been tested yet on any target. #define HAL_FLASH_CACHES_OFF(_d_, _i_) \ CYG_MACRO_START \ _i_ =3D 0; /* avoids warning */ \ unsigned long __state; \ HAL_DISABLE_INTERRUPTS(__state); \=20=20=20=20 HAL_UCACHE_IS_ENABLED(_d_); \ HAL_UCACHE_SYNC(); \ HAL_UCACHE_INVALIDATE_ALL(); \ HAL_UCACHE_DISABLE(); \ HAL_RESTORE_INTERRUPTS(__state); \=20=20=20=20 CYG_MACRO_END #define HAL_FLASH_CACHES_ON(_d_, _i_) \ CYG_MACRO_START \ unsigned long __state; \ HAL_DISABLE_INTERRUPTS(__state); \=20=20=20=20 if (_d_) HAL_UCACHE_ENABLE(); \ HAL_RESTORE_INTERRUPTS(__state); \=20=20=20=20 CYG_MACRO_END #else // HAL_CACHE_UNIFIED #define HAL_FLASH_CACHES_OFF(_d_, _i_) \ CYG_MACRO_START \ _i_ =3D 0; /* avoids warning */ \ unsigned long __state; \ HAL_DISABLE_INTERRUPTS(__state); \ HAL_DCACHE_IS_ENABLED(_d_); \ HAL_DCACHE_SYNC(); \ HAL_DCACHE_INVALIDATE_ALL(); \ HAL_DCACHE_DISABLE(); \ HAL_ICACHE_INVALIDATE_ALL(); \ HAL_RESTORE_INTERRUPTS(__state); \ CYG_MACRO_END #define HAL_FLASH_CACHES_ON(_d_, _i_) \ CYG_MACRO_START \ unsigned long __state; \ HAL_DISABLE_INTERRUPTS(__state); \ if (_d_) HAL_DCACHE_ENABLE(); \ HAL_RESTORE_INTERRUPTS(__state); \ CYG_MACRO_END I know that someone else has already pointed out this potential problem, but no fix was added, this makes me worry because I cannot be the only persion who is using the jffs2 system on a powerpc 850, and this is a very easy problem to reproduce. Mark Retallack Embedded Software Engineer Siemens Traffic Controls=20 Sopers Lane, Poole, Dorset. BH17 7ER. UK. Tel: 01202 782189 Fax: 01202 782545 www.siemenstraffic.com Committed to quality traffic solutions and service excellence Todays Quote: I want the presidency so bad I can already taste the hors d'oeuvres.=20=20 -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss