Porting ChibiOS 3.0

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
Marco
Posts: 128
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

Porting ChibiOS 3.0

Post by Marco »

Hello Giovanni,

I have ported ChibiOS 2.6.1 to a new device (ARM Cortex M4 based). The kernel is up and running and some drivers are already implemented.
Next step I want to do is support for ChibiOS 3.0 because of the tickless mode.
I came across a problem I don't know how to solve at the moment.

If I want to use the original SysTick timer to use as the system tick I define the following in chconf.h:

Code: Select all

#define CH_CFG_ST_TIMEDELTA                 0


I used the STM32 file as example.
When i try to compile the code i get the following:

Code: Select all

mkdir -p build/obj
mkdir -p build/lst
Compiling chcoreasm_v7m.s
Compiling crt0.c
Compiling vectors.c
Compiling chcore.c
In file included from ../../../os/hal/include/st.h:50:0,
                 from ../../../os/rt/ports/ARMCMx/chcore_timer.h:41,
                 from ../../../os/rt/ports/ARMCMx/chcore.h:225,
                 from ../../../os/rt/include/ch.h:81,
                 from ../../../os/rt/ports/ARMCMx/chcore.c:29:
../../../os/hal/ports/xxxxxxx/st_lld.h:69:2: error: #error "TIM2 not present"
../../../os/hal/ports/xxxxxxx/st_lld.h: In function 'st_lld_get_counter':
../../../os/hal/ports/xxxxxxx/st_lld.h:128:21: error: 'STM32_TIM2' undeclared (
first use in this function)
../../../os/hal/ports/xxxxxxx/st_lld.h:128:21: note: each undeclared identifier
 is reported only once for each function it appears in
../../../os/hal/ports/xxxxxxx/st_lld.h: In function 'st_lld_start_alarm':
../../../os/hal/ports/xxxxxxx/st_lld.h:142:3: error: 'STM32_TIM2' undeclared (f
irst use in this function)
../../../os/hal/ports/xxxxxxx/st_lld.h:144:26: error: 'STM32_TIM_DIER_CC1IE' un
declared (first use in this function)
../../../os/hal/ports/xxxxxxx/st_lld.h: In function 'st_lld_stop_alarm':
../../../os/hal/ports/xxxxxxx/st_lld.h:154:3: error: 'STM32_TIM2' undeclared (f
irst use in this function)
../../../os/hal/ports/xxxxxxx/st_lld.h: In function 'st_lld_set_alarm':
../../../os/hal/ports/xxxxxxx/st_lld.h:166:3: error: 'STM32_TIM2' undeclared (f
irst use in this function)
../../../os/hal/ports/xxxxxxx/st_lld.h: In function 'st_lld_get_alarm':
../../../os/hal/ports/xxxxxxx/st_lld.h:178:21: error: 'STM32_TIM2' undeclared (
first use in this function)
../../../os/hal/ports/xxxxxxx/st_lld.h: In function 'st_lld_is_alarm_active':
../../../os/hal/ports/xxxxxxx/st_lld.h:192:18: error: 'STM32_TIM2' undeclared (
first use in this function)
../../../os/hal/ports/xxxxxxx/st_lld.h:192:39: error: 'STM32_TIM_DIER_CC1IE' un
declared (first use in this function)
make: *** [build/obj/chcore.o] Error 1


Why is a timer needed when the SysTick is used for the system tick?
Those timers are for tickless right?

Marco
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

Re: Porting ChibiOS 3.0

Post by Tectu »

May we ask what you're porting ChibiOS/RT to? Any reasons for blanking out the path to your platform directory?


~ Tectu
Marco
Posts: 128
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

Re: Porting ChibiOS 3.0

Post by Marco »

Tectu wrote:May we ask what you're porting ChibiOS/RT to? Any reasons for blanking out the path to your platform directory?

~ Tectu

I'm planning to release the port when it's running, introducing a new family of microcontrollers to ChibiOS/RT :) until then it's a secret project ;)

Marco
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Porting ChibiOS 3.0

Post by Giovanni »

Hi,

Those timers are only used for the tickless mode, when CH_CFG_ST_TIMEDELTA=0 the header should not be included at all:

Code: Select all

#if CH_CFG_ST_TIMEDELTA > 0
#include "chcore_timer.h"
#endif


I modified it as follow and the error is not reported so I am sure that the header is not included.

Code: Select all

#if CH_CFG_ST_TIMEDELTA > 0
#error "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
#include "chcore_timer.h"
#endif


Please verify carefully your project, is the chconf.h you modify the same that is actually compiled? in order to use the tickless mode you have to implement the ST driver on your platform or provide the interface to the timer directly (less clean).

Giovanni
Marco
Posts: 128
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

Re: Porting ChibiOS 3.0

Post by Marco »

Yeah i modified the wrong chconf.h :roll: Shame on me.
Thank you Giovanni
Post Reply