Page 1 of 1

chibios 18.2.2 scheduler need a scheduler timer even in classic systick mode (18.2.0 was not)  Topic is solved

Posted: Tue Jan 22, 2019 12:10 am
by alex31
Hello,

I have jumped from 18.2.x r12272 to 18.2.2 after the 18.2.2 announce, and i have one project that does not compile anymore.

This project (F405) need 8 ICU timers, so, since no timer where left for tickless scheduler, i have used periodic systick, and the project is running perfectly fine with 18.2.x r12272

When trying to recompile with 18.2.2, chibios is complaining that timer 2 is in use and cannot be used for scheduling, even in periodic systick mode
(#define CH_CFG_ST_TIMEDELTA 0)

Is there something that have changed, and macro that has to be set to disable the need of scheduling timer when using classic periodic scheduler ?

Bug seems to be introduced by new check on file hal_st_lld.h @revision 12479

My real question is

Does chibios really need another timer than SYSTICK no matter if we use periodic or tickless scheduler (in this case, my code was wrong, and previous chibi revision was just not checking that)

or

Chibios only need SYSTICK when using periodic scheduler, and checks on file hal_st_lld.h just need to be more specific :

Code: Select all

-#if defined(STM32_TIM2_IS_USED)
+#if defined(STM32_TIM2_IS_USED) && (CH_CFG_ST_TIMEDELTA > 0)
 

for all the timers solve the compilation problem.

thanks for enlighting me on this point.


Thanks
Alexandre

Re: chibios 18.2.2 scheduler need a scheduler timer even in classic systick mode (18.2.0 was not)

Posted: Tue Jan 22, 2019 8:14 am
by alex31
if hal_st subsystem is only needed when OSAL_ST_MODE_FREERUNNING, some preprocessors test are wrong :

Code: Select all

#if OSAL_ST_MODE != OSAL_ST_MODE_NONE

should be

Code: Select all

#if OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING


If the problem is there, i propose a patch.



Alexandre

Re: chibios 18.2.2 scheduler need a scheduler timer even in classic systick mode (18.2.0 was not)

Posted: Tue Jan 22, 2019 8:54 am
by Giovanni
Hi,

It is supposed to work this way:

In periodic mode the ST driver must use SysTick.
In free running mode the ST driver must use one of the TIMx.

I will look into this later today.

Giovanni

Re: chibios 18.2.2 scheduler need a scheduler timer even in classic systick mode (18.2.0 was not)

Posted: Mon Jan 28, 2019 3:29 pm
by russian
I believe I am also affected, see viewtopic.php?f=35&t=4935 which I believe points to "bug #994" as potential source of this change.

Re: chibios 18.2.2 scheduler need a scheduler timer even in classic systick mode (18.2.0 was not)

Posted: Mon Jan 28, 2019 3:32 pm
by Giovanni
Hi,

Is version 19.1.0 fine? I made a fix there, I will back-port to 18.2 if so.

Giovanni

Re: chibios 18.2.2 scheduler need a scheduler timer even in classic systick mode (18.2.0 was not)

Posted: Mon Jan 28, 2019 10:13 pm
by alex31
Hi,

Not completely resolved : you can now use any timers in systick mode, which is nice, but in tickless mode, if you use the scheduler timer for anything else (i try GPT), it's no more trapped by the preprocessor test, and you only see that something goes wrong when you see the linker error message which is not explicit if you don't know what to search for :

Code: Select all

arm-none-eabi/bin/ld: ./build/obj/hal_gpt_lld.o (symbol from plugin): in function `gpt_lld_serve_interrupt':
(.text+0x0): multiple definition of `VectorB0'; ./build/obj/hal_st_lld.o (symbol from plugin):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status


Test is very simple :

use demos/STM32/RT-STM32F407-DISCOVERY which is already in tickless mode.
set HAL_USE_GPT to TRUE in halconf.h
set STM32_GPT_USE_TIM2 to TRUE in mcuconf.h

try to compile : boom. Using TIM2 both for scheduler and GPT should be trapped at the preprocessor level.

Anyway, thanks for fixing.

Alexandre

Re: chibios 18.2.2 scheduler need a scheduler timer even in classic systick mode (18.2.0 was not)

Posted: Tue Jan 29, 2019 6:37 pm
by alex31
Hi,

I apologize for my mistake in my last post, there is a copy paste error, instead of quoting Giovanni, i have pasted a stupid link to a merchant site.

i promess it's not free advertising for this site, but a true mistake.

sorry again
Alexandre

Re: chibios 18.2.2 scheduler need a scheduler timer even in classic systick mode (18.2.0 was not)

Posted: Sun Feb 17, 2019 5:20 pm
by Giovanni
Hi,

I added extra checks and ported it to 19.1 and 18.2 too.

Giovanni