Add bootloop counter to nanoboot

This commit adds a counter to the bootloop that is there to count how
many times nanoboot attempted to write-protect itself and reset the
microcotnroller. If that number is greater than
'NANOBOOT_MAX_WP_ATTEMPTS' nanoboot will transfer control to the next
stage bootloader regardless of the flash protection status.

This allows to avoid possible infinite reset-loop caused by failure to
write option bytes.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>