This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

thumb

Hello,

I wrote a function which call another function through a pointer of function call.
When I trace the call, as soon as I reach the function the thumb bit is cleared, and of course the program no more run correctly.
When I call the same function directly the thumb bit is not cleared, of course.

What are the mechanism which could clear my thumb bit?

normal call

unsigned char *ip1;
fnEraseFlashSector(ip1 ,0);

special call

ulong ( *tempt_Fct )( ulong );
ulong tempData;
ulong tempData2;
tempData = ((ulong (*)(ulong,ulong))tempt_Fct)(tempData,tempData2);

I need to write generic function calls for RPC.

Parents
  • Hello,

    I receive on UDP frame some data :
    - address of the function to call
    - number of parameter
    - list of parameter

    I read this data and affect then to their respective terms.
    If you have any idea to do that on another way, I will be pleased

    In all case I don't understand why my thumb bit change in this case.
    note : The function is really called.

    byte *ptrEnq;
    byte *ptrData;
    ulong ( *tempt_Fct )( ulong );
    ulong tempAddr;
    ulong tempData;
    ..........
            tempAddr = Mem_GetUlong(&ptrEnq);             //ptrEnq is automatically increased
            tempSize = Mem_GetByte(&ptrEnq);
            tempData = Mem_GetUlong(&ptrEnq);
            ptrData = (byte *)tempAddr;
            tempt_Fct = (ulong (*)(ulong))ptrData;
    
            switch (tempSize) {
                    case 1:
                            tempData = tempt_Fct(tempData);
                            break;
                    case 2:
                            tempData2 = Mem_GetUlong(&ptrEnq);
                            tempData = ((ulong (*)(ulong,ulong))tempt_Fct)(tempData,tempData2);
                            break;
                    case 3:
                            tempData2 = Mem_GetUlong(&ptrEnq);
                            tempData3 = Mem_GetUlong(&ptrEnq);
                            tempData = ((ulong (*)(ulong,ulong,ulong))tempt_Fct)(tempData,tempData2,tempData3);
                            break;
                    case 4:
                            tempData2 = Mem_GetUlong(&ptrEnq);
                            tempData3 = Mem_GetUlong(&ptrEnq);
                            tempData4 = Mem_GetUlong(&ptrEnq);
                            tempData = ((ulong (*)(ulong,ulong,ulong,ulong))tempt_Fct)(tempData,tempData2,tempData3,tempData4);
                            break;
                    default:
                            tempData = tempt_Fct(tempData);
                            break;
            }
    

Reply
  • Hello,

    I receive on UDP frame some data :
    - address of the function to call
    - number of parameter
    - list of parameter

    I read this data and affect then to their respective terms.
    If you have any idea to do that on another way, I will be pleased

    In all case I don't understand why my thumb bit change in this case.
    note : The function is really called.

    byte *ptrEnq;
    byte *ptrData;
    ulong ( *tempt_Fct )( ulong );
    ulong tempAddr;
    ulong tempData;
    ..........
            tempAddr = Mem_GetUlong(&ptrEnq);             //ptrEnq is automatically increased
            tempSize = Mem_GetByte(&ptrEnq);
            tempData = Mem_GetUlong(&ptrEnq);
            ptrData = (byte *)tempAddr;
            tempt_Fct = (ulong (*)(ulong))ptrData;
    
            switch (tempSize) {
                    case 1:
                            tempData = tempt_Fct(tempData);
                            break;
                    case 2:
                            tempData2 = Mem_GetUlong(&ptrEnq);
                            tempData = ((ulong (*)(ulong,ulong))tempt_Fct)(tempData,tempData2);
                            break;
                    case 3:
                            tempData2 = Mem_GetUlong(&ptrEnq);
                            tempData3 = Mem_GetUlong(&ptrEnq);
                            tempData = ((ulong (*)(ulong,ulong,ulong))tempt_Fct)(tempData,tempData2,tempData3);
                            break;
                    case 4:
                            tempData2 = Mem_GetUlong(&ptrEnq);
                            tempData3 = Mem_GetUlong(&ptrEnq);
                            tempData4 = Mem_GetUlong(&ptrEnq);
                            tempData = ((ulong (*)(ulong,ulong,ulong,ulong))tempt_Fct)(tempData,tempData2,tempData3,tempData4);
                            break;
                    default:
                            tempData = tempt_Fct(tempData);
                            break;
            }
    

Children