Hi, I have a system profile structure (set of system properties), saved in a serial dataflash. Size of a profile is about 16K. At power-up I need to extract from this profile another structure - slave profile (6K), and send it to the slave microcontroller over CAN. In order to do that at a certain point I need to initialize both structures in ram. And this is the only time when these structures are used.
The question is - what is the optimum way to allocate memory for these structures ? I am using STM32F107 with 64K of ram. If I initialize structures locally, in a 'parsing / slave initializing' function, I need to assign additional 22K to the stack, and I loose them for the application. By initializing these structures globally I also loose 22K of ram.
Would really appreciate considerations on this subject.
Gennady
I would make sure the data is stored in a way that it can be directly streamed from master to slave without any need for the data to be stored in RAM.
There really should be no reason for the master to fill a struct or whatever we are talking about with data that it will not make use of other than to forward to another processor.
The only reason for me to initialize the profile structure in ram is that I need to parse it to the slave profile. The best way would be to have a slave structure as a substructure of a main profile structure, but I can't change the formatting, and as I mentioned in another post, it's in a .json format with multiple unrelated fields, so needed data should be extracted.