It seems to be fixed after removing an extra (mistakenly initialized) semaphore. I think that was the issue. If you notice in the main.c, the semaphore init is initializing more than the defined SEM_SIZE.
I want to implement a simple osSleep() which blocks task from running until a certain time is met. I know that this can be easily done with a hardware timer or attach it to the time tick. But for the sake of portability issue, I would like to use something that is already available with the C library such as signal() and alarm(). Unfortunately, alarm() can only be used for one task, anyone has a better idea?
Hmmm... not sure if it was due to the optimization level or not, only declaring local variable as static is the only way to make it work. I cannot reproduce the issue anymore since I cleaned the whole project and rebuilt it.
My project on ARM is a bare metal system with some function stubs for newlib. I am trying to provide the simplest threading-like environment and Pico-OS coroutine is the closest and cleanest implementation I could find so far. I would say that Pico-OS coroutine as a clever hack instead of an ugly hack :)
I will provide the modification of the source code under BSD style license, but I need to fork the project from you if such project exists. That way I can do some attribution to the original creator and pay some respect to the license attached.
I am trying to implement this on an ARM platform, but somehow it gets stuck. Any details on how to port it? Especially with the function pointer and the stack when it is created?
I tested setjmp() and longjmp() to work without any issue on the platform. But modifying the jmp_buff seems the issue here since I don't know how to point to the new stack for each created task.