The main goal is to update program lpc17xx from UART0.
1. split lpc17xx code storage into two section, A and B.
2. If A or B have application code, run application code.
3. If A or B do not have application code , enter IAP state,wait for program data.
4. If A application code is runing, than enter IAP state will program B section.
5. If B application code is runing, than enter IAP state will program A section.
6. bootloader can choose run A or B section at startup by GPIO pin state or receive uart message.
7. If failed to run A, than run B. If failed to run B, than run A.
8. the program data from uart0 is AES encrypted(128bit or 256bitt),so it should be decrypt before flash to the program.