summaryrefslogtreecommitdiff
path: root/src/flash
Commit message (Collapse)AuthorAgeFilesLines
* LPC1768 updates, IAR board supportDavid Brownell2010-03-021-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* stellaris: recover_command use usleep rather than sleepSpencer Oliver2010-02-281-1/+1
| | | | | | | 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>
* ARMv7M: use software breakpoints for algorithmsSpencer Oliver2010-02-284-8/+4
| | | | | | | | - 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>
* new "stellaris recover" commandDavid Brownell2010-02-271-0/+66
| | | | | | | | | | | | | | | 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>
* AVR flash: handle AT90CAN128 chipsHans Peter Mortensn2010-02-241-4/+26
| | | | | | | | | 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>
* STR9xpec: issue warning when unlocking deviceSpencer Oliver2010-02-121-0/+8
| | | | | | | 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>
* STM32x: issue warning when unlocking device (bug #16)Spencer Oliver2010-02-121-2/+6
| | | | | | | 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>
* flash/str7x: After reset init the flash is unlockedEdgar Grimberg2010-02-021-2/+14
| | | | | | | | | | | | | | 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>
* NOR: cleanup driver declsDavid Brownell2010-01-2918-202/+200
| | | | | | Fix goofy struct indents. Function names *are* their addresses. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* NOR: fix diagnosticDavid Brownell2010-01-191-1/+1
| | | | | | | 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>
* flash: add error messages upon incorrect arguments to flash iterationØyvind Harboe2010-01-191-0/+6
| | | | | | | | 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>
* NAND: lpc3180 crashes on LPC3250richard vegh2010-01-161-13/+38
| | | | | | | | | | | | | 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>
* nand flash support for s3c64xxPeter Korsgaard2010-01-143-0/+79
| | | | | | | | | | | | 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>
* str9x.c: remove optimization when erasing the whole bankLaurentiu Cocanu2010-01-141-15/+3
| | | | | | | | | 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>
* NOR: add optional "flash erase_address" sector paddingDavid Brownell2010-01-133-23/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Doxygen file commentsDavid Brownell2010-01-113-0/+17
| | | | | | | 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>
* src/flash/nor: usage/help/doc updatesDavid Brownell2010-01-096-97/+125
| | | | | | | | | | | | | 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>
* NAND: help/usage/doc updatesDavid Brownell2010-01-083-48/+50
| | | | | | | | | | | | | | 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>
* MFLASH: help/usage updatesDavid Brownell2010-01-081-15/+18
| | | | | | | | | | 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>
* NOR: add FIXMEs for writing onesDavid Brownell2010-01-081-2/+5
| | | | | | | | 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>
* streamline and document helptext mode displaysDavid Brownell2010-01-021-1/+1
| | | | | | | | | | | | | | | | | | | 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>
* MinGW build fixesFreddie Chopin2009-12-283-6/+6
| | | | | | | | 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>
* stm32x commands get "usage"Freddie Chopin2009-12-281-0/+5
| | | | | | | | 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>
* NOR: last_addr also needs correction when checking alignmentPiotr Esden-Tempski2009-12-281-0/+1
| | | | | | | 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>
* NOR: make flash_write_unlock() pad to sector endDavid Brownell2009-12-271-2/+42
| | | | | | | | | | | | | | 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>
* NOR: messaging fixDavid Brownell2009-12-261-2/+2
| | | | | Fix syntax error: default to "wrote N bytes"; writing a single byte is an unusual case, not the normal one.
* NOR: Allocate the right amount of memoryDavid Brownell2009-12-261-1/+1
| | | | Switch to calloc() to simplify review and initialization.
* cygwin 1.7 build fixesDavid Brownell2009-12-261-1/+2
| | | | | | | | | | | 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>
* Packaging fix, NEWS updateDavid Brownell2009-12-211-1/+3
| | | | Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* cygwin build fixesDavid Brownell2009-12-192-6/+12
| | | | | | and shrink some too-long lines Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* AT91SAM9 NAND flash driver.Dean Glazeski2009-12-193-1/+754
| | | | | | | | | | 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>
* NOR FLASH: only erase/unlock whole sectorsDavid Brownell2009-12-181-8/+36
| | | | | | | | | | | | | | | 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>
* Subject: flash fill[bwh] should use bulk i/oDavid Brownell2009-12-181-2/+4
| | | | | | | | | 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>
* stellaris: fix min buffer length checksDavid Brownell2009-12-181-7/+4
| | | | | | | Word count == size/4; cope. And increase buf_min so it's large enough to cover the overhead in my tests. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* stellaris: update bulk flash writesDavid Brownell2009-12-181-20/+45
| | | | | | | | | | | | | | | | | | | | | | | Try to right-size the SRAM buffers, by not: - using them for very small writes - giving up when a large buffer isn't available - allocating buffers much larger than their data Also don't: - bother loading the code unless we allocate the writebuffer too - be so verbose with messaging: * be more concise * reduce importance (e.g. DEBUG not WARNING) * remove duplication The minimum buffer size is something of a guess. It's eight times smaller than before, almost the same size as the code being downloaded. It probably deserves some tuning. Also, note an erratum affecting flash protection on some chips; and narrow many over-wide lines affected by the above changes. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* NAND write data page refactoring.Dean Glazeski2009-12-182-59/+69
| | | | | | | | | | | Refactored the write page raw function into two new functions for writing data to a NAND device and then another function to finish up a write to a NAND device. This includes some new updates to introduce more error checking to existing code. [dbrownell@users.sourceforge.net: fix fault handling, whitespace] Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* NAND read data page refactor.Dean Glazeski2009-12-182-45/+25
| | | | | | | | | | | | | | Added a new function to encapsulate reading a page of data from a NAND device using either the read_block_data function of a NAND controller or to use direct reading of data from the NAND device. This also adds some performance enhancements and uses the read_data function if the read_block_data function fails safely (because it can't allocate a buffer in the working area). [dbrownell@users.sourceforge.net: fix fault handling, whitespace] Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* stellaris: commentsDavid Brownell2009-12-162-12/+34
| | | | | | | | | | | Someday revisit various issues: Tempest parts support writing more than one word at a time; for some target firmware it might be necessary to save and restore flash IRQ configuration. (The safest policy is likely to always reset after flash updates.) Plus swap some undesirable TAB characters with SPACE. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* stellaris: probe() cleanupsDavid Brownell2009-12-161-86/+42
| | | | | | | | | | | | | | Fix potential memory leak: make sure the per-bank data structures are only allocated in probe(), and that calling probe() multiple times is a NOP. Use it for auto_probe(). Require probe() to have done its thing: don't make access routines cope with it not having been called. Shrink a bunch of failure paths; and in some cases, correct them. Don't needlessly insist on a halted target for probe(). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* stellaris: remove needless codeDavid Brownell2009-12-161-50/+1
| | | | | | | No point in reading and discarding a status value when fetching part description data. Or having that needless "#if 0" code. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* stellaris: avoid chip writesDavid Brownell2009-12-161-13/+10
| | | | | | | | | | | | Previously "reading" clock info (and part info) also, as a side effect, wrote the flash timing register. Instead, be more safe: "reading" should only read. Write paths still refresh timing, coping with changes the application code may have made. Also rename the routine which sets flash timing, indicating what it's really doing; it's got nothing to do with a "mode". Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* NOR: bugfix "flash fill[bwh] ..." helptextDavid Brownell2009-12-161-3/+3
| | | | | | These commands don't have a "bank" parameter. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* stellaris: device IDsEric Wetzel2009-12-141-150/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I added the remaining devices and device IDs to stellaris.c, and removed several devices that don't exist on the Stellaris web page. Additionally, I found a few devices with duplicate IDs ... the DID1 Version Number for LM3Sxxx parts have DID1 Version = 0x0, and for LM3Sxxxx have DID1 Version = 0x1. So I extended the comparison to use the VER and FAM fields from DID1 also. ID=0x33: LM3S812 (DID1v0) and LM3S2616 (DID1v1) ID=0x39: LM3S808 (DID1v0) and LM3S2276 (DID1v1) These are the parts I removed from the file for lack of documentation (no data sheet to confirm part ID): LM3S318, LM3S1101, LM3S1108, LM3S1615, LM3S1616, LM3S2016, LM3S2101, LM3S2108, LM3S3759, LM3S3768, LM3S5757, LM3S5767, LM3S5768, LM3S5769, LM3S6815, LM3S6816, LM3S6915, LM3S6916, LM3S6111, LM3S6118. Also, sort devices according to part number. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* LPC2000: rename "r13_svc" as "sp_svc"David Brownell2009-12-121-1/+1
| | | | | | This driver didn't get updated when the name changed. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* add missing call to add new NAND devicesZachary T Welch2009-12-112-0/+4
| | | | | I forgot to add a call to the newly factored nand_device_add(), along with its forward declaration.
* fix 'write_image' usage informationZachary T Welch2009-12-111-1/+1
| | | | | The 'flash write_image' command erroneously listed the bank number, when it actually uses target addresses to do that lookup for the user.
* anotyer cygwin compile fixDavid Brownell2009-12-101-1/+2
| | | | Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* stellaris: flash protection updates, minor fixesDavid Brownell2009-12-092-68/+119
| | | | | | | | | | | | | | | | | | | | | | | | | Bugfix the read side of flash protection: - read the right register(s)! - handle more than 64K - record the results in the right places - don't display garbage. Partially bugfix the write side: - use 2KB lock regions instead of 1KB pages (!) - validate input range - don't try to _remove_ protection (it's write-once) - #define values we'll need to commit writes. - ... still doesn't handle pages over 64KB mark, or commit writes And minor cleanup and fixes: - get rid of some forward decls - properly locate a doxygen comment - fix some bad indentation - remove superfluous #include - add a new part ID (many are still missing) - make the downloaded algorithm code be read-only Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* Comment and doxygen fixesDavid Brownell2009-12-092-4/+2
| | | | Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* build: add build/src to include pathØyvind Harboe2009-12-083-3/+8
| | | | | | This allows including generated include files. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>