summaryrefslogtreecommitdiff
path: root/src/flash/nor
Commit message (Collapse)AuthorAgeFilesLines
* stm32 : change returned value of mass_erase functiongcembed2010-06-031-4/+5
| | | | | | | | | | | | | | Hello, "stm32x mass_erase" return ERROR_OK even if something goes wrong. Here is a summary of changes : * in stm32x_mass_erase : return ERROR_FLASH_OPERATION_FAILED when error detected in FLASH_SR register; * in COMMAND_HANDLER(stm32x_handle_mass_erase_command) : return the returned value of stm32x_mass_erase(). I don't know if there is reason to always return ERROR_OK ? Gaëtan
* nor: fix memory leaks during probeSpencer Oliver2010-05-295-0/+30
| | | | | | | Fix similar memory leaks as per commit: ef72484b785ec7462a0415afea679d08b864c7fb Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* flash: virtual driver update for get_flash_bank_by_name_noprobeSpencer Oliver2010-05-261-2/+2
| | | | | | Make sure we do not probe a flash when getting info. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* nor: add get_flash_bank_by_name autoprobeSpencer Oliver2010-05-263-4/+32
| | | | | | | | | | | 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>
* flash: add virtual flash bank driverSpencer Oliver2010-05-263-1/+248
| | | | | | | | | | | | | This adds a virtual flash bank driver that allows virtual banks to be defined that refer to an existing flash bank. For example the real address for bank0 on the pic32 is 0x1fc00000 but the user program will either be in kseg0 (0xbfc00000) or kseg1 (0x9fc00000). This also means that gdb will be aware of all the read only flash addresses. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* NOR/CFI: fix memory leak; check malloc return valueAntonio Borneo2010-05-261-3/+48
| | | | | | | | | | | Every time command "flash probe #" is executed, memory structures are re-allocated without preventive free() of former areas, causing memory leak. Also, memory allocation does not check return value, determining segmentation fault in case of out of memory. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* Change kb/s to KiB/s in messages about kibibytesJon Povey2010-05-161-4/+4
| | | | | | | 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>
* NOR/CFI: minor code cleanupAntonio Borneo2010-05-161-8/+0
| | | | | | | Remove few LOG_DEBUG() messages, together with code and variables required to build such messages. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* NOR/CFI: add cfi_read() implementationAntonio Borneo2010-05-161-2/+72
| | | | | | | | | | Final step to force bus_width size during CFI flash read. Added CFI specific implementation cfi_read() that uses only accesses at bus_width size. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* NOR: add read() callback to struct flash_driverAntonio Borneo2010-05-1623-1/+72
| | | | | | | | | | | | | | 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>
* NOR/TCL: fix typo in error messageAntonio Borneo2010-05-161-1/+1
| | | | Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* NOR: fix comment for DoxygenAntonio Borneo2010-05-161-2/+3
| | | | | | Either bus_width and chip_width are in bytes. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* NOR/CFI: remove use of cfi_add_byte()Antonio Borneo2010-05-161-40/+1
| | | | | | | Remove the function cfi_add_byte() and rewrite the only instance of it. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* NOR/CFI: use bus_width for memory access in cfi_write()Antonio Borneo2010-05-161-54/+15
| | | | | | | | | | | | | | During cfi_write(), head and tail of destination area could be not aligned to bus_width. Since write operation must be at bus_width size, source buffer size is extended and buffer padded with current values read from flash. Force using bus_width to read current value from flash. Do not use cfi_add_byte() anymore, to allow removing this function later on. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* NOR/CFI: use bus_width for memory access on flash ID.Antonio Borneo2010-05-161-25/+22
| | | | | | | | | | NOR flash structure requires each access to be bus_width wide. Fix read of flash ID accordingly to rule above. Add case (chip_width == 4), allowed by CFI spec and coherent with current value of CFI_MAX_CHIP_WIDTH but currently not used by any target. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* NOR/CFI: identify memory accesses not using "bus_width".Antonio Borneo2010-05-161-0/+8
| | | | | | | | | | | | | | | | | | | | Since NOR flash devices does not handle "byte enable lanes", each read/write access involves the whole "chip_width". When multiple devices are in parallel, usually all chips are enabled during each access. All such cases are compatible with flash accesses at "bus_width" size. Access at "bus_width" size is mandatory for write access to avoid transferring of garbage values to flash. During read access the flash controller should take care, and discard unneeded bytes. Anyway, it is good practice to use "bus_width" size also for read. Every memory access that does not respect "bus_width" size is marked with a "FIXME" comment. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* NOR/CFI: simplify bufferwsize computationAntonio Borneo2010-05-161-39/+10
| | | | | | | | | | | | | | | | | | | | | | | | | Review and simplify computation of bufferwsize. Add comments about variables' meaning. The same code is present 3 times in the file. Current patch updates all the 3 instances. Step 1) Replace "switch(bank->chip_width) {...}". Illegal values of bank->chip_width are already dropped. For legal values, the code is equivalent to: bufferwsize = buffersize / bank->chip_width; Step 2) The above code replacement plus the following line: bufferwsize /= (bank->bus_width / bank->chip_width); is merged in a single formula: bufferwsize = (buffersize / bank->chip_width) / (bank->bus_width / bank->chip_width); and simplified as: bufferwsize = buffersize / bank->bus_width; Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* NOR/CFI: check "flash bank" command argumentsAntonio Borneo2010-05-161-1/+11
| | | | | | | | | | | | | | | | | | Arguments chip_width and bus_width of command "flash bank" are not fully checked. While bus_width is later on redundantly checked in several other parts (e.g. in cfi_command_val()) and generates run-time error, chip_width is never checked, nor related to actual bus_width value. Added check to avoid: - (chip_width == 0), that would mean no memory chip at all, avoiding also division by zero e.g. in cfi_get_u8(); - (bus_width == 0), that would mean no bus at all; - unsupported cases of chip_width or bus_width value not power of 2; - unsupported case of chip width wider than bus. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* flash: require unique flash bank nameSpencer Oliver2010-05-131-0/+8
| | | | | | Make sure the flash bank name is unique Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* flash: add flash bank name supportSpencer Oliver2010-05-131-24/+21
| | | | | | | | | 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>
* Fujitsu MBM29SL800TE flash supportKarl Kurbjun2010-05-112-0/+18
| | | | | | | | | | | | | | | | | Hi, This is my first post to the list. First, I would like to thank everyone for their work on OpenOCD, it is a great tool to work with. I have been using it to debug code on hardware for the Rockbox project (www.rockbox.org). The target that I primarily work with has a Spansion/Fujitsu NOR flash (MBM29SL800TE). I attached a patch that adds support for this flash. I hope it can be included in the main repository. If there is something that needs to be changed with the patch before inclusion please let me know. -Karl Kurbjun
* cfi: add Numonyx M29W128G reset workaroundSpencer Oliver2010-05-101-32/+35
| | | | | | | | The ST/Numonix M29W128G has an issue when a 0xff cmd is sent, it cause an internal undefined state. The workaround according to the Numonyx is to send another 0xf0 reset cmd Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* flash: stop caching protection stateØyvind Harboe2010-05-054-126/+31
| | | | | | | | | | | | | | 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>
* flash: erase_address now has an unlock optionØyvind Harboe2010-05-053-15/+37
| | | | | | | 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>
* cfi: fix error handling for protect fnØyvind Harboe2010-05-051-4/+4
| | | | | | No error was propagated. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* gdb: connect will now fail if flash autoprobe failsØyvind Harboe2010-05-053-21/+21
| | | | | | | | | | | | 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>
* flash: more flash write_image bugfixesØyvind Harboe2010-05-051-21/+11
| | | | | | | | | Remove/fix lots of bugs in handling of non-contigious sections and out of order sections. Fix a gaffe introduced in previous commit to src/flash/nor/core.c Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* str7x: improve error handlingØyvind Harboe2010-05-051-73/+133
| | | | | | clean up error handling a bit. No change in behavior. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* str71x: fix previous commitSpencer Oliver2010-05-041-3/+4
| | | | | | fix build issue with 70226c221f5879bb6126ff3f2ec9ae64c68d80d6 commit Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* flash: less bogus errorsØyvind Harboe2010-05-047-8/+8
| | | | | | | Removed bogus errors when trying to allocate a large a target memory buffer as possible. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* str7x: fix bogus error messagesØyvind Harboe2010-05-041-3/+5
| | | | | | | | Remove bogus error messages when trying to allocate a large chunk of target memory and then falling back to a smaller one. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* cfi: made som info output debug outputØyvind Harboe2010-05-041-2/+2
| | | | | | | E.g. how much target memory that is used during flashing is debug info. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* STM32 flash erase timeout fixTobias Ringström2010-05-031-2/+2
| | | | | | | | | | | | | | | The current timeout for STM32 flash block erase and flash mass erase is 10 (ms), which is too tight, and fails around 50% of the time for me. The data sheet for STM32F107VC specifies a maximum erase time of 40 ms (for both operations). I'd also consider it a bug that the code does not detect a timeout, but just assumes that the operation has completed. The attached patch does not address this bug. The attached patch increases the timeouts from 10 to 100 ms. Please apply. /Tobias
* flash: write_image would fail for certain imagesØyvind Harboe2010-04-291-14/+55
| | | | | | | | | | | Fix a bug where write_image would fail if the sections in the image were not in ascending order. This has previously been fixed in gdb load. Solved by sorting the image sections before running flash write_image erase unlock foo.elf. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* flash: write_image will now pad erase to nearest sectorØyvind Harboe2010-04-291-8/+2
| | | | | | | | | | this is done for unlocking and it is a simple omission that it wasn't done for sectors. The unnerving thing is that nobody has complained about this until now.... Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* nor: remove bogus output about padding sectionsØyvind Harboe2010-04-281-1/+2
| | | | | | | padding of 0 bytes is actually no padding, do not output warning about padding in that case. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* stm32x: allow flash probe on a running targetAndreas Fritiofson2010-04-201-6/+0
| | | | | | | | | | | | | | | If the flash has not yet been probed and GDB connects while the target is running, the flash probe triggered by GDB's memory map read will fail. In that case the returned memory map will be empty, causing a subsequent load from within GDB to fail. There's not much you can do from GDB to recover, other than a restart; a 'mon reset init' and manual 'mon flash probe' won't help since GDB has already made up its mind about the memory map. It seems there's no reason to require the target to be halted when probing the flash. Remove the check to let a valid memory map be provided to GDB even when connecting to a running target. Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
* NOR/core bugfix: restore invariantsDavid Brownell2010-04-151-5/+16
| | | | | | | | | | | | | | | | The The patch labeled "CFI CORE: bug-fix protect single sector" was merged rged without some requested bugfixes. Most significantly it broke invariants in the code, invalidating descriptions and changing the calling convention for underlying drivers. (It (Also wasn't CFI-specific...) Fix that, and Include an update from Antonio Borneo for the degenerate "nothing to do" case, (although that's still in the wrong location. which is presumably why that is it was working in some cases but not all.) src/flash/nor/core.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* NOR/CFI: remove redundant codeAntonio Borneo2010-04-151-6/+2
| | | | | | | | Arguments for "flash bank" command are already parsed and put in "bank" struct. Removed code to parse them again. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* NOR/CFI: fix order of arguments checkAntonio Borneo2010-04-151-2/+2
| | | | | | | | | | | | Syntax of "flash bank" command requires: - chip_width as CMD_ARGV[3] - bus_width as CMD_ARGV[4] Actual code swaps the arguments. Bug has no run time impact since wrong variables are only used to check value and both are checked against same constraint. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* NOR/TMS470: review scope of symbolsAntonio Borneo2010-04-111-7/+7
| | | | | | Add "static" qualifier to private functions and data. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* NOR/CFI: review scope of functionsAntonio Borneo2010-04-101-3/+3
| | | | | | Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* NOR/STR7X: review scope of dataAntonio Borneo2010-04-101-2/+2
| | | | | | Add "static" qualifier to private data. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* NOR/ADUC702X: review scope of dataAntonio Borneo2010-04-101-1/+1
| | | | | | Add "static" qualifier to private data. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* NOR/AVRF: review scope of dataAntonio Borneo2010-04-101-1/+1
| | | | | | Add "static" qualifier to private data. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* NOR/CORE: review scope of dataAntonio Borneo2010-04-101-1/+1
| | | | | | Add "static" qualifier to private data. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* NOR/DRIVERS: review scope of functionsAntonio Borneo2010-04-101-1/+1
| | | | | | | Add "static" qualifier to private functions. Remove unused "extern" in src/ecosboard.c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* STR9XPEC: review scope of functionsAntonio Borneo2010-04-101-1/+1
| | | | | | Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* TCL: review scope of functionsAntonio Borneo2010-04-102-3/+1
| | | | | | Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* NOR TCL: fix usage messageAntonio Borneo2010-03-261-1/+1
| | | | | | | | 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>