On 2/22/16 1:24 PM, will sanfilippo wrote:
My 1/2 cent on this topic (and I certainly dont think you killed the discussion; it is a difficult topic): * I think the HAL is meant to be a fairly general, simple, abstraction. Hopefully over time we will be able to incorporate more advanced HAL features, but most HALs I have seen implement the basics and I bet that works for most folks. * I think the HAL should live in hw/mcu. Well, api in hw/hal and implementation in hw/mcu. * As sterling says, drivers can be built that use the HAL. Take the external ADC example. There would be a driver for that ADC chip that would use a SPI HAL if it had SPI. For internal ADCs, the HAL provided in hw/hal should be enough as I suspect it will (eventually), implement what most folks want. * As far as being able to see what features of a HAL are implemented, I dont see why this is such a problem but it is probably because I am not thinking of “beginner” users. Doesnt seem terribly difficult to document, on a per mcu basis, which features of the HAL are supported by that particular MCU. And if the developer calls an API with some parameters that are not implemented on this MCU they get an error. Part of the problem I have with this is is my own personal bias: I would never blindly call HAL functions without first reading the chip documentation. I dont see why anyone would do such a thing :-) * I am not a fan of runtime HAL introspection APIs. To me, that is just extra code that serves very little useful purpose.
I agree with no runtime, but think there should be capabilities on a more granular basis.
i.e. a driver can require a hal-adc, or hal-gpio capability, and an MCU can export these, rather than the just "hal."
* I think the HALs should allow for the user to choose which “peripheral” to bind to and that is done through the BSP or the HAL API itself. For example, the user should be able to pick ADC #1 or ADC #3. * I do agree that sometimes it is difficult to know that you need to call functions like bspProvideADCconfig() and the like. Not sure how this gets solved other than documentation and looking at examples that we provide.
IMO, the HAL should provide APIs to do this, and the BSP should call those APIs.
Did you see other email: what do you think about flash? Should the HAL APIs just apply to internal flash / should we get rid of HAL Flash altogether, or should HAL flash encompass both internal & external flashes...?
Sterling
