Commit Graph

447 Commits

Author SHA1 Message Date
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
Antonio Borneo
0c82bea44a TCL: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 19:28:13 +08:00
Antonio Borneo
a092e8d237 NOR TCL: fix usage message
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-26 09:14:56 +01:00
Daniel Bäder
010492a1ed change %x and %d to PRIx32 and PRId32 where needed for cygwin 2010-03-25 12:45:32 +01:00
Øyvind Harboe
96949890ee jtag: move towards making out_value const
These were relatively straightforward fixes which are
backwards compatible.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-20 11:16:49 +01:00
Spencer Oliver
ae1c64706a PIC32MX: add unlock cmd
'unlock' performs a full unlock/erase of the device, removing any
code protection.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-03-18 09:35:45 +00:00
Øyvind Harboe
36df240cea jtag: cut down on usage of unintended modification of global end state
jtag_get/set_end_state() is now deprecated.

There were lots of places in the code where the end state was
unintentionally modified.

The big Q is whether there were any places where the intention
was to modify the end state. 0.5 is a long way off, so we'll
get a fair amount of testing.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-18 08:43:19 +01:00
Bradey Honsinger
f85ad1e52a image loading: fix problem with offsets > 0x80000000
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-03-16 10:11:40 +01:00
Spencer Oliver
257a764582 PIC32: add flash algorithm support
Add flash algorithm support for the PIC32MX.
Still a few things todo but this dramatically decreases
the programing time, eg. approx programming for 2.5k test file.
 - without fastload: 60secs
 - with fastload: 45secs
 - with fastload and algorithm: 2secs.

Add new devices to supported list.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-03-10 21:03:22 +00:00
Spencer Oliver
f10ed95a5c STM32: flash loader cleanup
- make algorithm array static const.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-03-10 20:32:18 +00:00
Spencer Oliver
d0a57c0f0c STR7: flash loader cleanup
- make algorithm array static const.
 - increase algorithm buffer size to 32k.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-03-10 20:32:06 +00:00
Spencer Oliver
6344f2ab98 STR9: flash loader cleanup
- make algorithm array static const.
 - increase algorithm buffer size to 32k.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-03-10 20:31:59 +00:00
Spencer Oliver
2946c895a1 ADUC702x: flash loader cleanup
- make algorithm array static const.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-03-10 20:31:53 +00:00
Antonio Borneo
17d437a7a1 CFI CORE: bug-fix protect single sector
Cannot protect or unprotect single sector in cfi flash.
When first==last the procedure fails.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-09 22:54:40 +01:00
Antonio Borneo
fc1063a1b9 cfi: simplify and clearify code
At the end I have added comments /* FIXME: to be removed */
There are 3 lines in which my simplification is not complete due to
data dependency with LOG_DEBUG() messages visible in the patch.
Such log_debug has been introduced on Jan 22, 2007 with commit
4fc97d3f27 during development activity
in this file/procedure.

From my point of view, these logs can be removed, since not part of a
consistent flow of information.
Alternatively, could be borrowed in the new cfi_send_command(), but
this will increase verbosity.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-08 18:31:27 +01:00
Øyvind Harboe
57d7743639 jtag: jtag_add_ir_scan() now takes a single field
In the code a single field was all that was ever used. Makes
jtag_add_ir_scan() simpler and leaves more complicated stuff
to jtag_add_plain_ir_scan().

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-08 08:12:25 +01:00
Øyvind Harboe
e018c7c1d2 jtag: retire tap field
jtag_add_dr/ir_scan() now takes the tap as the first
argument, rather than for each of the fields passed
in.

The code never exercised the path where there was
more than one tap being scanned, who knows if it even
worked.

This simplifies the implementation and reduces clutter
in the calling code.

use jtag_add_ir/dr_plain_scan() for more fancy situations.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-08 08:12:25 +01:00
Antonio Borneo
f7d1be714b CFI: review print of Voltage values
JEDEC standard reports Vpp integer part encoded as 4 bit HEX value.
To print it using decimal digits, %u is required.
Other voltage values are coded as BCD, so %x is appropriate.

Code already prints one nibble at a time, so no need for field width
and precision in format string.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-06 09:53:21 +01:00
David Brownell
5e78ddcea0 NOR: trim range in flash_driver_protect()
When the beginning or end of the specified range of sectors
already has the requested protection status, don't ask the
flash driver to change those sectors.

