Hi,
I'm using embOS 3.60 and just wanted to use OS_ExtendTaskContext() to save task specific global variables as described in the User guide.
unfortunately it does not work as expected.
As far as I can see the variables are not correctly stored on the stack or restored after the context is activated again.
The functions for saving and restoring are just like the example with the small difference that I need to store 2 variables:
Display All
As far as I can see VarA is stored correctly but VarB is not.
So I start thinking about it and the point I don't get is: where exactly will be VarA and VarB stored on the stack?
Is this the end of the stack or a fixed place in the beginning of the stack? And how does the OS know how many space I need there to store my extended context informations?
Do I need to tell the OS somehow that there is more stack needed for the context extension?
Kind Regards
sowiso
I'm using embOS 3.60 and just wanted to use OS_ExtendTaskContext() to save task specific global variables as described in the User guide.
unfortunately it does not work as expected.
As far as I can see the variables are not correctly stored on the stack or restored after the context is activated again.
The functions for saving and restoring are just like the example with the small difference that I need to store 2 variables:
Source Code
- typedef struct {
- OS_U32 VarA;
- OS_U32 VarB;
- } T_context_extention;
- ...
- OS_U32 _VarA;
- OS_U32 _VarB;
- ...
- static void _SaveConext(void * pStack)
- {
- T_context_extention* p;
- p =((T_context_extention*)pStack) - (1 - OS_STACK_AT_BOTTOM); /* create pointer */
- /* save all members of ther structure */
- p->VarA = _VarA;
- p->VarB = _VarB;
- }
- static void _RestoreContext(const void * pStack)
- {
- T_context_extention* p;
- p =((T_context_extention*)pStack) - (1 - OS_STACK_AT_BOTTOM); /* creat pointer */
- /* save all members of ther structure */
- _VarA = p->VarA;
- _VarB = p->VarB;
- }
As far as I can see VarA is stored correctly but VarB is not.
So I start thinking about it and the point I don't get is: where exactly will be VarA and VarB stored on the stack?
Is this the end of the stack or a fixed place in the beginning of the stack? And how does the OS know how many space I need there to store my extended context informations?
Do I need to tell the OS somehow that there is more stack needed for the context extension?
Kind Regards
sowiso