mpc564xc flash_init crash with C90LC c_aray

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

mpc564xc flash_init crash with C90LC c_aray

3,619 Views
xiujuantang
Contributor II

Hi, guys

 

We met a problem with flash driver integration, when calling flash_init an invalid interrupt is generated, and we do not know why it happens. Functions are properly copied into RAM. What can be the cause? Initialization data not good, or board setting about frequency or something maybe wrong? Thanks in advance for you kindly support.

Labels (1)
18 Replies

2,844 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

do you use this driver?

http://www.nxp.com/files/soft_dev_tools/software/device_drivers/MPC56XX_C90LC_JDP_SSD_100_DEVD.exe

Which exception was triggered? When you step the asm code, does it jump to beginning of the FlashInit, at least?

Do you use BOOKE or VLE project/driver?

Lukas

2,844 Views
xiujuantang
Contributor II

Hi, Lukas

I was using the MPC56XX_C90LC_JDP_SSD_100_DEVD.EXE

Driver used is in this folder:

\xPC56xx_C90LC\Driver\diab\vle\c-array_driver

I do not quite understand what this means in the release note:

Drivers released in binary c-array format to provide compiler-independent support for non-debug-mode embedded applications.

When I debug with lauterbar, after calling (void)pFlashInit( &m_flashSsdConfig );

Interrupt happens.

It jump to FlashInit, and then problem I think.

Something in the stackframe:

...

exception

SV:0X4001F104(asm)

0x4001f104 is the start address of FlashInit.

Is there some constraint that may cause the crash just after jump to the driver init function?

0 Kudos

2,844 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Could you share your project? It would be much faster...

Lukas

0 Kudos

2,842 Views
xiujuantang
Contributor II

This is the config pass to FlashInit, I’m not sure if bad param can cause a interrupt.

0 Kudos

2,840 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

