cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to Use Flash Driver and EED together

Santhamurthy R
Associate II
Posted on March 31, 2017 at 08:54

Hello All,

I am working on SPC560B54L5 board using SPC5studio version 5.2.3.

Since the code for EED(EEPROM Emulation Driver) is not getting generated automatically in version 5.2.3, I updated the plugin for EED locally, shared in ST community

Now, if I am working only with EED component the application is working fine. But when I am trying to add both Flash and EED component together in the application, it is giving error as ''conflicting types for FlashInit()'', since the prototype of FlashInit() for both the drivers is same, please refer FlashInit() in eed_flash.h of EED component and ssd_c90fl.h of Flash component. It differs only with the formal argument.

In my application I should use both the EED and Flash components.I am attaching my test application and compilation error screenshot with this kindly check and provide your valuable suggestion for resolving the reported issue.

0690X00000606aKQAQ.png

Thanks in Advance

Regards,

R.Santhamurthy

Note: this post was migrated and contained many threaded conversations, some content may be missing.
8 REPLIES 8
Erwan YVIN
ST Employee
Posted on March 31, 2017 at 10:03

Hello ,

It is not a classic case.

Anyway , you can use the patch mode mecanism.

for the 'conflicting types for FlashInit()' you can patch these 2 files eed_flash.h of EED component and ssd_c90fl.h of Flash component to adapt the 2 structures or use a compilation switch.

A

 patch.xml will be created dedicated for your project and a decorator will be created for your component files.

you will be able Clean/Generate.

         Best regards

                      Erwan

Posted on March 31, 2017 at 11:26

Hi Erwan,

Patch mode is enabled and the corresponding patches and decorators are also generated but I am facing difficulty in building the application successfully. I am attaching the error message console screenshot below for your reference.

Kindly guide me in building the application successfully. 

0690X00000606UHQAY.png0690X00000606aeQAA.png0690X00000606dYQAQ.png

Thankyou

Regards,

R.Santhamurthy

Posted on April 03, 2017 at 10:28

Hello ,

Please Remove flash driver components

It is not recommended to use Flash drivers components and eeprom emulation driver.

Unplug the components Flash drivers and keep eeprom emulation driver.

anyway , you can use some unofficial source code with eeprom emulation driver.

https://community.st.com/0D70X000006SbEDSA0

 

  Best regards

         Erwan

Posted on April 05, 2017 at 07:35

Hi Erwan,

Thanks for your reply,

Actually we are writing two applications here one is bootloader and another one is actual application,updating the application area is done from bootloader so when our bootloader executes it will check for one location in EEPROM if that location is filled with value 1 ,then updating of application flash area  protocol will get executed ,we will be receiving application hex file data over a UART.when we integrated EEPROM and FLASH driver in bootloader application we are getting the 'conflicting types for FlashInit()' Error,If we remove Flash driver how we can write the hex file data in application area ,please suggest me with best solution so that i can fix this issue and complete my firmware upgrade application.

whatever code shared by you in above thread is writing to data flash,that to it is failing to write in some of the locations,when we use emulated EERPOM component we didn't face this issue.

Thanks in advance...

---

Thanks & Regards,

Santhamurthy

Posted on April 05, 2017 at 11:27

hello 

Santhamurthy ,

I have checked with expert.

You do not need to integrate Flash driver component when Emulated EEPROM component is set.

from the Emulated EEPROM Component you can access to the Flash Driver API.

Check the Demos applications associated and the document provided in EEPROM Emulation Driver.

Cf Chapter 6 (Flash Management API)

0690X00000606dUQAQ.png

   Best regards

             Erwan

Posted on April 17, 2017 at 15:16

Hi Erwan,

As per your above valuable suggestion, I am trying to use EED alone for both flash and EED.

However, the SPC560Bxx RLA EED Test application emulates first 2 blocks of D-flash for EED and the consequent two blocks for flash storage. But in my application I should also write into the C-Flash memory. so I updated the existing test application by adding C-flash sectorization and corresponding flashconfig structure.

Below are the changes made :

/************************************C-Flash sectorization in eed_flash.h*************************************/

/* Low space block 0 */

#define C_OFFSET_LOW_B0 0x0000 /* Offset of low block 0 */

#define C_LOW_B0_SIZE 0x8000 /* 32KB size */

/* Low space block 1 */

#define C_OFFSET_LOW_B1 0x8000 /* Offset of low block 1 */

#define C_LOW_B1_SIZE 0x4000 /* 16KB size */

/* Low space block 2 */

#define C_OFFSET_LOW_B2 0xC000 /* Offset of low block 2 */

#define C_LOW_B2_SIZE 0x4000 /* 16KB size */

/* Low space block 3 */

#define C_OFFSET_LOW_B3 0x10000 /* Offset of low block 3 */

#define C_LOW_B3_SIZE 0x8000 /* 32KB size */

/* Low space block 4 */

#define C_OFFSET_LOW_B4 0x18000 /* Offset of low block 4 */

#define C_LOW_B4_SIZE 0x8000 /* 32KB size */

/* Low space block 5 */

