cancel
Showing results for 
Search instead for 
Did you mean: 

How to arrange the variables at EEPROM using COSMIC ?

jeffrey23
Associate II
Posted on May 14, 2010 at 10:06

How to arrange the variables at EEPROM using COSMIC ?

5 REPLIES 5
luca239955_stm1_st
Senior II
Posted on May 17, 2011 at 15:08

@eeprom tEGD tsEGD;

@eeprom tEYD tsEYD;

Regards,

Luca (Cosmic)

jeffrey23
Associate II
Posted on May 17, 2011 at 15:08

Hi Luca,

I tried to declare the variables as you mentioned.

But I got some error messages as attachment.

#error clnk Debug\A101VW01.lkf:1 symbol _FLASH_CR2 not defined ((C:\Program Files (x86)\COSMIC\CXSTM8_16K\Lib\libm0.sm8)eepstr.o (C:\Program Files (x86)\COSMIC\CXSTM8_16K\Lib\libm0.sm8)eeprom.o (C:\Program Files (x86)\COSMIC\CXSTM8_16K\Lib\libm0.sm8)eepwrp.o )

#error clnk Debug\A101VW01.lkf:1 symbol _FLASH_NCR2 not defined ((C:\Program Files (x86)\COSMIC\CXSTM8_16K\Lib\libm0.sm8)eepstr.o (C:\Program Files (x86)\COSMIC\CXSTM8_16K\Lib\libm0.sm8)eeprom.o (C:\Program Files (x86)\COSMIC\CXSTM8_16K\Lib\libm0.sm8)eepwrp.o )

#error clnk Debug\A101VW01.lkf:1 symbol _FLASH_IAPSR not defined ((C:\Program Files (x86)\COSMIC\CXSTM8_16K\Lib\libm0.sm8)eepstr.o (C:\Program Files (x86)\COSMIC\CXSTM8_16K\Lib\libm0.sm8)eeprom.o (C:\Program Files (x86)\COSMIC\CXSTM8_16K\Lib\libm0.sm8)eepwrp.o

Regards,

Boltnut 

B.Montanari
ST Employee
Posted on May 17, 2011 at 15:08

Hi Boltnut,

On your main.c (or any used header) declare this:

/*    FLASH section

 */

volatile char FLASH_CR1     @0x505a;    /* Flash Control Register 1 */

volatile char FLASH_CR2     @0x505b;    /* Flash Control Register 2 */

volatile char FLASH_NCR2    @0x505c;    /* Flash Complementary Control Reg 2 */

volatile char FLASH_FPR     @0x505d;    /* Flash Protection reg */

volatile char FLASH_NFPR    @0x505e;    /* Flash Complementary Protection reg */

volatile char FLASH_IAPSR   @0x505f;    /* Flash in-appl Prog. Status reg */

volatile char FLASH_PUKR    @0x5062;    /* Flash Program memory unprotection reg */

volatile char FLASH_DUKR    @0x5064;    /* Data EEPROM unprotection reg */

This should solve your problem

Regards,

Bruno

jeffrey23
Associate II
Posted on May 17, 2011 at 15:08

Hi Bruno,

Thanks for your help. It fixed my linkage issue.

jeffrey23
Associate II
Posted on May 17, 2011 at 15:08

Hi Bruno,

As you suggested, I tried to add the FLASH section for solving the linker issue.

Unfortunately, its behavior is wrong even linkage issue was fixed.

Could you give me more suggestion ?

Therefore I changed back original declartion. It can work fine.

EXTERN tEGD tsEGD   @0x4000;

EXTERN tEYD tsEYD   @0x4020;

            /* Unlock Data memory */

            FLASH_Unlock(FLASH_MEMTYPE_DATA);

            if (fDown)

            {

                if (tsEGD.bBrightness > BRIGHTNESS_MIN)

                    tsEGD.bBrightness--;

            }

            else

            {

                if (tsEGD.bBrightness < BRIGHTNESS_MAX)

                    tsEGD.bBrightness++;

            }

            /* Lock Data memory */

            FLASH_Lock(FLASH_MEMTYPE_DATA);