hal_st_lld override implementation

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

hal_st_lld override implementation

Postby vrollei » Mon Jun 03, 2019 1:35 pm

Hi,

what is the best way to override hal_st_lld implementation?
Vitaly

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

Re: hal_st_lld override implementation

Postby Giovanni » Mon Jun 03, 2019 1:46 pm

Hi,

Currently there is no clean mode if you are using HAL...

Proceed as follow:
1) Edit osal.h and make it define OSAL_ST_MODE_NONE, this disables the ST driver.
2) Define PORT_USE_ALT_TIMER=1 in your makefile and provide a chcore_timer_alt.h file with your own implementation.

I'll do something about point 1 next. Point 2 is already fine and working as intended.

Probably it would be a good idea to overhaul the ST driver, I may need more comparators for a new kernel safety feature soon (thread watchdogs).

Giovanni

vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

Re: hal_st_lld override implementation

Postby vrollei » Mon Jun 03, 2019 1:53 pm

Thanks for reply!

I mean overriding only low level implementation: hal_st_lld.h/hal_st_lld.c.

I have RTC based ST implementation, but it is very annoying to edit hal_st_lld.h/hal_st_lld.c every time....
Vitaly

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

Re: hal_st_lld override implementation

Postby Giovanni » Mon Jun 03, 2019 7:34 pm

Hi,

You could just make your own .mk file to import from your Makefile, place your LLDs into another directory.

Giovanni

vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

Re: hal_st_lld override implementation

Postby vrollei » Wed Jun 05, 2019 4:40 pm

Hi,

with modified make file it would be difficult to change project config: change ST timer....

Is it possible to use STM32_ST_USE_TIMER == 0 macro to switch between implementations?

Or maybe you can add ST based on RTC implementation to STM32 hal_st_lld?
Vitaly


Return to “ChibiOS/HAL”

Who is online

Users browsing this forum: No registered users and 5 guests