foxBMS / foxbms-2

foxBMS 2, online documentation at https://docs.foxbms.org
https://foxbms.org
Other
263 stars 121 forks source link

Static to Dynamic assignment of database memory #19

Closed AnkitKherodiya closed 1 year ago

AnkitKherodiya commented 1 year ago

/**

/ 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

/**

/**

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.

foxBMS commented 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