Commit Graph

447 Commits

Author SHA1 Message Date
Øyvind Harboe
955316a727 fix warning: remove assigned to variable
variable is subsequently not used

Change-Id: I177d21c6ba9f1f2e3765feffdbf317ea375a8cfe
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/149
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-11-02 09:44:08 +00:00
Spencer Oliver
889a306fc8 flash: add Stellaris Blizzard class
Change-Id: I83f0d6edf3ab31d9fa86682f20cec77dc47ba2f6
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/146
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2011-11-01 19:45:33 +00:00
Øyvind Harboe
9933fa334d cfi: unsupported code paths now report and return error
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-31 20:41:18 +00:00
Jonathan Dumaresq
af51c69fbc Fixes comment typo for page size
Change-Id: I6dd8aadcecd680c48e696aeec0daf74d2addbb05
Signed-off-by: Jonathan Dumaresq <jdumaresq@cimeq.qc.ca>
Reviewed-on: http://openocd.zylin.com/132
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
2011-10-28 15:24:50 +00:00
Antonio Borneo
40c425e400 NOR/CORE: fix clang warning
The fix is inline with the Linux coding style that forbids
assignment in if condition

Change-Id: I10338a249bcfeff87d8596f7e17f209e26b41678
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/86
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-10-23 14:37:48 +00:00
Antonio Borneo
3432049276 FLASH/CFI: fix clang warnings
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-10-23 14:16:45 +00:00
Øyvind Harboe
dad3850264 fm3: fix warning for superfluous assignment
Change-Id: I4f8e8c2e676a2728ddc6227daf9ca6a7ceb3d505
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/46
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-10-23 13:29:09 +00:00
Øyvind Harboe
d5b5f9f4fd kinetis: fix warning about malloc(0) w/assert
Change-Id: Ib40204675bfc5429c744f9ed7e2f7098384b753d
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/47
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-10-23 13:26:53 +00:00
Edgar Grimberg
0577ba8331 tms470: removed unnecessary operations
This should silence a warning.

Change-Id: Id91a9ebacae836083b1db2654a8e7bf24b2300e9
Signed-off-by: Edgar Grimberg <edgar.grimberg@gmail.com>
Reviewed-on: http://openocd.zylin.com/52
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-10-23 11:34:05 +00:00
Antonio Borneo
811f7d3f7e FLASH/STMSMI: fix clang "dead store" warning
Change-Id: Icfdefdc48432db2057d3fea19dc424571d2385eb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/50
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-10-22 11:45:29 +00:00
Marc Willam / Holger Wech
9ddb94c1f3 Updated fm3.c, added Flash type 2 support, error handling improved
Change-Id: I684aca11c4554290d0e57c6d3318d8082980c1ef
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
Reviewed-on: http://openocd.zylin.com/10
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-10-19 11:05:27 +00:00
Spencer Oliver
0dac042a10 luminary: add new targets
update target support from latest SW-DRL 8049

Change-Id: I40aba4d30fe2b79fd955f466c64d99a1dfd63ecf
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/31
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
Tested-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-10-18 06:36:11 +00:00
Attila Kinali
2f6bdac60a Add the SAM3N familly to the chip_details table
Change-Id: Ic122d324eacf6e667ed6008ebb84708be944222c
Signed-off-by: Attila Kinali <attila@kinali.ch>
Reviewed-on: http://openocd.zylin.com/29
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
Tested-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-10-17 17:40:25 +00:00
Spencer Oliver
8c3c5e53e3 flash: fix lpc2000 driver typo
Change-Id: I3a759ed98a27fd186c12355b846d5e97dba86c5b
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-10-14 14:18:56 +02:00
Andreas Fritiofson
92b14f8ca9 stm32f1x: use async algorithm in flash programming routine
Let the target algorithm be running in the background and buffer data
continuously through a FIFO. This reduces or removes the effect of latency
because only a very small number of queue executions needs to be done per
buffer fill. Previously, the many repeated target state changes, register
accesses (really inefficient) and algorithm uploads caused the flash
programming to be latency bound in many cases. Now it should scale better
with increased throughput.

Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2011-10-09 00:00:53 +02:00
Andreas Fritiofson
a147563ac1 stm32f1x: use register base instead of register offset
Access the different flash banks' registers using a bank specific register
base and a register specific offset. This is equivalent but feels more
natural.

Some accesses were discovered that maybe should not be hard coded to bank0
registers. Add a note about that.

Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2011-10-09 00:00:52 +02:00
Clément Burin des Roziers
da8ce5f2e1 STM32L: Added flash driver and target
Added the flash driver for the STM32L family, which highly differ from the STM32F family.
Added the TCL target file for JTAG access.
2011-10-03 18:42:39 +02:00
Mathias K
bfe634aa91 kinetis cpu flash driver
Initial release of the freescale kinetis cpu flash driver.
2011-09-17 14:20:37 +02:00
Rodrigo L. Rosa
e1a2d7255e optional crc for flash writing
crc check was always performed on newly flashed data, now it is optional
flash mem can be locked by writing a specific word to a specific address in flash.
to verify flash, target must be halted, and this will (when the new halt sequence is implemented) require reseting the chip. if the target is reset after writing the lock words, then it will lock, hence the CRC will fail because it is not possible to read stuff from the target.

