Andes Workshop

It is currently Fri Mar 29, 2024 8:18 am

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: 指定變數存在某個section裡的語法
PostPosted: Wed Aug 17, 2011 11:49 am 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
如果要指定變數存在某個section裡,可以用下列的方式宣告。
(下面的STACK為指定的section name,您可以改為任何section name)
char stack[10000] __attribute__ ((section ("STACK"))) = { 0 };


Top
 Profile Send private message E-mail  
 
 Post subject: Re: 指定變數存在某個section裡的語法
PostPosted: Thu Nov 03, 2011 10:08 pm 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
也可以指定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;
}


Top
 Profile Send private message E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group