function allocation & IP code protection
Hello,
I see WRPERR error in the text, are you sure the device options bytes are ok regarding protections (PCrop and/or Write Protection) ?
If you tried already the example with Keil, maybe the protections are still active.
Check option bytes protections with STLink utility.
Rgds,
Laurent