MPC5642A SSD_C90 Flash driver can ONLY write the Low-address flash blocks

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

MPC5642A SSD_C90 Flash driver can ONLY write the Low-address flash blocks

Jump to solution
1,073 Views
ZhouYiChuan
Contributor III


Dear NXP experts;
I have a bootloader baseline , it can flashing the Low/Middle/High MPC5642A Flash Blocks.
Unfortunately , it doesn't support UDS and was implemented based on CodeWarrior Version 10.5
I need to port it to S32 Design Studio and add UDS features.

Now, my issue is:
the SSD_C90 flash driver (copied from old bootloader) can ONLY write the Low-address flash blocks.
The write operation to Middle or High address flash block will return C90FL_ERROR_VERIFY
#define C90FL_ERROR_VERIFY 0x00000700 /* There is a mismatch between the source data and content in the checked flash memory */

My analysis is:
In old bootloader, the flash operation functions are allocated to RAM.
Or I didn't unlock the Middle and High Flash blocks?
but I copied the function InitFlashBlocks() at initialization phase (please refer to attached source codes)

But the blocking points for me are
1) don't know how to add RAM section into the 56xx_flash.ld (used by S32 Design studio)
The LCF file format used by CodeWarrior is different from the *.ld file format.

2) don't know how to make the Flash Erase/Write functions allocate to RAM
Can I follow the way in CodeWarrior like below?

__declspec(section ".myCodeInRAM") uint16_t WriteFlash(uint32_t dest,uint32_t size,uint32_t source)
{
uint32_t returnCode; /* Return code from each SSD function. */
returnCode = pFlashProgram( &ssdConfig, dest, size, source, (tpfNullCallback)NULL_CALLBACK );

if ( C90FL_OK != returnCode )
{
return (uint16_t)returnCode;
}
returnCode = pProgramVerify( &ssdConfig, dest, size, source, &failAddress1, &failData1, &failSource1, (tpfNullCallback)NULL_CALLBACK);
return (uint16_t)returnCode;
}

It very appreciated that if you can provide an example flash driver project under S32 Design Studio


Another small question is:
I S32 Design studio debug window, no variables can be added into the 'Variables' to watch it. No matter global variable or local variables.

Thank you in advance

YiChuan

================ following details can explain my problems better =====================
I create a small test project, receive command from CAN and execute erase, read and write flash. It send back the return value of SSD_C90 flash driver.

CANoe_log.PNG
It can be found if I try to write addr = 0x0004 0000 , the failure reason is 0x700 == C90FL_ERROR_VERIFY
And from debug window, the flash addr = 0x0004 00000 keep all 0xFF.

debug_window.png
I also attached the .lcf and main.c for CodwWarrior , for your reference.

Tags (2)
0 Kudos
1 Solution
1,048 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi YiChuan,

1. The easiest option is to delete 'const' in c-array drivers like this:

Change from:

const unsigned long FlashErase_C[] =
{

0x182106D0, 0x00801B01, 0x0910DD01, 0x480FC0E3, 0x7480063F,
0x67E0C0CE, 0xE603CCD3, 0xE802C1D3, 0x67BCE206, 0x67DCE607,

...

to:

unsigned long FlashErase_C[] =
{

0x182106D0, 0x00801B01, 0x0910DD01, 0x480FC0E3, 0x7480063F,
0x67E0C0CE, 0xE603CCD3, 0xE802C1D3, 0x67BCE206, 0x67DCE607,

...

Then the function is automatically copied to RAM by startup files and no other changes are needed.

2. Variables view show all static variables automatically. For global variables, it is necessary to use Expressions:

lukaszadrapa_0-1634298834360.png

Regards,

Lukas

View solution in original post

0 Kudos
3 Replies
1,070 Views
ZhouYiChuan
Contributor III

Dear NXP Experts:

The reason that 'Can't write Middle and High flash block' was found by me just now:
The middle and High Blocks are not unlocked. 

But still expect you can support me on these two issues:

1) how to make Flash driver function allocated to RAM

2) Can't add variables into watch window while debugging. 

 

thanks again and BR

YiChuan

0 Kudos
1,049 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi YiChuan,

1. The easiest option is to delete 'const' in c-array drivers like this:

Change from:

const unsigned long FlashErase_C[] =
{

0x182106D0, 0x00801B01, 0x0910DD01, 0x480FC0E3, 0x7480063F,
0x67E0C0CE, 0xE603CCD3, 0xE802C1D3, 0x67BCE206, 0x67DCE607,

...

to:

unsigned long FlashErase_C[] =
{

0x182106D0, 0x00801B01, 0x0910DD01, 0x480FC0E3, 0x7480063F,
0x67E0C0CE, 0xE603CCD3, 0xE802C1D3, 0x67BCE206, 0x67DCE607,

...

Then the function is automatically copied to RAM by startup files and no other changes are needed.

2. Variables view show all static variables automatically. For global variables, it is necessary to use Expressions:

lukaszadrapa_0-1634298834360.png

Regards,

Lukas

0 Kudos
1,040 Views
ZhouYiChuan
Contributor III

Dear Lukas:

Your quick and professional solution is very appreciated!!! 

thank you very much!

 

BR

YiChuan

0 Kudos