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

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!

Reply to
Zhenhuan Du
Loading thread data ...

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?

Reply to
varname

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.