aboutsummaryrefslogtreecommitdiff
path: root/src/flash/nor/cfi.c
AgeCommit message (Collapse)Author
2017-05-08mips32, add support for micromips in debug modeSalvador Arroyo
Micromips is 16bit oriented, branch and jumps are 16 bit based. The upper half 16bits of a 32bit instruction with the major opcode, must go first in the instruction stream, hence the SWAP16 macro and swap16 array function, needed if the code is written as 32 bit word in little endian cores. Endianess info added to ejtag_iinfo. Pointer to ejtag_info and isa field added to pracc context. MIPS32 code are renamed to MIPS32_ISA_... To select the isa, the new code has an additional isa parameter (1 for micromips, 0 for mips32). In JR instruction the isa bit must be set to execute micromips code. The suffix u is added to the OP codes to avoid signed/unsigned comparison errors and to make sure the right shift is performed logically. The isa in debug mode is updated in the poll function. Code for miniprograms, in kernel mode, need to be converted. CFI code only for mips32. Change-Id: I79a8b637d49b0e2d92b6dd5eb5aa8aa0520bf938 Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es> Reviewed-on: http://openocd.zylin.com/4032 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-02-10target: Add 64-bit target address supportDongxue Zhang
Define a target_addr_t type to support 32-bit and 64-bit addresses at the same time. Also define matching TARGET_PRI*ADDR format macros as well as a convenient TARGET_ADDR_FMT. In targets that are 32-bit (avr32, nds32, arm7/9/11, fm4, xmc1000) be least invasive by leaving the formatting unchanged apart from the type; for generic code adopt TARGET_ADDR_FMT as unified address format. Don't silently change gdb formatting here, leave that to later. Add COMMAND_PARSE_ADDRESS() macro to abstract the address type. Implement it using its own parse_target_addr() function, in the hopes of catching pointer type mismatches better. Add '--disable-target64' configure option to revert to previous 32-bit target address behavior. Change-Id: I2e91d205862ceb14f94b3e72a7e99ee0373a85d5 Signed-off-by: Dongxue Zhang <elta.era@gmail.com> Signed-off-by: David Ung <david.ung.42@gmail.com> [AF: Default to enabling (Paul Fertser), rename macros, simplify] Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
2016-06-23cfi: Add support for strangely endianness broken SoC implementationsEsben Haabendal
This adds the 'data_swap' parameter to the CFI driver, which enables swapping of data bytes when writing/programming words to the flash. Note, that this specifically means that bytes are not swapped when writing command words to the flash chip. Unless you are using the SAP in an LS102x chip to program an attached 16-bit NOR flash, you hopefully do not need this! Change-Id: I1e6f7169da36f373c880d1756d9c21c9957acc50 Signed-off-by: Esben Haabendal <esben@haabendal.dk> Reviewed-on: http://openocd.zylin.com/3109 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2016-05-24Remove FSF address from GPL noticesMarc Schink
Also make GPL notices consistent according to: https://www.gnu.org/licenses/gpl-howto.html Change-Id: I84c9df40a774958a7ed91460c5d931cfab9f45ba Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3488 Tested-by: jenkins Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2016-02-29Cleanup: removal of obsolete semicolonsAlexander Kurz
Obsolete C source code semicolons were removed using the semantic patch semicolon/semicolon.cocci, see coccinellery.org Change-Id: I153b4995a9e028ebaf5f58c947821dc78345a777 Signed-off-by: Alexander Kurz <akurz@blala.de> Reviewed-on: http://openocd.zylin.com/3367 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2016-02-29cfi intel: fixing faulty flash write error messageAlexander Kurz
Writing to Intel CFI flash with unaligned tail bytes raised a false error message although all data was programmed successfully. e.g.: > flash write_image image 0x602e0000 bin > Programming at 0x602e0000, count 0x00000002 bytes remaining > couldn't write word at base 0x60000000, address 0x602e0000 > error writing to flash at address 0x60000000 at offset 0x002e0000 Root cause for this false error was a mixup of two result variables introduced with ecc8041c. Change-Id: Ib6b85293dbed946a36a307e5b198c47b901145bf Signed-off-by: Alexander Kurz <akurz@blala.de> Reviewed-on: http://openocd.zylin.com/3233 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2016-02-13cfi: support for 16-bit flash with reversed endiannessEsben Haabendal
This is for targets where flash controller has reverse endianness compared to target. For these, the 'bus_swap' parameter can be given to the CFI driver, which will cause command CFI commands to be written with bytes swapped. This is only for x16 CFI flash. Change-Id: I698b768e92e65d160232e90b0e81a824e3c81a46 Signed-off-by: Esben Haabendal <esben@haabendal.dk> Reviewed-on: http://openocd.zylin.com/3041 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2016-02-03flash: nor: {pic32mx,cfi}: fix register namesPaul Fertser
Commit fd43be07265b5f3cf3146f2bb80c1c2fc0a44fcf introduced a regression: since the register names were changed from those traditional for MIPS to common GDB scheme the code that makes use of them needs to be changed accordingly. This commit restores pic32mx flash driver functionality. Change-Id: Id18c739390fae36737a02dc30c363d0444f53b96 Reported-by: Louis Rannou <louson@users.sf.net> Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/3206 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-11-10cfi: Fix fallback to memory writesEsben Haabendal
Change-Id: I2d09139b95ff62c62a0b071584e85a87494ed313 Signed-off-by: Esben Haabendal <esben@haabendal.dk> Reviewed-on: http://openocd.zylin.com/3095 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-17flash: Constify write bufferAndreas Fritiofson
Change-Id: Ic812098d3ed5a2992c26bb57d08ae350e2c5d5d8 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/2040 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-11-07target: use target_buffer_set_u32_arraySpencer Oliver
Attempt to use target_buffer_set_u32_array to convert to target endian arrays rather reimplementing code. This also removed cfi_fix_code_endian as its functionality is also repeated. Change-Id: I7c359dbe46ea791cd5f6fb18d8b0fb6895c599d3 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1783 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2013-10-31Remove unnecessary castsAndreas Fritiofson
Change-Id: Ia97283707282ccccdc707c969f59337313b4e291 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1767 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-31Clean up many C99 integer types format specifiersPaul Fertser
This eliminates most of the warnings reported when building for arm-none-eabi (newlib). Hsiangkai, there're many similar warnings left in your nds32 files, I didn't have the nerve to clean them all, probably you could pick it up. Change-Id: Id3bbe2ed2e3f1396290e55bea4c45068165a4810 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/1674 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-07-01Support for SST 39VF3201C NOR flashIS2T
* Add Thumb-2 code to write flash memories that don't support DQ5 polling * Make sure default values for unlock commands are set even if there is no PRI information given by the flash * Add a fixup to disable DQ5 polling for the SST 39VF3201C Change-Id: Ib08cf20547d0f500d5f78241521e6b49050c3d40 Signed-off-by: IS2T development team <dev.is2t@gmail.com> Reviewed-on: http://openocd.zylin.com/1449 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-06-05update files to correct FSF addressSpencer Oliver
Change-Id: I429f7fd51f77b0e7c86d7a7f110ca31afd76c173 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1426 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2013-02-02armv7m: use ARM_MODE_THREAD core mode for algoorithm'sSpencer Oliver
This makes sure we are using privileged mode when executing any loaders. Change-Id: I18bf32ec92e1c76a66ab25e3712652bc3650b332 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1108 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2013-02-02armv7m: use generic arm::core_modeSpencer Oliver
To simplify things change over to using the generic core_mode struct rather than maintaining a armv7m specific one. Change-Id: Ibf32b785d896fef4f33307fabe0d8eb266f7086f Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/966 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2012-10-12cfi: remove typos and code cleanupSpencer Oliver
No change to code, just fix some formatting issues. Change-Id: I177430a99bfecbf90a1ddf623321c29d4db516b0 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/906 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-10-08flash/nor: make all working area pointers localAndreas Fritiofson
Working area pointers shouldn't be re-used, so there's no point in storing them in the flash bank struct. Make all such pointers local. Change-Id: Iab65b4e8b475fed7fc72fb8928f54590fa69d260 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/865 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-08-24cfi: fix type-punning warnings in cfi_spansion_write_blockAndreas Fritiofson
Retest the condition when needed, instead of abusing the common_magic field as a flag. There are only two options here. Either it's an armv7m or it's another arm. is_arm(...) will return true even for armv7m, so it's imperative to check in the right order. Change-Id: Ic227f19f7babf1b0b0fe075f9a3abc4eabc7d5f1 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/779 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-05-14cfi: fix write_bank segfault with spansion flash on armv7mAurelien Jacobs
cfi_spansion_write_block() passes an arm_algorithm struct to target_run_algorithm() which in turn calls armv7m_start_algorithm() which expect an armv7m_algorithm struct. As armv7m_algorithm is bigger than arm_algorithm, when armv7m_start_algorithm() writes in the struct, it overrun the buffer, writting junk on the stack, which latter on generates a segfault. This patch ensure we use a properly sized armv7m_algorithm struct when the target is an armv7m. Change-Id: I4ab67c15ae4bb72454414a81b92a4231dcdb2239 Signed-off-by: Aurelien Jacobs <aurel@gnuage.org> Reviewed-on: http://openocd.zylin.com/623 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-05-14cfi: fix cfi arch check regressionSpencer Oliver
seems 9933fa334de551096674d4044ed7ac2152213e8b introduce a regression if the target was anything other than armv4_5 or armv7m. Just check that we have an arm target. Change-Id: I67c05138e5be2952ee92e9bfa15e1d050844462a Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/615 Tested-by: jenkins Reviewed-by: Aurelien Jacobs <aurel@gnuage.org>
2012-05-14cfi: check supported archSpencer Oliver
check that the cfi driver supports the current target arch. Change-Id: I8a95908684de67bf1657d1956f2573662a641cc1 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/614 Tested-by: jenkins Reviewed-by: Aurelien Jacobs <aurel@gnuage.org>
2012-05-14build: use generic name for arm_algorithm varsSpencer Oliver
This makes the code a bit easier to read as arm_algorithm can refer to other arch's, not just armv4_5. Change-Id: I78c99d40f34cda04e06f2daee75b48ff40a1d23d Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/613 Tested-by: jenkins Reviewed-by: Aurelien Jacobs <aurel@gnuage.org> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-02-06build: cleanup src/flash/nor directorySpencer Oliver
Change-Id: Ic299de969ce566282c055ba4dd8b94892c4c4311 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/420 Tested-by: jenkins
2012-01-04Change return value on error.Mathias K
On wrong parameters a error is signalized to the calling function. Change-Id: I484443fdb39938e20382edc9246d5ec546a5c960 Signed-off-by: Mathias K <kesmtp@freenet.de> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com> Reviewed-on: http://openocd.zylin.com/282 Tested-by: jenkins Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-11-04cfi: fix gaffe in fixing warningsØyvind Harboe
introduced reading garbage value for arm32. Change-Id: Ib5792a8a3207ee4db6d01d354df98c3cfabce037 Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com> Reviewed-on: http://openocd.zylin.com/162 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-10-31cfi: unsupported code paths now report and return errorØyvind Harboe
found by clang, would have done something undefined and mysterious later on. Change-Id: If7d7aca8514575d229ed0b17378bf8b1bbf347c4 Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com> Reviewed-on: http://openocd.zylin.com/133 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-10-23FLASH/CFI: fix clang warningsAntonio Borneo
Total of 5 warnings: 3x "Dead store": removed dead assignment to variable; 1x "Dereference of null pointer": this is not an error, but a limited visibility of clang, since pointer erase_region_info is initialized inside cfi_fixup_non_cfi(); 1x "Branch condition evaluates to a garbage value": this is a real coding bug that could issue SIGSEGV, since "goto cleanup" can be executed before initialization of "source". Change-Id: Id3c323c82bb15cbd3bb8fc04b23541f11145f109 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/84 Tested-by: jenkins Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-08-24non_cfi: add SST39WF1601 supportAndreas Bießmann
Invented by jknick in sparkfun forum: http://forum.sparkfun.com/viewtopic.php?t=19788 Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
2011-08-18cfi: add EN29LV800BB supportGunnar Henne
Posted by telekatz@gmx.de in the bettyhacks forum for openocd 0.4.0 and integrated into 0.5.0 by Gunnar Henne. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-08-09flash/nor/cfi: fix TopBottom for atmel chipsAndreas Bießmann
There are some older atmel nor chips which have negated logic for TopBottom detection. This patch adds a special handling for the old chips. This is the same mechanism as implemented in linux kernel. Signed-off-by: Andreas Bießmann <andreas.devel@gmail.com>
2011-06-05mips: add nor flash write from memory blockStefan Mahr
2011-04-27cfi: leave check on whether target is running to target_write_memory()Øyvind Harboe
there was a check in clearing the status register that called exit() if the target was running. target_write_memory() has such a check and will report the error correctly. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-01-31cfi: use ARM32 machine code on all CPUs but Cortex M3Øyvind Harboe
ARM11 broke with aa61a3b3d8b6acad19050987835ec05f3d298bdb as the code only checked for arm 7/9. CFI probably needs work for non-ARM targets but perhaps not adding working area memory to e.g. MIPS will give the default slow CFI support. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-01-10cfi: fix release build warningsSpencer Oliver
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-01-06cfi: use safer arch detectionSpencer Oliver
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-01-06Add the support for the armv7m arch.Jonathan Dumaresq
Signed-off-by: Jonathan Dumaresq <jdumaresq@cimeq.qc.ca>
2011-01-02cfi_protect is not implemented on Spansion flashes (many do not even have ↵Michael Schwingen
protection bits). Demote from error to warning, so that common board code can use "flash write_image erase unlock" regardless of the flash type. Signed-off-by: Michael Schwingen <michael@schwingen.org>
2011-01-02non-CFI flash code uses data from CFI structures. Make sure that timeouts ↵Michael Schwingen
are filled in on non-CFI flashes, and print CFI information in all cases, nut just on CFI flashes. Signed-off-by: Michael Schwingen <michael@schwingen.org>
2010-12-10contrib: add source to the cfi flash loadersSpencer Oliver
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-12-10cfi: disable buffer writes for M29W128GSpencer Oliver
For some reason buffer writes for the M29W128G do not work reliably, so disable them. See: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=504a3e72208fc6a65924426ff5693982590bccdc Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-12-10cfi: allow optional buffer write supportSpencer Oliver
Some flash's do not support buffer writes, so we now check they are supported before trying to use them. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-12-10cfi: calculate correct timeoutsSpencer Oliver
The existing code used incorrect timeout values for the various cfi operations. We now calculate the timeouts and convert to msecs if necessary. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-12-10cfi: prefix string hex outputSpencer Oliver
Add hex prefix so we know output is not decimal. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-12-10cfi: add time format to cfi query outputSpencer Oliver
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-12-10cfi: whitespace and long line cleanupSpencer Oliver
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-09-15cfi: add sst39vf6401bFlemming Futtrup
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-11cfi: tighten up type usage a bitØyvind Harboe
sizeof() is a bit less scary than seing assumption about size of type, no bug as such. Use NULL instead of 0 for pointers. More obvious that it is a pointer from code inspection. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-03Numonyx M29W160ET patchWookey
Someone called David Carne popped up on IRC and offered a fix (as he's not on this list so can;t post here). I am just passing it on. (thanx David) 10:54 < davidc__> Basically; the Numonyx M29W160ET has an incorrect CFI PRI block; it describes the erase blocks backwards 10:54 < davidc__> the linked patch has a fixup for that part [really trivial]: