网站公告列表

  没有公告

加入收藏
设为首页
联系站长
您现在的位置: 61IC中国电子在线 >> 技术文库 >> 嵌入式 >> 文章正文
  新版WINAVR环境下Demo.c编译及调试具体步骤           ★★★ 【字体:
新版WINAVR环境下Demo.c编译及调试具体步骤
作者:61IC录入    文章来源:本站原创    点击数:    更新时间:2006-4-7    
运行mfile.
运行Programmers Notepad 2.

1. 在Programmers Notepad 2环境下
   File->New->Project
   建立一个新项目: New.pnproj
   在Projects窗口
   New Project Group->demo->Add Files
   打开C:\WinAvr\examples\demo\demo.c
2. 在mfile环境下
   File->Open..
   打开C:\WinAvr\mfile\makefile_template模版文件
   另存为C:\WinAvr\examples\demo\makefile
   点击ok确认.
3. 在mfile环境下
a.MakeFile->Main file name..
   设置main file为demo
b.Mainfile->Mcu type->At90->at90s2313
c.Mainfile->Debug format->Avr-ext-COFF(AVR Studio...)
   生成可以在avrstudio中打开进行源码级调试的目标文件
   C:\WinAvr\examples\demo\demo.cof
d.Mainfile->C/C++ source file(s)...
   选择C:\WinAvr\examples\demo\demo.c
   点击ok.
4. 在mfile环境下
   File->save保存make文件
5. 在Programmers Notepad 2环境下
   在Projects窗口
   New Project Group->demo->Add Files
   打开C:\WinAvr\examples\demo\makefile
   Tools->[WINAVR] Make ALL
   在Output窗口显示C:\WinAvr\examples\demo\demo.c的编译结果如下:

> "make.exe" all

-------- begin --------
avr-gcc (GCC) 3.4.1
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Compiling: demo.c
avr-gcc -c -mmcu=at90s2313 -I. -gstabs   -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=demo.lst  -std=gnu99 -Wp,-M,-MP,-MT,demo.o,-MF,.dep/demo.o.d demo.c -o demo.o

Linking: demo.elf
avr-gcc -mmcu=at90s2313 -I. -gstabs   -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=demo.o  -std=gnu99 -Wp,-M,-MP,-MT,demo.o,-MF,.dep/demo.elf.d demo.o    --output demo.elf -Wl,-Map=demo.map,--cref    -lm

Creating load file for Flash: demo.hex
avr-objcopy -O ihex -R .eeprom demo.elf demo.hex

Creating load file for EEPROM: demo.eep
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 -O ihex demo.elf demo.eep

Creating Extended Listing: demo.lss
avr-objdump -h -S demo.elf > demo.lss

Creating Symbol Table: demo.sym
avr-nm -n demo.elf > demo.sym

Converting to AVR Extended COFF: demo.cof
avr-objcopy --debugging --change-section-address .data-0x800000 --change-section-address .bss-0x800000 --change-section-address .noinit-0x800000 --change-section-address .eeprom-0x810000  -O coff-ext-avr demo.elf demo.cof
Discarding local symbol outside any compilation unit: .do_copy_data_start
Discarding local symbol outside any compilation unit: .do_copy_data_loop
Discarding local symbol outside any compilation unit: .do_clear_bss_start
Discarding local symbol outside any compilation unit: .do_clear_bss_loop

Size after:
demo.elf  :
section    size      addr
.text       244         0
.data         0   8388704
.bss          3   8388704
.noinit       0   8388707
.eeprom       0   8454144
.stab       804         0
.stabstr   1234         0
Total      2285



Errors: none
-------- end --------


> Process Exit Code: 0
   

6.运行AVR Studio 4
  键入cancel放弃创建或打开AVR Studio的项目文件
  选择AVR Simulator ->AT90S2313
  键入finish, AVR Studio 4开始创建deno_cof.aps文件
  
7.在AVR Studio 4环境下Debug Demo.c
  ...............
               欢迎点击进入:TI德州中文网   (国内唯一针对TI应用的中文技术网站)    文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
    没有相关文章
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    站长:61IC 湘ICP备05002478号