Andes Workshop
https://forum.andestech.com/

How to use global variable in inline assembly
https://forum.andestech.com/viewtopic.php?f=25&t=1023
Page 1 of 1

Author:  HuJin [ Fri Apr 20, 2018 11:19 am ]
Post subject:  How to use global variable in inline assembly

Sometime programmer need inline assembly programming, 《Andes Programming Guild》 gets an chapter to illustrate how to do inline assembly programming and shows several examples. It shows how to use global variable which is defined in C code:
Code:
char arr[4] = {0,1,2,3};
int main (void)
{
   printf("hello world");
   asm("movi $r1, #10");
   asm(".extern arr[4]");
   asm ("la $r0, arr");
   return 0;
}

Page 1 of 1 All times are UTC + 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/