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

Report here problems in any of ChibiOS components. This forum is NOT for support.
User avatar
alex31
Posts: 374
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 38 times
Been thanked: 61 times
Contact:

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

Postby alex31 » Tue Jan 22, 2019 12:10 am

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

User avatar
alex31
Posts: 374
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 38 times
Been thanked: 61 times
Contact:

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

Postby alex31 » Tue Jan 22, 2019 8:14 am

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
Attachments
hal_st_patch.diff.zip
patch : hal_st subsystem is only included if OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING
(634 Bytes) Downloaded 129 times

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: chibios 18.2.2 scheduler need a scheduler timer even in classic systick mode (18.2.0 was not)

Postby Giovanni » Tue Jan 22, 2019 8:54 am

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

User avatar
russian
Posts: 364
Joined: Mon Oct 29, 2012 3:17 am
Location: Jersey City, USA
Has thanked: 16 times
Been thanked: 14 times

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

Postby russian » Mon Jan 28, 2019 3:29 pm

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.
http://rusefi.com/ - electronic fuel injection

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: chibios 18.2.2 scheduler need a scheduler timer even in classic systick mode (18.2.0 was not)

Postby Giovanni » Mon Jan 28, 2019 3:32 pm

Hi,

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

Giovanni

User avatar
alex31
Posts: 374
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 38 times
Been thanked: 61 times
Contact:

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

Postby alex31 » Mon Jan 28, 2019 10:13 pm

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

User avatar
alex31
Posts: 374
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 38 times
Been thanked: 61 times
Contact:

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

Postby alex31 » Tue Jan 29, 2019 6:37 pm

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

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: chibios 18.2.2 scheduler need a scheduler timer even in classic systick mode (18.2.0 was not)

Postby Giovanni » Sun Feb 17, 2019 5:20 pm

Hi,

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

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 7 guests