Then, instant segfault panic, because the mainthread's Thread struct is located just before the system's VTimer list base!
Why can't the mainthread Thread struct be at the base of the thread's stack, as is the case with all other threads?
In chsys.c, delete the mainthread declaration and change:
Code: Select all
setcurrp(_thread_init(&mainthread, NORMALPRIO));
currp->p_stklimit = &__main_thread_stack_base__;
to:
Code: Select all
setcurrp(_thread_init((Thread *)&__main_thread_stack_base__, NORMALPRIO));
currp->p_stklimit =
&__main_thread_stack_base__ + sizeof(Thread)/sizeof(stkalign_t) + 1;
Are there ChiBiOS supported systems where this would not work?