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

Use this forum for requesting small changes in ChibiOS. Large changes should be discussed in the development forum. This forum is NOT for support.
Post Reply
faisal
Posts: 382
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 45 times
Been thanked: 62 times

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

Post 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
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

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

Post by Giovanni »

That is a pretty good idea.

Giovanni
Post Reply