9 Replies Latest reply on Jan 26, 2018 3:22 AM by CrVi_1101311

    Emulated EEPROM

      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.





        • 1. Re: Emulated EEPROM

          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.

          • 2. Re: Emulated EEPROM

            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.





            • 3. Re: Emulated EEPROM

              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.

              • 4. Re: Emulated EEPROM

                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.

                • 5. Re: Emulated EEPROM



                  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];








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


                  and later using in the code




                  Result = EEEProm_Write(MyData,EEEPromArea,EEEPROMSIZE);




                  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)

                  • 6. Re: Emulated EEPROM

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





                    • 7. Re: Emulated EEPROM

                      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.

                      • 8. Re: Emulated EEPROM

                        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.





                        1 of 1 people found this helpful
                        • 9. Re: Emulated EEPROM

                          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?



                          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










                          Reserved Emulated eemprom:

                              0x2000-0x200F: User data

                                          0x2010-0x201F: User Config