also added a function that resets the jtag state machine.
this is not used yet, but will be soon.
it is implemented to allow strict control over JTAG state machine, necessary to implement to halt and unlocking sequences.
2011-08-30 15:09:34 -07:00
Jonathan Dumaresq
62eec47ff1 This will add the Value Line HD of stm32 devices.
This has been tested on STM32F100VE
2011-08-25 20:13:16 +02:00
Andreas Bießmann
b2ff00fb86 non_cfi: add SST39WF1601 support
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-24 11:12:53 +02:00
olivier Schonken
8292b1b5cd Fix Sam3u flash bank 1 issue 2011-08-21 19:37:20 +02:00
Gunnar Henne
0d5a38d829 cfi: add EN29LV800BB support
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-18 09:55:44 +01:00
Rodrigo L. Rosa
d1a16ce9d6 fix return error msj
retval was not correctly propagated
2011-08-09 20:55:26 +02:00
Andreas Bießmann
6e5c37be29 flash/nor/cfi: fix TopBottom for atmel chips
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-08-09 20:19:37 +02:00
Øyvind Harboe
7d2bf8805d Revert "dsp5680xx: disable for now, it generates warnings"
This reverts commit d567df02b9.
2011-08-09 20:15:21 +02:00
Spencer Oliver
b066a7db24 flash: update stm32 driver names
Use consistent names for the stm32 family flash drivers, eg.
stm32x -> stm32f1x
stm32f2xxx -> stm32f2x

this makes it easier to add support for newer stm32 families.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-07-28 11:42:27 +01:00
Ronny Strutz
e872d2880e add Fujitsu FM3 Family flash support
Signed-off-by: Ronny Strutz <ronny@ewoks.de>
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-07-26 21:15:34 +01:00
Luca Bruno
898dd3af46 Fix typo in command output
Fix a bunch of minor typo in user facing output.

Signed-off-by: Luca Bruno <lucab@debian.org>
2011-07-10 17:00:57 +02:00
Øyvind Harboe
d567df02b9 dsp5680xx: disable for now, it generates warnings
Use "git revert <commit>" to revert this commit, then build and
repair and post patch to the mailing list.

Warnings generated with:

nios2-elf-gcc (GCC) 3.4.6 (Altera Nios II 9.1 b222)

openocd/src/target/dsp5680xx.c: In function 'eonce_rx_upper_data':
openocd/src/target/dsp5680xx.c:252: warning: cast increases required
alignment of target type
openocd/src/target/dsp5680xx.c: In function 'eonce_rx_lower_data':
openocd/src/target/dsp5680xx.c:268: warning: cast increases required
alignment of target type
openocd/src/target/dsp5680xx.c: In function 'eonce_pc_store':
openocd/src/target/dsp5680xx.c:508: warning: dereferencing type-punned
pointer will break strict-aliasing rules
openocd/src/target/dsp5680xx.c: In function 'dsp5680xx_read':
openocd/src/target/dsp5680xx.c:736: warning: cast increases required
alignment of target type
openocd/src/target/dsp5680xx.c:737: warning: cast increases required
alignment of target type
openocd/src/target/dsp5680xx.c: In function 'dsp5680xx_write_8':
openocd/src/target/dsp5680xx.c:823: warning: cast increases required
alignment of target type
openocd/src/target/dsp5680xx.c: In function 'dsp5680xx_write':
openocd/src/target/dsp5680xx.c:938: warning: cast increases required
alignment of target type
openocd/src/target/dsp5680xx.c:941: warning: cast increases required
alignment of target type
openocd/src/target/dsp5680xx.c: In function 'dsp5680xx_f_wr':
openocd/src/target/dsp5680xx.c:1355: warning: cast increases required
alignment of target type
2011-06-28 18:39:01 +02:00
Rodrigo L. Rosa
d343941386 doxy & cleanup 2011-06-12 11:18:27 +02:00
Rodrigo L. Rosa
cbe201fe6b fix protection behavior 2011-06-12 11:18:27 +02:00
Rodrigo L. Rosa
7b0ead520d cleanup trailing whitespaces 2011-06-12 11:18:27 +02:00
Rodrigo L. Rosa
f4a3db0d4a fix flash driver size, sector erase 2011-06-12 11:18:27 +02:00
Stefan Mahr
5d9b7cdd2b mips: add nor flash write from memory block 2011-06-05 22:45:21 +02:00
Freddie Chopin
f6315d5e5b Fix "unused variable" warnings (errors) detected with GCC 4.7.0 - trivial fixes 2011-06-04 09:35:13 +02:00
Stefan Mahr
6d6837f988 add support for spansion flash on mindspeed c300 eval board
Signed-off-by: Stefan Mahr <stefan.mahr@sphairon.com>
2011-05-25 22:02:40 +02:00
Rodrigo L. Rosa
ef599aebfd flashing speed improved using queued jtag. error propagation improved. 2011-05-19 07:27:02 +02:00
Rodrigo L. Rosa
129f099ef1 flash support (only full erase/write) for 568013 and 568037 2011-05-18 18:47:55 +02:00
Øyvind Harboe
36d60ee6c8 cfi: leave check on whether target is running to target_write_memory()
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-04-27 23:02:28 +02:00
SimonQian
5bd1f0bad4 add STM32F2 revY 2011-04-26 12:05:07 +02:00
SimonQian
2e88162b00 remove read of flash_size in STM32F2 2011-04-26 12:04:57 +02:00
Alexandre Pereira da Silva
32ede8fa21 Fix non cfi x16 nor flash connected to x8 bus. The ids in the table should be masked before comparison. 2011-04-19 12:53:05 +02:00
Spencer Oliver
f9feeacb7f pic32: update pic32mx flash driver
Update devices as per the latest programming manual.

