I made small modifications on version arduino-1.0-beta4 and it works well on my Atmega1284.
Board definition is;
atmega1284.name=Bobuino W/ ATmega1284P
atmega1284.upload.protocol=arduino
atmega1284.upload.maximum_size=131072
atmega1284.upload.speed=57600
atmega1284.bootloader.low_fuses=0xFF
atmega1284.bootloader.high_fuses=0xDC
atmega1284.bootloader.extended_fuses=0xFD
atmega1284.bootloader.path=sanguino
atmega1284.bootloader.file=ATmegaBOOT_168_atmega1284p.hex
atmega1284.bootloader.unlock_bits=0x3F
atmega1284.bootloader.lock_bits=0x0F
atmega1284.build.mcu=atmega1284p
atmega1284.build.f_cpu=16000000L
atmega1284.build.core=arduino
atmega1284.build.variant=Bobuino
pins_arduino.h file in folder "C:\arduino-1.0-beta4\hardware\arduino\variants\Bobuino"
/*
pins_arduino.h - pin definitions for the Arduino board
Part of Arduino / Wiring Lite
Copyright (c) 2005 David A. Mellis
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
$Id: pins_arduino.c 254 2007-04-20 23:17:38Z mellis $
*/
#ifndef Pins_Arduino_h
#define Pins_Arduino_h
#include <avr/pgmspace.h>
#define NUM_DIGITAL_PINS 32
#define NUM_ANALOG_INPUTS 8
#define analogInputToDigitalPin(p) ((p < 8) ? (p) + 24 : -1)
#define analogInputPinToBit(p) ((P >= 24) ? (p) - 24 : -1)
#define digitalPinHasPWM(p) ((p) == 3 || (p) == 4 || (p) == 12 || (p) == 13 || (p) == 14 || (p) == 15)
const static uint8_t SS = 4;
const static uint8_t MOSI = 5;
const static uint8_t MISO = 6;
const static uint8_t SCK = 7;
const static uint8_t SDA = 17;
const static uint8_t SCL = 16;
const static uint8_t LED = 13;
const static uint8_t A0 = 24;
const static uint8_t A1 = 25;
const static uint8_t A2 = 26;
const static uint8_t A3 = 27;
const static uint8_t A4 = 28;
const static uint8_t A5 = 29;
const static uint8_t A6 = 30;
const static uint8_t A7 = 31;
// Bit 7 6 5 4 3 2 1 0
// PCMSK3 = PCINT31, PCINT30, PCINT29, PCINT28, PCINT27, PCINT26, PCINT25, PCINT24
// Dg.Pin 15 14 13 12 11 10 9 8 PCICRBit = 1
// PCMSK2 = PCINT23, PCINT22, PCINT21, PCINT20, PCINT19, PCINT18, PCINT17, PCINT16
// Dg.Pin 23 22 21 20 19 18 17 16 PCICRBit = 2
// PCMSK1 = PCINT15, PCINT14, PCINT13, PCINT12, PCINT11, PCINT10, PCINT9, PCINT8
// Dg.Pin 7 6 5 4 3 2 1 0 PCICRBit = 0
// PCMSK0 = PCINT7, PCINT6, PCINT5, PCINT4, PCINT3, PCINT2, PCINT1, PCINT0
// Dg.Pin 31 30 29 28 27 26 25 24 PCICRBit = 3
#define digitalPinToPCICR(p) (((p) >= 0 && (p) <= 31) ? (&PCICR) : ((uint8_t *)0))
#define digitalPinToPCICRbit(p) (((p) <= 7) ? 0 : (((p) <= 15) ? 1 : (((p) <= 23) ? 2 : 3)))
#define digitalPinToPCMSK(p) (((p) <= 7) ? (&PCMSK1):(((p) <= 15) ? (&PCMSK3):(((p) <= 23) ? (&PCMSK2):(((p) <= 31) ? (&PCMSK0):((uint8_t *)0)))))
#define digitalPinToPCMSKbit(p) (((p) <= 7) ? (p) : (((p) <= 15) ? ((p) - 8) : (((p) <= 23) ? ((p) - 16) : ((p) - 24))))
#ifdef ARDUINO_MAIN
// ATMEL ATMEGA1284
//
// +---\/---+
// (D 0) PB0 1| |40 PA0 (AI 0 / D24)
// (D 1) PB1 2| |39 PA1 (AI 1 / D25)
//INT2 (D 2) PB2 3| |38 PA2 (AI 2 / D26)
// PWM (D 3) PB3 4| |37 PA3 (AI 3 / D27)
// PWM (D 4) PB4 5| |36 PA4 (AI 4 / D28)
// MOSI (D 5) PB5 6| |35 PA5 (AI 5 / D29)
//PWM MISO (D 6) PB6 7| |34 PA6 (AI 6 / D30)
//PWM SCK (D 7) PB7 8| |33 PA7 (AI 7 / D31)
// RST 9| |32 AREF
// VCC 10| |31 GND
// GND 11| |30 AVCC
// XTAL2 12| |29 PC7 (D 23)
// XTAL1 13| |28 PC6 (D 22)
// RX0 (D 8) PD0 14| |27 PC5 (D 21) TDI
// TX0 (D 9) PD1 15| |26 PC4 (D 20) TDO
//INT0 RX1 (D 10) PD2 16| |25 PC3 (D 19) TMS
//INT1 TX1 (D 11) PD3 17| |24 PC2 (D 18) TCK
// PWM (D 12) PD4 18| |23 PC1 (D 17) SDA
// PWM (D 13) PD5 19| |22 PC0 (D 16) SCL
// PWM (D 14) PD6 20| |21 PD7 (D 15) PWM
// +--------+
//
// these arrays map port names (e.g. port B) to the
// appropriate addresses for various functions (e.g. reading
// and writing)
const uint16_t PROGMEM port_to_mode_PGM[] = {
NOT_A_PORT,
(uint16_t) &DDRA,
(uint16_t) &DDRB,
(uint16_t) &DDRC,
(uint16_t) &DDRD,
};
const uint16_t PROGMEM port_to_output_PGM[] = {
NOT_A_PORT,
(uint16_t) &PORTA,
(uint16_t) &PORTB,
(uint16_t) &PORTC,
(uint16_t) &PORTD,
};
const uint16_t PROGMEM port_to_input_PGM[] = {
NOT_A_PORT,
(uint16_t) &PINA,
(uint16_t) &PINB,
(uint16_t) &PINC,
(uint16_t) &PIND,
};
const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
// PORTLIST
// -------------------------------------------
PB, // PB 0 ** 0 ** D 0
PB, // PB 1 ** 1 ** D 1
PB, // PB 2 ** 2 ** D 2
PB, // PB 3 ** 3 ** D 3 PWM
PB, // PB 4 ** 4 ** D 4 PWM SS
PB, // PB 5 ** 5 ** D 5 MOSI
PB, // PB 6 ** 6 ** D 6 MISO
PB, // PB 7 ** 7 ** D 7 SCK
PD, // PD 0 ** 8 ** D 8 RX0
PD, // PD 1 ** 9 ** D 9 TX0
PD, // PD 2 ** 10 ** D 10 RX1
PD, // PD 3 ** 11 ** D 11 TX1
PD, // PD 4 ** 12 ** D 12 PWM
PD, // PD 5 ** 13 ** D 13 PWM
PD, // PD 6 ** 14 ** D 14 PWM
PD, // PD 7 ** 15 ** D 15 PWM
PC, // PC 0 ** 16 ** D 16 SCL
PC, // PC 1 ** 17 ** D 17 SDA
PC, // PC 2 ** 18 ** D 18 TCK
PC, // PC 3 ** 19 ** D 19 TMS
PC, // PC 4 ** 20 ** D 20 TDO
PC, // PC 5 ** 21 ** D 21 TDI
PC, // PC 6 ** 22 ** D 22
PC, // PC 7 ** 23 ** D 23
PA, // PA 0 ** 24 ** D 24 AI 0
PA, // PA 1 ** 25 ** D 25 AI 1
PA, // PA 2 ** 26 ** D 26 AI 2
PA, // PA 3 ** 27 ** D 27 AI 3
PA, // PA 4 ** 28 ** D 28 AI 4
PA, // PA 5 ** 29 ** D 29 AI 5
PA, // PA 6 ** 30 ** D 30 AI 6
PA // PA 7 ** 31 ** D 31 AI 7
};
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] =
{
_BV(0), /* 0, PB0 */
_BV(1), /* 1, PB1 */
_BV(2), /* 2, PB2 */
_BV(3), /* 3, PB3 */
_BV(4), /* 4, PB4 */
_BV(5), /* 5, PB5 */
_BV(6), /* 6, PB6 */
_BV(7), /* 7, PB7 */
_BV(0), /* 8, PD0 */
_BV(1), /* 9, PD1 */
_BV(2), /* 10, PD2 */
_BV(3), /* 11, PD3 */
_BV(4), /* 12, PD4 */
_BV(5), /* 13, PD5 */
_BV(6), /* 14, PD6 */
_BV(7), /* 15, PD7 */
_BV(0), /* 16, PC0 */
_BV(1), /* 17, PC1 */
_BV(2), /* 18, PC2 */
_BV(3), /* 19, PC3 */
_BV(4), /* 20, PC4 */
_BV(5), /* 21, PC5 */
_BV(6), /* 22, PC6 */
_BV(7), /* 23, PC7 */
_BV(0), /* 24, PA0 */
_BV(1), /* 25, PA1 */
_BV(2), /* 26, PA2 */
_BV(3), /* 27, PA3 */
_BV(4), /* 28, PA4 */
_BV(5), /* 29, PA5 */
_BV(6), /* 30, PA6 */
_BV(7) /* 31, PA7 */
};
const uint8_t PROGMEM digital_pin_to_timer_PGM[] =
{
NOT_ON_TIMER, /* 0 - PB0 */
NOT_ON_TIMER, /* 1 - PB1 */
NOT_ON_TIMER, /* 2 - PB2 */
TIMER0A, /* 3 - PB3 */
TIMER0B, /* 4 - PB4 */
NOT_ON_TIMER, /* 5 - PB5 */
TIMER3A, /* 6 - PB6 */
TIMER3B, /* 7 - PB7 */
NOT_ON_TIMER, /* 8 - PD0 */
NOT_ON_TIMER, /* 9 - PD1 */
NOT_ON_TIMER, /* 10 - PD2 */
NOT_ON_TIMER, /* 11 - PD3 */
TIMER1B, /* 12 - PD4 */
TIMER1A, /* 13 - PD5 */
TIMER2B, /* 14 - PD6 */
TIMER2A, /* 15 - PD7 */
NOT_ON_TIMER, /* 16 - PC0 */
NOT_ON_TIMER, /* 17 - PC1 */
NOT_ON_TIMER, /* 18 - PC2 */
NOT_ON_TIMER, /* 19 - PC3 */
NOT_ON_TIMER, /* 20 - PC4 */
NOT_ON_TIMER, /* 21 - PC5 */
NOT_ON_TIMER, /* 22 - PC6 */
NOT_ON_TIMER, /* 23 - PC7 */
NOT_ON_TIMER, /* 24 - PA0 */
NOT_ON_TIMER, /* 25 - PA1 */
NOT_ON_TIMER, /* 26 - PA2 */
NOT_ON_TIMER, /* 27 - PA3 */
NOT_ON_TIMER, /* 28 - PA4 */
NOT_ON_TIMER, /* 29 - PA5 */
NOT_ON_TIMER, /* 30 - PA6 */
NOT_ON_TIMER /* 31 - PA7 */
};
#endif
#endif
And I added the two lines for Atmega1284 to wiring_analog.c
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
if (pin >= 54) pin -= 54; // allow for channel or pin numbers
#elif defined(__AVR_ATmega1284P__)
if (pin >= 24) pin -= 24; // allow for channel or pin numbers
#else
if (pin >= 14) pin -= 14; // allow for channel or pin numbers
#endif
And two lines to wiring_private.h
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define EXTERNAL_NUM_INTERRUPTS 8
#elif defined(__AVR_ATmega1284P__)
#define EXTERNAL_NUM_INTERRUPTS 3
#else
#define EXTERNAL_NUM_INTERRUPTS 2
#endif