Hello I just did a quick check for erase_check. I checked all flash drivers function pointers to "erase_check":
grep -ri '\.erase_check' * nor/avrf.c: .erase_check = default_flash_mem_blank_check, nor/str7x.c: .erase_check = default_flash_blank_check, nor/lpc2000.c: .erase_check = lpc2000_erase_check, nor/str9xpec.c: .erase_check = str9xpec_erase_check, nor/ocl.c: .erase_check = ocl_erase_check, nor/aduc702x.c: .erase_check = default_flash_blank_check, nor/at91sam3.c: .erase_check = sam3_erase_check, nor/stm32x.c: .erase_check = default_flash_mem_blank_check, nor/lpc2900.c: .erase_check = lpc2900_erase_check, nor/at91sam7.c: .erase_check = at91sam7_erase_check, nor/str9x.c: .erase_check = default_flash_blank_check, nor/virtual.c: .erase_check = virtual_blank_check, nor/tms470.c: .erase_check = tms470_erase_check, nor/lpc288x.c: .erase_check = lpc288x_erase_check, nor/faux.c: .erase_check = default_flash_blank_check, nor/pic32mx.c: .erase_check = default_flash_mem_blank_check, nor/ecos.c: .erase_check = default_flash_blank_check, nor/stellaris.c: .erase_check = default_flash_mem_blank_check, nor/cfi.c: .erase_check = default_flash_blank_check, Seems like most use default "default_flash_blank_check", or "default_flash_mem_blank_check". This function pointers are called from grep -ri '\->erase_check' * flash/nor/virtual.c: if ((retval = master_bank->driver->erase_check(master_bank)) != ERROR_OK) flash/nor/tcl.c: if ((retval = p->driver->erase_check(p)) == ERROR_OK) Example checking "default_flash_blank_check" gives its located in flash/nor/core.c:int default_flash_blank_check(struct flash_bank *bank) This function seems to have some kind of caching mechanism: if (blank == 0xFF) bank->sectors[i].is_erased = 1; else bank->sectors[i].is_erased = 0; But have a fallback function that really checks byte-per-byte I think. Otherwise I think the function is useful for detecting bad flash chips. It might be that a flash is worn-out due to many erase-cycles etc. Somehow we would like to go out and really check that all bytes are 0xFF after an erase command. If not, then chip is broken, but then caching mechanism must work! All write commands should invalidate cache... /Fredrik Øyvind Harboe <oyvind.har...@zylin.com> wrote on 08/06/2010 03:44:04 PM: > Øyvind Harboe <oyvind.har...@zylin.com> > 08/06/2010 03:44 PM > > To > > David Brownell <davi...@pacbell.net> > > cc > > Fredrik Hederstierna <fredrik.hederstie...@securitas-direct.com>, > openocd-development <openocd-development@lists.berlios.de> > > Subject > > Re: [Openocd-development] Question about "flash erase_check" command > > > If it uses broken caching, fix the damn caching. > > I do not know if it does, as I have not used it nor do I trust it. > > I *always* erase before I program and I have no other use of > checking if flash is blank. > > > > > (When I used it last week I got current status... > > if there was caching, it was correct.) > > I believe at some point the status was correct most of the time... > > > Don't just give up and trash basic mechanisms that > > let folk track/examine core flash status... > > Somebody spoke up for this command, so now I will not delete it. > > If someone wants to analyze the code and post test results that > would be welcome. > > -- > Øyvind Harboe > US toll free 1-866-980-3434 / International +47 51 63 25 00 > http://www.zylin.com/zy1000.html > ARM7 ARM9 ARM11 XScale Cortex > JTAG debugger and flash programmer
_______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development