Hi Ping - thank you for getting resolution on this issue. It is very helpful to finally understand exactly what's happening. But unfortunately, the truth of this matter has some very unfortunate consequences.
This confirms that all of the App Notes which talk about using CRP1 to protect Sector-0 from being written failed to mention that this wouldn't work when using the USB Bootloader, because the whole flash, including Sector-0, gets deleted when "firmware.bin" is deleted. This has serious consequences for anyone (such as myself) who has developed a product using the USB interface with the expectation that secure field updates could be performed using the "drag-n-drop" method in Windows Explorer. It appears that this will not be possible without using CRP3 and a Secure USB Secondary Bootloader.
NXP has provided code examples in the form of LPCXpresso projects for several other NXP processors which implement a USB Secondary Bootloader - I am still hoping for such an LPCXpresso project example for the LPC11U68 so I can customize it, integrate it into my application and still realize the "drag-n-drop" method for updating code in the field. If you could provide such an LPCXpresso project, that would be very useful.
The alternative solution you've provided in App Note AN11732 uses a "tool" to build a composite ".bin" from the target application and an NXP provided "bin" version of a bootloader. I need to study this more, but two things come to mind immediately:
1) AN11732 says that once programmed with this composite image, the chip is placed in CRP2 mode. This still means that if the end product were able to be put into the native (ROM-based) Bootloader mode, that the Flash in the chip is still vulnerable to being erased by simply deleting the "firmware.bin" file using Windows Explorer, correct?
2) In that case, the end product solution would need to NOT allow the customer access to putting the chip in the native Bootloader mode, and rely solely on this new integrated composite image update method. Which raises the next big question...
3) How feasible is this new method for end user customers (the average consumer) to use to update the firmware in the product? Previously, a simple "drag-n-drop" solution was the method. Easy and familiar for customers to do. It appears that this new method would require the customer to run a Script from a folder which also contains the composite binary in order to perform updates. For Windows 7, this means that the end user now has to install a driver. This is something beyond the ability of the average consumer to do without requiring technical support.
I am still interested in being able to use CRP3 and a Source Code USB Secondary Bootloader solution so I can still have the simple "drag-n-drop" update method. Can you supply an example LPCXpresso project for such a solution for the LPC11U68, as is available for several of your other LPC processors?
And one further clarification... I am assuming that if the part IS put into CRP3, then deleting "firmware.bin" would no longer erase the Flash - is this assumption correct?
I am designing a consumer product with an exposed USB Port with the expectation that customers could do a simple "drag-n-drop" to update their code. Everything I've read, and everything I've been lead to believe about this chip suggested that this capability was possible. It's very disheartening to now learn that this isn't really possible with this chip without implementing a CRP3-based solution, as any other CRP setting leaves the chip vulnerable to erasure.
Thank you for your help Ping. I look forward to your answers to my questions about both the LPCXpresso example project I've requested, and also your comments about how feasible this new AN11732 method is for the average end user customer to use.
Matt