[NOTE] HAL 6 and OSAL Evolutions

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: [NOTE] HAL 6 and OSAL Evolutions

Postby Giovanni » Sun Oct 29, 2017 4:35 pm

Hi,

HAL queues under rework.

The idea is to be able to read-write I/O queues using data move operations, currently iqReadTimeout() and oqWriteTimeout() read/write data one byte at time which is not optimal.

I am also going to add functions to write input queues and read output queues from ISR side, non-blocking of course. This could make drivers more efficient it applicable.

The problem introduced with interval_t will also be addressed in this change.

Giovanni

faisal
Posts: 374
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 44 times
Been thanked: 60 times

Re: [NOTE] HAL 6 and OSAL Evolutions

Postby faisal » Thu Dec 13, 2018 11:09 pm

Continued from here:
viewtopic.php?f=25&t=4934

Re: OSAL creating threads
Postby Giovanni » Thu Dec 13, 2018 3:12 pm

Hi,

The main reason is that the OSAL API is not meant to be a full RTOS abstraction, it should be just the minimum required to allow HAL to interface an RTOS. In that perspective threads creation is not necessary, my feeling is that the current OSAL is already too fat for its intended role.

Giovanni


The HAL currently uses event broadcasts and the such, which is not as portable as signaling a specific thread. If you want to make HAL OSAL portable - I think HAL/OSAL shouldn't be using event broadcasts. It's not a common RTOS feature. Though I guess event broadcasts could be emulated in the OSAL OS specific bindings - by registering event listeners in a table etc .. and calling each of the callbacks.

Some ideas for OS abstraction layer design I've gotten from open source projects that are deployed on a variety of OSs. Ones that comes to mind are uGFX and ArduPilot:
https://github.com/fredizzimo/uGFX/blob ... /gos/gos.h
https://github.com/ArduPilot/ardupilot/ ... ies/AP_HAL

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: [NOTE] HAL 6 and OSAL Evolutions

Postby Giovanni » Fri Dec 14, 2018 7:10 am

Hi,

We already have two full OS abstractions in ChibiOS:

- NASA OSAL.
- CMSIS RTOS.

Both are quite complete and "standard", why inventing a 3rd one? I would rather spend time making new skins for Posix or OSEK standards (both possible). BTW I don't like any of those for various reasons, I could be biased but the native ChibiOS API is way better IMHO.

About HAL:

HAL does not use the broadcast events directly, it calls an event function which is normally translated in a callback (see OS-less implementations), it is the RT OSAL that defaults events to the RT broadcast mechanism.

About threads creation, there are several points against that:

- Minimalism like I already explained.
- OS-less implementations could not create threads unless OSAL becomes an RTOS itself. There is already a minimal RTOS, it is NIL.
- Threads creation is very RTOS-specific you cannot assume a specific model. Some RTOSes do no create threads at all.
- OSAL API is almost equal to ChibiOS API, just functions have been renamed, there is little point in using that at application level except in the OS-less scenario.

Digressing, my view about OSAL:

The real problem with HAL OSAL is that it is too similar to the ChibiOS API, it is not easy to implement on top of other RTOSes lacking certain features or making different assumptions. Probably the HAL-OSAL interface should be simplified even more in order to make it more RTOS-neutral, not an high priority, I have not seen huge interest about this, HAL users tend to like RT/NIL and stay.

Giovanni


Return to “Development and Feedback”

Who is online

Users browsing this forum: No registered users and 28 guests