Unable to erase the BOOT_KEY

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unable to erase the BOOT_KEY

1,002 Views
bjrajendra
Senior Contributor I

Hello all,

 

I'm trying to create Flash Bootloader in S32K144 & accordingly I made changes in the linker file to shift the code to new location & also added a new segment to add the BOOT_KEY at the end of the srec file and I reflected in my srec file.

I used thread S32K_Boot_Problem for creating a linker file at new location & thread Example S32K144 Flash RW simple to erase the key from RAM. But I couldn't able to erase or re-program the BOOT_KEY.

When I'm trying to debug the code, it is showing as IMPRECISERR and got stuck in UsagefaultHanlder. I searched about Fault handling on S32K144 & used the corresponding files which resulted stucking at some break point.

I tried moving the address of the function (where erasing the BOOT_KEY takes place) to several places, but there is no use.

Help me in solving this issue.

Thanks in advance,

Regards,

Raju

0 Kudos
4 Replies

753 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

the code needs to be executed from RAM memory. Also it's necessary to disable interrupts to ensure that flash is not accessed during the operation.

You can use this simple syntax to place the function which erases/programs the flash to RAM memory:

__attribute__ ((section(".code_ram"))) // place the code below into .code_ram section
void FlashErase(void);

Regards,

Lukas

0 Kudos

753 Views
bjrajendra
Senior Contributor I

Thanks Lukas for your swift response,

I tried disabling the interrupts using  __asm("cpsid if") ; instruction. But When I'm trying to debug the Code, and trying to rewrite the memory, It's getting LOCKUP reset while executing the instruction

while((FTFC->FSTAT & FTFC_FSTAT_CCIF_MASK) == 0); //wait if operation in progress

I think I Observed in Example S32K144 Flash RW simple is the commands are FTFE instead of FTFC. will it make any difference.

Also I attached Images of the Error Images

Code Execution.PNG

After Reset.PNG

Thanks in Advance,

BJ Rajendranath

0 Kudos

753 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

do you have some simple project to share, so I can check it on my side?

FTFE vs. FTFC - that's just different name. I wrote the example for earlier silicon mask set. I hope I will find some time to update it.

Regards,

Lukas

0 Kudos

753 Views
bjrajendra
Senior Contributor I

Hi Lukas,

I reopened the same query with another post, with much detailed explaination. Unable to Erase Sector  

Kindly help in solving the issue.

Thanks in advance,

Raju

0 Kudos