We have used J-LINK and J-Flash to program STM32F ARM families for a while and now planning to use ST-LINK and ST-LINK utility instead.
We have merged bootloader and application code to make hex file for production. In some projects there is no write protect pages and in others the application code write protects some pages upon first run.
We don't have problem programming the boards with the hex files for the projects that there is no write protected pages using ST-LINK. But for the projects which some pages are set to be write protected within the code after first run, the code does not run when it is programmed by ST-LINK.
If we just open the option bytes setting in ST-LINK utility and write protect all pages that the code itself supposed to write protect in its first run the code starts running. We cannot do this as it increases the time for programming each board and also increase the chance of error selecting wrong pages to be write protected.
Any help is appreciated.