We now use the full DEVID to identify the target. Previously we used
a 8bit id but that has now been changed in the manual.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-04-14 09:17:17 +01:00
Øyvind Harboe
378567da4e mips: illustrates how to improve performance
Do not require unecessary roundtrips for clocking out
data.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-04-01 08:59:11 +02:00
Olivier Schonken
ac6f8f9616 at91sam3: Modified cidr comparisson to ignore version bits
production processor versions increment, thus the version
bits should be ignored for future proofing. e.g.
Engineering sample version == 0x00, production version 0x01
2011-03-30 16:01:00 +02:00
Uwe Hermann
33a17fd359 Fix a bunch of typos.
Fix a bunch of typos.

Most are in code comments, so nothing should break. UNKOWN_COMMAND and
CMD_UNKOWN are not used elsewhere, so correcting the spelling should
also not break anything.
2011-03-17 07:25:25 +01:00
Øyvind Harboe
5ca7cbe2d2 stm32x: add support for STM32F20x
ready for wider testing and comments on basic erase + programming.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-02-04 10:55:43 +01:00
Øyvind Harboe
a0858bfed0 cfi: use ARM32 machine code on all CPUs but Cortex M3
ARM11 broke with aa61a3b3d8
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-31 10:30:48 +01:00
Thomas Schmid
4df93cb95f Fixed small mistakes in at91sam3 info command
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-01-26 12:38:27 +00:00
Eric Wetzel
a727418184 stellaris: automatically generate and update device IDs
Added a Perl script to contrib that uses the header files in StellarisWare complete Firmware Development Package provided by TI/Luminary to generate a new list of device IDs

Used Perl script and revision 6734 of TI/Luminary StellarisWare to update device IDs
2011-01-19 08:41:03 +01:00
Erik Botö
4749a40821 Flash driver for em357
Hi,

I took the stm32x NOR flash driver and adapted it for the Ember EM357
chip. This chip is very similar to em351 and stm32w so the driver
should be easily extended to support those as well if anyone can get
their hands on some of those for testing.

changelog:
Added NOR flash driver em357

Best regards,
Erik Botö
2011-01-14 14:56:46 +01:00
Santeri Salko
5b1efd0176 str9xpec: Find flash controller from the chain.
Find the flash controller by position since it is before the core,
not after it.