This will among other things turn command sequences like
this into the NOPs one would expect:

	flash protect_check 0
	flash info 0
		... reports everything as unprotected ...
	flash protect 0 0 1 off

That speeds things up (by whatever work was just avoided).

Also, with Stellaris (which can't unprotect flash at  page level)
this can eliminate some undesirable/false error reports.  (And
finishes fixing a bug currently listed in our bug database...)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-03-03 21:01:16 -08:00
David Brownell
5fdf9535ce NOR: invalidate cached state on target resume
The NOR infrastructure caches some per-sector state, but
it's not used much ... because the cache is not trustworthy.

This patch addresses one part of that problem, by ensuring
that state cached by NOR drivers gets invalidated once we
resume the target -- since targets may then modify sectors.

Now if we see sector protection or erase status marked as
anything other than "unknown", we should be able to rely
on that as being accurate.  (That is ... if we assume the
drivers initialize and update this state correctly.)

Another part of that problem is that the cached state isn't
much used (being unreliable, it would have been unsafe).
Those issues can be addressed in later patches.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-03-03 20:57:49 -08:00
David Brownell
99939c3c75 NOR: stellaris message tweaks
Give a more accurate failure message when trying to unprotect; don't
complain about pages being write protected, just say that unprotect is
not supported by the hardware ... referencing the new "recover" command,
which is the way to achieve that.

Likewise, when trying to protect, talk about "pages" (matching hardware
doc) not "sectors" (an concept that's alien to these chips).

Also make the helptext for the "recover" command mention that it
also erases the device.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-03-03 13:08:16 -08:00
Spencer Oliver
2119c0a764 STM32: Add Value Line Flash Programming Support
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-03-03 10:20:37 +00:00
David Brownell
53b3d4dd53 LPC1768 updates, IAR board support
Fix some issues with the generic LPC1768 config file:

 - Handle the post-reset clock config:  4 MHz internal RC, no PLL.
   This affects flash and JTAG clocking.

 - Remove JTAG adapter config; they don't all support trst_and_srst

 - Remove the rest of the bogus "reset-init" event handler.

 - Allow explicit CCLK configuration, instead of assuming 12 MHz;
   some boards will use 100 Mhz (or the post-reset 4 MHz).

 - Simplify: rely on defaults for endianness and IR-Capture value

 - Update some comments too

Build on those fixes to make a trivial config for the IAR LPC1768
kickstart board (by Olimex) start working.

Also, add doxygen to the lpc2000 flash driver, primarily to note a
configuration problem with driver: it wrongly assumes the core clock
rate never changes.  Configs that are safe for updating flash after
"reset halt" will thus often be unsafe later ... e.g. for LPC1768,
after switching to use PLL0 at 100 MHz.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-03-02 15:02:01 -08:00
Spencer Oliver
c9560ba190 stellaris: recover_command use usleep rather than sleep
windows api does not define a posix sleep, use usleep that
has an openocd wrapper to the win32 native function.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-02-28 22:48:57 +00:00
Spencer Oliver
a851ce0d6f ARMv7M: use software breakpoints for algorithms
- armv7m_run_algorithm now requires all algorithms to use
   a software breakpoint at their exit address
 - updated all algorithms to support this

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-02-28 22:26:52 +00:00
David Brownell
e70d42a727 new "stellaris recover" command
Stellaris chips have a procedure for restoring the chip to
what's effectively the "as-manufactured" state, with all the
non-volatile memory erased.  That includes all flash memory,
plus things like the flash protection bits and various control
words which can for example disable debugger access.  clearly,
this can be useful during development.

Luminary/TI provides an MS-Windows utility to perform this
procedure along with its Stellaris developer kits.  Now OpenOCD
users will no longer need to use that MS-Windows utility.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-02-27 00:31:35 -08:00
Hans Peter Mortensn
7abe9f38b2 AVR flash: handle AT90CAN128 chips
I have successfully programmed the AT90CAN128, based on the mega128  
with some small modifications.

[ dbrownell@users.sourceforge.net: patch cleanup ]

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-02-24 23:35:12 -08:00
Spencer Oliver
f7a6e62776 STR9xpec: issue warning when unlocking device
Issue warning to user when unlocking or writing the option bytes.
The new settings will not take effect until a target reset.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-02-12 10:49:18 +00:00
Spencer Oliver
747a607aef STM32x: issue warning when unlocking device (bug #16)
Issue warning to user when unlocking or writing the option bytes.
The new settings will not take effect until a target reset.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-02-12 10:49:11 +00:00
Edgar Grimberg
503f6139c7 flash/str7x: After reset init the flash is unlocked
The default state of the STR7 flash after a reset init is unlocked.
The information in the flash driver now reflects this.

The information about the lock status cannot be read from the
flash chip, so the user is informed that flash info might not
contain accurate information.

[dbrownell@users.sourceforge.net: line length shrinkage]

Signed-off-by: Edgar Grimberg <edgar.grimberg@zylin.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-02-02 09:30:33 -08:00
David Brownell
303b493c22 NOR: cleanup driver decls
Fix goofy struct indents.  Function names *are* their addresses.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-29 13:52:08 -08:00
David Brownell
fb4239866c NOR: fix diagnostic
The "NOR: last_addr also needs correction when checking alignment"
patch omitted a necessary update to the key diagnostic; fix.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-19 13:56:33 -08:00
Øyvind Harboe
cdcb9b0885 flash: add error messages upon incorrect arguments to flash iteration
According to OpenOCD error handling rules the error is
logged at where it occurs(same site where an exception
would have been thrown).

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-01-19 10:58:48 +01:00
Laurentiu Cocanu
24653c950a str9x.c: remove optimization when erasing the whole bank
Using the erase bank command will cause a time out error. Replacing
this with the erase sector bank will provide a slower but safer and
stable method to erase the flash.

Signed-off-by: Laurentiu Cocanu <laurentiu.cocanu@zylin.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-01-14 15:07:24 +01:00
David Brownell
73566405b6 NOR: add optional "flash erase_address" sector padding
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-13 23:33:25 -08:00
David Brownell
8c730aaee2 Doxygen file comments
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-11 00:16:57 -08:00
David Brownell
1c5c57ec8e src/flash/nor: usage/help/doc updates
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>
2010-01-09 10:25:03 -08:00
David Brownell
296a011db5 NOR: add FIXMEs for writing ones
It can invalidate ECC codes, and in general is not guaranteed
to work.  (However on some chips it _appears_ to behave.)  Just
don't do it; don't write in those cases.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-08 16:47:58 -08:00
David Brownell
b3bf1d12b2 streamline and document helptext mode displays
Most commands are usable only at runtime; so don't bother saying
that, it's noise.  Moreover, tokens like EXEC are cryptic.  Be
more clear: highlight only the commands which may (also) be used
during the config stage, thus matching the docs more closely.
There are

 - Configuration commands (per documentation)
 - And also some commands that valid at *any* time.

Update the docs to note that "help" now shows this mode info.

This also highlighted a few mistakes in command configuration,
mostly commands listed as "valid at any time" which shouldn't
have been.  This just fixes ones I noted when sanity testing.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-02 15:52:35 -08:00
Freddie Chopin
6b1eeb92fe MinGW build fixes
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-28 13:09:31 -08:00
Freddie Chopin
37cc6c495f stm32x commands get "usage"
Add .usage fields to stm32x command_registration,
so that "help stm32x" shows required parameters.

Signed-off-by: Freddie Chopin <freddie_chopin@op.pl>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-28 13:05:50 -08:00
Piotr Esden-Tempski
cba1813d5c NOR: last_addr also needs correction when checking alignment
Otherwise the new alignment checking algorithm thinks that the
address is not aligned, because it is way beyond the last sector.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-28 12:31:47 -08:00
David Brownell
155a6a2c0b NOR: make flash_write_unlock() pad to sector end
Resolve a regression when using newish automagic "write_image"
modes, by always padding to the end of affected sectors.

Also document some issues associated with those automagic options,
in the User's Guide and also some related code comments.

We might need similar padding at the *beginning* of some sectors,
but this is a minimalist fix for the problems which have currently
been reported (plus doc updates).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-27 11:34:31 -08:00
David Brownell
df58812b52 NOR: messaging fix
Fix syntax error:  default to "wrote N bytes"; writing a
single byte is an unusual case, not the normal one.
2009-12-26 10:24:39 -08:00
David Brownell
396b0f3012 NOR: Allocate the right amount of memory
Switch to calloc() to simplify review and initialization.
2009-12-26 10:22:28 -08:00
David Brownell
b72bfabf0d cygwin build fixes
and shrink some too-long lines

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-19 15:43:55 -08:00
David Brownell
3f18900b19 NOR FLASH: only erase/unlock whole sectors
Much to my surprise, I observed a "flash erase_address ..."
command erasing data which I said should not be erased.

The issue turns out to be generic NOR flash code which was
silently, and rather dangerously, morphing partial-sector
references into unrequested whole-sector ones.

This patch removes that low-level morphing.  If desired, it
can and should be done in higher level code.  (We might need
to fix some stuff in the GDB server code.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-18 10:16:52 -08:00
David Brownell
013b05f7f8 Subject: flash fill[bwh] should use bulk i/o
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-18 10:09:35 -08:00
David Brownell
7641934197 stellaris: fix min buffer length checks
Word count == size/4; cope.  And increase buf_min so it's large
enough to cover the overhead in my tests.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-18 09:59:40 -08:00
David Brownell
e40f638063 stellaris: update bulk flash writes
Try to right-size the SRAM buffers, by not:
 - using them for very small writes
 - giving up when a large buffer isn't available
 - allocating buffers much larger than their data

Also don't:
 - bother loading the code unless we allocate the writebuffer too
 - be so verbose with messaging:
    * be more concise
    * reduce importance (e.g. DEBUG not WARNING)
    * remove duplication

The minimum buffer size is something of a guess.  It's eight
times smaller than before, almost the same size as the code
being downloaded.  It probably deserves some tuning.

Also, note an erratum affecting flash protection on some chips;
and narrow many over-wide lines affected by the above changes.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-18 01:33:19 -08:00
David Brownell
d265c219b9 stellaris: comments
Someday revisit various issues:  Tempest parts support writing
more than one word at a time; for some target firmware it might
be necessary to save and restore flash IRQ configuration.  (The
safest policy is likely to always reset after flash updates.)

Plus swap some undesirable TAB characters with SPACE.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-16 14:17:31 -08:00
David Brownell
1cd7b3b49b stellaris: probe() cleanups
Fix potential memory leak:  make sure the per-bank data
structures are only allocated in probe(), and that calling
probe() multiple times is a NOP.  Use it for auto_probe().

Require probe() to have done its thing:  don't make access
routines cope with it not having been called.  Shrink a
bunch of failure paths; and in some cases, correct them.

Don't needlessly insist on a halted target for probe().

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-16 14:17:31 -08:00
David Brownell
6f2b9ea9e1 stellaris: remove needless code
No point in reading and discarding a status value when fetching
part description data.  Or having that needless "#if 0" code.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-16 14:17:31 -08:00
David Brownell
f85dc92d2a stellaris: avoid chip writes
Previously "reading" clock info (and part info) also, as a side
effect, wrote the flash timing register.  Instead, be more safe:
"reading" should only read.  Write paths still refresh timing,
coping with changes the application code may have made.

Also rename the routine which sets flash timing, indicating what
it's really doing; it's got nothing to do with a "mode".

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-16 14:17:31 -08:00
David Brownell
47998a55e0 NOR: bugfix "flash fill[bwh] ..." helptext
These commands don't have a "bank" parameter.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-16 11:57:59 -08:00
Eric Wetzel
36dec1b319 stellaris: device IDs
I added the remaining devices and device IDs to stellaris.c, and
removed several devices that don't exist on the Stellaris web page.

Additionally, I found a few devices with duplicate IDs ... the DID1
Version Number for LM3Sxxx parts have DID1 Version = 0x0, and for
LM3Sxxxx have DID1 Version = 0x1. So I extended the comparison to
use the VER and FAM fields from DID1 also.

ID=0x33: LM3S812 (DID1v0) and LM3S2616 (DID1v1)
ID=0x39: LM3S808 (DID1v0) and LM3S2276 (DID1v1)

These are the parts I removed from the file for lack of documentation
(no data sheet to confirm part ID):

  LM3S318,
  LM3S1101, LM3S1108,
  LM3S1615, LM3S1616,
  LM3S2016,
  LM3S2101, LM3S2108,
  LM3S3759, LM3S3768,
  LM3S5757, LM3S5767, LM3S5768, LM3S5769,
  LM3S6815, LM3S6816,
  LM3S6915, LM3S6916,
  LM3S6111, LM3S6118.

Also, sort devices according to part number.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-14 15:59:01 -08:00
David Brownell
0a9d7cab6d LPC2000: rename "r13_svc" as "sp_svc"
This driver didn't get updated when the name changed.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-12 15:43:02 -08:00
Zachary T Welch
8438dee786 fix 'write_image' usage information
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-11 18:45:34 -08:00
David Brownell
a34345451d anotyer cygwin compile fix
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-10 17:42:20 -08:00
David Brownell
3d9cb516c2 stellaris: flash protection updates, minor fixes
Bugfix the read side of flash protection:
 - read the right register(s)!
 - handle more than 64K
 - record the results in the right places
 - don't display garbage.

Partially bugfix the write side:
 - use 2KB lock regions instead of 1KB pages (!)
 - validate input range
 - don't try to _remove_ protection (it's write-once)
 - #define values we'll need to commit writes.
 - ... still doesn't handle pages over 64KB mark, or commit writes

And minor cleanup and fixes:
 - get rid of some forward decls
 - properly locate a doxygen comment
 - fix some bad indentation
 - remove superfluous #include
 - add a new part ID (many are still missing)
 - make the downloaded algorithm code be read-only

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-09 21:16:09 -08:00
David Brownell
910dd664ce Comment and doxygen fixes
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-09 10:25:52 -08:00
Øyvind Harboe
eb1bc657ae build: add build/src to include path
This allows including generated include files.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-12-08 10:16:10 +01:00
David Brownell
0a1b7dcfc4 ARM: use <target/arm.h> not armv4_5.h
Move most declarations in <target/armv4_5.h> to <target/arm.h>
and update users.

What's left in the older file is stuff that I think should be
removed ... the old register cache access stuff, which makes it
awkward to support microcontroller profile (Cortex-M) cores.

The armv4_5_run_algorithm() declaration was moved too, even
though it's not yet as generic as it probably ought to be.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-07 14:57:44 -08:00
David Brownell
a4a2808c2a ARM: move opcode macros to <target/arm_opcodes.h>
Move the ARM opcode macros from <target/armv4_5.h>, and a few
Thumb2 ones from <target/armv7m.h>, to more appropriate homes
in a new <target/arm_opcodes.h> file.

Removed duplicate opcodes from that v7m/Thumb2 set.  Protected
a few macro argument references by adding missing parentheses.

Tightening up some of the line lengths turned up a curious artifact:
the macros for the Thumb opcodes are all 32 bits wide, not 16 bits.
There's currently no explanation for why it's done that way...

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-07 14:57:43 -08:00
Zachary T Welch
30a6e683b8 add 'flash list', rewrite 'flash banks'
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-06 21:39:35 -08:00
Zachary T Welch
56c5f6361e fix NOR flash regression
When factoring the bank setup command into flash_bank_add(), I forgot
to include a call to the new helper.
2009-12-06 20:15:08 -08:00
Mathias Kuester
12b67a2b41 NOR: add 29LV400BC flash device
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-05 11:12:59 -08:00
David Brownell
c2cc677056 ARM: rename armv4_5_algorithm as arm_algorithm
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-04 20:19:49 -08:00
David Brownell
e51b9a4ac7 ARM: ARMV4_5_COMMON_MAGIC --> ARM_COMMON_MAGIC
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-04 19:46:44 -08:00
David Brownell
0073e7a69e ARM: rename ARMV4_5_MODE_* as ARM_MODE_*
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-04 19:21:14 -08:00
David Brownell
31e3ea7c19 ARM: rename ARMV4_5_STATE_* as ARM_STATE_*
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-04 19:14:48 -08:00
Zachary T Welch
f3e6f584f1 remove flash.h from tree
Remove the now vestigial <flash/flash.h> header from the tree,
replacing a few references with <flash/nor/core.h>
2009-12-04 16:56:24 -08:00
Zachary T Welch
ae6374e25d split flash.h into into flash/nor/*.h
Move the bulk of the flash.h file into flash/nor/core.h, leaving an
empty husk that will be removed in the next patch.

The NOR driver structure is an implementation detail, so move it into
its own private header file <flash/nor/driver.h> along with helper
declaration for finding them by name.
2009-12-04 16:56:24 -08:00
Zachary T Welch
d9dc604a4d remove target.h from flash.h
The flash.h header does not require the target.h header file, but
its implementation source files do.  Move it to flash/nor/imp.h.
2009-12-04 16:56:23 -08:00
Zachary T Welch
5fdee60fd4 eliminate src/flash/flash.c
Move remaining NOR flash implemenation into flash/nor/core.c
Removes flash.c from the build, leaving only its header to split.
2009-12-04 16:56:23 -08:00
Zachary T Welch
c90702eaa7 add flash/nor/drivers.c
Encapsulates access to the flash_drivers array, providing a base
of operations for future dynamic driver module loading features.
2009-12-04 16:56:23 -08:00
Zachary T Welch
04ee41de52 move more nor flash implementation details
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-04 16:56:23 -08:00
Zachary T Welch
c65d94f7d0 add flash/nor/core.[ch]
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-04 03:34:33 -08:00
Zachary T Welch
3cb0b56005 add flash/nor/{tcl.c,imp.h} from flash/flash.c
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.
2009-12-04 03:34:33 -08:00
Zachary T Welch
822c06d9e3 remove tertiary include paths
With all #include directives converted, we only need to have the
top-level src/ directory in the search path.
2009-12-03 04:24:50 -08:00
Zachary T Welch
f7bd1e8f3a change #include "../hello.h" to "hello.h"
Before we can -I the top-level src/ directory alone, references to
"hello.h" must be updated.  This is an internal header, so it does
not need angle brackets.
2009-12-03 04:24:50 -08:00
Zachary T Welch
2b2d5ec1e3 change #include "flash.h" to <flash/flash.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "flash.h"

the following form should be used.

	#include <flash/flash.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:42 -08:00
Zachary T Welch
a8880f0b5a change #include "mips32.h" to <target/mips32.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "mips32.h"

the following form should be used.

	#include <target/mips32.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
7da02a8330 change #include "image.h" to <target/image.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "image.h"

the following form should be used.

	#include <target/image.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
1650ab3a22 change #include "embeddedice.h" to <target/embeddedice.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "embeddedice.h"

the following form should be used.

	#include <target/embeddedice.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
54063d7294 change #include "avrt.h" to <target/avrt.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "avrt.h"

the following form should be used.

	#include <target/avrt.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
f52a596860 change #include "armv7m.h" to <target/armv7m.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "armv7m.h"

the following form should be used.

	#include <target/armv7m.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
ddea033043 change #include "armv4_5.h" to <target/armv4_5.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "armv4_5.h"

the following form should be used.

	#include <target/armv4_5.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
41e92d8a7a change #include "arm966e.h" to <target/arm966e.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "arm966e.h"

the following form should be used.

	#include <target/arm966e.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:40 -08:00
Zachary T Welch
9e3136a5f8 change #include "arm7_9_common.h" to <target/arm7_9_common.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "arm7_9_common.h"

the following form should be used.

	#include <target/arm7_9_common.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:40 -08:00
Zachary T Welch
2958665f6b change #include "algorithm.h" to <target/algorithm.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "algorithm.h"

the following form should be used.

	#include <target/algorithm.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:40 -08:00
Zachary T Welch
cb4a475f6c change #include "jtag.h" to <jtag/jtag.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "jtag.h"

the following form should be used.

	#include <jtag/jtag.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:33 -08:00
Zachary T Welch
df0e90ec8c change #include "types.h" to <helper/types.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "types.h"

the following form should be used.

	#include <helper/types.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:52 -08:00
Zachary T Welch
6512e5e36b change #include "time_support.h" to <helper/time_support.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "time_support.h"

the following form should be used.

	#include <helper/time_support.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:52 -08:00
Zachary T Welch
6c3a28ca26 change #include "membuf.h" to <helper/membuf.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "membuf.h"

the following form should be used.

	#include <helper/membuf.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:52 -08:00
Zachary T Welch
d1bc4375e9 change #include "binarybuffer.h" to <helper/binarybuffer.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "binarybuffer.h"

the following form should be used.

	#include <helper/binarybuffer.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:17 -08:00
Zachary T Welch
896ac8d4ef allow #include directives to use module name
Includes the src directory in the search path, so header files may be
migrated from:

  #include "foo.h"

to
  #include <module/foo.h>

which is more conducive for installation.
2009-12-03 01:54:15 -08:00
Zachary T Welch
fe9228a32d move nor drivers to src/flash/nor
Moves NOR flash drivers to 'src/flash/nor/'.
Adds 'src/flash/nor/Makefile.am'.
Builds 'libocdflashnor.la'.
2009-12-02 23:27:09 -08:00