probable a bug in stm32f4xx code
Posted: Thu Apr 10, 2014 10:26 am
Hi, I am just newly to use ERIKA RTOS, try to run the example in porting_examples_GNU\monostack\EEtest08 for stm32f4xx, and found a tiny bug,
in cpu\cortex_mx\src\ee_contex.c, the original code is as below
#ifdef __MONO__
void EE_cortex_mx_change_context(EE_TID tid)
{
do {
tid = EE_std_run_task_code(tid);
} while (EE_std_need_context_change(tid));
}
#endif /* __MONO__ */
when both tasks are termiated, the tid=-1, calling EE_cortex_mx_change_context in ISR without checking tid will cause system crash. I modified the code to:
#ifdef __MONO__
void EE_cortex_mx_change_context(EE_TID tid)
{
while (EE_std_need_context_change(tid)) {
tid = EE_std_run_task_code(tid);
}
}
#endif /* __MONO__ */
and it's working for stm32f407 discovery board now . Could someone take a look, if there are any side effects.
BTW, I've made a stm32f2xx porting, thanks to the elegant code, I just need to comment out 1 line of code.
in cpu\cortex_mx\src\ee_contex.c, the original code is as below
#ifdef __MONO__
void EE_cortex_mx_change_context(EE_TID tid)
{
do {
tid = EE_std_run_task_code(tid);
} while (EE_std_need_context_change(tid));
}
#endif /* __MONO__ */
when both tasks are termiated, the tid=-1, calling EE_cortex_mx_change_context in ISR without checking tid will cause system crash. I modified the code to:
#ifdef __MONO__
void EE_cortex_mx_change_context(EE_TID tid)
{
while (EE_std_need_context_change(tid)) {
tid = EE_std_run_task_code(tid);
}
}
#endif /* __MONO__ */
and it's working for stm32f407 discovery board now . Could someone take a look, if there are any side effects.
BTW, I've made a stm32f2xx porting, thanks to the elegant code, I just need to comment out 1 line of code.