cancel
Showing results for 
Search instead for 
Did you mean: 

@eeprom

colin239955_st
Associate II
Posted on August 09, 2011 at 18:31

Anyone know how to use the @eeprom on the cosmic compiler

Does it suppot @eeprom vu32 EE_Total;

The above passed the complier but if I try to use it I get errors I've also tried char and int but none seem to work.

I want to read and write u23 u16 and u8 to EEPROM without having to worry about pointer etc there also seems to be a 4 byte structure.
8 REPLIES 8
luca239955_stm1_st
Senior II
Posted on August 09, 2011 at 21:34

It should work as you wrote it; what kind of errors do you get?

Also take a look at page 51 of the manual.

Regards,

Luca

colin239955_st
Associate II
Posted on August 11, 2011 at 14:45

This is the error I get below but only whan I try to use it in function that is in another file that's included into main.c

So I assume I have to declare it as external somewhere?

Running Linker

clnk -l''C:\Program Files\COSMIC\CXSTM8_32K\Lib'' -o Debug\light_sensor.sm8 -mDebug\light_sensor.map -eDebug\light_sensor.err -p Debug\light_sensor.lkf

errors reported in Debug\light_sensor.err

The command: ''clnk -l''C:\Program Files\COSMIC\CXSTM8_32K\Lib'' -o Debug\light_sensor.sm8 -mDebug\light_sensor.map -eDebug\light_sensor.err -p Debug\light_sensor.lkf '' has failed, the returned value is: 1

exit code=1.

colin239955_st
Associate II
Posted on August 11, 2011 at 15:11

No it doesn't work anyway even in main, even if I just load it with a number I get the same link error.

EE_totalPowerAcc = 0x00001201; /* */

 

colin239955_st
Associate II
Posted on August 11, 2011 at 17:18

I found if I complie just the main file it's ok

If I try to build the full project the linker fails.

This is the code it produced by compiling the main

; 384  FLASH_Unlock(FLASH_MEMTYPE_DATA);

3113  06fa a601           ld a,#1

3114  06fc cd0000         call _FLASH_Unlock

3116                     ; 386  ee_test = 0x12;

3118  06ff ae0012         ldw x,#18

3119  0702 89             pushw x

3120  0703 ae0000         ldw x,#_ee_test

3121  0706 cd0000         call c_eewrw

3123  0709 85             popw x

3124                     ; 388  EE_totalPowerAcc = totalPowerAcc.l;

3126  070a ae0048         ldw x,#_totalPowerAcc

3127  070d cd0000         call c_ltor

3129  0710 ae0004         ldw x,#_EE_totalPowerAcc

3130  0713 cd0000         call c_eewrl

3132                     ; 390  FLASH_Lock(FLASH_MEMTYPE_DATA);

3134  0716 a601           ld a,#1

3135  0718 cd0000         call _FLASH_Lock

from this 

 FLASH_Unlock(FLASH_MEMTYPE_DATA);

 ee_test = 0x12;

 

 EE_totalPowerAcc = totalPowerAcc.l;

 

 FLASH_Lock(FLASH_MEMTYPE_DATA); totalPowerAcc.l is a structure for a u32

luca239955_stm1_st
Senior II
Posted on August 12, 2011 at 16:45

the generated code looks ok, but I need more details to understand where the problem comes from: the exact error message from the linker (apparently STVD directs the linker to report this into a specific file) and possibly the source code for both files (if you are still trying with that configuration)

colin239955_st
Associate II
Posted on August 31, 2011 at 19:28

Look like the header is not seen

error clnk Debug\light_sensor.lkf:1 symbol _FLASH_CR2 not defined ((C:\Program Files\COSMIC\CXSTM8_32K\Lib\libm0.sm8)eepwrl.o (C:\Program Files\COSMIC\CXSTM8_32K\Lib\libm0.sm8)eeprom.o )

error clnk Debug\light_sensor.lkf:1 symbol _FLASH_NCR2 not defined ((C:\Program Files\COSMIC\CXSTM8_32K\Lib\libm0.sm8)eepwrl.o (C:\Program Files\COSMIC\CXSTM8_32K\Lib\libm0.sm8)eeprom.o )

error clnk Debug\light_sensor.lkf:1 symbol _FLASH_IAPSR not defined ((C:\Program Files\COSMIC\CXSTM8_32K\Lib\libm0.sm8)eepwrl.o (C:\Program Files\COSMIC\CXSTM8_32K\Lib\libm0.sm8)eeprom.o )

It seems that linker can not find the eeprom.i file also I'm having problems with the any of the lib file that use the assert_param() the compiler can't fimd the prototype and when I add it to my config file it give many ramdom error.

My experiance of this compiler and the ST part has been very poor thinking of droping the Cosmic compiler for sure I don't think I'll be purchasing it. 

/* Exported types ------------------------------------------------------------*/

/* Exported constants --------------------------------------------------------*/

/* Uncomment the line below to expanse the ''assert_param'' macro in the

   Standard Peripheral Library drivers code */

#define USE_FULL_ASSERT    (1)

/* Exported macro ------------------------------------------------------------*/

#ifdef  USE_FULL_ASSERT

/**

  * @brief  The assert_param macro is used for function's parameters check.

  * @param expr: If expr is false, it calls assert_failed function

  *   which reports the name of the source file and the source

  *   line number of the call that failed.

  *   If expr is true, it returns no value.

  * @retval : None

  */

#define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))

/* Exported functions ------------------------------------------------------- */

void assert_failed(uint8_t* file, uint32_t line);

#else

#define assert_param(expr) ((void)0)

#endif /* USE_FULL_ASSERT */

colin239955_st
Associate II
Posted on September 06, 2011 at 19:50

Stll not working anyone any ideas why the linker doesn't see the eeprom.i file?

ruben2399
Associate
Posted on September 03, 2012 at 12:10

Hi,

I am having the same problem.

Has this issue been resolved?