This fixes the problem that str9xpec enable_turbo (or any other
str9xpec command) did not work. (See my post in
http://forum.sparkfun.com/viewtopic.php?f=18&t=25542)

Signed-off-by: Santeri Salko <santeri.salko@gmail.com>
2011-01-14 14:55:24 +01:00
Spencer Oliver
8684bd1342 cfi: fix release build warnings
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-01-10 09:37:18 +00:00
Eric Wetzel
0535531d27 nit: more LOG_* \n fixes
Remove extra \n from LOG_DEBUG, LOG_INFO, and LOG_WARNING messages

Remove LOG_INFO_N
LOG_INFO_N was only used once and had a \n at the end

Change LOG_USER_N calls that end with \n to LOG_USER
2011-01-09 21:35:23 +01:00
Spencer Oliver
aa61a3b3d8 cfi: use safer arch detection
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-01-06 10:35:59 +00:00
Jonathan Dumaresq
6a1750e961 Add the support for the armv7m arch.
Signed-off-by: Jonathan Dumaresq <jdumaresq@cimeq.qc.ca>
2011-01-06 08:05:02 +01:00
Eric Wetzel
a665ef716a nit: do not add \n at end of LOG_ERROR
Fixed in many other places, and submitted in response to Øyvind's invitation.
2011-01-05 21:46:12 +01:00
Øyvind Harboe
e8eb5bbc04 nit: do not add \n at end of LOG_ERROR
This is done in many other places as well, patch
to fix gratefully accepted!
2011-01-03 13:37:41 +01:00
Øyvind Harboe
c69553cbc5 error handling: the error number is not part of the user interface
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>
2011-01-03 13:33:27 +01:00
Michael Schwingen
09a0a69c09 cfi_protect is not implemented on Spansion flashes (many do not even have 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-02 21:15:27 +01:00
Michael Schwingen
d8ece229f9 non-CFI flash code uses data from CFI structures. Make sure that timeouts 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>
2011-01-02 21:15:08 +01:00
Andrew MacIsaac
50e79d60ce Compilation Warnings on OS X 10.5
I received a number of "-Wshadow" related warnings (treated as errors) while
trying to build on OS X Leopard.  In addition, there were two miscellaneous
other warnings in the flash drivers.  Attached are two patches which correct
these issues and the commit messages to accompany them.

My system has the following configuration (taken from uname -a):

Darwin 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009;
root:xnu-1228.15.4~1/RELEASE_I386 i386

=== Werror_patch.txt Commit Message ===
compilation: fixes for -Wshadow warnings on OS X

These changes fix -Wshadow compilation warnings on OS X 10.5.8

Compiled with the following configure command:

../configure --prefix=/usr/local --enable-maintainer-mode --enable-jlink
--enable-ft2232_libftdi

=== flash_patch.txt Commit Message ===
compilation: fixes for flash driver warnings on OS X

These changes fix two compilation warnings on OS X 10.5.8:

../../../../src/flash/nor/at91sam3.c:2767: warning: redundant redeclaration
of 'at91sam3_flash'
../../../../src/flash/nor/at91sam3.c:101: warning: previous declaration of
'at91sam3_flash' was here

and

../../../../src/flash/nor/stmsmi.c:205: warning: format not a string literal
and no format arguments

Compiled with the following configure command:

../configure --prefix=/usr/local --enable-maintainer-mode --enable-jlink
--enable-ft2232_libftdi
===

Andrew
2010-12-29 22:16:28 +01:00
Øyvind Harboe
eea91f71f9 warning: fix warning where GCC didn't catch a doubly declared global structure
Why hasn't earlier versions of GCC caught this? Bug?

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-12-29 22:14:43 +01:00
Øyvind Harboe
4f9a9b8eba warnings: use more 'const' for char *
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-12-29 22:07:39 +01:00
Spencer Oliver
4994c60083 stm32x : always use valid flash base address
This change matches the previous behaviour of using the known
flash address.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-12-23 13:10:15 +00:00
Spencer Oliver
56d9ee779d flash: print flash bank name on flash info cmd
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-12-23 12:39:22 +00:00
Spencer Oliver
319555cd35 stm32: fix reversed option byte write
This has been a long standing bug that has never been spotted.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-12-23 12:11:17 +00:00
Spencer Oliver
690e054a3d stm32: update option bytes for stm32xl family
add supoort for xl family boot bank option.
The option byte handling will be cleaned up in a later patch.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-12-23 12:11:16 +00:00
Spencer Oliver
3d834bdab7 stm32: add stm32 xl family flash support
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-12-23 12:11:14 +00:00
Spencer Oliver
83e5aaf577 stm32: add dual flash bank support
This patch adds the initial dual flash bank support for devices such
as the stm32xl family.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-12-23 12:11:13 +00:00
Øyvind Harboe
969b1e66dd stm32: fix unprotect
the unprotect fn in stm32 needs to unprotect more sectors
than was requested aligned to some boundary.

Print warning when this happens.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-12-15 09:48:37 +01:00
Øyvind Harboe
39dbb516a4 flash: clarify protect documentation
some chips unprotect more than the range asked for. The
protect fn, must unprotect/protect minimally the range given.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-12-15 09:48:37 +01:00
Spencer Oliver
cbf48bed6a contrib: add source to the cfi flash loaders
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-12-10 19:37:39 +00:00
Spencer Oliver
ae68ddc25e cfi: disable buffer writes for M29W128G
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-10 13:36:09 +00:00
Spencer Oliver
26ba6ea511 cfi: allow optional buffer write support
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-10 13:36:09 +00:00
Spencer Oliver
fe4fe623d5 cfi: calculate correct timeouts
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-10 13:36:08 +00:00
Spencer Oliver
b4ee2864e4 cfi: prefix string hex output
Add hex prefix so we know output is not decimal.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-12-10 13:36:07 +00:00
Spencer Oliver
6165f14ee2 cfi: add time format to cfi query output
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-12-10 13:36:07 +00:00
Spencer Oliver
b3052b614c cfi: whitespace and long line cleanup
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-12-10 13:36:06 +00:00
Rolf Meeser
f2a1b7f3af Fix sector layout for 504-KiB LPC2000 devices 2010-12-04 09:35:33 +01:00
Rolf Meeser
40a93104d5 lpc2900.c: Improve debug output for device probing 2010-12-01 08:48:02 +01:00
Rolf Meeser
71031bcf7f lpc2900.c: Add support for new device LPC2926 2010-12-01 08:47:57 +01:00
Rolf Meeser
1bd87f5dba LPC2900: Avoid false positive reprobing if first probing fails 2010-12-01 08:47:51 +01:00
Antonio Borneo
1892a2b510 FLASH/NOR: Rename spearsmi.c to stmsmi.c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-11-23 08:37:35 +01:00
Antonio Borneo
42082f7c23 FLASH/NOR: rename from spearsmi to stmsmi
STMicroelectronics controller SMI is not SPEAr specific.
Rename it and change name to every symbol in the code.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-11-23 08:37:34 +01:00
Antonio Borneo
4bbdf966d4 STR750: Add SMI interface support
Modified spearsmi driver to include support for STR75x
Added missing initialization in tcl file for STR750

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-11-23 08:37:31 +01:00
Antonio Borneo
e6fc371e2e NOR/SPEARSMI: fix segfault
If flash chip is not listed in the table, or if no flash is
connected, pointer must be properly initialized.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-11-23 08:37:28 +01:00
Øyvind Harboe
8902789f0d flash: iterating over an address range now handles multiple banks
e.g. flash erase_address now works across an address
range that spans multiple flash chips.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-11-22 11:16:40 +01:00
Spencer Oliver
838cd58e24 build: add common.mk
Rather than specifying common makefile variables move
them all to a common.mk.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-11-18 14:05:56 +00:00
Antonio Borneo
ab263fafbb FLASH/NOR: Remove useless file tms470.h
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-11-17 17:02:43 +01:00
Antonio Borneo
29d7031fe3 FLASH/NOR: Remove useless file str9xpec.h
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-11-17 17:02:39 +01:00
Antonio Borneo
7bbd6c7683 FLASH/NOR: Remove useless file str9x.h
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-11-17 17:02:38 +01:00
Antonio Borneo
d16dbaa0fc FLASH/NOR: Remove useless file str7x.h
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-11-17 17:02:36 +01:00
Antonio Borneo
5d09972931 FLASH/NOR: Remove useless file stm32x.h
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-11-17 17:02:35 +01:00
Antonio Borneo
f1f8d9a6c9 FLASH/NOR: Remove useless file stellaris.h
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-11-17 17:02:33 +01:00
Antonio Borneo
f5ae179519 FLASH/NOR: Remove useless file pic32mx.h
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-11-17 17:02:19 +01:00
Antonio Borneo
4cc3597944 FLASH/NOR: Remove useless file lpc288x.h
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-11-17 17:02:07 +01:00
Antonio Borneo
fb7c709804 FLASH/NOR: Remove useless file lpc2000.h
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-11-17 17:02:03 +01:00
Antonio Borneo
28bbe4e983 FLASH/NOR: Remove useless file avrf.h
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-11-17 17:01:59 +01:00
Øyvind Harboe
2b546fdc45 flash: fix bug with multiple back-to-back flash chips
flash programming via flash write_image or gdb load would
produce a bogus error message that the flash chip was to
small.

The solution is to limit the current flash programming
run to the current chip.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-11-17 16:56:28 +01:00
Antonio Borneo
52558354e6 FLASH/NOR: Remove useless file at91sam7.h
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-11-17 08:55:39 +01:00
Antonio Borneo
d213e1a12c FLASH/NOR: Remove useless file at91sam3.h
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-11-17 08:55:35 +01:00
Antonio Borneo
c5414f95b6 FLASH/NOR: Remove useless file spearsmi.h
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-11-17 08:55:31 +01:00
Antonio Borneo
49f42ab51d NOR/SPEARSMI: Add comments about SPI
SMI interface hides the real SPI bus between SPEAr and
external flash.
Added comments to highlight the SPI operation, to help a
future rework in SPI generic and SPEAr specific drivers.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-11-17 08:55:08 +01:00
Antonio Borneo
e7a8de1762 NOR/SPEAr: Add support for Serial NOR
Add support and documentation for STMicroelectronics
SPEAr Serial Memory Interface (SMI).
Code tested on SPEAr3xx only.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-11-16 09:16:11 +01:00
Freddie Chopin
015bf55944 Add comments and tiny improvements to STM32 flash loader algorithm
Add comments to assembly flash loader for STM32. Add tiny improvement in
size of the algorithm (40 vs 48 bytes) and tiny speed improvement (~1.5%,
as time is wasted on waiting for end of operation anyway).

Signed-off-by: Freddie Chopin <freddie_chopin@op.pl>
2010-11-15 09:17:14 +01:00
Øyvind Harboe
fc4e001de3 stm32: return early upon block write failure
only if we do not have enough ram do we continue.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-11-09 08:12:51 +01:00
Øyvind Harboe
6ef3d4ccfe stm32: return error when failing to read
add missing error handling.

Output warning when assuming maximum flash size in the
family when failing to read.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-11-09 08:12:25 +01:00
Øyvind Harboe
49a231f38d stm32: add error propagation on writes
catch problems earlier.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-11-09 08:05:55 +01:00
Øyvind Harboe
e774df7f69 stm32: sharpen error handling for timeouts
delete lots of crud by handling this all in one spot.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-11-09 08:05:55 +01:00
Spencer Oliver
4617cd0f91 src: add loader src description
- add comment where to find the various loaders src files.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-10-28 10:08:16 +01:00
Øyvind Harboe
3931b99d14 fileio: fileio_size() can now fail
Part of making the fileio API more robust.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-29 18:56:07 +02:00
Øyvind Harboe
3a693ef526 fileio: refactor struct fileio to be an opaque structure
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-29 08:43:27 +02:00
Øyvind Harboe
45e5d1d90a flash: fix error handling
memory leaks and missing check on memory allocation.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-27 16:46:13 +02:00
Øyvind Harboe
19167a7af6 image: fix spelling mistake
struct imageection => struct imagesection

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-27 16:29:51 +02:00
Øyvind Harboe
22911a3aed flash: fix error handling
sensible error must be reported at failure site

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-21 22:17:38 +02:00
Øyvind Harboe
9aafd42853 embeddedice: fix error handling
error is now reported at failure site.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-21 22:17:38 +02:00
Øyvind Harboe
f6a3fc818b warnings: fix alignment warnings
These warnings are for architectures that do not
support non-aligned word access.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-20 13:12:35 +02:00
Flemming Futtrup
c14852385f cfi: add sst39vf6401b
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-15 11:35:29 +02:00
Øyvind Harboe
8c21659d2a cfi: random crash in cfi_probe() fixed
for non_cfi cfi chips free() was invoked on rodata.

The mystery is why this bug has survived for so long.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-11 10:37:32 +02:00
Øyvind Harboe
ef92da3315 cfi: tighten up type usage a bit
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-11 10:37:32 +02:00
Wookey
ae80c3564a Numonyx M29W160ET patch
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]:
2010-09-03 22:08:30 +02:00
Spencer Oliver
1ca286557a flash: increase stellaris flash loader buffer
This speeds up programming for targets with more working area,

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-08-31 20:09:25 +01:00
Fredrik Hederstierna
a8c8c238f2 str9x: faster flash erase of entire chip
The patch improves flash erase for STR9x in case of a full bank erase.
Then the chip erase command is used instead which improves speed significantly.

Also I think it might help if e.g. STR912 enters some state where flash banks are locked, and a chip erase command is the key for unlocking the flash.
2010-08-12 08:53:29 +02:00
David Brownell
a84112f471 stellaris flash comment update
This flash driver works on more than just two chips.
(Though it does need work still, e.g. to protect more than 64K.
(On non-'3748-A0 chips where errata allow that.))

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-08-01 02:27:14 -04:00
Spencer Oliver
260eb4548b flash: remove algorithm exit_point address for supported targets
For the above targets the exit_point is
optional when used with run_algorithm, so remove it.

This makes updating the algorithm less error prone.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-07-20 09:02:42 +01:00
Spencer Oliver
b05ae41331 flash: use bkpt for str9 flash algo algorithm
STR9 is ARMv5 arch so use bkpt instruction rather than
waste a breakpoint.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-07-16 22:52:49 +01:00
Olaf Lüke
2986320cde at91sam3s* support
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-25 21:37:53 +02:00
Antonio Borneo
9b5572857a nor/str7x: review scope of symbols
Add "static" qualifier to private function.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-06-21 22:14:23 +08:00
Antonio Borneo
190986eb8c nor/virtual: review scope of symbols
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-06-21 22:14:19 +08:00
Antonio Borneo
decd417064 target/avr: review scope of symbols
Add "static" qualifier to private functions.
Move duplicated global declarations from "target/avrt.c"
and "nor/avrf.c" to "target/avrt.h".
Remove unused declarations form "nor/avrf.c".

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-06-21 22:14:17 +08:00
Antonio Borneo
984bf15821 nor/at91sam3: replace helper membuf
Helper ./src/helper/membuf.c is only used in at91sam3.c

1) Replace membuf with LOG_*

2) The original code in sam3_GetDetails() invalidates
   all the buffered output of sam3_GetInfo(). The new
   code skips sam3_GetInfo() if its output should not
   be printed.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-06-17 07:20:36 +02:00
Øyvind Harboe
72d227cd5e tms470: -Wshadow warning fixes
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-16 00:08:58 +02:00
Øyvind Harboe
42c84c59b1 str9xpec: -Wshadow warning fixes
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-16 00:07:59 +02:00
Øyvind Harboe
f9acaa894f str9x: -Wshadow warning fixes
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-16 00:05:58 +02:00
Øyvind Harboe
8022940c5c str7x: -Wshadow warning fixes
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-16 00:02:58 +02:00
Øyvind Harboe
72eb87673c stm32x: -Wshadow warning fixes
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-16 00:00:57 +02:00
Øyvind Harboe
e538367186 stellaris: -Wshadow warning fixes
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-15 23:59:21 +02:00
Øyvind Harboe
0a837fc36b lpc2900: -Wshadow warning fixes
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-15 23:58:19 +02:00
Øyvind Harboe
0365225c48 lpc2000: -Wshadow warning fixes
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-15 23:53:36 +02:00
Øyvind Harboe
953d96f1e2 ecos flash: -Wshadow warning fixes
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-15 23:32:47 +02:00
Øyvind Harboe
88aa5e31d1 at91sam7: -Wshadow warning fixes
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-15 23:31:36 +02:00
Øyvind Harboe
90454525b6 flash: -Wshadow warning fix
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-15 23:29:08 +02:00
Øyvind Harboe
9132f7083d cfi: add LOG_ERROR() in case of unsupported intel erase algorithm
found by code inspection. There are many other places in
CFI where LOG_ERROR() should be called similarly...

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-14 15:42:39 +02:00
Øyvind Harboe
b6a8254065 flash: fix bug in error propagation of flash write_image
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-14 12:27:58 +02:00
Øyvind Harboe
18918a0423 cfi: fix gaffe introduced in previous version
flash probe broke w/in last commit.

ecc8041c0f

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-14 09:48:12 +02:00
Øyvind Harboe
4532dc7831 flash: add error handling to get_flash_by_addr/name
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-11 15:53:23 +02:00
Øyvind Harboe
ecc8041c0f cfi: fix error propagation
any read/write operation to memory can fail.

block write algorithm error propagation was broken
in that it would continue after an error was reported
writing data to ram or the algorithm failing.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-11 15:53:23 +02:00
Øyvind Harboe
9ab7636ce6 flash: add error message if image is too big for flash
replaced assert() w/error message if the image is
too big.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-09 17:12:52 +02:00
Øyvind Harboe
49e6c61bcc flash: flash erase_address takes unsigned arguments
fixed bug where address was parsed as a signed, rather
than unsigned it.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-09 16:01:10 +02:00
Øyvind Harboe
14c112e992 cfi: fix GDB keep alive bug
Long running CFI writes could cause GDB timeout.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-08 10:48:46 +02:00
gcembed
a1cf1b5244 stm32 : change returned value of mass_erase function
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
2010-06-03 20:40:00 +02:00
Spencer Oliver
86e851e1e2 nor: fix memory leaks during probe
Fix similar memory leaks as per commit:
ef72484b78

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-05-29 15:43:42 +01:00
Spencer Oliver
215353ef67 flash: virtual driver update for get_flash_bank_by_name_noprobe
Make sure we do not probe a flash when getting info.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-05-26 11:10:17 +01:00
Spencer Oliver
ee4106ee99 nor: add get_flash_bank_by_name autoprobe
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-26 11:10:16 +01:00
Spencer Oliver
5319ccd7eb flash: add virtual flash bank driver
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>
2010-05-26 11:10:15 +01:00
Antonio Borneo
ef72484b78 NOR/CFI: fix memory leak; check malloc return value
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>
2010-05-26 11:01:07 +01:00
Jon Povey
5fd1c2db9a Change kb/s to KiB/s in messages about kibibytes
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-16 13:55:01 +02:00
Antonio Borneo
76b81682ee NOR/CFI: minor code cleanup
Remove few LOG_DEBUG() messages, together with code and
variables required to build such messages.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-05-16 13:39:47 +02:00
Antonio Borneo
602685e66f NOR/CFI: add cfi_read() implementation
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>
2010-05-16 13:39:47 +02:00
Antonio Borneo
bc8be110ff NOR: add read() callback to struct flash_driver
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-16 13:39:47 +02:00
Antonio Borneo
24ebfffff5 NOR/TCL: fix typo in error message
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-05-16 13:39:47 +02:00
Antonio Borneo
feb95fbb7b NOR: fix comment for Doxygen
Either bus_width and chip_width are in bytes.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-05-16 13:39:47 +02:00
Antonio Borneo
ebdd3a1670 NOR/CFI: remove use of cfi_add_byte()
Remove the function cfi_add_byte() and rewrite the only
instance of it.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-05-16 13:39:47 +02:00
Antonio Borneo
34f70956ed NOR/CFI: use bus_width for memory access in cfi_write()
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>
2010-05-16 13:39:47 +02:00
Antonio Borneo
a69cbf0f74 NOR/CFI: use bus_width for memory access on flash ID.
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>
2010-05-16 13:39:47 +02:00
Antonio Borneo
61bb0d3d23 NOR/CFI: identify memory accesses not using "bus_width".
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>
2010-05-16 13:39:47 +02:00
Antonio Borneo
89747f81f2 NOR/CFI: simplify bufferwsize computation
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>
2010-05-16 13:39:47 +02:00
Antonio Borneo
c7b269ace1 NOR/CFI: check "flash bank" command arguments
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>
2010-05-16 13:39:47 +02:00
Spencer Oliver
a7fb60dc7b flash: require unique flash bank name
Make sure the flash bank name is unique

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-05-13 20:44:07 +01:00
Spencer Oliver
7b36d2a229 flash: add flash bank name support
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-13 20:44:07 +01:00
Karl Kurbjun
6f03e92959 Fujitsu MBM29SL800TE flash support
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
2010-05-11 20:10:08 +02:00
Spencer Oliver
bbc8f4e6ce cfi: add Numonyx M29W128G reset workaround
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>
2010-05-10 15:39:29 +01:00
Øyvind Harboe
737c9b6258 flash: stop caching protection state
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-05 15:24:25 +02:00
Øyvind Harboe
f7e0f3c285 flash: erase_address now has an unlock option
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-05 15:24:25 +02:00
Øyvind Harboe
3077f5845f cfi: fix error handling for protect fn
No error was propagated.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-05-05 15:24:24 +02:00
Øyvind Harboe
82ea640830 gdb: connect will now fail if flash autoprobe fails
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-05-05 15:24:24 +02:00
Øyvind Harboe
7e33f87b3d flash: more flash write_image bugfixes
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>
2010-05-05 15:24:24 +02:00
Øyvind Harboe
0d8f60e28f str7x: improve error handling
clean up error handling a bit. No change in behavior.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-05-05 15:24:24 +02:00
Spencer Oliver
909130e16e str71x: fix previous commit
fix build issue with 70226c221f commit

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-05-04 15:51:43 +01:00
Øyvind Harboe
282e89c878 flash: less bogus errors
Removed bogus errors when trying to allocate a large
a target memory buffer as possible.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-05-04 09:11:21 +02:00
Øyvind Harboe
70226c221f str7x: fix bogus error messages
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>
2010-05-04 09:11:21 +02:00
Øyvind Harboe
fe60480b7a cfi: made som info output debug output
E.g. how much target memory that is used during flashing
is debug info.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-05-04 07:40:46 +02:00
Tobias Ringström
14f4606dcb STM32 flash erase timeout fix
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
2010-05-03 11:55:08 +02:00
Øyvind Harboe
5e79f999bc flash: write_image would fail for certain images
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>
2010-04-29 18:39:48 +02:00
Øyvind Harboe
78248f1df6 flash: write_image will now pad erase to nearest sector
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>
2010-04-29 03:54:43 +02:00
Øyvind Harboe
49b7905cae nor: remove bogus output about padding sections
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>
2010-04-28 08:01:28 +02:00
Andreas Fritiofson
ddf7aabc67 stm32x: allow flash probe on a running target
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>
2010-04-20 08:55:48 +02:00
David Brownell
620310bcc6 NOR/core bugfix: restore invariants
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>
2010-04-15 19:48:55 -07:00
Antonio Borneo
b886049c74 NOR/CFI: remove redundant code
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>
2010-04-15 19:19:54 +02:00
Antonio Borneo
c9e58238c3 NOR/CFI: fix order of arguments check
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>
2010-04-15 19:19:46 +02:00
Antonio Borneo
41cb911853 NOR/TMS470: review scope of symbols
Add "static" qualifier to private functions and data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-11 01:19:41 +08:00
Antonio Borneo
4809dbb2d7 NOR/CFI: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 22:14:34 +08:00
Antonio Borneo
d7246f452f NOR/STR7X: review scope of data
Add "static" qualifier to private data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 21:52:33 +08:00
Antonio Borneo
9acd453d9f NOR/ADUC702X: review scope of data
Add "static" qualifier to private data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 19:58:15 +08:00
Antonio Borneo
069f88cfac NOR/AVRF: review scope of data
Add "static" qualifier to private data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 19:56:24 +08:00
Antonio Borneo
300f0f53c5 NOR/CORE: review scope of data
Add "static" qualifier to private data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 19:54:22 +08:00
Antonio Borneo
402d3292bb NOR/DRIVERS: review scope of functions
Add "static" qualifier to private functions.
Remove unused "extern" in src/ecosboard.c

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 19:38:15 +08:00
Antonio Borneo
61c0635991 STR9XPEC: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 19:29:51 +08:00