Question
Programming STM32 Option bytes : When and where ?
Posted on March 06, 2013 at 15:00
Dear All
I'm using IAR EWARM to compile my bootloader and application.I'm developing on STM32L151 64K version.My bootloader is located in pages 0-63, sectors 0-3, I would like to protect this area against flash write, just to be sure my bootloader will never been written spuriously.I understand I have to write the WRP byte of option bytes to enable this protection.What I do not understand is where and when I should write these option bytes ?1) Should these option bytes should be included into the hex or bin file ? So I'm sure the protection will be active once the chip burned with the hex or bin file ?If so, how can I configure IAR to setup these option bytes ?2) In my bootloader code ? Should I programmatically write the option bytes in my bootloader code ? I tried, but it seems as soon as the option byte is written, the chip resets and then an infinite loop occurs.3) ?I agree I'm missing the basics about the options bytes programming, any help would be greatly appreciated !ThanksJerome #iar-ewarm #option-bytes #stm32-flash-bootloader