30.10.2014 Views

o_195h4n6al16jb186b1b2qs7fgssa.pdf

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

• Startup Code<br />

• DSP Library<br />

• dsPIC Peripheral Libraries<br />

• Standard C Libraries (with Math Functions)<br />

• MPLAB C30 Built-in Functions<br />

1.2 OMF-SPECIFIC LIBRARIES/STARTUP MODULES<br />

Library files and startup modules are specificto OMF (Object Module Format).<br />

An OMF<br />

can be one of the following:<br />

• COFF - This is the default.<br />

• ELF - The debugging format used for ELF object files is DWARF 2.0.<br />

There are two ways to select the OMF:<br />

1. Set an environment variable called PIC30_OMFfor all tools.<br />

2. Select the OMF on the command line when envoking the tool, i.e., -<br />

omf=omfor<br />

-momf=omf.<br />

dsPIC tools will first look for generic library files when building your<br />

application (no OMF<br />

specification). If these cannot be found, the tools will look at your OMF<br />

specifications<br />

and determine which library file to use.<br />

As an example, if libdsp.ais not found and no environment variable or<br />

command-line opton is set, the file libdsp-coff.awill be used by default.<br />

dsPIC<br />

®<br />

Language Tools Libraries<br />

DS51456B-page 8<br />

1.3 STARTUP CODE<br />

2004 Microchip Technology Inc.<br />

In order to initialize variables in data memory, the linker creates a data<br />

initialization<br />

template. This template must be processed at startup, before the application<br />

proper<br />

takes control. For C programs, this function is performed by the startup modules<br />

in<br />

libpic30-coff.a (either crt0.oor crt1.o) or libpic30-elf.a (either<br />

crt0.eoor crt1.eo). Assembly language programs can utilize these modules<br />

directly by linking with the desired startup module file. The source code for the<br />

startup<br />

modules is provided in corresponding .sfiles.<br />

The primary startup module (crt0) initializes all variables (variables without<br />

initializers<br />

are set to zero as required by the ANSI standard) except for variables in the<br />

persistent<br />

và xác định các tập tin thư viện để sử dụng.<br />

Ví dụ, nếu libdsp.ais không tìm thấy và không có biến môi trường hoặc<br />

dòng lệnh opton được thiết lập, các tập tin libdsp-coff.awill được sử dụng theo<br />

mặc định.<br />

dsPIC<br />

®<br />

Thư viện Công cụ Ngôn ngữ<br />

DS51456B trang 8<br />

1.3 STARTUP MÃ<br />

2004 Microchip Technology Inc<br />

Để khởi tạo các biến trong bộ nhớ dữ liệu, các mối liên kết tạo ra một khởi tạo<br />

dữ liệu<br />

mẫu. Mẫu này phải được xử lý lúc khởi động, trước khi áp dụng thích hợp<br />

mất quyền kiểm soát. Đối với chương trình C, chức năng này được thực hiện<br />

bằng các bộ phận khởi động trong<br />

libpic30-coff.a (hoặc crt1.o crt0.oor) hoặc libpic30-elf.a (hoặc<br />

crt0.eoor crt1.eo). Các chương trình ngôn ngữ lắp ráp có thể sử dụng các môđun<br />

trực tiếp bằng cách liên kết với các tập tin khởi động mô-đun mong muốn. Các<br />

mã nguồn cho khởi động<br />

module được cung cấp trong .sfiles tương ứng.<br />

Các mô-đun khởi động chính (crt0) khởi tạo tất cả các biến (biến mà không cần<br />

khởi tạo<br />

được thiết lập để không theo yêu cầu của tiêu chuẩn ANSI), trừ các biến trong<br />

dai dẳng<br />

phần dữ liệu. Các mô-đun khởi động thay thế (crt1) không thực hiện khởi tạo dữ<br />

liệu.<br />

Để biết thêm về mã khởi động, xem MPLAB ASM30, MPLAB LINK30 và tiện<br />

ích của người sử dụng<br />

Guideand, cho các ứng dụng C, hướng dẫn người sử dụng MPLAB C30 C<br />

Compiler.<br />

1.4 DSP THƯ VIỆN<br />

Thư viện DSP (libdsp-omf.a) cung cấp một tập hợp các hoạt động xử lý tín hiệu<br />

kỹ thuật số để một chương trình mục tiêu để thực hiện trên một dsPIC30F điều<br />

khiển tín hiệu số (DSC).<br />

Tổng cộng, 49 chức năng được hỗ trợ bởi các thư viện DSP.<br />

1,5 dsPIC PERIPHERAL THƯ VIỆN<br />

Các dsPIC (phần mềm và phần cứng) peripherallibraries cung cấp chức năng và<br />

macro<br />

lập và kiểm soát thiết bị ngoại vi dsPIC30F DSC. Ví dụ về sử dụng cũng có<br />

cung cấp trong mỗi chương liên quan đến cuốn sách này.<br />

Các thư viện này là bộ xử lý cụ thể và các hình thức libpDevice-omf.a, nơi<br />

Thiết bị = dsPIC số thiết bị (ví dụ, libp30F6014-coff.afor các dsPIC30F6014<br />

thiết bị.)<br />

1.6 TIÊU CHUẨN THƯ VIỆN C (với các hàm toán)<br />

Một bộ hoàn chỉnh của ANSI-89 thư viện phù hợp được cung cấp. Các tiêu<br />

chuẩn thư viện C<br />

tập tin được libc-omf.a (được viết bởi Dinkumware, một nhà lãnh đạo ngành

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!