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.
faisal
Posts: 260
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 35 times
Been thanked: 34 times

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

Postby faisal » Fri Feb 22, 2019 2:41 am

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: 13074
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 758 times
Been thanked: 637 times
Contact:

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

Postby Giovanni » Fri Feb 22, 2019 8:23 am

That is a pretty good idea.

Giovanni


Return to “Small Change Requests”

Who is online

Users browsing this forum: No registered users and 2 guests