Copy flash drivers from ROM to RAM

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

Copy flash drivers from ROM to RAM

1,241 Views
ponnitresa_kuri
Contributor III

Hi

I am using c55 flash libraries  for my controlller s32r274.So inorder to perform flash erase and write 

I need to copy flash libraries from ROM to RAM

for this i used linker script using ld file

MEMORY

{
RAM_FLASHCODE : org = 0x40010400, len = 32K
}

SECTIONS
{

/* Flash code load in RAM*/
.flashlib : {} > RAM_FLASHCODE

}

After compilation i am able to see flash libraries in RAM location.

pastedImage_1.png

But after flashing the code to ECU and during test it is not working

During flash init ,the control is moved to RAM,but its not executing.

pastedImage_3.png

So i need to know if i need to add some extra code during start up to execute from RAM?

Labels (1)
Tags (1)
5 Replies

1,086 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

there's simpler option which I usually use. The C-arrays are defined like this:

pastedImage_8.png

If you delete the "const", it won't be constant in flash but it will be automatically copied to RAM by startup files as initialized array.

Regards,

Lukas

1,086 Views
ponnitresa_kuri
Contributor III

Actually my source code is executing from address 0x00FD0000, and i need to erase sector 0x00FF0000.

   i moved all C55 flash libraries to RAM area and during erase operation flash libraries get executed from RAM area.

      But when i am trying to sector 0x00FF0000,the control goes to exception handlers.

But if i move my application code to sector 0x00FB0000 and try to erase sector 0x00FF0000,It is  working properly.

Can anyone tell me if erase operation cannot be performed if source code is running in same bank.

1,086 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

have you tried to disable interrupts? If you need to handle interrupts also during flash operations, it’s necessary to move all resources (interrupt vector table, interrupt handlers…) to RAM or to another partition too.

Also notice that the drivers are asynchronous. That means that FlashErase function just starts the erase operation. Then FlashCheckStatus function should be used to check if the operation has been already finished. Obviously, this code which calls FlashCheckStatus function must be also placed in RAM or in different partition.

Regards,

Lukas

1,086 Views
ponnitresa_kuri
Contributor III

Hi Mr.Lukas

   You are right ,Due to external watchdog there is interrupt for supporting watchdog refreshing functionality.

I have already moved FlashCheckStatus to RAM area.

   But when i try to remove interrupt vector table to RAM area ,its giving me error during execution.

Due you know the reason?

1,086 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

I can't really say, this would require more debugging. I would try to put a breakpoint to IVOR4 handler and then step the code to see why it fails.

Regards,

Lukas