Page 1 of 1

Integrating ChibiOS to STM32Cube via CMSIS-OS on Nucle F411

Posted: Tue Sep 29, 2015 4:33 pm
by swiedjaja
Hi Giovanni and ChibiOS users,
I'm trying to integrating ChibiOS in STM32CubeMX on NucleF411RE board. STM32Cube software enable us to integrate RTOS via CMSIS interface, and they included FreeRTOS on that.
I think it will be nice if I can have ChibiOS instead FreeRTOS on my STM32Cube, so I try to use simple SysTick to generate timer event, I configure CH_CFG_ST_TIMEDELTA 0 in chconf.h, and call chibios scheduler from SysTickCallback, but I got chSysHalt with reason "SV#6".
I suppose the error is on my wrong SysTick implementation, and the other is the linker script, cube linker script quite different from chibios script.

This is my SysTick ISR: (cube style ISR callback funtion)
void HAL_SYSTICK_Callback(void)
{
// CH_IRQ_PROLOGUE();
chSysLockFromISR();
chSysTimerHandlerI();
chSysUnlockFromISR();
// CH_IRQ_EPILOGUE();
}

I also attach my debugger screen, I'm using openstm32 ide and I put chibios project code on https://github.com/swiedjaja/Cube-F411RE-ChibiOS

thanks for let me participate on this very interesting rtos software!

Re: Integrating ChibiOS to STM32Cube via CMSIS-OS on Nucle F

Posted: Tue Sep 29, 2015 5:04 pm
by Giovanni
Hi,

You need those prologue/epilogue macros or reschedule will not happen.

SV#6 means that you are calling ISR code without those macros.

Code: Select all

 *            - SV#1, misplaced @p chSysDisable().
 *              - Called from an ISR.
 *              - Called from a critical zone.
 *              .
 *            - SV#2, misplaced @p chSysSuspend()
 *              - Called from an ISR.
 *              - Called from a critical zone.
 *              .
 *            - SV#3, misplaced @p chSysEnable().
 *              - Called from an ISR.
 *              - Called from a critical zone.
 *              .
 *            - SV#4, misplaced @p chSysLock().
 *              - Called from an ISR.
 *              - Called from a critical zone.
 *              .
 *            - SV#5, misplaced @p chSysUnlock().
 *              - Called from an ISR.
 *              - Not called from a critical zone.
 *              .
 *            - SV#6, misplaced @p chSysLockFromISR().
 *              - Not called from an ISR.
 *              - Called from a critical zone.
 *              .
 *            - SV#7, misplaced @p chSysUnlockFromISR().
 *              - Not called from an ISR.
 *              - Not called from a critical zone.
 *              .
 *            - SV#8, misplaced @p CH_IRQ_PROLOGUE().
 *              - Not called at ISR begin.
 *              - Called from a critical zone.
 *              .
 *            - SV#9, misplaced @p CH_IRQ_EPILOGUE().
 *              - @p CH_IRQ_PROLOGUE() missing.
 *              - Not called at ISR end.
 *              - Called from a critical zone.
 *              .
 *            - SV#10, misplaced I-class function.
 *              - I-class function not called from within a critical zone.
 *              .
 *            - SV#11, misplaced S-class function.
 *              - S-class function not called from within a critical zone.
 *              - Called from an ISR.
 *            .


In the distribution there are some demos without HAL, you may start from those then add the ST library code. See \demos\various\RT-ARMCM4-GENERIC

I suggest to not use the tickless mode initially, make it work first then go for the complex stuff.

Also, please use the latest code from the subversion repository, a couple of problems have been fixed in the CMSIS RTOS layer that will be released in 3.0.3.

Giovanni

Re: Integrating ChibiOS to STM32Cube via CMSIS-OS on Nucle F

Posted: Wed Sep 30, 2015 6:14 am
by swiedjaja
Thanks for your reply Giovanni, I already try using CH_IRQ_PROLOGUE() and CH_IRQ_EPILOGUE(), but the system halt, it's seem the stm32cube startup code not compatible, and If I used chibios gcc startup code, the cube library complaining.
Hope some day I will see this stuff working together in harmony ;)

Re: Integrating ChibiOS to STM32Cube via CMSIS-OS on Nucle F

Posted: Wed Sep 30, 2015 8:14 am
by Giovanni
Hi,

ChibiOS requires a dual stack setup and several other requirements (FPU, caches, various initializations). As soon they start providing code usable in real world we would gladly stop doing extra work.

Giovanni

Re: Integrating ChibiOS to STM32Cube via CMSIS-OS on Nucle F411

Posted: Sat Sep 17, 2016 5:55 am
by Chudik
swiedjaja
Did you get any further than your first code on github?