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

Problem with Compiler/linker Generating code for indirect function pointers

void sys_startup_init(BOOL8 shutdown)
{
//
// Check for operating mode
//
if (!shutdown)
{
// setup MMU
shutdown = (*isys_startup_mmu_init)(shutdown);



....
}

// Shutdown if mode is not normal
....
}

The sys_startup_init function is entered from assembly code.

The code shutdown = (*isys_startup_mmu_init)(shutdown);
function pointer is where the code execution is incorrect.


Changing the function to :
void sys_startup_mmu_init(void)

results in the correct code being executed. However is not possible to change all the indirect function calls in this manner, so this is not a feasible solution.

C compiler version: 7.07h

Parents
  • "2 floats and an int requires reentrant"

    No, it doesn't.
    The following (admittedly trivial) function compiles OK without any need for reentrant:

    void func( float f1, float f2, float f3, float f4, int i)
    {
       volatile int local_int;
       volatile int local_float;
    
       local_float = f1;
       local_float = f2;
       local_float = f3;
       local_float = f4;
    
       local_int   = i;
    }
    "...none were required. It was done like it was a PC."

    Yes, that's exactly how I found out all this stuff!
    Initially, someone else started the port and used reentrant to get around the function-pointer problem - but it is not necessary. By supplying the appropriate Linker options, the Linker is able to correctly overlay these functions.

    You can (probably) reduce the overhead in your code by abandonging reentrant and using the appropriate Linker controls?

Reply
  • "2 floats and an int requires reentrant"

    No, it doesn't.
    The following (admittedly trivial) function compiles OK without any need for reentrant:

    void func( float f1, float f2, float f3, float f4, int i)
    {
       volatile int local_int;
       volatile int local_float;
    
       local_float = f1;
       local_float = f2;
       local_float = f3;
       local_float = f4;
    
       local_int   = i;
    }
    "...none were required. It was done like it was a PC."

    Yes, that's exactly how I found out all this stuff!
    Initially, someone else started the port and used reentrant to get around the function-pointer problem - but it is not necessary. By supplying the appropriate Linker options, the Linker is able to correctly overlay these functions.

    You can (probably) reduce the overhead in your code by abandonging reentrant and using the appropriate Linker controls?

Children