aboutsummaryrefslogtreecommitdiff
path: root/src/flash/nor/tcl.c
AgeCommit message (Collapse)Author
2014-09-22flash/nor/tcl.c: Do not double probe banksAndrey Smirnov
Previous to this version the code of handle_flash_probe_command would probe a bank twice: first time by auto-probe through a call to flash_command_get_bank and second time by calling the probe function directly. This change adds a flash_command_get_bank_maybe_probe wich is a more generic version of the flash_command_get_bank, that would allow commands to decide whether auto-probing should be performed or not. Change-Id: If150ca9c169ffe05e8c7eba36338d333360811e3 Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Reviewed-on: http://openocd.zylin.com/2093 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-06-22flash/nor/tcl.c: fix formatting in "rejected" error messagePaul Fertser
The error message (with the usage field unpopulated) looks like this, obviously missing at least a space before Usage: Error: 'fm3' driver rejected flash bank at 0x00000000Usage (null) Change-Id: I2a625676e784d02942823f972a201f7f4f810c68 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2161 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-29flash/nor/tcl: fix segfault on write_image misusePaul Fertser
"flash write_image (unlock|erase)" (without filename) was causing segmentation fault in strcmp(). This patch fixes it. Change-Id: Ia3b8c796f4107621d78605c02d2b8e123b1b207b Reported-by: ajkroll][ <ajkroll][@irc.freenode.net> Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/1970 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-10-07flash: add padded_value cmdSpencer Oliver
This adds support for setting the default value used when padding image sections. Previously 0xff was used but some targets have an erased value of 0x00. Change-Id: If3df6fea3abf95b09daa3ff7be362acf991070ce Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1635 Tested-by: jenkins
2013-10-03flash/nor: Make info function optionalAndreas Fritiofson
Remove lots of no-op or dummy info function implementations and check if it's implemented before invoking it. Change-Id: I2144dad6a84a80359bb13a8a29a4614387e4c135 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1642 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>
2012-08-24tcl: fix potential memory leaksSpencer Oliver
Reorder to allocate all memory after COMMAND_PARSE_NUMBER call. This removes a clang warning about un-released memory Change-Id: I8dbeb664a6467077157015bd879bc0aefc5e8614 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/776 Tested-by: jenkins 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-23flash: print bank usage on failureSpencer Oliver
This makes use of the newly introduced usage field in the flash bank structure. Also remove the assertion if usage field is null and lets print a DEBUG_LOG message instead. Change-Id: I384bf0e2c444fcc99deef73aec9ef01149a91c76 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/391 Tested-by: jenkins
2012-01-04retire ERROR_INVALID_ARGUMENTS and replace with ERROR_COMMAND_SYNTAX_ERRORØyvind Harboe
Change-Id: I6dee51e1fab1944085391f274a343cdb9014c7a4 Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com> Reviewed-on: http://openocd.zylin.com/300 Tested-by: jenkins Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-08-09fix return error msjRodrigo L. Rosa
retval was not correctly propagated
2011-01-03error handling: the error number is not part of the user interfaceØyvind Harboe
Do not propagate error number to user. This is for internal programming purposes only. Error messages to the user is reported as text via LOG_ERROR(). Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-12-23flash: print flash bank name on flash info cmdSpencer Oliver
The flash bank name is a required element in adding flash banks, however other than looking at the config file there is no way of getting the name used in openocd. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-09-29fileio: fileio_size() can now failØyvind Harboe
Part of making the fileio API more robust. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-29fileio: refactor struct fileio to be an opaque structureØyvind Harboe
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-21flash: fix error handlingØyvind Harboe
sensible error must be reported at failure site Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-15flash: -Wshadow warning fixØyvind Harboe
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-14flash: fix bug in error propagation of flash write_imageØyvind Harboe
when a write/unlock/erase failed during write_image, then an error was not propagated back up so e.g. flash write image from tcl scripts would not throw an exception. Also flash filling speed was printed even when the operation failed. Output is now less confusing. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-11flash: add error handling to get_flash_by_addr/nameØyvind Harboe
autoprobing can fail and this error has to be reported up the call stack. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-09flash: flash erase_address takes unsigned argumentsØyvind Harboe
fixed bug where address was parsed as a signed, rather than unsigned it. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-05-26nor: add get_flash_bank_by_name autoprobeSpencer Oliver
When a flash cmd is called using the flash name the autoprobe function is not called. autoprobe is called if flash_command_get_bank falls through to get_flash_bank_by_num. This makes both get_flash_bank_by_name and get_flash_bank_by_num behave the same. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-05-16Change kb/s to KiB/s in messages about kibibytesJon Povey
Change download rate messages about kibibytes from "kb/s" to "KiB/s" units. See: http://en.wikipedia.org/wiki/Data_rate_units Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
2010-05-16NOR: add read() callback to struct flash_driverAntonio Borneo
Final target is to force bus_width size during CFI flash read. In this first step I need to replace default flash read with flash specific implementation. This patch introduces: - flash_driver_read() layer; - default_flash_read(), backward compatible; - read() callback in struct flash_driver; - proper initialization in every flash_driver instance. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-05-16NOR/TCL: fix typo in error messageAntonio Borneo
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-05-13flash: require unique flash bank nameSpencer Oliver
Make sure the flash bank name is unique Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-05-13flash: add flash bank name supportSpencer Oliver
flash cmds can now be passed either the bank name or the bank number. For example. flash info stm32.flash flash info 0 Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-05-05flash: stop caching protection stateØyvind Harboe
There are a million reasons why cached protection state might be stale: power cycling of target, reset, code executing on the target, etc. The "flash protect_check" command is now gone. This is *always* executed when running a "flash info". As a bonus for more a more robust approach, lots of code could be deleted. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-05-05flash: erase_address now has an unlock optionØyvind Harboe
Quite useful to be able to unlock the flash, just like in the flash write_image cmd. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-05-05gdb: connect will now fail if flash autoprobe failsØyvind Harboe
This stops GDB from launching with an empty memory map, making gdb load w/flashing fail for no obvious reason. The error message points in the direction of the gdb-attach event that can be set up to issue a halt or "reset init" which will put GDB in a well defined stated upon attach and thus have a robust flash autoprobe. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-04-10TCL: review scope of functionsAntonio Borneo
Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-03-26NOR TCL: fix usage messageAntonio Borneo
The command "flash bank" has updated syntax. Add the mandatory parameter <target> to the usage message that prints in case of error. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.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-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-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>
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-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-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>
2009-12-16NOR: bugfix "flash fill[bwh] ..." helptextDavid Brownell
These commands don't have a "bank" parameter. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-11fix 'write_image' usage informationZachary T Welch
The 'flash write_image' command erroneously listed the bank number, when it actually uses target addresses to do that lookup for the user.
2009-12-06add 'flash list', rewrite 'flash banks'Zachary T Welch
Rename the existing 'flash banks' implementation as 'flash list', and replace the broken 'flash_banks' TCL wrapper with a new command handler. Adds documentation for the new 'flash list' command in the user guide.
2009-12-06fix NOR flash regressionZachary T Welch
When factoring the bank setup command into flash_bank_add(), I forgot to include a call to the new helper.
2009-12-04move more nor flash implementation detailsZachary T Welch
Splits the exec mode commands out of flash.c into the flash/nor/ files. The routines used by these high-level commands are moved into nor/core.c, with their internal declarations placed in nor/imp.h. Fixes distribution of <flash/nor/core.h> header.
2009-12-04add flash/nor/core.[ch]Zachary T Welch
The newly moved flash TCL routines access the internals of the module too much. Fix the layering issues by adding new core NOR flash APIs: <flash/nor/core.h>: - flash_driver_find_by_name() - self-descriptive <flash/nor/imp.h>: - flash_bank_add() - encapsulates adding banks to bank list - flash_bank_list() - encapsulates retreiving bank list This allows the externs in flash/nor/imp.h to be removed, and these mechanisms may now be re-used by other flash module code.
2009-12-04add flash/nor/{tcl.c,imp.h} from flash/flash.cZachary T Welch
Moves the top-level 'flash' command handlers into flash/nor/tcl.c, with flash/nor/imp.h providing an internal implementation header to share non-public API components.