Friday, February 23rd 2018, 7:47am UTC+1

You are not logged in.

  • Login
  • Register

Florian

Beginner

Date of registration: May 27th 2014

Posts: 4

1

Wednesday, June 4th 2014, 3:58pm

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

SEGGER - Til

Super Moderator

Date of registration: Nov 14th 2007

Posts: 264

2

Wednesday, June 4th 2014, 4:08pm

Hi Florian,

Quoted

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.

Quoted

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

Florian

Beginner

Date of registration: May 27th 2014

Posts: 4

3

Wednesday, June 4th 2014, 4:50pm

Hi Til,

thanks for your reply.

I dont think we use the embos release lib in our config.
I'll definately have to debug some more. If you have any other suggestions where I could look to find some answers in my application or the os, please let me know.

Thanks
Florian

SEGGER - Til

Super Moderator

Date of registration: Nov 14th 2007

Posts: 264

4

Wednesday, June 4th 2014, 4:55pm

Hi Florian,

The task control block includes the member "Id".
The acutal debug check tests if the value in this member is still valid.
You could set a watchpoint on this variable to find out when/where it is changed.

Regards,
Til

Florian

Beginner

Date of registration: May 27th 2014

Posts: 4

5

Thursday, June 19th 2014, 1:12pm

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

SEGGER - Til

Super Moderator

Date of registration: Nov 14th 2007

Posts: 264

6

Friday, June 20th 2014, 8:44am

Hi Florian,

Quoted

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.

Quoted

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

Sounds strange to me.

Quoted

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

Florian

Beginner

Date of registration: May 27th 2014

Posts: 4

7

Wednesday, July 2nd 2014, 1:22pm

The problem is now resolved.

It turned out that we send OS_Events to a certain task that was not yet initialized in some circumstances. That means the Id is 0 and we'll get an OS_Error.

Thanks for the support.