I am working on one Embedded C project. The main problem with Embedded System is limited memory. I am running in to one issue where I need to take 32 Byte of data from a serial communication link using interrupt and then save this data to EEPROM.
The time to write one byte in EEPROM requires 4ms time. In order to save my memory, I can write the data as I receive it from the serial interface (inside ISR). But is is not a viable solution.
Another method I can use is to use one structure containing 32 byte buffer :
struct example_struct
{
unsigned char buffer[32];
};
allocate it 32 byte of memory, use it to save my data in ISR and after writing the EEPROM free the memory. Unfortunately, I do not have this liberty in my C compiler. The development environment does not support malloc and free.
To be specific about the problem , I want to optimize the memory use. Instead of using global buffer to hold data what could be the possible way of transfer data in between ISR and EEPROM write function?
The RAM available for the processing is limited to 368 Bytes.
malloc in embedded systems; Dynamic memory allocation in embedded C
Please advice
Thank you