Seminar Topics & Project Ideas On Computer Science Electronics Electrical Mechanical Engineering Civil MBA Medicine Nursing Science Physics Mathematics Chemistry ppt pdf doc presentation downloads and Abstract

Full Version: WinAVR and C Debugging Tutorial Seminar Report
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
WinAVR and C Debugging Tutorial Seminar Report


[attachment=67250]


Introduction

WinAVR is a set of developing tools for Atmel AVR RISC microprocessors
Programs written in C, compiled with GCC and avr-libc
Open source, obtained at: winavr.sourceforge.net


Installing

Fairly easy to install (for use at home)
http://winavr.sourceforge
Comes with all the tools you need: Programmer’s Notepad, MFile


Programmer’s Notepad

Programmer’s Notepad is the main tool you will be using to write your C code
Just like any other compiler
syntax highlighting
Support for different programming languages
Ability to compile your code (using gcc compiler)


Adding external tools (continued)

Select a Scheme (C/C++)
Click on “Add”
“Name” is an identifier for this tool
Command is the command used
Folder should be %d (Path of file)
This tool will call “make extcoff”, and is now available under “Tools” menu
We will need this later for debugging in AVR Studio


Building your source

Write your C source, save as blinky.c
Open up MFile
Makefile -> Main File Name = blinky (no .c)
Makefile -> MCU Type = atmega32
Other values should be fine at default
File -> Save As to blinky.c directory
In Programmer’s Notepad: Select Tools ->Make All


MFile

Simple program to make Makefiles for compiling your C code
A Makefile is a configuration file that tells the compiler how to compile your code
What chip you’re using (atmega32)
Target filename (blinky.c)


GNU Make

WinAVR uses “Makefiles” when building projects, with GNU Make

GNU Make builds dependencies and then source files

Will only rebuild files from updated or new source (saves time)

Very powerful tool: see C:\WinAVR\doc\gnu\make.html for more info


Programming your ATmega32

To program your chip with the C code you wrote:
Go to AVR Studio
Connect to your chip using JTAG ICE
Go to Fuses tab, make sure Ext Clock is set
In Program tab, flash your chip with the .hex file you compiled in Programmer’s Notepad
That’s it!


Building C code for Debugging

Go to Tools  Options  Tools
Pull down the Schemes window and click on C/C++ option
A make extcoff option will appear; click OK
Click on Tools again
Click on make extcoff to generate the COF file
(this will generate the correct debug file for AVR Studio that includes the C code information)