Simulated EEPROM and __attribute__ ((space(),section()))

This conference allows discussion on any subject not already covered in another PICmicro conference. If a topic becomes popular enough, a new conference will be created for it.

Simulated EEPROM and __attribute__ ((space(),section()))

Postby JuanjoAlm » Thu Aug 13, 2020 4:43 pm

Im being introduced in a still developing project. The point is that they save a serial doing this:

Code: Select all
__prog__ char SERIAL[X]  __attribute__ ((space(XXX),section("XXX")));


And some settings using AN1095 (Emulating Data EEPROM).

¿What is the difference?
JuanjoAlm
 
Posts: 4
Joined: Thu Aug 13, 2020 4:33 pm
PIC experience: Professional 1+ years with MCHP products

Re: Simulated EEPROM and __attribute__ ((space(),section()))

Postby ric » Thu Aug 13, 2020 9:54 pm

What C compiler are you using?
What family of PIC devices?
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 581
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products

Re: Simulated EEPROM and __attribute__ ((space(),section()))

Postby jtemples » Fri Aug 14, 2020 9:00 pm

Given AN1095 and the use of __prog__ I'm guessing it's a PIC24 and XC16.

The declaration places the serial number at a specific address, and it will be part of the hex file that is programmed into the PIC rather than being written at run time.

AN1095 is a library that lets you write to flash at run time, simulating EEPROM on parts that don't have it (most PIC24s don't).
jtemples
Verified identity
 
Posts: 195
Joined: Sun May 25, 2014 2:23 am
Location: The 805
PIC experience: Professional 5+ years with MCHP products

Re: Simulated EEPROM and __attribute__ ((space(),section()))

Postby JuanjoAlm » Mon Aug 17, 2020 5:43 pm

Oh, thanks for the info!

Just one last question:

Why should I use a simulated library with a pic24fj512 wheter the program memory has a 10.000 erase/write cycle endurance? If my program just modifies that memory once a day.

Thanks for all!
JuanjoAlm
 
Posts: 4
Joined: Thu Aug 13, 2020 4:33 pm
PIC experience: Professional 1+ years with MCHP products

Re: Simulated EEPROM and __attribute__ ((space(),section()))

Postby jtemples » Mon Aug 17, 2020 7:03 pm

The library is just for convenience, saving you from having to write and test flash write routines.
Last edited by jtemples on Tue Aug 18, 2020 5:16 am, edited 1 time in total.
jtemples
Verified identity
 
Posts: 195
Joined: Sun May 25, 2014 2:23 am
Location: The 805
PIC experience: Professional 5+ years with MCHP products

Re: Simulated EEPROM and __attribute__ ((space(),section()))

Postby AussieSusan » Tue Aug 18, 2020 3:36 am

The (relatively) low erase/write cycle count in one reason why using the FLASH as EEPROM is probably not a good idea unless you really know what you are doing.
In general it is easier to get an external EEPROM and use that - they typically have erase/write cycle counts in the millions.
Also, depending on the amount of data you need to save and the write page size, there can be various techniques that let you erase a block and then write multiple times within that block which helps to extend the life of the EEPROM.
Susan
AussieSusan
Verified identity
 
Posts: 137
Joined: Mon Jun 16, 2014 4:45 am
PIC experience: Experienced Hobbyist


Return to Other PICmicro topics

Who is online

Users browsing this forum: No registered users and 3 guests