Picproje Elektronik Sitesi

DERLEYİCİLER => Microchip MPLAB C serisi => Microchip C30 => Konuyu başlatan: sigmoid - 10 Aralık 2007, 11:31:36

Başlık: MPLAB C30 da Peripheral Libraryleri nasıl kullanıyoruz?
Gönderen: sigmoid - 10 Aralık 2007, 11:31:36
Dökümanlardaki örnekkleri birebir copy +paste yaptığım halde bile derlerken undefined referans diye hata veriyor. Örneğin usart örneğini derlemeye çalıştığımda aşağıdaki hatayı veriyor.


Executing: "C:\Program Files\Microchip\MPLAB C30\bin\pic30-gcc.exe" -mcpu=30F6014 -x c -c   "main.c" -o"main.o" -g -Wall
main.c:1:1: warning: "__dsPIC30F6014__" redefined
<built-in>:1:1: warning: this is the location of the previous definition
main.c: In function '_T1Interrupt':
main.c:11: warning:  PSV model not specified for '_T1Interrupt';
  assuming 'auto_psv' this may affect latency
Executing: "C:\Program Files\Microchip\MPLAB C30\bin\pic30-gcc.exe" -mcpu=30F6014 "main.o" -o"perib.cof" -Wl,-L"C:\Program Files\Microchip\MPLAB C30\lib",--script="C:\Program Files\Microchip\MPLAB C30\support\gld\p30f6014.gld",-Map="perib.map",--report-mem


Program Memory Usage

section                    address   length (PC units)   length (bytes) (dec)
-------                    -------   -----------------   --------------------
.reset                           0                 0x4             0x6  (6)
.ivt                           0x4                0x7c            0xba  (186)
.aivt                         0x84                0x7c            0xba  (186)
.text                        0x100                0xd4           0x13e  (318)
.dinit                       0x1d4                 0x8             0xc  (12)
.isr                         0x1dc                 0x2             0x3  (3)

                    Total program memory used (bytes):          0x2c7  (711) <1%


Data Memory Usage

section                    address      alignment gaps    total length  (dec)
-------                    -------      --------------    -------------------
.nbss                        0x800                   0             0x2  (2)

                       Total data memory used (bytes):            0x2  (2) <1%


Dynamic Memory Usage

region                     address                      maximum length  (dec)
------                     -------                      ---------------------
heap                             0                                   0  (0)
stack                        0x802                              0x1f9e  (8094)

                       Maximum dynamic memory (bytes):         0x1f9e  (8094)

main.o(.text+0x16): In function `_T1Interrupt':
D:\A Proje\Elektronik Projeler\Ar-Ge\dsPIC perip\main.c:15: undefined reference to `WriteTimer1'
main.o(.text+0x32): In function `main':
D:\A Proje\Elektronik Projeler\Ar-Ge\dsPIC perip\main.c:33: undefined reference to `ConfigIntTimer1'
main.o(.text+0x36): D:\A Proje\Elektronik Projeler\Ar-Ge\dsPIC perip\main.c:35: undefined reference to `WriteTimer1'
main.o(.text+0x40): D:\A Proje\Elektronik Projeler\Ar-Ge\dsPIC perip\main.c:39: undefined reference to `OpenTimer1'
main.o(.text+0x44): D:\A Proje\Elektronik Projeler\Ar-Ge\dsPIC perip\main.c:51: undefined reference to `ReadTimer1'
Link step failed.
BUILD FAILED: Mon Dec 10 11:24:10 2007


Bu kütüphaneleri kullanırken yapmam gereken başka bir şey mi var?
Başlık: MPLAB C30 da Peripheral Libraryleri nasıl kullanıyoruz?
Gönderen: sigmoid - 10 Aralık 2007, 18:40:39
olayı çözdüm.  timer, uart, i2c vb Peripheral elemanları kullanırken il olarak önce ilgili header dosyasını çağırmamız gerekiyor. #include "timer.h" #include "uart.h" gibi.

ben sadece aşağıdaki işlemi yapmadığımdan derlenmiyordu. Aslında derleniyormuşta, linker ilgili kütüphaneyi bulamadığından hata veriyormuş. Kullandığımız pice göre ilgili kütüphaneyi eklememiz yeterliymiş.

Her pic farklı kütüphane dosyası kullanıyor. dsPIC30F6014 için Project penceresinde Library üzerine sağ tuşa tıklayarak Add Files tan libp30F6014-coff.a ve libp30F6014-elf.a eklemeke gerekiyormuş. Bu library ekleyince iş düzeldi.