Fix for erasing STM32L152

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 adds checking of the lock state and will only unlock if necessary.

Unfortunately, I have only been able to test this against the STM32L152 (on an Olimex board - https://www.olimex.com/Products/ARM/ST/STM32-H152/), but I doubt the change will break anything.

As there are a lot of white space changes (due to a change in indentation), the diff file isn't incredibly clear, essentially all I've done is added in an additionally stlink_read_debug32 (line 1027) and an if condition on line 1028.