aboutsummaryrefslogtreecommitdiff
path: root/src/flash
AgeCommit message (Collapse)Author
2010-03-18jtag: cut down on usage of unintended modification of global end stateØyvind Harboe
jtag_get/set_end_state() is now deprecated. There were lots of places in the code where the end state was unintentionally modified. The big Q is whether there were any places where the intention was to modify the end state. 0.5 is a long way off, so we'll get a fair amount of testing. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-16lpc3180: LPC3180(LPC3250) SLC driver implementedrichard vegh
Until this time only basic SLC functionality exists when you want to use SLC to access external nand flash. Basic functionality can be selected with command: lpc3180 select 0 slc It is anyway very slow to write/read to/from nand flash. With the new command, SLC speed improved about 20 times, and hardware ECC info also read/written from/to nand flash OOB area: lpc3180 select 0 slc bulk Speed improvement achieved by using working are in SRAM of the LPC3250 chip and controlling DMA controller to interact between SRAM and SLC peripheral. Here are the patches, and if they are ok than take them. Tested with hitex LPC3250 usb stick. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-16image loading: fix problem with offsets > 0x80000000Bradey Honsinger
Fixes bug that prevented users from specifying a base address of 0x80000000 or higher in image commands (flash write_image, etm image, xscale trace_image). image.base_address is an offset from the start address contained in the image file (if there is one), or from 0 (for binary files). As a signed 32-bit int, it couldn't be greater than 0x7fffffff, which is a problem when trying to write a binary file to flash above that address. Changing it to a 64-bit long long keeps it as a signed offset, but allows it to cover the entire 32-bit address space. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-10PIC32: add flash algorithm supportSpencer Oliver
Add flash algorithm support for the PIC32MX. Still a few things todo but this dramatically decreases the programing time, eg. approx programming for 2.5k test file. - without fastload: 60secs - with fastload: 45secs - with fastload and algorithm: 2secs. Add new devices to supported list. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-03-10STM32: flash loader cleanupSpencer Oliver
- make algorithm array static const. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-03-10STR7: flash loader cleanupSpencer Oliver
- make algorithm array static const. - increase algorithm buffer size to 32k. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-03-10STR9: flash loader cleanupSpencer Oliver
- make algorithm array static const. - increase algorithm buffer size to 32k. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-03-10ADUC702x: flash loader cleanupSpencer Oliver
- make algorithm array static const. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-03-09CFI CORE: bug-fix protect single sectorAntonio Borneo
Cannot protect or unprotect single sector in cfi flash. When first==last the procedure fails. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-08cfi: simplify and clearify codeAntonio Borneo
At the end I have added comments /* FIXME: to be removed */ There are 3 lines in which my simplification is not complete due to data dependency with LOG_DEBUG() messages visible in the patch. Such log_debug has been introduced on Jan 22, 2007 with commit 4fc97d3f2726efa147cfdb0c456eace51550e1e3 during development activity in this file/procedure. From my point of view, these logs can be removed, since not part of a consistent flow of information. Alternatively, could be borrowed in the new cfi_send_command(), but this will increase verbosity. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-08jtag: jtag_add_ir_scan() now takes a single fieldØyvind Harboe
In the code a single field was all that was ever used. Makes jtag_add_ir_scan() simpler and leaves more complicated stuff to jtag_add_plain_ir_scan(). Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-08jtag: retire tap fieldØyvind Harboe
jtag_add_dr/ir_scan() now takes the tap as the first argument, rather than for each of the fields passed in. The code never exercised the path where there was more than one tap being scanned, who knows if it even worked. This simplifies the implementation and reduces clutter in the calling code. use jtag_add_ir/dr_plain_scan() for more fancy situations. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-06CFI: review print of Voltage valuesAntonio Borneo
JEDEC standard reports Vpp integer part encoded as 4 bit HEX value. To print it using decimal digits, %u is required. Other voltage values are coded as BCD, so %x is appropriate. Code already prints one nibble at a time, so no need for field width and precision in format string. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-03NOR: trim range in flash_driver_protect()David Brownell
When the beginning or end of the specified range of sectors already has the requested protection status, don't ask the flash driver to change those sectors. This will among other things turn command sequences like this into the NOPs one would expect: flash protect_check 0 flash info 0 ... reports everything as unprotected ... flash protect 0 0 1 off That speeds things up (by whatever work was just avoided). Also, with Stellaris (which can't unprotect flash at page level) this can eliminate some undesirable/false error reports. (And finishes fixing a bug currently listed in our bug database...) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-03-03NOR: invalidate cached state on target resumeDavid Brownell
The NOR infrastructure caches some per-sector state, but it's not used much ... because the cache is not trustworthy. This patch addresses one part of that problem, by ensuring that state cached by NOR drivers gets invalidated once we resume the target -- since targets may then modify sectors. Now if we see sector protection or erase status marked as anything other than "unknown", we should be able to rely on that as being accurate. (That is ... if we assume the drivers initialize and update this state correctly.) Another part of that problem is that the cached state isn't much used (being unreliable, it would have been unsafe). Those issues can be addressed in later patches. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-03-03NOR: stellaris message tweaksDavid Brownell
Give a more accurate failure message when trying to unprotect; don't complain about pages being write protected, just say that unprotect is not supported by the hardware ... referencing the new "recover" command, which is the way to achieve that. Likewise, when trying to protect, talk about "pages" (matching hardware doc) not "sectors" (an concept that's alien to these chips). Also make the helptext for the "recover" command mention that it also erases the device. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-03-03STM32: Add Value Line Flash Programming SupportSpencer Oliver
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-03-02LPC1768 updates, IAR board supportDavid Brownell
Fix some issues with the generic LPC1768 config file: - Handle the post-reset clock config: 4 MHz internal RC, no PLL. This affects flash and JTAG clocking. - Remove JTAG adapter config; they don't all support trst_and_srst - Remove the rest of the bogus "reset-init" event handler. - Allow explicit CCLK configuration, instead of assuming 12 MHz; some boards will use 100 Mhz (or the post-reset 4 MHz). - Simplify: rely on defaults for endianness and IR-Capture value - Update some comments too Build on those fixes to make a trivial config for the IAR LPC1768 kickstart board (by Olimex) start working. Also, add doxygen to the lpc2000 flash driver, primarily to note a configuration problem with driver: it wrongly assumes the core clock rate never changes. Configs that are safe for updating flash after "reset halt" will thus often be unsafe later ... e.g. for LPC1768, after switching to use PLL0 at 100 MHz. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-02-28stellaris: recover_command use usleep rather than sleepSpencer Oliver
windows api does not define a posix sleep, use usleep that has an openocd wrapper to the win32 native function. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-02-28ARMv7M: use software breakpoints for algorithmsSpencer Oliver
- armv7m_run_algorithm now requires all algorithms to use a software breakpoint at their exit address - updated all algorithms to support this Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-02-27new "stellaris recover" commandDavid Brownell
Stellaris chips have a procedure for restoring the chip to what's effectively the "as-manufactured" state, with all the non-volatile memory erased. That includes all flash memory, plus things like the flash protection bits and various control words which can for example disable debugger access. clearly, this can be useful during development. Luminary/TI provides an MS-Windows utility to perform this procedure along with its Stellaris developer kits. Now OpenOCD users will no longer need to use that MS-Windows utility. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-02-24AVR flash: handle AT90CAN128 chipsHans Peter Mortensn
I have successfully programmed the AT90CAN128, based on the mega128   with some small modifications. [ dbrownell@users.sourceforge.net: patch cleanup ] Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-02-12STR9xpec: issue warning when unlocking deviceSpencer Oliver
Issue warning to user when unlocking or writing the option bytes. The new settings will not take effect until a target reset. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-02-12STM32x: issue warning when unlocking device (bug #16)Spencer Oliver
Issue warning to user when unlocking or writing the option bytes. The new settings will not take effect until a target reset. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-02-02flash/str7x: After reset init the flash is unlockedEdgar Grimberg
The default state of the STR7 flash after a reset init is unlocked. The information in the flash driver now reflects this. The information about the lock status cannot be read from the flash chip, so the user is informed that flash info might not contain accurate information. [dbrownell@users.sourceforge.net: line length shrinkage] Signed-off-by: Edgar Grimberg <edgar.grimberg@zylin.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-29NOR: cleanup driver declsDavid Brownell
Fix goofy struct indents. Function names *are* their addresses. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-19NOR: fix diagnosticDavid Brownell
The "NOR: last_addr also needs correction when checking alignment" patch omitted a necessary update to the key diagnostic; fix. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-19flash: add error messages upon incorrect arguments to flash iterationØyvind Harboe
According to OpenOCD error handling rules the error is logged at where it occurs(same site where an exception would have been thrown). Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-01-16NAND: lpc3180 crashes on LPC3250richard vegh
The LPC3180 NAND driver was crashing on some large page chips. Fix: - Crash and related functionality (don't memset too much OOB data) - Some debug messages - Command handling now works [dbrownell@users.sourceforge.net: whitespace/linelength/message cleanup] Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-14nand flash support for s3c64xxPeter Korsgaard
Identical to the existing 2412/2443 support except for the base address and NFCONF value (bit 2 is reserved and should be written as 1 ref UM). Tested on a s3c6410 board, but controller is identical in 6400/6410 except for 8bit MLC ECC support in 6410 which isn't supported by the driver. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-01-14str9x.c: remove optimization when erasing the whole bankLaurentiu Cocanu
Using the erase bank command will cause a time out error. Replacing this with the erase sector bank will provide a slower but safer and stable method to erase the flash. Signed-off-by: Laurentiu Cocanu <laurentiu.cocanu@zylin.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-01-13NOR: add optional "flash erase_address" sector paddingDavid Brownell
Add a NOR flash mechanism where erase_address ranges can be padded out to sector boundaries, triggering a diagnostic: > flash erase_address 0x0001f980 16 address range 0x0001f980 .. 0x0001f98f is not sector-aligned Command handler execution failed in procedure 'flash' called at file "command.c", line 647 called at file "command.c", line 361 > > flash erase_address pad 0x0001f980 16 Adding extra erase range, 0x0001f800 to 0x0001f97f Adding extra erase range, 0x0001f990 to 0x0001fbff erased address 0x0001f980 (length 16) in 0.095975s (0.163 kb/s) > This addresses what would otherwise be something of a functional regression. An earlier version of the interface had a dangerous problem: it would silently erase data outside the range it was told to erase. Fixing that bug turned up some folk who relied on that unsafe behavior. (The classic problem with interface bugs!) Now they can get that behavior again. If they really need it, just specify "pad". Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-11Doxygen file commentsDavid Brownell
Add file comments to a few files. Make the GDB server use more conventional (pointer-free) hex digit conversion. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-09src/flash/nor: usage/help/doc updatesDavid Brownell
Make "usage" messages use the same EBNF as the User's Guide; no angle brackets. Improve and correct various helptexts. Don't use "&function"; a function's name is its address. Remove a couple instances of pointless whitespace; shrink a few overlong lines; fix some bad indents. Add TODO list entry re full support for NAND/NOR bank names. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-08NAND: help/usage/doc updatesDavid Brownell
Usage messages should use the same EBNF as the User's Guide; no angle brackets. Be more complete too ... some params were missing. Improve and correct various helptexts. Make user's guide refer to the NAND "driver" name, not the controller name; that's a bit more precise. Don't use "&function"; its name is its address. Line up struct initializers properly. Remove some blank lines. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-08MFLASH: help/usage updatesDavid Brownell
Make "usage" messages use the same EBNF as the User's Guide; no angle brackets. Improve and correct various helptexts. Don't use "&function"; a function's name is its address. Remove a couple instances of pointless whitespace. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-08NOR: add FIXMEs for writing onesDavid Brownell
It can invalidate ECC codes, and in general is not guaranteed to work. (However on some chips it _appears_ to behave.) Just don't do it; don't write in those cases. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-02streamline and document helptext mode displaysDavid Brownell
Most commands are usable only at runtime; so don't bother saying that, it's noise. Moreover, tokens like EXEC are cryptic. Be more clear: highlight only the commands which may (also) be used during the config stage, thus matching the docs more closely. There are - Configuration commands (per documentation) - And also some commands that valid at *any* time. Update the docs to note that "help" now shows this mode info. This also highlighted a few mistakes in command configuration, mostly commands listed as "valid at any time" which shouldn't have been. This just fixes ones I noted when sanity testing. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-28MinGW build fixesFreddie Chopin
Print "ssize_t" as "%ld" (+ cast to long) not as "%zu". Official MinGW (gcc 3.4.5) doesn't understand "z" flag. Signed-off-by: Freddie Chopin <freddie_chopin@op.pl> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-28stm32x commands get "usage"Freddie Chopin
Add .usage fields to stm32x command_registration, so that "help stm32x" shows required parameters. Signed-off-by: Freddie Chopin <freddie_chopin@op.pl> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-28NOR: last_addr also needs correction when checking alignmentPiotr Esden-Tempski
Otherwise the new alignment checking algorithm thinks that the address is not aligned, because it is way beyond the last sector. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-27NOR: make flash_write_unlock() pad to sector endDavid Brownell
Resolve a regression when using newish automagic "write_image" modes, by always padding to the end of affected sectors. Also document some issues associated with those automagic options, in the User's Guide and also some related code comments. We might need similar padding at the *beginning* of some sectors, but this is a minimalist fix for the problems which have currently been reported (plus doc updates). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-26NOR: messaging fixDavid Brownell
Fix syntax error: default to "wrote N bytes"; writing a single byte is an unusual case, not the normal one.
2009-12-26NOR: Allocate the right amount of memoryDavid Brownell
Switch to calloc() to simplify review and initialization.
2009-12-26cygwin 1.7 build fixesDavid Brownell
It's less accepting of signed char ... insisting that e.g. tolower() not receive one as a parameter. It's probably good to phase out such usage, given the number of bugs that lurk in the vicinity (assumptions that char is unsigned), so fix these even though such usage is actually legal. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-21Packaging fix, NEWS updateDavid Brownell
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-19cygwin build fixesDavid Brownell
and shrink some too-long lines Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-19AT91SAM9 NAND flash driver.Dean Glazeski
This creates the TCL interface for configuring an AT91SAM9 NAND flash controller and implements the necessary functions to correctly work with a NAND flash device connected to the chip. This includes updates to the driver list and the Makefile.am to support building the driver and also houses the documentation update in openocd.texi. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-18NOR FLASH: only erase/unlock whole sectorsDavid Brownell
Much to my surprise, I observed a "flash erase_address ..." command erasing data which I said should not be erased. The issue turns out to be generic NOR flash code which was silently, and rather dangerously, morphing partial-sector references into unrequested whole-sector ones. This patch removes that low-level morphing. If desired, it can and should be done in higher level code. (We might need to fix some stuff in the GDB server code.) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-18Subject: flash fill[bwh] should use bulk i/oDavid Brownell
It's currently allocating a big buffer but writing it out in units of sizeof(host's pointer) ... sub-optimal. Plus fix a couple minor coding style goofs. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>