MPC5748 FlashErase IVOR1Trap using C55FG Flash Standard Software Driver

cancel
Showing results for 
Search instead for 
Did you mean: 

MPC5748 FlashErase IVOR1Trap using C55FG Flash Standard Software Driver

848 Views
sx
Contributor III

Hi I'm developing a bootloader for MPC5748G, and I found AN5319 on the official website days ago, so I decided to develop my bootloader based on it. Unfortunately when I erase the flash with the SSD driver, the bootloader will jump to IVOR1Trap. I checked the reference manual and realize that the reason might be read and write flash simultaneously at an same partition, but I'm still confused why there is no problem in AN5319.

My SSD driver was downloaded from this page:

https://www.nxp.com/webapp/sps/download/preDownload.jsp?render=true

It's different from AN5319, but I think they are just different versions, is that so?

And there are my code:  

init.PNG

erase.PNG

when midBlockSelect = 0x2f0, pFlashErase() worked well, but if midBlockSelect = 0x3F8, it jumped to IVOR1. When midBlockSelect = 0x3F8, blocks 0x00F90000--0x00F93FFF and  0x00FB0000--0x00FB7FFF are selected to be erased, but they are located in Read Parition 2 which contains my bootloader codes. That might cause the IVOR1Trap, but I'm not so sure about it.

And there are codes from AN5319:

init1.PNG

erase1.PNG

When lowBlockSelect = 0x17C, it will erase blocks  0x00FC0000--0x00FC7FFF,  0x00FC8000--0x00FCFFFF and  0x00FE0000--0x00FEFFFF in Read Partition 0 which contains block  0x00FC8000--0x00FCFFFF occupied by bootloader.

When midBlockSelect = 0x3FE, it will erase several blocks in Read Partition 2 which contains block 0x00F90000--0x00F93FFF  occupied by bootloader.

partition.PNG

So what's the real reason, please help me to find it, thanks! And forgive my poor English ^_^.

lukaszadrapa

Labels (1)
0 Kudos
5 Replies

511 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

I wrote in section 4.2 Flash programming in the application note:

"Used C-array drivers are defined as constants by default. C-array drivers are compiled as position independent and they can be copied to any location. We can either copy the drivers to RAM manually or we can simply re-define them as variables (just delete “const”) and they will be automatically copied to RAM by startup code."

If you open the c-array files which modify the flash, you will see:

pastedImage_8.png

Regards,

Lukas

0 Kudos

511 Views
sx
Contributor III

Hi Lukas, 

Actually I deleted all "const" in C-array drivers before I wrote my question in here, there are some codes:

flasherase.PNG

main.PNG

And according to your application note: 

1.PNG

I didn't move these functions and resources to RAM, so that should be the reason.

But next question is: How to move these functions and resources to RAM in S32DS?

Regards,

Su Xiong

0 Kudos

511 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

when you delete the "const", the arrays are going to be initialized variables, so they are automatically copied to RAM memory by startup files. When you reach the main function, you can check that it is already copied. You can find the addresses in map file.

Next question is - have you tried to disable interrupts?

Regards,

Lukas

0 Kudos

510 Views
sx
Contributor III

Hi Lukas, 

Thanks for your advice. I enabled LINFlexD_2's interrupts and PIT_Ch0's interrupt and didn't move them to RAM. I'm wondering how to do so in S32DS or whether I have to disable them. And what about the 'const' of IVORnTable and IntcIsrVectorTable?

Regards,

Su Xiong

0 Kudos

510 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

this could help:

https://community.nxp.com/docs/DOC-334030 

It's necessary to modify the linker file to move vector tables to RAM memory.

Regards,

Lukas

0 Kudos