avr-gcc programming

Download AVR-GCC Programming

Post on 01-Jan-2016

27 views

Category:

Documents

0 download

Embed Size (px)

DESCRIPTION

AVR-GCC Programming. Using C Development Tools to program your Arduino Microcontrollers. Presented by: Charles Norona November 17th, 2011. Intro to WinAVR. Set of tools for developing Arduino M/Cs. Includes: Avr-gcc (command line compiler) Avr-libc (compiler library) - PowerPoint PPT Presentation

TRANSCRIPT

  • AVR-GCC ProgrammingPresented by: Charles NoronaNovember 17th, 2011Using C Development Tools to program your Arduino Microcontrollers.

    C. Norona, cnorona1@gmail.com

  • Intro to WinAVRSet of tools for developing Arduino M/Cs.Includes:Avr-gcc (command line compiler)Avr-libc (compiler library)Avr-as (assembler library)AVRDude (Programming Interface)Avarice (JTAG ICE interface)Avr-gdb (Debugger)Programmer's Notepad (IDE/Code Editor)

    C. Norona, cnorona1@gmail.com

  • Getting WinAVRDownload the latest version of WinAVR at the download page. Latest version as of Nov. 15, 2011 is 20100110.Run the installer once downloaded.

    C. Norona, cnorona1@gmail.com

  • Setting Up the Dev EnvironmentSteps involved:Editing the Makefile.Explanation of the makefile.Resources for editing.Setting up and using an IDE. In this case: Programmer's Notepad.Adding custom commandsSetting up the project.Running the program.

    C. Norona, cnorona1@gmail.com

  • Editing the Make FileExplanation of important Makefile instructions. Refer to Main Tutorial for WinAVR reference.

    References for navigating the Makefile:AVRDude Options (lists of acceptable parameters and commands usage).Microcontroller Datasheet (tech specs).AVRDude.conf (configuration file for AVRDude).Can generally found at: ../AVRDude-XXXXXXXX/bin/avrdude.conf

    C. Norona, cnorona1@gmail.com

  • Setting Up and Using an IDEOur IDE needs to be set up with proper build and make commands.Make AllMake CleanProgram DeviceMake ExtcoffMake Coff (deprecated)

    COFF Common Object File Format. However in the context of the AVR it is referred to as the fileformat that AVR Studio uses for its debugging. AVR Studio 4.07 and later also supports an extendedCOFF format that has a few extra features. The WinAVR package is able to make both types of COFFfiles, although you may need to add the COFF extension package on.

    C. Norona, cnorona1@gmail.com

  • Setting Up and Using an IDEIn Programmer's Notepad the tools customization can be accessed by Tools Options

    C. Norona, cnorona1@gmail.com

  • Setting Up and Using an IDEMake All CommandName: Make AllCommand: makeFolder: %dParameters: allSave: Current File

    C. Norona, cnorona1@gmail.com

  • Setting Up and Using an IDEMake All CommandCapture output: enabled and uses main window.Clear output: optionalOutput Parsing: Use built-in error parser.

    C. Norona, cnorona1@gmail.com

  • Setting Up and Using an IDEEnsure that the rest of the commands are implemented. The following are the corresponding settings for each command:

    C. Norona, cnorona1@gmail.com

  • Running a ProgramAdd this code to the new file, test01.c.

    Do not forget to edit the Makefile with appropriate values.

    Code will have errors for sake of exemplification.

    #include #include

    void main (void){ unsigned char counter;

    //set PORTB for output DRB = 0xFF;

    while (1) { //set PORTB.2 high PORTB |= 1

  • Demo Time!

    C. Norona, cnorona1@gmail.com

  • ReferencesMain page for WinAVR. http://winavr.sourceforge.net/helpme.html. Main Tutorial for WinAVR which this presentation is based on. http://winavr.sourceforge.net/install_config_WinAVR.pdf. By C. O'Flynn and E. Weddington AVRDUDE Info. http://www.nongnu.org/avrdude/user-manual/avrdude_4.html. WinAVR Download link. http://sourceforge.net/projects/winavr/files/WinAVR/20100110/. Arduino Duemilanove Listing. http://arduino.cc/en/Main/arduinoBoardDuemilanove. WinAVR GCC Tutorials Source. Contains plenty of tutorials to do various things with your arduino. http://winavr.scienceprog.com/.

    C. Norona, cnorona1@gmail.com

Recommended

View more >