Added support for replacing the entry points for the bootloader and the application before programming, and added a function to get the next page to write from the program memory