'AVR-GCC'에 해당되는 글 2건

  1. 2009.04.07 linux에서 AVR 컴파일하기
  2. 2008.11.18 AVR Studio / AVR-GCC 뜯어 보기
linux에서는 gcc에서 옵션으로 지원을 한다고 한다.

AVR Options - Using the GNU Compiler Collection (GCC)

3.17.23 AVR Options

These options are defined for AVR implementations:

-mmcu=mcu
Specify ATMEL AVR instruction set or MCU type.

Instruction set avr1 is for the minimal AVR core, not supported by the C compiler, only for assembler programs (MCU types: at90s1200, attiny10, attiny11, attiny12, attiny15, attiny28).

Instruction set avr2 (default) is for the classic AVR core with up to 8K program memory space (MCU types: at90s2313, at90s2323, attiny22, at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515, at90c8534, at90s8535).

Instruction set avr3 is for the classic AVR core with up to 128K program memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).

Instruction set avr4 is for the enhanced AVR core with up to 8K program memory space (MCU types: atmega8, atmega83, atmega85).

Instruction set avr5 is for the enhanced AVR core with up to 128K program memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323, atmega64, atmega128, at43usb355, at94k).

-msize
Output instruction sizes to the asm file.
-minit-stack=N
Specify the initial stack address, which may be a symbol or numeric value, `__stack' is the default.
-mno-interrupts
Generated code is not compatible with hardware interrupts. Code size will be smaller.
-mcall-prologues
Functions prologues/epilogues expanded as call to appropriate subroutines. Code size will be smaller.
-mno-tablejump
Do not generate tablejump insns which sometimes increase code size.
-mtiny-stack
Change only the low 8 bits of the stack pointer.


[링크 : http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/AVR-Options.html]

avrprog는 2001년 6월 이후로 업데이트 안되고 있고, avrdude가 계속 유지 되고 있는 듯 보인다.

[AVRPROG : http://sourceforge.net/projects/avrprog/]
[AVRDUDE : http://savannah.nongnu.org/projects/avrdude]
[gnome-avrdude : http://sourceforge.net/projects/gnome-avrdude]


아쉽게도 AVR Studio는 AVR32(32bit 버전)용 밖에 없다.

  AVR32 GNU Toolchain 2.1.6 - Linux Fedora 9 (27 MB, revision 2.1.6, updated 3/09) RPMs for Fedora Core 9.
  AVR32 Studio 2.1.1 for Linux (249 MB, revision 2.1.1, updated 2/09) AVR32 Studio package for Linux.
[atmel official : http://www.atmel.com/dyn/products/tools.asp?family_id=682]

참고 링크
[링크 : http://picky9.com/blog/entry/223]

Posted by 구차니
embeded/AVR (ATmega,ATtiny)2008. 11. 18. 00:15

AVR Studio 에서는 상당 부분이 자동으로 생성된다. (source가 아니라 makefile)
AVR 프로그래밍 처음 단계는 아마도
#include <avr/io.h>가 아닐까 싶은데 이부분을 추적을 해 보았다.

makefile - 자동생성

MCU 에 AVR Studio에서 프로젝트 생성시 선택된 프로세서의 타입이 지정되고
아래의 COMMON 에 -mmcu=atmega128 로 확장이 된다. 일단 avr-gcc의 도움말을 보자면

Usage: avr-gcc [options] file...
Options:
  -pass-exit-codes         Exit with highest error code from a phase
  --help                   Display this information
  --target-help            Display target specific command line options
  --help={target|optimizers|warnings|undocumented|params}[,{[^]joined|[^]separate}]
                           Display specific types of command line options
  (Use '-v --help' to display command line options of sub-processes)
  -dumpspecs               Display all of the built in spec strings
  -dumpversion             Display the version of the compiler
  -dumpmachine             Display the compiler's target processor
  -print-search-dirs       Display the directories in the compiler's search path

  -print-libgcc-file-name  Display the name of the compiler's companion library
  -print-file-name=<lib>   Display the full path to library <lib>
  -print-prog-name=<prog>  Display the full path to compiler component <prog>
  -print-multi-directory   Display the root directory for versions of libgcc
  -print-multi-lib         Display the mapping between command line options and
                           multiple library search directories
  -print-multi-os-directory Display the relative path to OS libraries
  -print-sysroot-headers-suffix Display the sysroot suffix used to find headers
  -Wa,<options>            Pass comma-separated <options> on to the assembler
  -Wp,<options>            Pass comma-separated <options> on to the preprocessor

  -Wl,<options>            Pass comma-separated <options> on to the linker
  -Xassembler <arg>        Pass <arg> on to the assembler
  -Xpreprocessor <arg>     Pass <arg> on to the preprocessor
  -Xlinker <arg>           Pass <arg> on to the linker
  -combine                 Pass multiple source files to compiler at once
  -save-temps              Do not delete intermediate files
  -pipe                    Use pipes rather than intermediate files
  -time                    Time the execution of each subprocess
  -specs=<file>            Override built-in specs with the contents of <file>
  -std=<standard>          Assume that the input sources are for <standard>
  --sysroot=<directory>    Use <directory> as the root directory for headers
                           and libraries
  -B <directory>           Add <directory> to the compiler's search paths
  -b <machine>             Run gcc for target <machine>, if installed
  -V <version>             Run gcc version number <version>, if installed
  -v                       Display the programs invoked by the compiler
  -###                     Like -v but options quoted and commands not executed
  -E                       Preprocess only; do not compile, assemble or link
  -S                       Compile only; do not assemble or link
  -c                       Compile and assemble, but do not link
  -o <file>                Place the output into <file>
  -x <language>            Specify the language of the following input files
                           Permissible languages include: c c++ assembler none
                           'none' means revert to the default behavior of
                           guessing the language based on the file's extension

Options starting with -g, -f, -m, -O, -W, or --param are automatically
 passed on to the various sub-processes invoked by avr-gcc.  In order to pass
 other options on to these processes the -W<letter> options must be used.

For bug reporting instructions, please see:
<URL:http://sourceforge.net/tracker/?atid=520074&group_id=68108&func=browse>.

-m 의 경우 avr-gcc 에 의해서 생성된 하위 프로세서로 자동적으로 넘겨져서 처리가 된다고 한다.
아무튼 처음에 설정하는 <avr/io.h> 는 컴파일러의 include 디렉토리에 위치하는데
기본값으로 설치를 했다면 아래의 경로에 위치하게 된다.


이 파일들 중에서 우리가 보고 싶은것은 io.h 인데 이 파일을 열어 보면


와 같이 #if #elif 로 묶여 있고 그 중에 우리가 찾던
__AVR_ATmega128__ 이라는 선언이 존재 한다. 아마도 -mmcu=atmega128이 이런식으로 치환이 되는 듯 하다.


아무튼 치환될 iom128.h 파일을 열어 보면 우리가 사용하는 일반적인 용어(!) 인
PINA DDRA 등의 선언과 그 에 상응하는 주소를 볼 수 있다.
Posted by 구차니