Page 1 of 1

testhal: Separate portable parts of HAL structs from non-portable

Posted: Fri Feb 22, 2019 2:41 am
by faisal
In testhal, the various HAL peripheral configuration structures are continuously redefined in the portab.c/h files. The configuration structures should be defined in the actual application code (main.c in all the testhal applications I've seen ...), and the non-portable board specific parts of the struct should be defined as a macro in portab.h (as is the intended function of portab.c/.h). Thus, main.c would contain the platform agnostic portions of the configuration struct, and portab.h would contain non-portable parts.

This would demonstrate the true portable nature of the HAL, and show a clean separation between the upper layer and the lower layer.

From a maintainer's standpoint (that's you Giovanni :) ), it is less burden on ensuring all the peripheral configurations are the same between the various boards a particular multi testhal application supports.

See this post for an example:
viewtopic.php?f=24&t=5012&p=34929#p34929

Re: testhal: Separate portable parts of HAL structs from non-portable

Posted: Fri Feb 22, 2019 8:23 am
by Giovanni
That is a pretty good idea.

Giovanni