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)
$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|
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
Hi there, I have moved your question to the Architectures and Processors forum. Many thanks.