Thứ Tư, 27 tháng 2, 2013

Dùng Visual C++ Express làm IDE lập trình cho AVR

Tạo makefile bằng chương trình Mfile của WinAVR
Ví dụ dưới đây tạo make file cho ATMega8, 12Mhz, 1 file source là main.c:

Start > All Programs > WinAVR > MFile
  • Main file name: main --> Click OK
  • MCU name:
    •  MCUType = atmega8

  • F_CPU: Makefile > Enable Editing of Makefile
    • F_CPU = 12000000
  • C/C++ source files...: mặc định có file main.c

  • Chọn programmer (mạch nạp)
  • Chọn Port (cổng COM, hoặc LPT, hoặc USB )
  • Những cái khác thì để mặc định
Save Makefile: File > Save As ...: save vào folder có chứa file main.c

------------------------------------------------------------------------------------------------------
Khởi động  Visual C++ 2008 Express:
        Start > All Programs > Micosoft Visual C++ 2008 Express
        File > New Project > Chọn Project types: General và Template: Makefile Project


Debug Configuration Settings:
  • Built Command Line:         make
  • Re-built Command Line:    make all
  • Clean Command Line:       make clean
  • Output (for debugging):    your_project_name.hex




Release Configuration Settings:
  • Chose Same as debug configuration
  • Finish.



Open Properties page:
  • Project > Properties > Configuration Properties > NMake
  • Common Language Runtime Support: Common Language Runtime Support (/clr). Chức năng này để khởi động IntelliSence củaVisual C++.
  • Apply > OK
 

 Add source file vào project:
  • Add file main.c
  • Copy Make file vào project folder






Build project:
  • Build
  • Rebuild
  • Clean


Không có nhận xét nào:

Đăng nhận xét