I have a scenario where I have 2D arrays of variable sizes and various data types (double and boolean as of now). These arrays should be read and processed by a microcontroller which has 256KB of SRAM.
In my setup I plan to transfer these arrays from SD card (stored as files) to SRAM for processing. I currently can think of following possible aproaches
- These arrays are actually matrices from MATLAB. So I intend to save MATLAB variables as .mat and reuse code from matimport.c
- Save the data contained in the variables in an xml file. Use an XML parser for the target microcontroller
- Create custom binary files with associated metadata. So the program in microcontroller reads the metadata(rows, columns, data type)about the binary file and extract variable based on offset's computed from the meta data
Sol 1 looks easy and straight forward. But, I guess I need to use certain MATLAB external libraries and I suppose these precompiled libraries (such as libmat.lib, libmx.lib) are not available for ARM.
Sol 2 is easy if there are good parser's written for a microcontroller. Suggestions of XML parser's are welcome
Sol 3 involves slightly more work. For this method, I intend to write a C application that reads .mat files and create a custom binary file with metadata and actual data. And have another identical import function in the microcontroller.
Total size of all variables combined is the range of 20KB to 40KB. Therefore, SD card is used in the system.
Which among these techniques is well suited for a low footprint embedded solution ? My goal is to choose and go with a solution that utilizes the least amount of memory and one which is most flexible for expansion. Ofcourse, do suggest any other approaches to solve this problem.
PS. The device is not Arduino based. But, I nevertheless added it as Arduino Development comes under the realm of this question.