How to integrate a new memory to the Linux?
Please, I would like the get some advises about how to get some C/C++ global variables and some dynamically allocated memory to be mapped into a parallel NVRAM connected to the Colibris iMX6 EIM bus, so that these data could be automatically non volatile data.
Explaining my problem in more details:
My new carrier board have a NVRAM (SRAM + Battery) connected to the Colibri iMX6 parallel bus (EIM bus). This NVRAM is intended to keep the structure to run a legacy application firmware from a former hardware platform, which had a NVRAM for nonvolatile data.
In the former platform there was an RTOS. The nonvolatile data were C/C++ global variables and dynamically allocated memory, allocated in specials .data and .heap segments, both of them mapped into the NVRAM by the linker. So, the data allocated in these segments were non volatile.
The difficulty now is that this nonvolatile data, including pointers to nonvolatile allocated memory, are accessed all along the firmware, during run time. So it is difficult to change to another method of nonvolatile data retentions that demands functions calls, because it would demand a big rework in the firmware.
To save the nonvolatile data during shunt down is also not possible because there is not enough time for that.
So, the most straight forward solution appears to be the nonvolatile data directly mapped into the NVRAM, like in the former platform, without the need functions calls for saving/restoring data.
Currently, in the Colibri iMX6 platform with Linux, I can access that NVRAM only with pointers obtained with mmap(). Even using this pointers that would demand a big rework in the firmware.
Maybe I am not in the right way with this idea. So, I would appreciate any other advise.