Imagecraft C Compiler and Development Environment for The

Total Page:16

File Type:pdf, Size:1020Kb

Imagecraft C Compiler and Development Environment for The JumpStarter C for AVR – C Compiler for Atmel AVR INTRODUCTION .............................................................................................5 Version, Trademarks, and Copyrights .................................................. 5 Software License Agreement................................................................ 6 IMPORTANT: Licensing the Software................................................ 8 Transferring a License to Another Computer ....................................... 9 Using the Hardware Dongle ............................................................... 10 Annual Maintenance ........................................................................... 11 Support................................................................................................ 12 Product Updates.................................................................................. 14 File Types and File Extensions........................................................... 15 ImageCraft C Compiler Extensions.................................................... 17 Converting from Other ANSI C Compilers........................................ 19 Optimizations...................................................................................... 21 Acknowledgments .............................................................................. 24 GETTING STARTED .....................................................................................25 Quick Start Guide ............................................................................... 25 Example Projects ................................................................................ 27 EMBEDDED PROGRAMMING....................................................................29 Embedded Programming Basics......................................................... 29 Some Pitfalls ....................................................................................... 30 Best Practices...................................................................................... 32 Bit Twiddling...................................................................................... 34 General Debugging Hints ................................................................... 36 Debugging and Flash Programming With AVR Studio ..................... 40 CODE::BLOCKS IDE.....................................................................................43 Code::Blocks IDE ............................................................................... 43 Useful General Settings for CodeBlocks IDE .................................... 45 ImageCraft Enhancements to CodeBlocks ......................................... 46 Migrating From Version 7 Projects .................................................... 47 IDE and the Compiler ......................................................................... 48 Project Management ........................................................................... 49 Editor .................................................................................................. 51 Handy CodeBlocks Editor Features.................................................... 52 Multi-Target Support and Build Properties ........................................ 53 C::B Supported Variables ................................................................... 60 Menu Reference: Build Options - Project........................................... 64 1 JumpStarter C for AVR – C Compiler for Atmel AVR Build Options - Paths.......................................................................... 65 Build Options - Compiler ................................................................... 66 Build Options - Target ........................................................................ 69 Project - Debug/Download Interface .................................................. 73 ImageCraft: Bootloader Download->Logic ISP................................. 74 JUMPSTART DEBUGGER............................................................................75 JumpStart Debugger JDB ................................................................... 75 Installing Drivers for JDB-AVR......................................................... 76 Atmel Debug Pod Firmware Updates................................................. 77 Solving Debug Pod Connection Issues............................................... 78 Debugger Operations .......................................................................... 80 CodeBlocks Debugger Functions ....................................................... 83 Advanced Debug Toolbar (ADT) Functions ...................................... 86 C PREPROCESSOR........................................................................................89 C Preprocessor Dialects ...................................................................... 89 Predefined Macros .............................................................................. 90 Pragmas............................................................................................... 92 Supported Directives........................................................................... 96 String Literals and Token Pasting....................................................... 98 C IN 16 PAGES...............................................................................................99 Preamble ............................................................................................. 99 Declaration........................................................................................ 102 Expressions and Type Promotions.................................................... 105 Statements......................................................................................... 110 C LIBRARY AND STARTUP FILE ............................................................113 C Library General Description ......................................................... 113 Overriding a Library Function.......................................................... 114 Startup File........................................................................................ 115 Header Files ...................................................................................... 118 Character Type Functions................................................................. 119 Floating-Point Math Functions ......................................................... 121 Standard IO Functions ...................................................................... 123 Standard Library And Memory Allocation Functions...................... 127 String Functions................................................................................ 130 Variable Argument Functions........................................................... 134 Stack Checking Functions ................................................................ 135 2 JumpStarter C for AVR – C Compiler for Atmel AVR Greater Than 64K Access Functions ................................................ 137 PROGRAMMING THE AVR.......................................................................139 Accessing AVR Features .................................................................. 139 io???.h Header Files.......................................................................... 140 XMega Header Files ......................................................................... 142 Generating Production ELF File....................................................... 143 CRC Generation................................................................................ 145 Program Data and Constant Memory ............................................... 146 Strings ............................................................................................... 147 Stacks ................................................................................................ 148 Inline Assembly ................................................................................ 149 IO Registers ...................................................................................... 150 XMega IO Registers ......................................................................... 151 Global Registers................................................................................ 152 Addressing Absolute Memory Locations ......................................... 154 Accessing Memory Outside of the 64K Range ................................ 156 C Tasks ............................................................................................. 160 Bootloader Applications ................................................................... 161 Interrupt Handling............................................................................. 162 Accessing EEPROM......................................................................... 165 Accessing the UART, SPI, I2C etc................................................... 168 Specific AVR Issues ......................................................................... 169 C RUNTIME ARCHITECTURE ..................................................................171 Data Type Sizes ................................................................................ 171 Assembly Interface and Calling Conventions .................................. 173 Function Pointers .............................................................................. 176 C Machine Routines.......................................................................... 177 Program and Data Memory Usage...................................................
Recommended publications
  • AVRDUDE a Program for Download/Uploading AVR Microcontroller flash and Eeprom
    AVRDUDE A program for download/uploading AVR microcontroller flash and eeprom. For AVRDUDE, Version 6.0rc1, 16 May 2013. by Brian S. Dean Send comments on AVRDUDE to [email protected]. Use http://savannah.nongnu.org/bugs/?group=avrdude to report bugs. Copyright c 2003,2005 Brian S. Dean Copyright c 2006 - 2008 J¨orgWunsch Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the con- ditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another lan- guage, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Free Software Foundation. i Table of Contents 1 Introduction............................... 1 1.1 History and Credits ......................................... 2 2 Command Line Options .................... 4 2.1 Option Descriptions ......................................... 4 2.2 Programmers accepting extended parameters ................. 15 2.3 Example Command Line Invocations ........................ 18 3 Terminal Mode Operation ................. 22 3.1 Terminal Mode Commands.................................. 22 3.2 Terminal Mode Examples ................................... 23 4 Configuration
    [Show full text]
  • Atmel Evaluation Board Tutorial
    Atmel Evaluation Board Tutorial Bruised and bearlike Andri guidings while differentiated Steve reinfuses her censors concretely and traduces uniquely. Manish is uncappingunsupposable: very sherevoltingly. elutriating feloniously and deep-drawn her witan. Self-loading Wesley retails her spirituousness so straitly that Bartie Usb protocol stack, lcds and evaluation board so Thank you Chris that means a legal to me but hear. This is the most common way we develop of an AVR. Tutorial How to Design Your enterprise Custom STM32. After this better done by board was all required certificates are at place. Fi chips which are widely used in mobile devices and the Internet of Things applications. Let see if anyone else but get you actually more specific info. Used in atmel sample programs are included to build the board designs offered by an urgent requirement so much, as we just let us write the cheapest ones. Usb port like a board, but not have the atmel has worked with? We have selected this board mainly because of substitute low cost. By default the royal Wizard launches at startup. Thanks for friend article. But it will use the board and how you. Your schematic comparison errors, and connected to understand polarized components like to upload process from avr processor, download atmel studio comes preloaded with custom microcontroller. The really brief design and manufacturing files and user's guide. To run on board, superimposed pins as vias. The Xplained Pro extension series evaluation kits offers additional peripherals to wool the features of the dire and idle the development of. MCU and acting as secure element to your devices.
    [Show full text]
  • 8-Bit Microcontrollers 32-Bit Microcontrollers and Application
    8-bit Microcontrollers 32-bit Microcontrollers and Application Processors QUICK REFE R ENCE GUIDE February 2009 Everywhere You Are® AVR Introduction Atmel® offers both 8-bit and 32-bit AVR®s. AVR microcontrollers and application processors deliver unmatched flexibility. AVR combines the most code-efficient architecture for C and assembly programming with the ability to tune system parameters throughout the entire life cycle of your key products. Not only do you get to market faster, but once there, you can easily and cost-effectively refine and improve your product offering. The AVR XMEGA gives you 16-bit performance and leading low-power features at 8-bit price. It’s simple: AVR works across the entire range of applications you’re working on... or want to work on. & Introduction QUICK REFERENCE GUIDE AVR Key Benefits AVR32 Key Benefits High performance High CPU performance picoPower™ technology Low power consumption High code density High data throughput High integration and scalability Low system cost Complete tool offering High reliability Atmel’s AVR is addressing the 8-bit and 16-bit market Easy to use Environment Friendly Packages For AVR and AVR32 microcontrollers and application processors, all the lead free packages are RoHS compliant, lead free, halide free and fully green. All parts are offered in fully green packaging only. Product Range Atmel microcontrollers - success through innovation Atmel offers both 8-bit and 32-bit AVR’s, and since day one the AVR philosophy has always been clear: Highest performance with no power penalty. tinyAVR 1-16 KBytes Flash, 8-32 pin packages megaAVR 4-256 KBytes Flash, 28-100 pin packages AVR XMEGA 16-384 KBytes Flash, 44-100 pin packages AVR32 UC3 16-512 KBytes Flash, 48-144 pin packages AVR32 AP7 Up to 32 KBytes On-chip SRAM, 196-256 pin packages & QUICK REFERENCE GUIDE Product Range Product Product Range Range Product Families tinyAVR® General purpose microcontrollers with up to 16K Bytes Flash program memory, 512 Bytes SRAM and EEPROM.
    [Show full text]
  • Adaptive Elevator Dispatcher (Using an 8-Bit AVR Microcontroller)
    the Technology Interface/Spring 2007 Cloutier and Moslehpour Adaptive Elevator Dispatcher (Using an 8-bit AVR Microcontroller) by Greg Cloutier Saeid Moslehpour [email protected] [email protected] Dep. of Electrical & Computer Engineering Dep. of Electrical & Computer Engineering University of Hartford University of Hartford Abstract: An elevator usually operates in a first come, first served mode. Any individual passenger only selects to go up or down from their current location. It is not until the passenger has entered the elevator that their actual desired location is known. The elevator will run up and stop at floors in ascending order where either a desired location is known or a new pickup request has been made. The elevator then repeats this process in the down direction and continues to cycle in this fashion until it has reacted to all the requests. Also note that the elevator has no idea what the passenger count is per request. A group of 10 passengers only needs to request a destination one time. This project will focus on a simulated office building that has 10 floors and four elevators. There are at least three different time periods where it would be nice to optimize the dispatch of the elevators with the intent to increase passenger throughput. These times are in the morning when workers first arrive, lunch time when some workers go to a cafeteria on a particular floor (or leave the building), and in the afternoon when workers leave the building. Initially, this project will focus on the Monday morning rush with the intent to increase passenger throughput over a fixed period of time.
    [Show full text]
  • AVR Butterfly Evaluation Kit
    AVR Butterfly Evaluation Kit .............................................................................................. User Guide Table of Contents Section 1 Introduction ........................................................................................... 1-5 1.1 Resources Available on the AVR Butterfly Kit ..........................................1-6 Section 2 How to Operate the Pre-programmed Application................................ 1-7 2.1 Included Firmware ....................................................................................1-7 2.2 Joystick Input ............................................................................................1-8 2.3 Menu System ............................................................................................1-9 2.4 Bootloader...............................................................................................1-11 Section 3 Using the AVR Butterfly ...................................................................... 1-15 3.1 Connectors..............................................................................................1-15 3.2 Programming the AVR Butterfly..............................................................1-15 3.3 JTAG.......................................................................................................1-19 3.4 LCD Display ............................................................................................1-20 3.5 Joystick ...................................................................................................1-20
    [Show full text]
  • Avrdude Userguide
    AVRDUDE A program for download/uploading AVR microcontroller flash and eeprom. For AVRDUDE, Version 5.1, 13 January 2006. by Brian S. Dean Send comments on AVRDUDE to [email protected]. Use http://savannah.nongnu.org/bugs/?group=avrdude to report bugs. Copyright c 2003,2005 Brian S. Dean Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the con- ditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another lan- guage, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Free Software Foundation. i Table of Contents 1 Introduction............................... 1 1.1 History and Credits ......................................... 1 2 Command Line Options .................... 3 2.1 Option Descriptions ......................................... 3 2.2 Example Command Line Invocations ........................ 10 3 Terminal Mode Operation ................. 14 3.1 Terminal Mode Commands.................................. 14 3.2 Terminal Mode Examples ................................... 15 4 Configuration File ........................ 18 4.1 AVRDUDE Defaults........................................ 18
    [Show full text]
  • Getting Started
    C Programming for Microcontrollers Featuring ATMEL’s AVR Butterfly and the Free WinAVR Compiler Joe Pardue SmileyMicros.com Copyright © 2005 by Joe Pardue, All rights reserved. Published by Smiley Micros Smiley Micros 5601 Timbercrest Trail Knoxville, TN 37909 Email: [email protected] Web: http://www.SmileyMicros.com ISBN 0-9766822-0-6 Products and services named in this book are trademarks or registered trademarks of their respective companies. In all instances where Smiley Micros is aware of a trademark claim, the product name appears in initial capital letters, in all capital letters, or in accordance with the vendor’s capitalization preferences. Readers should contact the appropriate companies for complete information on trademarks and trademark registrations. All trademarks and registered trademarks in this book are the property of their respective holders. No part of this book, except the programs and program listings, may be reproduced in any form, or stored in a database of retrieval system, or transmitted or distributed in any form, by any means, electronic, mechanical photocopying, recording, or otherwise, without the prior written permission of Smiley Micros or the author. The programs and program listings, or any portion of these, may be stored and executed in a computer system and may be incorporated into computer programs developed by the reader. NONE OF THE HARDWARE USED OR MENTIONED IN THIS BOOK IS GUARANTEED OR WARRENTED IN ANY WAY BY THE AUTHOR. THE MANUFACTURERS OR THE VENDORS THAT SHIPPED TO YOU MAY PROVIDE SOME COVERAGE, BUT THAT IS BETWEEN YOU AND THEM. NEITHER THE AUTHOR NOR SMILEY MICROS CAN PROVIDE ANY ASSISTANCE OR COMPENSATION RESULTING FROM PROBLEMS WITH THE HARDWARE.
    [Show full text]
  • AVR Development Board
    www.ijemr.net ISSN (ONLINE): 2250-0758, ISSN (PRINT): 2394-6962 Volume-7, Issue-2, March-April 2017 International Journal of Engineering and Management Research Page Number: 585-588 AVR Development Board Ankush Tandon1, Aayush Dubey2, Akash Singhal3, Ayush Goyal4, Gulshan Kumar Goyal5, Heena Aggarwal6 1,2,3,4,5,6Department of Electrical Engineering, Swami Keshvanand Institute of Technology Management & Gramothan, Ramnagaria, Jagatpura, Jaipur (RAJ.), INDIA ABSTRACT AMD chips) that provides the intelligence, RAM and Microcontroller is a compressed micro computer EEPROM memories and interfaces to rest of system, like manufactured to control the functions of embedded systems serial ports, disk drives and display interfaces. A in office machines, robots, home appliances, motor vehicles, microcontroller has all or most of these features built-in and a number of other gadgets. A micro controller to a single chip, so it doesn’t need a motherboard and development board is a printed circuit board containing a many components. AVRs are available with 8-pins to micro controller and the minimal support logic needed for an engineer to become acquainted with the microcontroller 100-pins, although anything 64-pin or over is surface on the board and to learn to program it. mount only. Most people start with a DIL (Dual In Line) Microcontroller has a CPU, in addition with a 28-pin chip like the ATmega328 or the 40-pin fixed amount of RAM, ROM and other peripherals all ATmega16 or ATmega32. PC microprocessors are embedded on a single chip. At times it is also termed as a always at least 32-bit and commonly now 64-bit.
    [Show full text]
  • Nuts and Volts
    Archivo Descargado desde las WEBS http://www.enigmaelectronica.tk Http://www.enigma.phpnet.us By enigmaelectronica > 01 $7.00 CANADA $5.50 74470 89295 03 U.S. Cover.qxd 12/11/2008 1:25 PM Page 1 Vol. 30 No. 1 NUTS & VOLTS PROTO BUDDY • SPICE SIMULATION • MOSFETS • How To - SMT SOLDERING January 2009 Jan 09.qxd 12/10/2008 6:02 PM Page 6 January 2009 www.nutsvolts.com C o n t e n t s Features 50 Power MOSFETs ■ By Gerard Fonte Part 1 will cover the theory behind these useful devices that have a lot of overlooked features. 54 A Touch of Spice ■ By Peter Stonard This month, make discoveries about IC circuits that are well-known and learn more about the concepts of sub-circuits and macromodels. 60 How To: Surface Mount Soldering ■ By Robert Doerr Get over your fear of working with these tiny components. Page 44 Page 40 Projects Columns 34 Instrumentation for Model Rocketry Incorporate additional instrumentation to a flight recorder 12 TechKnowledgey 2009 to measure a rocket’s rate of roll, relative altitude, and Events, Advances, and News booster-stage separation detection. ■ By Michael Bessant Topics covered include reconnecting brain ●●●● Advanced Level cells, a new unified storage appliance, don’t mix headphones and pacemakers, plus more. 40 16x16 Tri-Colored LED Matrix — 15 Personal Robotics Real Time Clock for the Parallax SX52 Understanding, Designing & Constructing This project allows the user to create their own scrolling Robots display to show the time (or other messages) in multiple Robo resolutions for 2009. colors.
    [Show full text]
  • Smiley's AVR Butterfly Introduction
    C Programming for Microcontrollers Quick Start Guide: The Next Generation Joe Pardue SmileyMicros.com Copyright © 2008 by Joe Pardue, All rights reserved. Published by Smiley Micros - October 2008 Smiley Micros 5601 Timbercrest Trail Knoxville, TN 37909 Email: [email protected] Web: http://www.SmileyMicros.com Products and services named in this book are trademarks or registered trademarks of their respective companies. In all instances where Smiley Micros is aware of a trademark claim, the product name appears in initial capital letters, in all capital letters, or in accordance with the vendor’s capitalization preferences. Readers should contact the appropriate companies for complete information on trademarks and trademark registrations. All trademarks and registered trademarks in this book are the property of their respective holders. No part of this book, except the programs and program listings, may be reproduced in any form, or stored in a database of retrieval system, or transmitted or distributed in any form, by any means, electronic, mechanical photocopying, recording, or otherwise, without the prior written permission of Smiley Micros or the author. The programs and program listings, or any portion of these, may be stored and executed in a computer system and may be incorporated into computer programs developed by the reader. NONE OF THE HARDWARE USED OR MENTIONED IN THIS BOOK IS GUARANTEED OR WARRANTED IN ANY WAY BY THE AUTHOR. THE MANUFACTURERS OR THE VENDORS THAT SHIPPED TO YOU MAY PROVIDE SOME COVERAGE, BUT THAT IS BETWEEN YOU AND THEM. NEITHER THE AUTHOR NOR SMILEY MICROS CAN PROVIDE ANY ASSISTANCE OR COMPENSATION RESULTING FROM PROBLEMS WITH THE HARDWARE.
    [Show full text]
  • NUTS and VOLTS Message Code: We Can Use the Same Sendchar Function to Arbitrarily Set the Cursor Position
    WWW.GiURUMELE.Hi2.RO WWW.RADiOSCAMATORUL.Hi2.RO > 11 $7.00 CANADA $5.50 74470 89295 03 U.S. Cover.qxd 10/8/2008 7:10 PM Page 1 Vol. 29 No. 11 NUTS & VOLTS PICMAS TREE • HOLIDAY LIGHTS • ZLOG ALTIMETER • CRUSTCRAWLER ARM November 2008 Full Page.qxd 12/4/2007 4:26 PM Page 2 WWW.GiURUMELE.Hi2.RO WWW.RADiOSCAMATORUL.Hi2.RO Full Page.qxd 6/2/2008 11:31 AM Page 3 WWW.GiURUMELE.Hi2.RO WWW.RADiOSCAMATORUL.Hi2.RO Free Book with Kit Full Page.qxd 10/7/2008 9:23 AM Page 4 WWW.GiURUMELE.Hi2.RO WWW.RADiOSCAMATORUL.Hi2.RO Let your geek shine. Meet Pete Lewis, lead vocalist for the band Storytyme. Pete recently created the RS1000, a new personal monitor system for performing musicians. It was SparkFun’s tutorials, products and PCB service that enabled him to take his idea to market in less than a year. The tools are out there. Find the resources you need to let your geek shine too. Sharing Ingenuity WWW.SPARKFUN.COM ©2008 SparkFun Electronics, Inc. All rights reserved. Hear music from Storytyme at www.storytymeband.com, or check out Pete’s RS1000 at www.rockonaudio.com. Full Page.qxd 10/7/2008 9:30 AM Page 5 You’ve done it the hard way. You’ve earned the right. Introducing Logic, the new Logic Analyzer with SPI, Serial, and I2C. Now shipping for $149. WWW.GiURUMELE.Hi2.RO WWW.RADiOSCAMATORUL.Hi2.RO Divide the oscillator frequency by 10 million, and measure the timing with an LED and a stopwatch.
    [Show full text]
  • Joe Pardue Smileymicros.Com
    Quick Start Guide for Using the WinAVR Compiler with ATMEL’s AVR Butterfly Joe Pardue SmileyMicros.com The Butterfly Quick Start was extracted from C Programming for Microcontrollers – Featuring ATMEL’s Butterfly and the free WinAVR compiler (available from SmileyMicros.com) Copyright © 2005 by Joe Pardue, All rights reserved. Published by Smiley Micros Smiley Micros 5601 Timbercrest Trail Knoxville, TN 37909 Email: [email protected] Web: http://www.SmileyMicros.com ISBN 0-9766822-0-6 Products and services named in this book are trademarks or registered trademarks of their respective companies. In all instances where Smiley Micros is aware of a trademark claim, the product name appears in initial capital letters, in all capital letters, or in accordance with the vendor’s capitalization preferences. Readers should contact the appropriate companies for complete information on trademarks and trademark registrations. All trademarks and registered trademarks in this book are the property of their respective holders. No part of this book, except the programs and program listings, may be reproduced in any form, or stored in a database of retrieval system, or transmitted or distributed in any form, by any means, electronic, mechanical photocopying, recording, or otherwise, without the prior written permission of Smiley Micros or the author. The programs and program listings, or any portion of these, may be stored and executed in a computer system and may be incorporated into computer programs developed by the reader. NONE OF THE HARDWARE USED OR MENTIONED IN THIS BOOK IS GUARANTEED OR WARRENTED IN ANY WAY BY THE AUTHOR. THE MANUFACTURERS OR THE VENDORS THAT SHIPPED TO YOU MAY PROVIDE SOME COVERAGE, BUT THAT IS BETWEEN YOU AND THEM.
    [Show full text]