EE_hal_terminate_task and EE_hal_terminate_savestk

Forum related to ERIKA Enterprise and RT-Druid version 2

Moderator: paolo.gai

Post Reply
srl100
Newbie
Posts: 15
Joined: Thu May 20, 2010 2:07 pm

EE_hal_terminate_task and EE_hal_terminate_savestk

Post by srl100 » Mon Sep 06, 2010 1:40 pm

Can anyone give me a plain description of what EE_hal_terminate_task() and EE_hal_terminate_savestk() should do?

There are plenty of examples of what the functions do for particular processor architectures, thanks, but what I am missing is an overview of what the requirement for these functions is.

Thanks,

Steve.

srl100
Newbie
Posts: 15
Joined: Thu May 20, 2010 2:07 pm

Re: EE_hal_terminate_task and EE_hal_terminate_savestk

Post by srl100 » Mon Sep 20, 2010 3:34 pm

Sorted!

What was misleading me was the name of EE_hal_terminate_savestk() - it's not called at task termination time, but prior to running the task (in preparation for the task's eventual termination).

Once I'd got my head round that it was clearer what the routine should do!

paolo.gai
Administrator
Posts: 875
Joined: Thu Dec 07, 2006 12:11 pm

Re: EE_hal_terminate_task and EE_hal_terminate_savestk

Post by paolo.gai » Tue Sep 21, 2010 6:20 pm

Hi!

sorry for the delay, I was out of town for a while...

The idea is that the two functions works more or less as a longjump in the C library.

Each task when using OSEK saves all registers which are saved if used by the callee. Then it saves the stack pointer and calls the thread body.

Then the terminatetask is called inside the task, which takes back the data saved unwinding the stack.

the function should be written when possible in a way that if the user forgets to put the TerminateTask, then the thread returns on the unwinding procedure avoiding a system crash. Typically you obtain this by putting the termination part after the save in the assembler file.

Note that FP, EDF, FRSH kernels does not support TerminateTask and these functions...

I hope this helps...

PJ

Post Reply