• slider image 442
  • slider image 497
  • slider image 498
  • slider image 499
  • slider image 500
  • slider image 502
:::


Browsing this Thread:   1 Anonymous Users






有關#pragma的使用
#1
資深會員
資深會員


查看用戶資訊
小弟欲處理的程式中包含下列指令:
#pragma udata access AccessSection //39
near unsigned char Rec_Data; //1
near unsigned int RXQTop; //2
near unsigned int RXQEnd; //2

#pragma udata bank00=0x60 //160
char USBTXQ[UTXQSize]; //160

#pragma udata bank01=0x100 //256
char TCPData[TCPDSize]; //192
char StoreString[StoreSize];

因這些變數會被多個函數所使用,因此想提出放到header檔中,但卻發現無法在header中將其設為extern 變數,是否只要規定了使用的位址後,就不能將其提出至header呢?

假設我將上述內容存於res.h中,再於A.c及B.c檔中分別include res.h,會產生如下錯誤(未設為extern時):
section 'bank00' type is non-overlay and absolute but occurs in more than one input file.

若header中設為extern時,則為:
section address permitted only at definition

這是表示#pragma udata bank00=0x60,無法在header中進行宣告嗎?

說起來res.h檔中使用extern 應為declaration,A.c及B.c中,有一個應是definition,但在compiler的錯誤訊息中似乎沒有對它們加以分別

若各位前輩有相關的經驗,還請不吝指教

發表於: 2008/4/17 12:39
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 有關#pragma的使用
#2
版主
版主


查看用戶資訊
觀念問題,請打電話來討論,用寫的太長了。

發表於: 2008/4/17 14:46
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------