#define C_OFFSET_LOW_B5 0x20000 /* Offset of low block 5 */

#define C_LOW_B5_SIZE 0x20000 /* 128KB size */

/* Mid space block 6 */

#define C_OFFSET_MID_B6 0x40000 /* Offset of low block 6 */

#define C_MID_B6_SIZE 0x20000 /* 128KB size */

/* Mid space block 7 */

#define C_OFFSET_MID_B7 0x60000 /* Offset of low block 7 */

#define C_MID_B7_SIZE 0x20000 /* 128KB size */

/* High space block 8 */

#define C_OFFSET_HIGH_B8 0x80000 /* Offset of low block 8 */

#define C_HIGH_B8_SIZE 0x20000 /* 128KB size */

/* High space block 9 */

#define C_OFFSET_HIGH_B9 0xA0000 /* Offset of low block 9 */

#define C_HIGH_B9_SIZE 0x20000 /* 128KB size */

/* High space block A */

#define C_OFFSET_HIGH_BA 0xC0000 /* Offset of low block A */

#define C_HIGH_BA_SIZE 0x20000 /* 128KB size */

/* High space block B */

#define C_OFFSET_HIGH_BB 0xE0000 /* Offset of low block B */

#define C_HIGH_BB_SIZE 0x20000 /* 128KB size */

/* High space block C */

#define C_OFFSET_HIGH_BC 0x100000 /* Offset of low block C */

#define C_HIGH_BC_SIZE 0x20000 /* 128KB size */

/* High space block D */

#define C_OFFSET_HIGH_BD 0x120000 /* Offset of low block D */

#define C_HIGH_BD_SIZE 0x20000 /* 128KB size */

/* High space block E */

#define C_OFFSET_HIGH_BE 0x140000 /* Offset of low block E */

#define C_HIGH_BE_SIZE 0x20000 /* 128KB size */

/* High space block F */

#define C_OFFSET_HIGH_BF 0x160000 /* Offset of low block F */

#define C_HIGH_BF_SIZE 0x20000 /* 128KB size */

#define C_FLASH_ARRAY_SIZE 0x180000 /* 3x512KB C Flash total size */

/*************************flshconf structure in eed_cfg.c************************************************************/

EEPROM_CONFIG flashconf = {

16,

0,

0,

CFLASH_REG_BASE,

0,

0x00000000,

FLASH_START_ADDRESS,

#if defined(_SPC560Dxx_) || defined(_SPC560P34L1_) ||\

defined(_SPC560P34L3_) || defined(_SPC560P40L1_) ||\

defined(_SPC560P40L3_) || defined(_SPC56ECxx_)

TRUE /* Flash has 32 bit access */

#else

FALSE /* Flash has 64 bit access */

#endif

};

I am also attaching the application for your reference kindly check whether the changes highlighted will meet my requirements.

Looking forward for your valuable suggestion.

Regards,

R.Santhamurthy

________________

Attachments :

SPC560Bxx_RLA EE Test Application for Discovery.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyiX&d=%2Fa%2F0X0000000bBR%2FcEq4SJtfC30ILuEl615emRvf1ISNMP7R2qZn9fAi0RI&asPdf=false
Posted on April 25, 2017 at 16:53

Hello 

Santhamurthy,

If you want to write in CFLASH, you can try this.

Maybe, you should unlock CFLASH.

'If the selected main array blocks or the shadow row is locked for programming, those

blocks or the shadow row will not be programmed, and FlashProgram will still return

C90FL_OK. User needs to verify the programmed data with DataVerify API.'

be cautious,  you can have a conflict with your program. (application.ld)

   Best regards

                  Erwan

Posted on May 18, 2017 at 16:03

Hi Erwan,

I defined a flashconfig structure with C - flash start address as shown below. When I tried to initialize the flashconfig structure through 'FSL_InitEeprom(&flashconf, callback)' I am facing initialization error. Return value of FSL_InitEeprom() is 0x00000020 which refers 'EE_ERROR_WRITE_IN_PROGRESS'. But I am sure that I am not initiating write function before initializing C-flash memory sector in my code.

Also kindly clarify me how to unlock the locked and shadow memory by using the EED driver since there is no API found in the EED driver component for the same.

My requirement is to write 1kb of data into EPROM and to write more than 100kb of data into C-flash memory sector simultaneously. Since it is unable to use both EED and flash driver components together kindly suggest how could I cover the both by overcoming the limitations.

flashconfig structure:

EEPROM_CONFIG flashconf = {

16,

0,

0,

CFLASH_REG_BASE,

0,

0x00000000,

FLASH_START_ADDRESS,

#if defined(_SPC560Dxx_) || defined(_SPC560P34L1_) ||\

defined(_SPC560P34L3_) || defined(_SPC560P40L1_) ||\

defined(_SPC560P40L3_) || defined(_SPC56ECxx_)

TRUE /* Flash has 32 bit access */

#else

FALSE /* Flash has 64 bit access */

#endif

};

Redefined C-flash address Range

CFLASH_REG_BASE is 0xC3F88000

FLASH_START_ADDRESS is 0x00000000

Thanks in Advance

With Regards,

R.Santhamurthy