NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Support Forum » cpu specific configuration registers

May 18, 2011
by kle8309
kle8309's Avatar
I have a question about this subject which is unclear to me how and where the compiler look for the specific chip configuration

Is this configuration in the make file like so:

AVRDUDEFLAGS=-c avr109 -p m168 -b 115200 -P COM5

This is from the config.mk for foodloader

#elif defined(__AVR_ATmega168__)
    /* {{{ */
    #define _ATMEGA168

    #define _TIMSK_TIMER1 TIMSK1
    #define _UDRIE_UART0 UDRIE0
    #define _TXEN_UART0 TXEN0
    #define _RXEN_UART0 RXEN0
    #define _RXCIE_UART0 RXCIE0
    #define _UBRRH_UART0 UBRR0H
    #define _UBRRL_UART0 UBRR0L
    #define _UCSRA_UART0 UCSR0A
    #define _UCSRB_UART0 UCSR0B
    #define _UCSRC_UART0 UCSR0C
    #define _UCSZ0_UART0 UCSZ00
    #define _UCSZ1_UART0 UCSZ01
    #define _SIG_UART_RECV_UART0 SIG_USART_RECV
    #define _SIG_UART_DATA_UART0 SIG_USART_DATA
    #define _UDR_UART0 UDR0
    #define _UDRE_UART0 UDRE0
    #define _RXC_UART0 RXC0
    #define _IVREG MCUCR
    #define _TIFR_TIMER1 TIFR1

    /* see datasheet! */
    #define _SIG_BYTE_1 0x1e
    #define _SIG_BYTE_2 0x94
    #define _SIG_BYTE_3 0x06

    /* see avrdude configuration */
    #define _AVR910_DEVCODE 0x35
May 18, 2011
by hevans
(NerdKits Staff)

hevans's Avatar

At compile time you tell avr-gcc which chip you are using with the -mmcu flag. In our Makefiles this is in the GCCFLAGS line

GCCFLAGS=-g -Os -Wall -mmcu=atmega168

Humberto

Post a Reply

Please log in to post a reply.

Did you know that sound travels via pressure waves in the air, and you can make these with a piezoelectric buzzer? Learn more...