attached is my test project (don't care about the test cases at the end of main.c, I just want to show how to use the drivers). As you can see, all you need to do is:

Include files:

#include  "ssd_types.h"

#include  "ssd_c90fl.h"

Assign function pointers:

extern const unsigned int FlashInit_C[];

extern const unsigned int FlashErase_C[];

extern const unsigned int BlankCheck_C[];

extern const unsigned int FlashProgram_C[];

extern const unsigned int ProgramVerify_C[];

extern const unsigned int CheckSum_C[];

extern const unsigned int GetLock_C[];

extern const unsigned int SetLock_C[];

extern const unsigned int FlashECCLogicCheck_C[];

extern const unsigned int FlashArrayIntegrityCheck_C[];

/* Assign function pointers */

pFLASHINIT    pFlashInit    = (pFLASHINIT)    FlashInit_C;

pFLASHERASE    pFlashErase    = (pFLASHERASE)    FlashErase_C;

pBLANKCHECK    pBlankCheck    = (pBLANKCHECK)    BlankCheck_C;

pFLASHPROGRAM  pFlashProgram  = (pFLASHPROGRAM)  FlashProgram_C;

pPROGRAMVERIFY pProgramVerify = (pPROGRAMVERIFY) ProgramVerify_C;

pCHECKSUM      pCheckSum      = (pCHECKSUM)      CheckSum_C;

pGETLOCK      pGetLock      = (pGETLOCK)      GetLock_C;

pSETLOCK      pSetLock      = (pSETLOCK)      SetLock_C;

pFLASHECCLOGICCHECK pFlashECCLogicCheck = (pFLASHECCLOGICCHECK) FlashECCLogicCheck_C;

pFLASHARRAYINTEGRITYCHECK pFlashAISC = (pFLASHARRAYINTEGRITYCHECK) FlashArrayIntegrityCheck_C;

Define ssdConfig structures for flash blocks:

/* C0Flash */

SSD_CONFIG ssdConfig = {

    C0_REG_BASE,            /* Flash control register base */

    C0_ARRAY_BASE,          /* base of main array */

    0,                      /* size of main array */

    SHADOW_ROW_BASE,        /* base of shadow row */

    SHADOW_ROW_SIZE,        /* size of shadow row */

    0,                      /* block number in low address space */

    0,                      /* block number in middle address space */

    0,                      /* block number in high address space */

    FLASH_PAGE_SIZE,        /* flash page size selection */

    FALSE                  /* debug mode selection */

};

/* C1Flash */

SSD_CONFIG ssdC1Config = {

    C1_REG_BASE,            /* Flash control register base */

    C1_ARRAY_BASE,          /* base of main array */

    0,                      /* size of main array */

    0,                      /* base of shadow row. Not available on C1Flash */

    0,                      /* size of shadow row. Not available on C1Flash */

    0,                      /* block number in low address space */

    0,                      /* block number in middle address space */

    0,                      /* block number in high address space */

    FLASH_PAGE_SIZE,        /* flash page size selection */

    FALSE                  /* debug mode selection */

};

And call FlashInit:

returnCode = pFlashInit( &ssdConfig );

Are you sure your project is VLE?

Lukas

0 Kudos

2,838 Views
xiujuantang
Contributor II

Hi, Lukas

Some new information for you. With lauterbar I step into Flashinit, see 0x4001F104 in the picture, start of the FlashInit in c_array.

I do not understand why the first 2 instruction are undef, a next step will be exception, some unexpected interrupt.

Another question is :

I mentioned before to you that I do not understand the following feature in the document,

Drivers released in binary c-array format to provide compiler-independent support for non-debug-mode embedded applications.

Drivers released in s-record format to provide compiler-independent support for debug-mode/JTAG programming tools.

I am debugging with lauterbar, so I should not use c-array? Is there link to the problem?

Br

Xiujuan

0 Kudos

2,835 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

could you take screenshot of your MMU settings like below? It looks like there's conflict VLE vs. BOOKE.

pastedImage_0.png

Yes, you can use c-array. C-array can be added to any project. The code is already compiled, so it ensures that there are no issues related to different compilers.

Lukas

0 Kudos

2,835 Views
xiujuantang
Contributor II

Hi, Lukas

I also need to integrate C55 lib on mpc577kn, for set MMU as vle, is there any difference with mpc564xc? There’s an link issue with C55 lib because of the __sync intrinsic function is seen not defined symbol so I can not start working on it but this job is quite urgent and I should consider the VLE before starting.

Thanks and Br

Xiujuan

0 Kudos

2,836 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

in case of MPC5646C, only one 4KB MMU page is created after reset. The VLE bit in RCHW says if the page is VLE or BOOKE. The rest is a matter of software. It's up to you how the MMU is initialized. If you have VLE application and if you want to execute VLE code from RAM, then configure MMU page for RAM as VLE. Attached is excel tool that helps to generate initialization code.

Almost all MPC57xx are VLE only and there's no MMU. The different one is MPC5777C.

Lukas

0 Kudos

2,837 Views
xiujuantang
Contributor II

Hello, Lukas

The last problem is solved by a clean and rebuild.

Br,

Xiujuan

0 Kudos

2,836 Views
xiujuantang
Contributor II

Hi, Lukas

A new problem on C55 flash library integrating.

I do not know why the instruction is not well translated, see the picture, 0x4001f0f6,

3000 is end of FlashErase and 1821 is start of FlashInit, and they are translated as one instruction.

Do you have any idea?

Br

Xiujuan

0 Kudos

2,836 Views
xiujuantang
Contributor II

OK, thanks a lot for your effort on this issue.

Br

Xiujuan

0 Kudos

2,837 Views
xiujuantang
Contributor II

Hi, Lukas

Finally I found this part of code in the demo you sent to me (also from the community you sent someone a tool that generate this part of code). And it works. So since we want a whole vle application, I do not know why the flash is vle, but ram not, so this part of code is mandatory to set mmu as vle?

lis r3, 0x1001

mtMAS0 r3

lis r3,0xC000

ori r3, r3, 0x0380

mtMAS1 r3

lis r3, 0x4000

ori r3, r3, 0x0028

mtMAS2 r3

lis r3, 0x4000

ori r3, r3, 0x003F

mtMAS3 r3

tlbwe

isync

Br

Xiujuan

0 Kudos

2,837 Views
xiujuantang
Contributor II

Hi, Lukas

I read some document about how to manage vle, but unfortunately it’s not easy for me to find a good way, I check my RCHW, vle = 1, then by default I thought all memory should be vle, but it’s not this case, now only flash is vle, and flash driver copied from flash to ram.

I also check MAS2 register, but not sure if I need to manage this register for my issue.

Our application is vle only, not mix mode, hope you can give us a solution that make flash driver works as soon as possible.

Thanks and Br

Xiujuan

0 Kudos

2,835 Views
xiujuantang
Contributor II

Hi, Lukas

Maybe that’s the cause, in my mmu setting I saw only rom is VLE, but ram area that contains driver code is not vle.

I will see if setting the ram vel will sovle the problem and let you know.

Br

Xiujuan

0 Kudos

2,835 Views
xiujuantang
Contributor II

Hi, Lukas

I will have an analyze of your demo, but to be faster it will be better you can add my skype and I share my desktop to you then you can see my project.

You can find me by my email address Xiujuan.tang@elektrobit.com<mailto:Xiujuan.tang@elektrobit.com>

Br

Xiujuan

0 Kudos

2,836 Views
xiujuantang
Contributor II

The interrupt goes inside the 5th entry of the interrupt table.

0 Kudos

2,836 Views
xiujuantang
Contributor II

Sorry I think it’s not allowed, the project is part of our product.

From my understanding it seems not code issue, is there anything you think that I can check? I can send you information.

DisableFlashCache is not called in the project, I do not know if it’s mandatory.

0 Kudos