EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Cosmic: @eeprom doesn't work

Started by Klaus Kaiser July 30, 2003
Hello,
I use the IdeaCPU12 V2.10f from Cosmic. To store a character in the EEPROM
of a MC9S12DG256B, I defined a variable like this:

@eeprom char foo;

Accordinc to Cosmic docs, this should be enough to make the compiler insert
a call to a EEPROM writing function in place of each write access to that
variable. But actually, I can't write to foo. The value of foo just isn't
changed to the new value. When I initialize the variable, e.g.:

@eeprom char foo = 'A';

foo has actually the value 'A', but I can't assign a new value to it.

The ECLKDIV register is set correctly according to the "PRDIV8 and EDIV bits
Determination Procedure" in EETS4K Block User Guide V02.06, and the memory
map is unchanged from the default.

Has anyone of you used the EEPROM writing features of Cosmic successfully?

Regards,
Klaus



Klaus Kaiser wrote:

[@eeprom char foo;]

> Accordinc to Cosmic docs, this should be enough to make the compiler insert
> a call to a EEPROM writing function in place of each write access to that

did you check whether the compiler called c_eewrc by looking at the
assembler output?

Did you read the _whole_ doc about EEPROM support, especially the red
bordered "note" about the possible need for modification of eeprom.s?

Did you relocate the register block?

> Has anyone of you used the EEPROM writing features of Cosmic successfully?

certainly. Although one can doubt whether implicit EEPROM support is
a good thing or whether EEPROM write access should be done explicitly
by calling a write routine. But that's the decision of the user (I
like it!), not the compiler vendor.

Oliver

Ceterum censeo addresses shouldn't be hard coded in library
functions.
--
Oliver Betz, Muenchen


Hi,

For the HCS12 processors you need to link libe.h12 as the first library in
your link file as the EEPROM erase/programming algorithms of the HC12 and
HCS12 are different.

You also need to enable and configure the EEPROM in your program for your
system. For example

INITEE = 0x01; // Enable EEPROM and leave at reset
address
EPROT = 0x88; // Disable erase/write protection for
entire EEPROM
ESTAT |= 0x10; // Clear illegal EE access flag
(ACCERR) write a 0ne to clear ECLKDIV = 0x15; // 4 Mhz Ocillator
no PLL bus change
// ECLKDIV = 0x29; // 8 Mhz
Ocillator no PLL bus change
// ECLKDIV = 0x4A; // 16 Mhz
Ocillator no PLL bus change

We have a working HCS12 256K example with EEPROM that I can send to you off
list if you like.

Best Regards,
Mike at Cosmic Software -----Original Message-----
From: Klaus Kaiser [mailto:]
Sent: Wednesday, July 30, 2003 7:57 AM
To: '
Subject: [68HC12] Cosmic: @eeprom doesn't work Hello,
I use the IdeaCPU12 V2.10f from Cosmic. To store a character in the EEPROM
of a MC9S12DG256B, I defined a variable like this:

@eeprom char foo;

Accordinc to Cosmic docs, this should be enough to make the compiler insert
a call to a EEPROM writing function in place of each write access to that
variable. But actually, I can't write to foo. The value of foo just isn't
changed to the new value. When I initialize the variable, e.g.:

@eeprom char foo = 'A';

foo has actually the value 'A', but I can't assign a new value to it.

The ECLKDIV register is set correctly according to the "PRDIV8 and EDIV bits
Determination Procedure" in EETS4K Block User Guide V02.06, and the memory
map is unchanged from the default.

Has anyone of you used the EEPROM writing features of Cosmic successfully?

Regards,
Klaus

--------------------
">http://docs.yahoo.com/info/terms/



The 2024 Embedded Online Conference