Andes Workshop http://forum.andestech.com/ |
|
指定變數存在某個section裡的語法 http://forum.andestech.com/viewtopic.php?f=16&t=132 |
Page 1 of 1 |
Author: | cindy [ Wed Aug 17, 2011 11:49 am ] |
Post subject: | 指定變數存在某個section裡的語法 |
如果要指定變數存在某個section裡,可以用下列的方式宣告。 (下面的STACK為指定的section name,您可以改為任何section name) char stack[10000] __attribute__ ((section ("STACK"))) = { 0 }; |
Author: | cindy [ Thu Nov 03, 2011 10:08 pm ] |
Post subject: | Re: 指定變數存在某個section裡的語法 |
也可以指定function放在某個section裡。 語法 #include <stdio.h> #include <stdlib.h> int __attribute__ ((section ("FUNCTIONA"))) mul2(int); int main(void) { printf("2*30=%d\n", mul2(30)); return EXIT_SUCCESS; } int mul2(int num){ return 2*num; } |
Page 1 of 1 | All times are UTC + 8 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |