For the generic Linux SL products, there are different possibilities to support retain/persistent variables or persistent storage of information/variables.
"Classic" Retains:
1) Store Retains in File
2) Store Retains in special memory (e.g. SRAM / NVRAM...)
3) Store Retains in shared memory
Besides this, it is also possible to use other features of CODESYS to better fulfill your needs, as they provide a higher level of persistence that we highly recommend:
The runtime requires either a proper shutdown to stop the application and then stores the retain variables in a file, or you can also trigger the storage manually inside the IEC application via the IEC library "CmpApp" → "AppStoreRetainsInFile"
Pro:
Con:
Configuration:
Nothing to do, as this is the default!
You can configure the runtime via the cfg File (CODESYSControl.cfg) so that it directly uses a given memory (e.g. physically mapped).
Pro:
Con:
Configuration:
[CmpApp] RetainType.Application=InSRAM [CmpRetain] Retain.SRAM.Size=0x.... Retain.SRAM.AddressMapped= -> in case you have a mapped address or: Retain.SRAM.Address= -> in case you have a physical address |
You can configure the runtime via the cfg File (CODESYSControl.cfg) so that it uses a shared memory memory. Then you can easily adapt to whatever "real" retain storage you have.
See also the following help page:
Pro:
Con:
Configuration:
[CmpApp] RetainType.Application=InSHM [CmpRetain] Retain.SHM.Size=0x.... Retain.SHM.Name= -> Filename of the shared memory to use |
See also....