Hello,
I have to design a device which has a STM32L152VD as main micro-controller. The user should be able to update the firmware using a GUI software from RS232. There should be a secure process to update the firmware. For example after verifying a password by micro-controller and there should be always a backup firmware to replace if the updating process failed. Should I use a second micro-controller and a flash memory to do this or is it possible to use the same MCU to handle it?
Thanks. How should we tell the MCU what the communication protocol (XMODEM,etc.) we start to use for loading application using bootloader? also, Do we have limitation on code size when we wish to load to MCU using boot loader in comparison with SWDIO,Jtag,etc. ?
You would have to write the code to implement the loader protocols of your choice.
Boot Loader is a generic term, if you want to interact with the ROM based System Loader the you'll need to use its documented protocol, or use it as a method to download your own loader code into RAM and transfer control to that.
The System Loader isn't going to provide you with any encryption or security. It can access all the FLASH memory in the device.
If you code your own loader, with its own features, this will take up some FLASH, which you will ideally not erase or overwrite.
You should review ISP (In System Programming), and IAP (In Application Programming), the former is the ROM Loader, the latter provides you with significantly more control, and the pins/interfaces used.
If you want to own the experience at both ends you'll need to write the code on the micro-controller, and the Windows/Linux GUI applications.
ST's Flash Loader Demonstrator and DFU applications aren't the most user-friendly tools, and are design primarily for the developer/engineering community.