Please note: We are aware of an issue affecting replies on the Arm Community forums, which may not be loading as expected.

We apologize for any inconvenience and appreciate your patience while we investigate and work to resolve the issue.

Thank you for your understanding.


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

if func has $sub$func, what is the function pointer of func with armcc v5.01 for cortex-r5?

extern void $Super$$func0(void);

void $Sub$$func0(void)

{

sts = ftl_codebank_loadoverlay(_);

$Super$$func0();

}

void func0(void)

{ int a=0; a++; }

extern void $Super$$func1(void);

void $Sub$$func1(void)

{

sts = ftl_codebank_loadoverlay(_);

$Super$$func1();

}

void func1(void)

{

int b=0; b++;

}

void nextfunc()

{

Next_Task.func = func0;

Next_Task1.func = func1;

}​

I use armcc --cortex-r5 --asm to compile the file , find the function which uses function pointer is thumb instruction, with assembly code of [Next_Task.func = func0] ,this will assign the pointer of func0,not $Sub$func0;

    ADR   r0,func0+ 1

    LDR   r1,|L5.12064|

    STR   r0,[r1,#0] ; Next_Task

 

another func1 with $Sub$$, also thumb instruction, with assembly code as follows ,but this pointer is $Sub$func1

MOVS   r0,#2

    LDR   r1,|L5.13192|

    STRB   r0,[r1,#0]

    LDR   r0,|L5.13196|

    LDR   r1,|L5.13200|

    STR   r0,[r1,#0] ; Next_Task1

 

for func0 ,if i add #pragam arm at the function which uses function pointer with assembly code as follows ,this will be $Sub$func0;

    LDR   r0,|L6.380|

    STR   r0,[r1,#0] ; Next_Task

I did a test while all func in a file

if nextfunc() add #pragam arm ,with func0 #pragam thumb, the pointer of func0 in nextfunc will be $Sub$func0;

if nextfunc() add #pragam arm ,with func0 #pragam arm, the pointer of func0 in nextfunc will be func0;

if nextfunc() add #pragam thumb ,with func0 #pragam arm, the pointer of func0 in nextfunc will be $Sub$func0;

if nextfunc() add #pragamthumb ,with func0 #pragam thumb, the pointer of func0 in nextfunc will be func0

Parents Reply Children
No data