Commit Graph

13 Commits

Author SHA1 Message Date
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
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
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 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 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
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
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
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