Closed AnkitKherodiya closed 1 year ago
Dear @AnkitKherodiya,
Thanks for this suggestion and the offer to contribute.
Dynamic memory allocation on an embedded device poses several risks and makes code hard (or even impossible) to validate and vertifiy. Further the BMS is basically always tailored to the specific use case and application and for that reason it needs specific adaptions, so a single compiled code for all possible battery systems architectures etc. will be nearly impossible to achive. And even it might be created, then again the problem is, that this code cannot be validated and vertified.
Therefore all code in foxBMS uses statically allocated memory and for the reasons written above we do not see a base to change that.
Best regards, The foxBMS Team
/**
GEN_REPEAT_MAXIMUM_REPETITIONS unless the implementation of the
define BS_NR_OF_STRINGS (1u)
/ safety check: due to implementation BS_NR_OF_STRINGS may not be larger than GEN_REPEAT_MAXIMUM_REPETITIONS /
if (BS_NR_OF_STRINGS > GEN_REPEAT_MAXIMUM_REPETITIONS)
error "Too large number of strings, please check implementation of GEN_REPEAT_U()."
endif
/**
define BS_NR_OF_MODULES_PER_STRING (1u)
/**
define BS_NR_OF_CELL_BLOCKS_PER_MODULE (18u)
Currently database structures are statically allocated, we should allocate them dynamically. This would help to have single compiled code for all requirements. User can configure it using GUI.
Let me know if you find this feature useful, can contribute by writing base layer for it.