hal_st_lld override implementation

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

hal_st_lld override implementation

Post by vrollei »

Hi,

what is the best way to override hal_st_lld implementation?
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: hal_st_lld override implementation

Post by Giovanni »

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

Post by vrollei »

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

Re: hal_st_lld override implementation

Post by Giovanni »

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

Post by vrollei »

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?
Post Reply