Placing Data Objects in EEPROM

Started by bernd71093 November 22, 2005
Hi experts,

I want to access data in the EEPROM space 0xC00. The target is the
S12XDP512. The compiler I use is called Cosmic v4.6.

The EEPROM space definition in the linkfile looks like:
=========================================================
+seg .eeprom -b 0xC00 -o 0x13FC00 -m 1024
var_eeprom.o //my file with the eeprom data //(-b: logic adr.; -o:
memory adr.; -m 1k size) The var_eeprom.c file:
======================
@eeprom char warm_start; // EEPROM variable definition

The main.c file:
===================
extern char warm_start;
...
main{
...
warm_start++; // doing something with the eeprom data
...
} PROBLEM:
There is no access to variable "warm_start" (no read and write is
possible. The value is always the same!?!

Thanks for your support!!

Bernd


Bernd,

You need to make sure your code (or the compiler initialization) is
initializing the ECLKDIV - EEPROM Clock Divider Register to the appropriate
divide value, so the EEPROM erasing and programming algorithms work well.
The appropriate ECLKDIV register setting depends on clock frequency, so the
Compiler probably needs you to specify it explicitly.

Hope this helps,
Doron
Nohau
HC12 In-Circuit Emulators
www.nohau.com/emul12pc.html

At 15:51 22/11/2005 +0000, you wrote:
>Hi experts,
>
>I want to access data in the EEPROM space 0xC00. The target is the
>S12XDP512. The compiler I use is called Cosmic v4.6.
>
>The EEPROM space definition in the linkfile looks like:
>=========================================================
>+seg .eeprom -b 0xC00 -o 0x13FC00 -m 1024
>var_eeprom.o //my file with the eeprom data //(-b: logic adr.; -o:
>memory adr.; -m 1k size) >The var_eeprom.c file:
>======================
>@eeprom char warm_start; // EEPROM variable definition
>
>The main.c file:
>===================
>extern char warm_start;
>...
>main{
>...
>warm_start++; // doing something with the eeprom data
>...
>} >PROBLEM:
>There is no access to variable "warm_start" (no read and write is
>possible. The value is always the same!?!
>
>Thanks for your support!!
>
>Bernd




Hi,

The -b and -o values are inverted. -b is the physical address and matches
the global S12X address, and -o is the logical address.

You also need the @eeprom modifier on the extern declaration in your main.c
file.

Regards,
Jean-Pierre Lavandier -----Message d'origine-----
De : bernd71093 [mailto:bernd71093@bern...]
Envoy: mardi 22 novembre 2005 16:52
: 68HC12@68HC...
Objet : [68HC12] Placing Data Objects in EEPROM Hi experts,

I want to access data in the EEPROM space 0xC00. The target is the
S12XDP512. The compiler I use is called Cosmic v4.6.

The EEPROM space definition in the linkfile looks like:
=========================================================
+seg .eeprom -b 0xC00 -o 0x13FC00 -m 1024
var_eeprom.o //my file with the eeprom data //(-b: logic adr.; -o:
memory adr.; -m 1k size) The var_eeprom.c file:
======================
@eeprom char warm_start; // EEPROM variable definition

The main.c file:
===================
extern char warm_start;
...
main{
...
warm_start++; // doing something with the eeprom data
...
} PROBLEM:
There is no access to variable "warm_start" (no read and write is
possible. The value is always the same!?!

Thanks for your support!!

Bernd

SPONSORED LINKS
Freescale
<http://groups.yahoo.com/gads?t=ms&k=Freescale+semiconductor+inc&w1=Freescal
e+semiconductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+micr
oprocessor&c=4&s6&.sig=K2HGv-zFlv5OYUv_QxIq_Q> semiconductor inc
Microcontrollers
<http://groups.yahoo.com/gads?t=ms&k=Microcontrollers&w1=Freescale+semicondu
ctor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microprocessor&
c=4&s6&.sig=SYHwNJjjGQXRvtt_GybT4g> Pic
<http://groups.yahoo.com/gads?t=ms&k=Pic+microcontrollers&w1=Freescale+semic
onductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microproces
sor&c=4&s6&.sig=umVbbnUwsPzEzKKD_pQfUw> microcontrollers
8051
<http://groups.yahoo.com/gads?t=ms&k51+microprocessor&w1=Freescale+semico
nductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microprocess
or&c=4&s6&.sig=NO-nSKjHoAlh9XtZ8LB1_A> microprocessor

_____

> .


_____



Hello,

U r allocating ur EPROM space.I'd better suggest u go thru the manuals of the cosmic, and ur linker file. this is b'cos u will hav 2 see where u r placing ur uninitialised data. By dfault, it gets stored in the .bss section, ie ur RAM. so u won't be able to read the correct(desired )value of ur variable from EEPROM.

If u want to modify some variable, the variable which u r modifying shld be in RAM. U hav 2 modify ur linker file accordingly.

bernd71093 <bernd71093@bern...> wrote:
Hi experts,

I want to access data in the EEPROM space 0xC00. The target is the
S12XDP512. The compiler I use is called Cosmic v4.6.

The EEPROM space definition in the linkfile looks like:
=========================================================
+seg .eeprom -b 0xC00 -o 0x13FC00 -m 1024
var_eeprom.o //my file with the eeprom data //(-b: logic adr.; -o:
memory adr.; -m 1k size) The var_eeprom.c file:
======================
@eeprom char warm_start; // EEPROM variable definition

The main.c file:
===================
extern char warm_start;
...
main{
...
warm_start++; // doing something with the eeprom data
...
} PROBLEM:
There is no access to variable "warm_start" (no read and write is
possible. The value is always the same!?!

Thanks for your support!!

Bernd
SPONSORED LINKS
Freescale semiconductor inc Microcontrollers Pic microcontrollers 8051 microprocessor

---------------------------------
YAHOO! GROUPS LINKS ---------------------------------
---------------------------------
Yahoo! Music Unlimited - Access over 1 million songs. Try it free.