[SOLVED] Code getting stuck in OS_InitKern_STD

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Code getting stuck in OS_InitKern_STD

    Hi,

    We're using embOS v4.22. I observed that sometimes ie 1-2/10 times the code gets stuck in OS_InitKern_STD; precisely in:
    OS_Delay called after OS_InitKern_STD. The portion of the attachment behaves like a recursive code forever. Can you help me understanding why this happens?

    My Main looks like this:

    Source Code

    1. void main(void)
    2. {
    3. sysinit();
    4. OS_IncDI(); // Initially disable interrupts
    5. OS_InitKern(); // Initialize OS - Gets stuck here once in a while in OS_Delay
    6. OS_InitHW(); // Initialize Hardware for OS
    7. Start_main_task();
    8. while(1);
    9. }
    Display All


    Regards,
    Gautam
    Images
    • Capture.PNG

      7.87 kB, 465×259, viewed 785 times
  • Hi Gautam,

    do you have an embOS license or are you working with an embOS trial version?
    You can also contact our embOS support directly per email.
    Please find the email address in the embOS manual in chapter "Support".

    OS_InitKern() does not call OS_Delay() at all.
    I don't see your call to OS_Delay() in your code snippet.

    Please be aware OS_Delay() can only work after the hardware timer was initialized and interrupts are enabled.
    This is usually done in OS_InitHW().
    If you call OS_Delay() in main() after OS_InitHW() with disabled interrupts you will reach OS_Error(OS_ERR_INTERRUPT_DISABLED).
    You should enable interrupts before using OS_Delay().
    You could e.g. simply remove the OS_IncDI() at the beginning of main().

    Does this solves your issue?

    Best regards,
    Til
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Til,

    Thanks for the quick reply. That's exactly what I'm testing, by removing : OS_IncDI();
    I don't call the OS_Delay routine. It seems to be an internal call. Yes, ours is a full licensed copy - object code license and hence I was unable to dig deeper.

    *Edit: Even after removing OS_IncDI(); the issue persists.

    Regards,
    Gautam

    The post was edited 1 time, last by gaugan ().

  • I tried enabling interrupts at start OS_DecRI(); and even that didn't help. Anything else that I can try?

    Edit: If I check the disassembler, here's the sequence

    1. OS_TerminateError
    2. OS_InitKern_STD
    3. OS_Delay ------ The code gets stuck here seems like a while(1) loop
    4. OS_SetTaskContextExtension
    5. OS_WaitEventTimed

    The post was edited 3 times, last by gaugan ().

  • Hi Gautam,

    I got your email, so we can continue the discussion there.

    Best regards,
    Til
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.