Page 1 of 1

Porting ChibiOS 3.0

Posted: Sun Nov 03, 2013 6:34 pm
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

Re: Porting ChibiOS 3.0

Posted: Sun Nov 03, 2013 6:50 pm
by Tectu
May we ask what you're porting ChibiOS/RT to? Any reasons for blanking out the path to your platform directory?


~ Tectu

Re: Porting ChibiOS 3.0

Posted: Sun Nov 03, 2013 7:07 pm
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

Re: Porting ChibiOS 3.0

Posted: Sun Nov 03, 2013 9:07 pm
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

Re: Porting ChibiOS 3.0

Posted: Sun Nov 03, 2013 9:27 pm
by Marco
Yeah i modified the wrong chconf.h :roll: Shame on me.
Thank you Giovanni