2023-03-16 02:57 AM
I working on a STM32L462 project, which needs to invoke the bootloader from the user program. I don't have access to the Boot0 pin. I came across two methods of doing the same but not sure which one should i employ for clean transition.
Method 1: - Set the system memory address in a pointer and set the main stack pointer after which invoke the system memory address.
Method 2: Hardware manual says about writing the option bytes of FLASH_OPTR register to ignore the boot pin ( setting nSWBOOT0 to 0) and setting the nBOOT0(0)and nBOOT1(1) option bytes.
How this two methods are different and which one to employ for a clean transition?
Solved! Go to Solution.
2023-03-31 07:34 AM
Hi @KK.4 ,
Previous answer from @MM..1 fully makes sense of course. Thanks.
I will just add some elements:
All in all, I think it is preferred to use method2 unless there are specific constraints on the application.
And if you use Bootloader only when Flash is erased, then you can use the option I indicated in the beginning, which would be the best option in that case.
I hope it helps.
2023-03-16 09:10 AM
Method 1 is preffered for start from code, because "is without reset" and if fail turn off on start original fw
but if fail with corrupted app bootloader not repeat start = brick
Method 2 need after options set invoke reset and dfu command run app or/and write options back
2023-03-31 07:34 AM
Hi @KK.4 ,
Previous answer from @MM..1 fully makes sense of course. Thanks.
I will just add some elements:
All in all, I think it is preferred to use method2 unless there are specific constraints on the application.
And if you use Bootloader only when Flash is erased, then you can use the option I indicated in the beginning, which would be the best option in that case.
I hope it helps.