This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

microlib and RTX

Sorry if my question is very simple...
But is it possible to use microlib together with RTX (Cortex M0) ?
I have read some of the doc about the microlib, but I'm not totally sure of the answer to my question....
Anyone ?

  • Forgot to add...
    One of my projects running on a lpc11c24 is behaving crazy. I have 9 threads running with sufficient stacks (user supplied). They usually run alright, but once in a while the system will fail. The symptoms are not the same each time. Sometimes all threads will stay in a os_dly_wait() for 65000 seconds (all threads!) and I can't figure why (the threads are all using the os_dly_wait() function at some point, usually sleeping for 100 msec or so). Another "crash scenario" is that something like half the threads will stop, and the "RTX Task and System" view in the debugger will just show Wait_DLY with the same delay value for the threads that are not running (the number will update).
    So something is playing havoc with my system, and I was wondering if it could be problems with microlib and my usage of it in a multi threaded system (I'm using floats btw)

    This is turning my hair even more gray...

  • And I will answer (part of) my own question :)
    It was the dreaded stack size! I keep wondering why after 30+ years of software development one still falls into this problem (maybe I'm the only one?)! In an effort to "optimize" the RAM usage, the stacksize in the startup file was lowered (to 128 bytes). This had the system crash after a few minutes. Lowering it to 96 had it crash immediatly, raising it to 128 made the system stable (it is now fixed at 256 bytes :)
    "Next time I see something similar I will check the stack as the first step"...(I have said that to myself many times before :D)

    The question still stands, are there any problems using Microlib with RTX ?

  • Don't you have task stack overflow checks enabled?

  • Tamir,
    yes I have, and sometimes they also trapped. But often I just see the before mentioned errors (long delays and threads stopping).
    When I think of it, when/why is the stacksize in startup.s used (I know it is used when main runs until the RTX init takes over)
    I run with user supplied stacks in all threads, also the init thread

  • When I think of it, when/why is the stacksize in startup.s used (I know it is used when main runs until the RTX init takes over)

    It is used before RTX takes control or if no RTOS like RTX is used.

  • Hi Jameel,
    yes, that is also my understanding. But if I lower the stacksize in startup.s too much, the system crashes!
    There must be something else ?

  • If that global stack overflows, then the startup code may overwrite global variables used by the C library, the OS or by any of the threads.

    Next thing is that you have multiple stacks in the startup file. One stack is used during startup - before you start to use threadspecific stacks.

    But the startup file also has stacks for other processor modes. Like interrupt processing.

  • But the startup file also has stacks for other processor modes. Like interrupt processing.

    Good catch. That fact had slipped my mind.

  • But the startup file also has stacks for other processor modes. Like interrupt processing.

    Thanks Per! That explains it perfectly!

    Any input on using the microlib with RTX ?