We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
I wrote a test function as;
// Task definitions OS_TID T_Test; U64 Test_stack[13312/8]; __task void init (void); __task void Test (void) ; // Function definition uint16_t TestFunc( uint8_t a0, uint8_t a1, uint8_t a2, uint16_t a3, uint8_t a4, uint8_t a7, uint16_t a9, uint16_t a10, uint8_t* a5, uint8_t* a6, uint8_t* a8, uint8_t* a11, uint8_t* a12, uint8_t* a13) { uint16_t x; //........ return 0; } __task void init (void) { /* Initialize Tasks */ T_Test = os_tsk_create_user (Test, 1, &Test_stack, sizeof(Test_stack)); os_tsk_delete_self(); } // Call Function __task void Test (void) { uint8_t x=9,*y; uint16_t z=0x1001; y=&x; x = TestFunc(x,x,x,z,x,x,z,z,y,y,y,y,y,y); os_tsk_delete_self(); }
The last two "y" are not equal to the address of the x. I need to know passing argument limitations and the reasons of this unexpected(according to me) condition.
Need help! (asap.)
Thanks.
My guess would be a stack alignment issue with all the uint8, uint16 and uint32 parameters being passed into this routine.
Check the memory space where the stack is located (ie: 'View Memory' window) to determine if the parameters in your call are there. Also, are the values you are seeing fragments of the correct address (ie: some hex values but not in proper order?).
If you want to pass that many parameters you usually just create a structure and pass in the structure's pointer to the function instead.