Emulated EEPROM

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I know the flash in PSoC 4 is emulated as EEPROM, which block of Flash is emaulated as EEPROM?

   

Is it is configurable as in PSoC 1 ? I would like to have the last block of EEPROM to be emaulated as EEPROM.

   

Thanks,

   

-Anandh

0 Likes
9 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Its not configurable same way as PSOC 1, however you could always

   

use the example project and look at the map file to determine where it

   

was placed.

   

 

   

Alternatively just use the low level FLASH write functions and a pointer

   

and set your own location. There is a whole section in the TRM discussing

   

the interface/read/write to NVM.

   

 

   

Regards, Dana.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

The EEEProm is quite easy to use: you just define an area of memory in flash (using the "const" directive) and give the address and size of the area to the write-function. The Emulated EEProm usermodule has no configurable parameters, everything is done via the APIs.

   

 

   

Bob 

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Bob is correct I think, if you want an absolute address

   

location for EEPROM you would have to use pointer only for GCC

   

on to effect array it to an absolute address.

   

 

   

Different ARM compilers handle this differently.

   

 

   

www.keil.com/support/docs/2829.htm     GCC, Realview

   

 

   

www.cypress.com/      Keil ARM

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Question for Bob.

   

 

   

Using pointer approach, is compile smart enough to keep track

   

of all the absolute addresses used ? To know how much memory

   

to set aside for EEPROM use, and where it is so it does not map

   

over the EEPROM with other stuff ?

   

 

   

I am not so sure now just using a pointer will work. I still think one

   

still needs to set aside memory needed with an absolute directive.

   

 

   

Your thoughts ?

   

 

   

Regards, Dana.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Dana,

   

for the sake of my so much propagated "Readability" I would always use a different approach.

   

something like

   

#define EEEPROMSIZE 1001

   

const uint8 EEEPromArea[EEEPROMSIZE];

   

 

   

or

   

 

   

const struct sMyEEEProm { uint8 IsProgrammed; uint8 Data[EEPROMSIZE];} MyEEEProm;

   

and later using in the code

   

 

   

Result = EEEProm_Write(MyData,EEEPromArea,EEEPROMSIZE);

   

or

   

Result = EEEProm_Write(MyData,(uint8 *)(& struct sMyEEEProm),sizeof(struct sMyEEEProm));

   

 

   

This way even arrays of a struct are possible with writes to a single element within a certain struct can be performed.

   

With freedom comes responsibility: DO NOT OVERWRITE YOUR CODE!!!

   

 

   

Bob (Hoping for only few typos)

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

What suddenly brings to my mind the "problem" of self-modifying code. I do not like the thought of that

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Of course this approach still does not force the EEPROM to

   

the last addresses in FLASH memory as originally stated

   

as a goal.

   

 

   

Regards, Dana.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Of course (or rather "curse" ) you may assign *ANY* hex value to a pointer.

   

Having an end-of-flash which would be

   

#define MY_FLASH_END CY_FLASH_BASE + CY_FLASH_SIZE

   

one could easily calculate the location of an EEEPROM_START when the size is know and assigning that calculated address to a pointer of a structure that organizes the EEEProm-area.

   

This will be target and compiler independent as long as one adjusts the #defines for flash start and size.

   

 

   

Bob

Hi, I´m a
beginner with the Psoc4.

I´m using a 4146AZI-s423 and the Em EEPROM marks it as incompatible component, but I think if I copy the generated source code, may be used it.

My question are how to use with relative directions and how to make to “force” the emulated eeprom to start at the end of the code, for example.

How can I read these address?

Example:

User_data, struct of 5 bytes in RAM  stored in a space of Em_eeprom----0x00---0x0F

User_config, struct of 4 bytes in RAM stored in a space reserved Em_eeprom ---0x10----0x1F

0x0000

.

Code

.

0x01fff

------------------

0x02000

.

Reserved Emulated eemprom:

    0x2000-0x200F: User data

                0x2010-0x201F: User Config

.

.

0x02fff

-------------------

Thanks.

0 Likes