====== [hemmerling] AVR Microcontrollers Expertness 3/4 - Software Design for the Atmel Platform ====== Related pages: *[[atmel.html|The Atmel AVR Family ( by Microchip Technology Inc. ) with Focus on ATxmega, ATmega, ATtiny and the Arduino / Freeduino Platform]]. *[[arduino.html|The Arduino / Freeduino Platform with Atmel ATmega, Microchip PIC, ARM, Freescale Coldfire]]. *[[atmega.html|Atmel ATmega, ATtiny, AT90 & ATmega ( by Microchip Technology Inc. ) on the Arduino / Freeduino Platform]]. *[[atxmega.html|Atmel ATxmega "XMEGA" ( by Microchip Technology Inc. )]] - This page deals with software tools which are suitable both for ATxmega and for ATmega, ATtiny. ===== 1 Howto include "C" Headers in a "C++" Project ===== *Question: How to include "C" headers in a "C++" project ? *Issue: Many C++ books donĀ“t cover the topic :-(. *Solution: extern ( #include "my_c_header.h" ) *Recommended readling: *[[http://msdn.microsoft.com/en-us/library/0603949d%28v=vs.80%29.aspx|Microoft MSDN Library "Using extern to Specify Linkage"]]. ===== 2 How to generate Graphics for the LCD Display of the "Atmel AVR XMEGA-A3BU Xplained kit" ===== *How To display a simple 128x32 logo ? *Solution: *On the Windows / Linux host computer, Create a BW image using [[http://www.gimp.org/|GIMP]]. Store it in the "XBM" format. *Write a little C program to convert it ( on the host Windows / Linux computer ) to a format native for the display. *Recommended reading: *[[http://en.wikipedia.org/wiki/X_BitMap|EN.Wikipedia "X BitMap"]] ( XBM ). ===== 3 Address Space ===== *Issue: AVR 8-bit CPUs work with 16-bit pointers. *In RAM, the 16-bit pointers limit access to 64K bytes. *In Flash, the 16-bit pointers limit access to 128K ( 64K words ). *However there are pointer extension registers ( RAMPZ ) that easily let you break these barriers. *WinAVR GNU-C/C++: *Make yourself familiar with the -mrelax compiler (linker) option, which is necessary to compile and link projects with > 128 Kbytes Flash. *Read-only data arrays stored in Flash memory are limited to < 32 Kbytes size. Explanations: -sizeof(int) = 2. -The requirement that array indices are signed by definition (so expressions like "pointer[-1]" can work). -The restriction that GCC wants to potentially allow byte access to all arrays/pointers. *CodeVisionAVR: *The commercial [[http://www.hpinfotech.ro/|HP Infotech "CodeVisionAVR Compiler"]] supports Flash access for memory of 256kb flash and greater, with its Medium and Large memory models. *Limits: *Recommended reading: *[[http://www.mikrocontroller.net/topic/22573|mikrocontroller.net, Thread "RAMPZ und AVR-GCC"]]. *[[http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=81288|AVR Freaks Forum, Thread "How to use morepgmspace.h"]]. *[[http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=877670|AVR Freaks Forum, Thread "128 KBytes Flash limit / barrier of AVR-GCC ?"]] #. *[[http://savannah.nongnu.org/patch/?6352|AVR C Runtime Library - Patches: patch #6352, Far pointer library]]. *[[http://www.nongnu.org/avr-libc/user-manual/FAQ.html#faq_funcptr_gt128kib|AVR Libc - Frequently Asked Questions , section "On a device with more than 128 KiB of flash, how to make function pointers work?"]]. ===== Appropriate OpenDirectory Directory Pages ===== *[[http://www.dmoz.org/Computers/Hardware/Components/Processors/AVR/|OpenDirectory "Top: Computers: Hardware: Components: Processors: AVR]]. {{tag>Atmel AVR AVR32 ATxmega128A1 ATxmega256A3BU ATmega ATtiny AT90 Arduino Freeduino ATxmega "ATX Mega" XMEGA XMEGA-A1 XMEGA-A3BU Xplained "AVR Studio" "8-bit" "32-bit" 8bit 32bit CPU "embedded system" "embedded systems"}}