ADS1.2 trouble: branching by writing PC is not supported

Dec 13, 2006 1 Replies

Hello, I got into trouble when learning ADS 1.2 inline assembly.



I create a project as arm executable image in default settings. It contains only one file : main.c



void main(void){



__asm { mov pc,0x0 } }


When i compiled this project , i got the error :



Warning : C2865W: extern 'main' needs to be 'int' function: 'int' assumed main.c line 1 Error : (Serious) C2044E: branching by writing PC is not supported main.c line 6 C:\main.c: 1 warning, 0 errors, 1 serious error


I google and find this file "

formatting link
" it says "C2044E: branching by writing PC is not supported. Illegal inline assembly instruction ? consult the ARM ARM for the allowed forms. "



Then I have a looked at arm architecture reference manual , but nothing helps.



I think maybe ADS1.2 compiler doesn't support this kinds of syntax. But how can I achieve the goal like this ?



Anybody help ,pls ? Thanks!


apparently main is defined as: int main(...), just change it.

[...]

seems like you are not allowed to take a branch in your program by directly writing to the pc, is jmp (or something equivalent) not an option?

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required