Forum: System Workbench for STM32

function allocation & IP code protection

Hi all
I’m trying to recompile the X-CUBE-PCROP examplewith AC6 (bornt with Keil) but there are some trouble
I’ve tryed to relocate functions placing this conde in the liner file

MEMORY
{
FLASH (rx)  : ORIGIN = 0x8000000, LENGTH = 992K
IP_CODE (x)  : ORIGIN = 0x080F8000, LENGTH = 32K
RAM (xrw)  : ORIGIN = 0x20000000, LENGTH = 96K
}

and the related section:

.ip_code :
{

  • (.IP_Code*);

} > IP_CODE

my function
attribute((section(“.IP_Code”))) int IP_test()
{
....
}

but even if it compile correctly and the .map file is ok I cannot program the nucleo board and this is the reported error:
auto erase enabled
Info : Device id = 0x10076415
Info : STM32L4xx flash size is 1024kb, base address is 0x8000000
Info : Erase the padded zone before the write
Error: Whole bank access must start at beginning of bank.
Info : Erase the padded zone before the write
Warn : Adding extra erase range, 0x00003000 to 0x000032bf
Info : wait_status_busy, WRPERR : error : remote address 0x40022000
Error: erase time-out error sector 16
Error: failed erasing sectors 6 to 495
Info : Padding image section 1 with 1002816 bytes
Info : wait_status_busy, WRPERR : error : remote address 0x40022000
Error: erase time-out error sector 16
Error: failed erasing sectors 0 to 496

    • Programming Failed **

shutdown command invoked

How can I solve this issue?

Thanks
Ivano

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