avt studio 4만 다뤄봐서.. 5 부터는 어떻게 되는진 모르겠지만

윈도우에서는  -D를 통해서 cpu 종류와 클럭을 넣어주었는데

리눅스에서는 컴파일러의 도움을 받아 mcu 종류를 넣어주면 알아서 확장해서 사용한다.

그래서 win-avr과 같은 종류별로 헤더를 찾는 수고로움이 더는 장점은 있지만

빌드 과정에서 설정하게 되어 있어서 모르면 더 복잡할지도..


-mmcu=architecture

Note that when only using -mmcu=architecture but no -mmcu=MCU type, including the file <avr/io.h> cannot work since it cannot decide which device's definitions to select.


Architecture Macros

avr5

AVR_ARCH=5

AVR_MEGA [5]

AVR_ENHANCED [5]

AVR_HAVE_JMP_CALL [4]

AVR_HAVE_MOVW [1]

AVR_HAVE_LPMX [1]

AVR_HAVE_MUL [1]

AVR_2_BYTE_PC [2]

avr51

AVR_ARCH=51

AVR_MEGA [5]

AVR_ENHANCED [5]

AVR_HAVE_JMP_CALL [4]

AVR_HAVE_MOVW [1]

AVR_HAVE_LPMX [1]

AVR_HAVE_MUL [1]

AVR_HAVE_RAMPZ [4]

AVR_HAVE_ELPM [4]

AVR_HAVE_ELPMX [4]

AVR_2_BYTE_PC [2]


-mmcu=MCU type

The following MCU types are currently understood by avr-gcc. The table matches them against the corresponding avr-gcc architecture name, and shows the preprocessor symbol declared by the -mmcu option. 


Architecture MCU name    Macro

avr5/avr51 [3] atmega128   __AVR_ATmega128__

[링크 : http://www.nongnu.org/avr-libc/user-manual/using_tools.html]





#define AVR 1

#define __AVR 1

#define __AVR_ARCH__ 5

#define __AVR_ATmega128__ 1

#define __AVR_ENHANCED__ 1

#define __AVR_MEGA__ 1

#define __AVR__ 1

#define __CHAR_BIT__ 8

#define __DBL_DENORM_MIN__ 1.40129846e-45

#define __DBL_DIG__ 6

#define __DBL_EPSILON__ 1.19209290e-7

#define __DBL_HAS_INFINITY__ 1

#define __DBL_HAS_QUIET_NAN__ 1

#define __DBL_MANT_DIG__ 24

#define __DBL_MAX_10_EXP__ 38

#define __DBL_MAX_EXP__ 128

#define __DBL_MAX__ 3.40282347e+38

#define __DBL_MIN_10_EXP__ (-37)

#define __DBL_MIN_EXP__ (-125)

#define __DBL_MIN__ 1.17549435e-38

#define __DECIMAL_DIG__ 9

#define __FINITE_MATH_ONLY__ 0

#define __FLT_DENORM_MIN__ 1.40129846e-45F

#define __FLT_DIG__ 6

#define __FLT_EPSILON__ 1.19209290e-7F

#define __FLT_EVAL_METHOD__ 0

#define __FLT_HAS_INFINITY__ 1

#define __FLT_HAS_QUIET_NAN__ 1

#define __FLT_MANT_DIG__ 24

#define __FLT_MAX_10_EXP__ 38

#define __FLT_MAX_EXP__ 128

#define __FLT_MAX__ 3.40282347e+38F

#define __FLT_MIN_10_EXP__ (-37)

#define __FLT_MIN_EXP__ (-125)

#define __FLT_MIN__ 1.17549435e-38F

#define __FLT_RADIX__ 2

#define __GNUC_MINOR__ 1

#define __GNUC_PATCHLEVEL__ 0

#define __GNUC__ 4

#define __GXX_ABI_VERSION 1002

#define __INTMAX_MAX__ 9223372036854775807LL

#define __INTMAX_TYPE__ long long int

#define __INT_MAX__ 32767

#define __LDBL_DENORM_MIN__ 1.40129846e-45L

#define __LDBL_DIG__ 6

#define __LDBL_EPSILON__ 1.19209290e-7L

#define __LDBL_HAS_INFINITY__ 1

#define __LDBL_HAS_QUIET_NAN__ 1

#define __LDBL_MANT_DIG__ 24

#define __LDBL_MAX_10_EXP__ 38

#define __LDBL_MAX_EXP__ 128

#define __LDBL_MAX__ 3.40282347e+38L

#define __LDBL_MIN_10_EXP__ (-37)

#define __LDBL_MIN_EXP__ (-125)

#define __LDBL_MIN__ 1.17549435e-38L

#define __LONG_LONG_MAX__ 9223372036854775807LL

#define __LONG_MAX__ 2147483647L

#define __NO_INLINE__ 1

#define __PTRDIFF_TYPE__ int

#define __REGISTER_PREFIX__ 

#define __SCHAR_MAX__ 127

#define __SHRT_MAX__ 32767

#define __SIZE_TYPE__ unsigned int

#define __STDC_HOSTED__ 1

#define __STDC__ 1

#define __UINTMAX_TYPE__ long long unsigned int

#define __USER_LABEL_PREFIX__ 

#define __USING_SJLJ_EXCEPTIONS__ 1

#define __VERSION__ "4.1.0"

#define __WCHAR_MAX__ 32767

#define __WCHAR_TYPE__ int

#define __WINT_TYPE__ unsigned int 

[링크 : http://www.avrfreaks.net/forum/how-does-mmcumcutarget-work]


'embeded > AVR (ATmega,ATtiny)' 카테고리의 다른 글

마우스 DIY 자료  (0) 2015.09.23
키보드 DIY 자료  (0) 2015.09.23
ubuntu 에서 AVR 컴파일하기  (0) 2015.07.30
USART UBRR error rate  (0) 2015.07.29
avr-libc 8bit AVR C++  (0) 2015.07.28
Posted by 구차니