Re: 關於C和組語同時使用
|
||||
---|---|---|---|---|
資深會員
|
請問 如果在DEBUG模式下
每次RESET 都會出現 STARTUP.AS檔案 要怎樣設定才可以讓IDE不出現這個檔案 ?? 不然每次都會彈出這個視窗 = =
發表於: 2009/10/19 13:47
|
|||
|
Re: 關於C和組語同時使用
|
||||
---|---|---|---|---|
新會員
|
感謝Ryang的回答。
發表於: 2009/10/16 11:23
|
|||
|
Re: 關於C和組語同時使用
|
||||
---|---|---|---|---|
版主
|
剛再測試一下,Build 完後會叫出 c018i.o 的畫面,但 reset 後就直接跳到main( ) 了。記住一點其實 c018i.c 也是你的程式,她是用來設定變數初始值、堆疊指標、一般通用指標等必需的設定。也就是說程式必須先執行 c018i.c 後你的程式才會正確的執行。
當然在 debug 過程中是忽略它的,只要管 main( ) 開市就可以了。
發表於: 2009/10/16 11:14
|
|||
|
Re: 關於C和組語同時使用
|
||||
---|---|---|---|---|
新會員
|
參照:
感謝Ryang的回應。 按照您說的方式修改以後,仍然會在Build All之後自動跳出c018i.c的程式碼視窗。 不過我想請問一下如果這是否只是MPLAB IDE的視窗設定問題,而不是程式碼在連結或是執行上的錯誤?如果只是設定問題,而不會影響到任何source code的運作和執行,那我就先忽略不管它了。 (BUILD SUCCEEDED,沒有任何warning) 謝謝。
發表於: 2009/10/16 10:44
|
|||
|
Re: 關於C和組語同時使用
|
||||
---|---|---|---|---|
版主
|
在MPLAB IDE 下,Reset 程式後後挑出啟動模組的程式。
可以在 Config --> Setting 下選擇程式在 Reset 後直接修執行啟動模組後在main( ) 停下來,這樣啟動模組就不會被叫出來了。 Attach file: (0.00 KB)
發表於: 2009/10/16 10:05
|
|||
|
Re: 關於C和組語同時使用
|
||||
---|---|---|---|---|
新會員
|
感謝Ryang的回應,不過可能誤會了我的語意,讓我釐清一下。
1. extern void asm_function(void); 此為函數的原型宣告,不用加 extern 之所以加extern,是因為在曾百由老師的書中有提到: Page_99:在C語言程式中必須要將被呼叫的組合語言函式宣告為外部(extern)函式。 此extern void asm_function(void); 為書中之範例。 2. GLOBAL asm_function global 不是 label 她是個指令,在組語裡有人將指令寫在第一個位置的嗎? GLOBAL是一個directive,的確不應該放在第一個位置,這個回答解決了兩個warning的問題,非常感謝! 3. 這是啟動模組 c018i.c 的程式,主要是將 Reset 的執行進入點轉向到 startup 的程式去執行。你沒看到有 goto 指令嗎?[/quote] 我知道這是啟動模組的程式,不過我的問題在每次Build All之後都會自動跳出c018i.c的程式碼視窗。 不知道這種情況是代表什麼意思。 麻煩各位先進再指點一下,謝謝。
發表於: 2009/10/16 9:49
|
|||
|
Re: 關於C和組語同時使用
|
||||
---|---|---|---|---|
版主
|
參照:
這是啟動模組 c018i.c 的程式,主要是將 Reset 的執行進入點轉向到 startup 的程式去執行。你沒看到有 goto 指令嗎?
發表於: 2009/10/15 9:36
|
|||
|
Re: 關於C和組語同時使用
|
||||
---|---|---|---|---|
新會員
|
好像語意有點不清,再重新排版一次。
麻煩有經驗的先進們指點一下, 謝謝。 ---------------------------- u901833 寫道: 各位先輩大家好: 想請問一下,小弟在用MCC18時,想試試cross-compiler的功能,於是寫了一個ex1.c和ex1.asm都include在Source Files裡, 我用的是MPLAB IDE v8.36 ex1.c及ex1.asm的兩個檔案內容如下 ex1.c:
#include <stdio.h>
執行之後以MPLAB SIM Uart1可以看到 Hello, world! 0 15 表示執行正常。 但是在Build All之後,出現了兩個warning,分別是Found directive in column 1. (EXTERN)及Found directive in column 1. (GLOBAL),程式執行上都沒有問題,但就是有這兩個討人厭的warning,請問該如何解決? 另外,每次Build All之後,都是自動跳出c018i.c的檔案並且有藍色箭頭指向 _entry (void) { _asm goto _startup _endasm } 中的_asm goto _startup _endasm, 請問這是怎麼回事?
發表於: 2009/10/15 9:13
|
|||
|
關於C和組語同時使用
|
||||
---|---|---|---|---|
新會員
|
各位先輩大家好:
想請問一下,小弟在用MCC18時,想試試cross-compiler的功能,於是寫了一個ex1.c和ex1.asm都include在Source Files裡,但是在Build All之後,出現了兩個warning,分別是Found directive in column 1. (EXTERN)及Found directive in column 1. (GLOBAL),程式執行上都沒有問題,但就是有這兩個討人厭的warning,請問該如何解決? 另外,每次Build All之後,都是自動跳出c018i.c的檔案並且有藍色箭頭指向 _entry (void) { _asm goto _startup _endasm } 中的_asm goto _startup _endasm, 請問這是怎麼回事? 我用的是MPLAB IDE v8.36 ex1.c及ex1.asm的兩個檔案內容如下 ex1.c: #include <stdio.h> #pragma config WDT = OFF extern void asm_function(void); unsigned int c_variable; void main (void) { printf ("Hello, world!\n"); c_variable = 0; printf ("%d\n",c_variable); asm_function(); printf ("%d\n",c_variable); while (1); } ex1.asm: EXTERN c_variable MYCODE CODE asm_function MOVLW 0x0f MOVWF c_variable RETURN GLOBAL asm_function END 執行之後以MPLAB SIM Uart1可以看到 Hello, world! 0 15 表示執行正常。 謝謝大家
發表於: 2009/10/13 15:33
|
|||
|