Page 1 of 1

hal_st_lld override implementation

Posted: Mon Jun 03, 2019 1:35 pm
by vrollei
Hi,

what is the best way to override hal_st_lld implementation?

Re: hal_st_lld override implementation

Posted: Mon Jun 03, 2019 1:46 pm
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

Re: hal_st_lld override implementation

Posted: Mon Jun 03, 2019 1:53 pm
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....

Re: hal_st_lld override implementation

Posted: Mon Jun 03, 2019 7:34 pm
by Giovanni
Hi,

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

Giovanni

Re: hal_st_lld override implementation

Posted: Wed Jun 05, 2019 4:40 pm
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?