|
|||||||||||
| 技術(shù)交流 | 電路欣賞 | 工控天地 | 數(shù)字廣電 | 通信技術(shù) | 電源技術(shù) | 測(cè)控之家 | EMC技術(shù) | ARM技術(shù) | EDA技術(shù) | PCB技術(shù) | 嵌入式系統(tǒng) 驅(qū)動(dòng)編程 | 集成電路 | 器件替換 | 模擬技術(shù) | 新手園地 | 單 片 機(jī) | DSP技術(shù) | MCU技術(shù) | IC 設(shè)計(jì) | IC 產(chǎn)業(yè) | CAN-bus/DeviceNe |
ICC的問(wèn)題還是AVRSTUDIO的問(wèn)題 !? |
| 作者:cctv 欄目:單片機(jī) |
ICC AVR6.28: 我在程序中定義了一些表: #pragma data:program #pragma abs_address:0x300 CHAR asciitohex[]={0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0,0,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f}; CHAR hextoascii[]={"0123456789ABCDEF"}; ..... #pragma end_abs_address #pragma data:data 用AVRSTUDIO打開(kāi)HEX文件定位是正確的.可是用AVRSTUDIO打開(kāi)COF文件就是一塌糊涂! 我試了3.5和4.07兩個(gè)版本,都有這個(gè)問(wèn)題.到底是ICC的問(wèn)題還是ABRSTUDIO的問(wèn)題 !? 急! 還有...ICC的文檔真是...垃圾...,比如關(guān)于#pragma data: 的用法也只有兩個(gè)簡(jiǎn)單的例子,根本沒(méi)有講清楚! 面向MCU的C都不可能完全兼容ANSI C的,寫(xiě)點(diǎn)文檔這么難啊! 做完這單我就換了,寧可用GCC ....ICC真是垃圾! |
| 2樓: | >>參與討論 |
| 作者: cctv 于 2003/8/12 22:08:00 發(fā)布:
還有一個(gè)問(wèn)題:原來(lái)FOR(;;) 循環(huán)還可以這樣編譯... 197: { for (k=0;k-6;k++) +000002DA: 9563 INC R22 Increment 197: { for (k=0;k-6;k++) +000002DB: 2F86 MOV R24,R22 Copy register +000002DC: 5086 SUBI R24,0x06 Subtract immediate +000002DD: F6C9 BRNE +0x59 Branch if status flag cleared 變成for (k=0;k-6;++k) 了! AVR 都是這樣的嗎 ? 作者是不是從右往左看字的... FAINT ! |
|
| 3樓: | >>參與討論 |
| 作者: cctv 于 2003/8/12 22:26:00 發(fā)布:
看看KEIL 是怎么編譯的... 3: for (i=0;i-5;i++) i++; C:0x0003 E4 CLR A C:0x0004 FF MOV R7,A C:0x0005 EF MOV A,R7 C:0x0006 24FB ADD A,#0xFB C:0x0008 6004 JZ C:000E C:0x000A 0F INC R7 C:0x000B 0F INC R7 C:0x000C 80F7 SJMP C:0005 4: } 無(wú)語(yǔ)... |
|
| 4樓: | >>參與討論 |
| 作者: cctv 于 2003/8/13 12:26:00 發(fā)布:
難道沒(méi)有人知道。 UP ! |
|
| 5樓: | >>參與討論 |
| 作者: powerpan 于 2003/8/13 13:53:00 發(fā)布:
我猜想 icc的編譯好像有點(diǎn)問(wèn)題。 而且你用了絕對(duì)地址放置數(shù)據(jù)。如果你沒(méi)有打開(kāi)代碼優(yōu)化的話,編譯出錯(cuò)是不可理解的。關(guān)鍵應(yīng)該是你是否打開(kāi)了優(yōu)化。 還有你說(shuō)的for循環(huán),本來(lái)他們的編譯器就不好。而且你試看看定義 CHAR i for (i=20;i>=0;i++)你看編譯之后正常不? GCC如果放置太多的data之后程序就死了,不敢用。 我覺(jué)得CVAVR非常不錯(cuò),編譯效率比較高。 例子: ;244 for (i=0;i<PWMDELAY;i++) LDI R16,LOW(0) _0x2B: CPI R16,10 BRGE _0x2C ;245 #asm ("nop"); nop SUBI R16,-1 RJMP _0x2B 可以看出非常簡(jiǎn)潔。 |
|
| 6樓: | >>參與討論 |
| 作者: cctv 于 2003/8/13 17:16:00 發(fā)布:
我沒(méi)啟用代碼壓縮. 3: for (i=20;i>=0;i++); +00000033: E104 LDI R16,0x14 Load immediate +00000034: C001 RJMP +0x0001 Relative jump 3: for (i=20;i>=0;i++); +00000035: 9503 INC R16 Increment 3: for (i=20;i>=0;i++); +00000036: 3000 CPI R16,0x00 Compare with immediate +00000037: F7E8 BRCC +0x7D Branch if status flag cleared 還是那個(gè)鬼樣子... 至于數(shù)組,我是完全沒(méi)辦法了.而且 |
|
| 7樓: | >>參與討論 |
| 作者: mrqingfeng 于 2003/8/13 21:31:00 發(fā)布:
那我該怎么辦? 剛想用ICC,聽(tīng)CCTV的一席話,真的有點(diǎn)怕了。ICC、GCC、還有CVAVR哪一個(gè)更優(yōu)秀,對(duì)AVR支持更好? |
|
| 8樓: | >>參與討論 |
| 作者: cctv 于 2003/8/13 22:30:00 發(fā)布:
沒(méi)有人知道?失望! |
|
| 9樓: | >>參與討論 |
| 作者: cctv 于 2003/8/14 16:39:00 發(fā)布:
繼續(xù)頂~其他人沒(méi)有遇到過(guò)這樣的情況嗎? 我發(fā)了mail給IM , "I can assure you the code is correct. Check it carefully and see." Faint . 我在AVR STUDIO 里調(diào)試看過(guò)的.絕對(duì)是先自加1 然后再進(jìn)行比較的.搞的我不得不在循環(huán)結(jié)束再加一條 i--; ,否則循環(huán)會(huì)提前結(jié)束.SHIT ! |
|
| 10樓: | >>參與討論 |
| 作者: wanglele 于 2003/8/14 20:33:00 發(fā)布:
自減的循環(huán)效率高,用AVR |
|
| 11樓: | >>參與討論 |
| 作者: cctv 于 2003/8/14 21:31:00 發(fā)布:
今天又出了新情況... 調(diào)試EEPROM 程序,在mian()開(kāi)頭用了如下定義: #pragma data:EEPROM #pragma abs_address:0x000 CHAR ep_password[]={0x00,0x38,0x00,0x38,0x00,0x38,0x00,0x38,0x00,0x38,0x00,0x38}; #pragma end_abs_address #pragma data:data CHAR temps; 緊接著剛好是一個(gè)中斷函數(shù) #pragma interrupt_handler timer1_ovf_isr:9 void timer1_ovf_isr(void) { } 現(xiàn)在程序一啟動(dòng)就到了timer1_ovf_isr函數(shù)了,真TMD 搞笑! 現(xiàn)在正在苦苦調(diào)試...如果今晚不解決,明天開(kāi)始啃CVAVR ,這個(gè)垃圾已經(jīng)浪費(fèi)了我將近一個(gè)星期了! |
|
| 12樓: | >>參與討論 |
| 作者: cctv 于 2003/8/14 21:35:00 發(fā)布:
自減效率高 - 這在C51 里體現(xiàn)的比C AVR 更明顯. C51的自加循環(huán)效率低多了. 我是想知道為什么會(huì)出這種低級(jí)的編譯錯(cuò)誤.以及如何避免. 并不是什么時(shí)候都可以用自減循環(huán)的. |
|
| 13樓: | >>參與討論 |
| 作者: cccp 于 2003/8/14 21:39:00 發(fā)布:
ICC和CV都用過(guò),效率名氣遠(yuǎn)不如IAR;蛘咴囋嘒CC。 |
|
| 14樓: | >>參與討論 |
| 作者: cctv 于 2003/8/14 22:37:00 發(fā)布:
汗...用CCCP專用表情的后果...請(qǐng)教CCCP 我到IAR的主頁(yè)看過(guò)了,有兩種產(chǎn)品: IAR Embedded Workbench Professional IAR MakeApp™ 我應(yīng)該用哪種 ? |
|
| 15樓: | >>參與討論 |
| 作者: cccp 于 2003/8/14 22:48:00 發(fā)布:
老相好的不看海了? 給你發(fā)個(gè)短消息,別回復(fù),現(xiàn)在用的是MyIE2禁止彈出窗口,給我發(fā)我也看不到。AVR只用過(guò)一次,就是破電話卡,用完了也就完了,有兩年沒(méi)搞過(guò)樂(lè)。 |
|
| 16樓: | >>參與討論 |
| 作者: avr 于 2003/8/15 9:17:00 發(fā)布:
為什么一定要使用絕對(duì)定位呢? 為什么一定要使用絕對(duì)定位呢?如果什么地址都要自己分配,還不如用匯編。 |
|
| 17樓: | >>參與討論 |
| 作者: seeseatv 于 2003/8/15 16:14:00 發(fā)布:
收到,謝謝! 太久沒(méi)來(lái)21IC了,馬甲的密碼都不太記得了...試了好久...才登陸上來(lái),哈哈. 短消息收到,非常感謝! 有沒(méi)有MSN 或者 QQ ,怕以后還有問(wèn)題請(qǐng)教,呵呵. 現(xiàn)在的21IC人氣比以前旺了很多,卻沒(méi)有以前那種氛圍了.大家都很冷漠. |
|
| 18樓: | >>參與討論 |
| 作者: seeseatv 于 2003/8/15 16:59:00 發(fā)布:
這么多編譯器的定位功能都是多余的了 ? 昨晚看完了CVAVR 的SPC ,功能確實(shí)比ICC周到多了.文檔也寫(xiě)的很好.清楚明了,調(diào)理分明.很容易找到自己想要的東西.我覺(jué)得ICC的文檔純粹是亂七八糟的堆砌,一定是語(yǔ)文沒(méi)學(xué)好,呵呵. 要做就做好,要么就別做.很簡(jiǎn)單的道理. 我在AVR 完全是新手,很多時(shí)候不知道是自己的問(wèn)題還是編譯器的問(wèn)題或者其他什么問(wèn)題.有高手來(lái)指點(diǎn)非常榮幸且高興,但老兄說(shuō)出這么牽強(qiáng)的話來(lái),失望. * - 本貼最后修改時(shí)間:2003-8-15 17:01:39 修改者:seeseatv |
|
| 19樓: | >>參與討論 |
| 作者: 音樂(lè)樂(lè)樂(lè) 于 2003/8/16 15:05:00 發(fā)布:
cctv:很明顯的使用錯(cuò)誤! #pragma abs_address:0x000 CHAR ep_password[]={0x00,0x38,0x00,0x38,0x00,0x38,0x00,0x38,0x00,0x38,0x00,0x38}; #pragma end_abs_address #pragma abs_address:是對(duì)程序存儲(chǔ)器用的,而你的數(shù)組定義卻沒(méi)有加const關(guān)鍵字! The AVR is a Harvard architecture machine, separating program MEMORY from data MEMORY. There are several advantages to such a design. For example, the separate address space allows an AVR DEVICE to access more total MEMORY than a conventional architecture. For example, the ATmega series allows up to 64K words of program MEMORY and 64K bytes of data MEMORY, and future DEVICEs with possibly even greater amounts of program MEMORY may be available later. However, the program counter still remains at 16 bits. Unfortunately, C was not invented on such a machine. In particular, C pointers are either data pointers or function pointers, and C rules already specify that you cannot assume data and function pointers can be converted BACK and forth. However, with a Harvard architecture machine like the AVR, even a data pointer may point to either data MEMORY or to program MEMORY. There are no STANDARD C rules for how to handle this. The ImageCraft AVR compiler uses the "const" qualifier to signify that an ITEM is in the program MEMORY. Note that for a pointer declaration, the const qualifier may appear in different places, depending whether it is qualifying the pointer variable itself or the ITEMs that it points to. For example: const int table[] = { 1, 2, 3 }; const CHAR *ptr1; CHAR * const ptr2; const CHAR * const ptr3; "table" is a table ALLOCATED in the program MEMORY. "ptr1" is an ITEM in the data MEMORY that points to data in the program MEMORY. "ptr2" is an ITEM in the program MEMORY that points to data in the data MEMORY. Finally, "ptr3" is an ITEM in the program MEMORY that points to data in the program MEMORY. In most cases, ITEMs such as "table" and "ptr1" are probably the most typical. The C compiler generates the LPM instruction to access the program MEMORY. Note that the C STANDARD does not require "const" data to be put in the read-ONLY MEMORY, and in a conventional architecture, this would not matter except for access rights. So, this use of the const qualifier is unconventional, but within the allowable parameters of the C STANDARD. However, this does introduce conflicts with some of the STANDARD C function definitions. For example, the STANDARD prototype for "strcpy" is strcpy(CHAR *dst, const CHAR *src), with the const qualifier of the second argument signifying that the function does not modify the argument. However, under ICCAVR, the const qualifier would indicate that the second argument points to the program MEMORY which is likely not the case. Thus these functions are defined without the const qualifiers. Finally, note that ONLY const variables with file storage class will be put into FLASH. For example, variables that are defined outside of a function body or variables that have the static storage class have file storage class. If you declare local variables with the const qualifier, they will not be put into FLASH and undefined behaviors may result. The compiler emits a warning when it detects this situation. |
|
| 20樓: | >>參與討論 |
| 作者: seeseatv 于 2003/8/16 17:32:00 發(fā)布:
謝謝你的回答.你比IMAGE CRAFT的客服強(qiáng)多了. 那個(gè)署名"Richard F. Man <richard@imagecraft.com>"的客服只給我了一個(gè)愚蠢的回答:"I can assure you the code is correct. Check it carefully and see." 搞笑! 1 你在哪里找到上面的說(shuō)明的? 我在HELP里沒(méi)找到哦. 2 你的回答解決我在FLASH 里定位數(shù)組的問(wèn)題.謝謝!我只所以用#pragma data:program和#pragma abs_address:0x300來(lái)定位代碼,因?yàn)镮CC里的文檔只說(shuō)他們是用來(lái)定位的,但沒(méi)說(shuō)明定位的對(duì)象.于是我想當(dāng)然的用來(lái)定位FLASH數(shù)據(jù)了,呵呵. 3 EEPROM 的定位還是沒(méi)解決.#pragma data:EEPROM #pragma abs_address:0x000一旦使用,編譯就會(huì)嚴(yán)重出錯(cuò):程序都不是從main()開(kāi)始運(yùn)行了. 4 我對(duì)ICC可以說(shuō)是失望透了.前天看完CVAVR的文檔有決定轉(zhuǎn)向CV.雖然CV不如IAR強(qiáng)大,但已經(jīng)夠用了.而ICC ,只能說(shuō)是一個(gè)toy 而已,30天的試用時(shí)間確實(shí)enough. |
|
| 21樓: | >>參與討論 |
| 作者: 音樂(lè)樂(lè)樂(lè) 于 2003/8/16 18:05:00 發(fā)布:
不知道你用的什么型號(hào)的 * - 本貼最后修改時(shí)間:2003-8-16 18:29:18 修改者:音樂(lè)樂(lè)樂(lè) |
|
| 22樓: | >>參與討論 |
| 作者: 音樂(lè)樂(lè)樂(lè) 于 2003/8/16 18:16:00 發(fā)布:
不知道你用的什么型號(hào) 象90S8515,EEPROM的0地址是不能用的 放在其他地址試試,如0x0020 那是在ICC的幫助文件里的,是你沒(méi)有好好的看呀 不過(guò)那個(gè)幫助文件做的很不好,沒(méi)有搜索功能! |
|
| 23樓: | >>參與討論 |
| 作者: seeseatv 于 2003/8/16 22:22:00 發(fā)布:
偶用的MEGA8 ,HELP文檔都是不能搜索的,深惡痛絕啊. |
|
| 24樓: | >>參與討論 |
| 作者: 音樂(lè)樂(lè)樂(lè) 于 2003/8/17 16:31:00 發(fā)布:
誰(shuí)說(shuō)都不能,Visual系列的 MSDN就可以的 |
|
|
|
| 免費(fèi)注冊(cè)為維庫(kù)電子開(kāi)發(fā)網(wǎng)會(huì)員,參與電子工程師社區(qū)討論,點(diǎn)此進(jìn)入 |
Copyright © 1998-2006 www.udpf.com.cn 浙ICP證030469號(hào) |