As per the lpc11xx manual the stack pointer should be set before IAP
calls are made.  

In lpc11xx_flash_prepare() and lpc11xx_flash_erase() bug in calculating
the ending sector number.
Error in calculating ending sector number.
Merge pull request #9 from jeffstaley/master

Bug fixes for lpc11xx code