cancel
Showing results for 
Search instead for 
Did you mean: 

how can I save 2 bytes in eeprom using c

apytel1
Associate II
Posted on July 18, 2007 at 15:47

how can I save 2 bytes in eeprom using c

16 REPLIES 16
apytel1
Associate II
Posted on November 16, 2006 at 08:12

Hello

I use st7flite09 and stvd3 and cosmic c.

I want to store two bytes in eeprom.

How can I do it?

I wrote in main.c:

@eeprom char var1;

@eeprom char var2;

and I became error:

#error clnk Debug\sw-dimm.lkf:1 no default placement for segment .eeprom

How can I fix it?

Please help me.

luca239955_st
Associate III
Posted on November 16, 2006 at 12:52

you must tell the linker where it must put the linker file. This is done by adding a line like

+seg .eeprom -b0x0C00 -c

in your .lkf

Regards,

Luca (Cosmic)

apytel1
Associate II
Posted on November 17, 2006 at 05:09

Thanks Luca

I try it and no luck. I write 0x1000 (first byte in eeprom) no luck.

I have question: how can I modify *.lkf file? It is done by linker.

This is my first step in st7 and c language ( befor I write only assemler for family '51)and I can't find solution for this problem.

I must write something in main.c and then linker modify *.lkf?

luca239955_st
Associate III
Posted on November 20, 2006 at 12:24

the linker file is read by the linker. It is a plain text file that you can modify with any editor. If you use STVD7, the linker file is generated automatically: either you use STVD7 menu until the linker file looks like you want, or you choose the option to edit it by habd.

Whatever way, once you have a line in your linker file like I explained in my first anwer, you are ready to go.

Regards,

Luca

apytel1
Associate II
Posted on November 22, 2006 at 04:58

it's immposible!

I wrote extra line like you said me: +seg .eeprom _b 0x1000 -c in *.lkf file.But when I try to start ''build'' function in STVD7 *.lkf file is automaticaly overwrite and my line is deleted.

I write my program in STVD 7 , maybe I must change anything in options (but I don't know where).

peterwrigley9
Associate II
Posted on November 24, 2006 at 12:06

In Project->Settings->Linker->Input, untick the 'auto' box beside the 'Script Lkf file name' text box.

You will then need to re-write the linker file with the extra segment locator (i.e. go back and add +seg .eeprom _b 0x1000 -c).

gavin1
Associate II
Posted on December 07, 2006 at 11:09

I believe I might have similar problems to above. My application only works when I don't use certain I/O ports. Is there any documentation for editing the linker file. Can't find any in the IDEA help... I assume that the linker documentation is what I'm seeking.

peterwrigley9
Associate II
Posted on December 07, 2006 at 11:18

The linker doesn't know about I/O ports, only memory addresses. What is the error you are having?

luca239955_st
Associate III
Posted on December 07, 2006 at 13:44

the linker documentation is actually a chapter of the compiler manual. This manual is installed with every compiler, or you can find it

http://www.cosmic-software.com/downloads/docs/cxst7.zip

Regards,

Luca (Cosmic)