Hi
I had a problem that I cannot figure out. I have 19 tasks/threads declared and created in my system. The documentation says that I can have up to 250 threads.
I found that my 19th thread is not being created. The create_thread call returns a id of is 0 for the 19th thread.
I have edit the configuration file to for 20 threads (the RTOS osTimer thread takes up one) and plenty of stack space for it.
All 19 threads have their own user stacks and I have made sure there is plenty of memory allocated to them.
If I remove one of my threads so there are 18, all 18 are created including the old 19th one. So there is nothing wrong with the way that that thread is defined because it will work if there are no more than 18 user threads.
What am I missing that is keeping me from creating more than 18 threads?
I am talking with them as well. No luck so far
Round here we'd disassemble it and see what the machine sees.
Create multiple threads with trivial content.
If you can not create them, then you have a good project to send in to Keil support.
If you can create them, then you have to consider that maybe one of your current threads corrupts some memory it doesn't own. Identify which thread that is the blocker and check which specific lines in the thread that is involved.
What is OS_PRIVCNT set too?
sorry for the delay in getting back to you. os_privcnt is set to 19
os_taskcnt is 24
I was trying to debug the thread_create by stepping into the RTOS source and followed it through and it return a non 0 for the id this time!!! I did not change anything but yet now it is returning a proper thread id
I don't get it. There is no reason why it should be working now
I added two additional threads to try to break it but those worked as well (increased cnt appropriately).
I don't understand it. I don't like things clearing up on their own without a reason becasue they could break again.
Thank you for your help in trying to figure this out but it seems to have fixed itself and is working now.