]> git.sur5r.net Git - openocd/commit
flash/nor: handle flash write alignment/padding in the infrastructure
authorTomas Vanek <vanekt@fbl.cz>
Sat, 10 Feb 2018 12:07:56 +0000 (13:07 +0100)
committerTomas Vanek <vanekt@fbl.cz>
Tue, 10 Apr 2018 05:17:52 +0000 (06:17 +0100)
commitc8c20b7c0bfbc802faf46598ac585707be99d153
tree3860500f5d587e21666c56ac39fda056ddeb2397
parenta867e36f78be231bfdf5161ff7172bcf69aa6280
flash/nor: handle flash write alignment/padding in the infrastructure

Most of flash drivers have to ensure proper flash write block alignment
and padding. As there was no support for it in the flash infrastructure,
each driver does it its own way. Sometimes this part of code is not properly
tested and contains bugs.

flash_write(_unlock) joins all image sections targeted to one flash bank
using padded areas as a glue. This solves alignment problems on section
boundaries but imposes other problems.

Introduce new flash bank parameters write_start_alignment,
write_end_alignment and minimal_write_gap.
New flash drivers can just properly set these values instead of handling
alignment by its own.

Adapt infrastructure (namely flash_write_unlock(), handle_flash_fill_command()
and handle_flash_write_bank_command()) to prepare write data padded
to an alignment required by the flash bank.

Rework flash_write_unlock() to discontinue write block when the gap
between sections is bigger than minimum specified in minimal_write_gap.
minimal_write_gap is set to one sector by default.

Change-Id: I4368dd402dfaf51c193bcbf1332cffff092b239b
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4399
Tested-by: jenkins
Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
src/flash/nor/core.c
src/flash/nor/core.h
src/flash/nor/tcl.c