Flash Erase

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

Flash Erase

3,972 Views
ganeshvaka2
Contributor II

Hi @all experts,

I am working CAN Based Bootloader for S32k142.I am Facing issue for Erase Application  memory  from 0x5000 to 0x3FFFF.when I was debugging step by step I will be Successfully Erasing memory. When  I was Flash and run code it is immediately going to HardFault_Handler.if any having any idea please explore here  .

Debugging mode: Successfully Erasing memory

Run Mode: HardFault_Handler

Capture1.PNG

 

Thank you for your Support 
Ganesh Babu Vaka

0 Kudos
Reply
11 Replies

3,899 Views
nelson_scheja
Contributor III

I had a very similar problem once (crash at flash operation in Run mode, but working fine on debugging). For me, it was solved by putting the function that starts the flash command into RAM and executing it from there.

If you are absolutely sure that your function EraseAndProgram() runs in RAM, I got no more idea about this.

0 Kudos
Reply

3,957 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Hi, could you defined which our SW product is this question related to?

0 Kudos
Reply

3,942 Views
ganeshvaka2
Contributor II

Hello @davidtosenovjan 

 

Thank you for your Valuable response!

As I said earlier I am working on CAN Based Bootloader. If I want flash new software need to  erase  old Software. When I was Request erase Software  am getting Hardfault handler .When i debug step by step I am facing Issue here .

flash.PNG

 If anyone have Any Idea please help me out 
Thanks and Regards 
Ganesh Babu.

0 Kudos
Reply

3,925 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

OK.

Do you execute this function from RAM?

0 Kudos
Reply

3,824 Views
pankajprasad100
Contributor III

Hello @davidtosenovjan 

How to call function from RAM?

 

 

Thanks & Regards

Pankaj Prasad

0 Kudos
Reply

3,795 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Easiest way it is just execute Debug_RAM target (if S32DS used), if runs the code from SRAM. Or you create new memory segment/section in the linker file and use an attribute before C function declaration to relocated selected function to RAM 

__attribute__ ((section(".MyRamCode"))) // place the code below into .MyRamCode section
void EraseAndProgram(void);

0 Kudos
Reply

3,788 Views
pankajprasad100
Contributor III

Since we are using IAR compiler, it will generate .icf file , so how can i  declare the 

__MY_RAM_ADR = ADDR (.MyRamCode);
  __MY_RAM_SIZE = SIZEOF (.MyRamCode);
  __MY_RAM_ROM_ADR = LOADADDR (.MyRamCode);

 

if you have any demo .icf file, please share to us.

 

Thanks & Regards 

PANKAJ PRASAD 

0 Kudos
Reply

3,761 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

You may see example for design studio, where linker command file is modified this way:

https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K144-Flash-RW-simple/ta-p/1110000

 

For IAR, please consult with IAR documentation or support. Thanks

 

0 Kudos
Reply

3,241 Views
ganeshvaka2
Contributor II

Hello @davidtosenovjan 

we are facing issue with s32k116 ,while trying to erase memory from RAM using API: EraseAndProgram .

Programming terminated with SIGINT Interrupt 

Please find the attached Debugging Console Screenshot 

ganeshvaka2_0-1643697514756.png


Please find flash.ld file 

Thank you 

 

0 Kudos
Reply

3,917 Views
ganeshvaka2
Contributor II

Yes 

0 Kudos
Reply

3,877 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

What is value of 'add' at that moment? Could you check in assembler window if code runs for SRAM to be completely sure?

0 Kudos
Reply