Error: OS_ERR_INV_TASK

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

  • Error: OS_ERR_INV_TASK

    Hi everyone,

    my application suddenly runs into OS_Error() with Error Code: 128 (OS_ERR_INV_TASK) at startup.
    The call stack does not give much information. The first entry I see is [OS_EXCEPTION + 0x21].

    This only happens if I compile with debug settings, not with release settings (optimization turned on). Since the problem only occured recently and the memory is running low, I suspect the issue in that area.
    When I run into this breakpoint the stack sizes seem to be ok, no sign of an overflow.

    It could be a problem with dynamic memory allocation. I'll look into that next but first I'd like to know more about this error and possible scenarios that could trigger this error.

    Any help would be greatly appretiated.

    Thanks,
    Florian
  • Hi Florian,

    This only happens if I compile with debug settings, not with release settings (optimization turned on).

    Do you use the embOS release library in your release configuration?
    The debug code is not included in the embOS release library.
    The application error still exists but there is no debug code which catches this error.

    I'll look into that next but first I'd like to know more about this error and possible scenarios that could trigger this error.

    This error means that the task control block was overwritten and is not longer valid.
    You could have a look in the task control block in a watch window.

    Without more information it's hard to say what could go wrong.
    Maybe you have a buffer overflow and your application overwrites the task control block.

    Best regards,
    Til
  • Hi Til,

    I can't always reproduce this. When I build my project with 'Release' Settings, it always works. After I have done this it also works for a while when I build with 'Debug' Settings.
    Now I ran into the problem again and could identify what Task Ids changed. It was 'USBH_Task' and 'USBH_ISR' from the Segger emUSB lib. Have you ever seen this before?
    There wasn't even a USB Stick attached to the system.

    -Florian
  • Hi Florian,

    When I build my project with 'Release' Settings, it always works.

    Are you sure that it works? OS_Error() is not called with release library because there is no debug code in release library.

    After I have done this it also works for a while when I build with 'Debug' Settings.

    Sounds strange to me.

    Now I ran into the problem again and could identify what Task Ids changed. It was 'USBH_Task' and 'USBH_ISR' from the Segger emUSB lib. Have you ever seen this before?

    I am not aware of any problems with emUSB Host.
    Could you please set a watchpoint on the Id member and try to identify where the value is changed?

    If you are working with licensed software you can In case of doubt also contact our support directly.
    That would make it easier to help you.

    Best regards,
    Til