From: "Retallack, Mark" <mark.retallack@siemens.com>
To: <ecos-discuss@ecos.sourceware.org>
Subject: [ECOS] Problem found with flash driver
Date: Thu, 02 Mar 2006 10:47:00 -0000 [thread overview]
Message-ID: <B573B0465A4EFB42997BADDC2FBDE154DB1EC9@ples506a.stcl.siemens.co.uk> (raw)
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.
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.
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.
After modding the code to disable interrupts before flushing and
disabling the cache, the system works correctly with no problems.
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_ = 0; /* avoids warning */ \
unsigned long __state; \
HAL_DISABLE_INTERRUPTS(__state); \
HAL_UCACHE_IS_ENABLED(_d_); \
HAL_UCACHE_SYNC(); \
HAL_UCACHE_INVALIDATE_ALL(); \
HAL_UCACHE_DISABLE(); \
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_UCACHE_ENABLE(); \
HAL_RESTORE_INTERRUPTS(__state); \
CYG_MACRO_END
#else // HAL_CACHE_UNIFIED
#define HAL_FLASH_CACHES_OFF(_d_, _i_) \
CYG_MACRO_START \
_i_ = 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
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.
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
next reply other threads:[~2006-03-02 10:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-02 10:47 Retallack, Mark [this message]
2006-03-02 16:36 Jay Foster
2006-03-02 16:43 Retallack, Mark
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B573B0465A4EFB42997BADDC2FBDE154DB1EC9@ples506a.stcl.siemens.co.uk \
--to=mark.retallack@siemens.com \
--cc=ecos-discuss@ecos.sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).