Clears DMA config registers for Discovery F4 board
to allow flash programming.  See texane/stlink issue #74.
Merge pull request #122 from sheaff/master

STM32F4 flash while using DMA potential fix
Fix byte count when doing unaligned memory read, fix issue #127

 - when start is adjusted, count should also be adjusted,
 - then, count is rounded to the next multiple of word size.
Merge pull request #128 from schodet/unaligned-read

Fix byte count when doing unaligned memory read, fix issue #127
Revert "[ merge ] patch from fischermi@t-online.de, GDB server endless loop"

This reverts commit 1c2828cc914260a57299461373bf835f90043863.
Add persistence support to gdb-server

When started with -m, or connected with 'target extended-remote', the
GDB server will not terminate upon disconnection from GDB, instead it
will begin listening for conenctions again.

Starting with extended-remote also has the advantage of allowing 'run'
to be used to reset the target and begin again.  Unfortunately, 'start'
is not working properly, as it does not send a reset packet (R), so it
complains when it tries to access memory before it is connected to the
target.
Merge pull request #132 from prattmic/master

Add gdb-server persistence
Move persistence flag to st_state_t

It makes sense for it to be with all other state data.  This meant
passing the entire state struct into serve.
Merge pull request #133 from prattmic/master

Move persistence flag to st_state_t
Add SIGINT handler for stlink cleanup

SIGINT causes st-util to immediately exit, without closing the open
stlink.  This leaves devices (at least the F4 Discovery) in a state
where they are unable to reset.  st-util could still connect and control
them, but a power cycle was required before they could reset on their
own.

A signal handler is added for SIGINT, which performs cleanup and closing
of the open stlink device, allowing it to function normally on
disconnect.
Merge pull request #135 from prattmic/signal_cleanup

Add SIGINT handler for stlink cleanup
Added lock state check to stlink_erase_flash_page.

On the STM32L152 processor, the erase fails for the first page as the
lock is already disabled (with the unlocking code causing the lock to
become re-enabled). This commit adds checking of the lock state and will
only unlock if necessary.
Limited DMA clearing to STM32F4, removed fatal error for flash loading.

Commit 0ed3907 added the clearing of DMA registers that was preventing
programming (see issue #74), however it uses hardcoded addresses of the
DMA registers on the STM32F4. This seems to prevent the flashing and
verification on STM32L1, as the registers only partly cover the range
zeroed. So the DMA clearing has been limited to the STM32F4
microcontroller.

Additionally, sometimes, typically directly after erases, a 'flash
loader run error' will occur that terminates the writing. This is not
necessary, as the writing is successfully performed by page writing
(line 1581 onwards of stlink-common.c), and so has been returned to a
error message (see issue #112). There is a comment on line 1574 (added by
Uwe Bonnes in commit 0164043f) that this may happen on blank devices,
and so the fatal error message is the incorrect response.
Merge pull request #138 from 6thimage/master

Fix for programming STM32L152
[ update ] bind gdb server on INADDR_ANY, as requested by thomas@popp.ws
Add Support for STM32L1xx Medium Plus and High density Devices

	Using reference RM0038 Rev 7
		The flash size register moved
		and the values in the registers changed their meaning
		Note that Medium Plus and High density deives have the
		same device ID, but only the Medium Plus definition is
		used in the code (the High comes along for free)
Merge pull request #140 from mower7/master

Adding Support for STM32L1xx Medium and High density devices
Add support for the STM32L1 Medium density device flash size calculation
In devices before "Rev X" the flash size register is 0 so we assume 128k
Note that "Rev X" is a LATER revision than "Rev Y" and others that might
seem like they are later!
Merge pull request #141 from mower7/master

A little mode tweaking for the STM32L Medium Density Devies
Add SIGTERM signal handler to also call cleanup
	When stopping st-util under Eclipse as an external tool the st-util
	receives a SIGTERM signal, and would not return the device to
	usb mass storage mode.  This change now calls cleanup in the SIGTERM handler too!!