TINY_1634_VARIANT "RPUADPT

Is there any chance this pins_arduino.h variant may work?

/*
  pins_arduino.h - Pin definition functions for use with Arduino IDE
  Part of RPUadpt project http://epccs.org/indexes/Board/RPUadpt/
  
  Copyright (C) 2015 Ronald S. Sutherland

  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
*/
#ifndef Pins_Arduino_h
#define Pins_Arduino_h

#include <avr/pgmspace.h>
// 
// 20SOICpin ATTINY1634reg-bit {PCINT} (ArduinoDigital) function #notes [RPUadpt]
// 9 PA0 {0} (D 15) [RX_!RE]
// 8 PA1 {1} (D 16) [TX_DE]
// 7 PA2 {2} (D 17) [DTR_!RE]
// 6 PA3 {3} (D 0) ADC0 [DTR_DE]
// 5 PA4 {4} (D 1) ADC1 [status led]
// 4 PA5 {5} (D 2) ADC2 OC0B [FTDI_!DSR]
// 3 PA6 {6} (D 3) ADC3 OC1B [MGNT_!RST]
// 2 PA7 {7} (D 4) ADC4 RXD0 [DTR_RO]
//
// 1 PB0 {8} (D 5) ADC5 TXD0 [DTR_DI]
// 20 PB1 {9} (D 6) ADC6 SDA [SDA_TINY icsp MOSI]
// 19 PB2 {10} (D 7) ADC7 DO [icsp MISO]
// 18 PB3 {11} (D 8) ADC8 OC1A [FTDI_!RTS] 
//      
// 17 PC0 {12} (D 9) ADC9 OC0A [FTDI_!CTS]
// 16 PC1 {13} (D 10) ADC10 ICP1 SCL [SCL_TINY icsp SCK]
// 15 PC2 {14} (D 11) ADC11 INT0 [FTDI_!DTR]
// 14 PC3 {15} (D 12) !RESET
// 13 PC4 {16} (D 13) XTAL2
// 12 PC5 {17} (D 14) XTAL1

// Arduino IDE 1.6.5 has the needed /avr/iotn1634.h from avr-libc 
// thus its core might work, as a variant.


#define TINY_1634_VARIANT "RPUADPT"

#define NUM_DIGITAL_PINS            17
#define NUM_ANALOG_INPUTS           12
#define analogInputToDigitalPin(p)  ((p < NUM_ANALOG_INPUTS) ? (p) : -1)
#define ifpin(p,what,ifnot) (((p) >= 0 && (p) < NUM_DIGITAL_PINS) ? (what) : (ifnot))
#define digitalPinHasPWM(p) ifpin(p,pgm_read_byte(digital_pin_to_timer_PGM + (p)) != NOT_ON_TIMER,1==0)
#define digitalPinToAnalogPin(p)    ( (p) >= 0 && (p) <= 12 ? (p) : -1 )
// retrun the channel rather its the digital pin # or an analog pin #, e.g. analogRead(A0) should work as expected
#define analogPinToChannel(p)	    ( (p) < NUM_ANALOG_INPUTS ? (p) : -1 )

static const uint8_t SS   = -1;
static const uint8_t MOSI = 6; 
static const uint8_t MISO = 7;
static const uint8_t SCK  = 10;

static const uint8_t SDA = 6;
static const uint8_t SCL = 10;
static const uint8_t LED_BUILTIN = 1; // status LED

static const uint8_t A0 = 0; 
static const uint8_t A1 = 1;
static const uint8_t A2 = 2;
static const uint8_t A3 = 3;
static const uint8_t A4 = 4;
static const uint8_t A5 = 5;
static const uint8_t A6 = 6;
static const uint8_t A7 = 7;
static const uint8_t A8 = 8;
static const uint8_t A9 = 9;
static const uint8_t A10 = 10;
static const uint8_t A11 = 11;
static const uint8_t A12 = 12;

#define PORT_NDX_TO_PCMSK(x) ((x) == 0 ? &PCMSK0 : ((x) == 1 ? &PCMSK1 : ((x) == 2 ? &PCMSK2 : (uint8_t )0)))

// These are macros to associate pins to pin change interrupts 
#define ifpin(p,what,ifnot)	    (((p) >= 0 && (p) < NUM_DIGITAL_PINS) ? (what) : (ifnot))
#define digitalPinToPCICR(p)    ifpin(p,&PCICR,(uint8_t *)0)
#define digitalPinToPCICRbit(p) ifpin(p,digital_pin_to_pcint[p] >> 3,0)
#define digitalPinToPCMSK(p)    ifpin(p,(uint8_t *)PORT_NDX_TO_PCMSK(digital_pin_to_pcint[p] >> 3),(uint8_t *)0)
#define digitalPinToPCMSKbit(p) ifpin(p,digital_pin_to_pcint[p] & 0x7,0)

#define PA 1
#define PB 2
#define PC 3

// specify port for each pin D0-D17
#define PORT_D0 PA
#define PORT_D1 PA
#define PORT_D2 PA
#define PORT_D3 PA
#define PORT_D4 PA
#define PORT_D5 PB
#define PORT_D6 PB
#define PORT_D7 PB
#define PORT_D8 PB
#define PORT_D9 PC
#define PORT_D10 PC
#define PORT_D11 PC
#define PORT_D12 PC
#define PORT_D13 PC
#define PORT_D14 PC
#define PORT_D15 PA
#define PORT_D16 PA
#define PORT_D17 PA

// specify port bit for each pin D0-D17
#define BIT_D0 3
#define BIT_D1 4
#define BIT_D2 5
#define BIT_D3 6
#define BIT_D4 7
#define BIT_D5 0
#define BIT_D6 1
#define BIT_D7 2
#define BIT_D8 3
#define BIT_D9 0
#define BIT_D10 1
#define BIT_D11 2
#define BIT_D12 3
#define BIT_D13 4
#define BIT_D14 5
#define BIT_D15 0
#define BIT_D16 1
#define BIT_D17 2

// macro equivalents of PROGMEM arrays port_to_mode_PGM[] etc. below
#define PORT_TO_MODE(x) (x == 1 ? &DDRA : (x == 2 ? &DDRB : (x == 3 ? &DDRC : NOT_A_PORT))) 
#define PORT_TO_OUTPUT(x) (x == 1 ? &PORTA : (x == 2 ? &PORTB : (x == 3 ? &PORTC : NOT_A_PORT)))
#define PORT_TO_INPUT(x) (x == 1 ? &PINA : (x == 2 ? &PINB : (x == 3 ? &PINC : NOT_A_PORT))) 

#ifndef ARDUINO_MAIN
extern const uint8_t digital_pin_to_pcint[];
#else

// this pin lookup table gives PCINT value
const uint8_t digital_pin_to_pcint[NUM_DIGITAL_PINS] =
{
  3, // D0 PD0
  4, // D1 PD1
  5, // D2 PD2
  6, // D3 PD3
  7, // D4 PB0
  8, // D5 PB1
  9, // D6 PB3
  10, // D7 PC7
  11, // D8 PD6
  12, // D9 PD5
  13, // D10 PD4
  14, // D11 PD7
  15, // D12 PB6
  16, // D13 PB7
  17, // D14 PB5
  0, // D15 PC6
  1, // D16 PC5
  2, // D17 PC4
};

// 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,
};

const uint16_t PROGMEM port_to_output_PGM[] =
{
	NOT_A_PORT,
	(uint16_t) &PORTA,
	(uint16_t) &PORTB,
	(uint16_t) &PORTC,
};

const uint16_t PROGMEM port_to_input_PGM[] =
{
	NOT_A_PORT,
	(uint16_t) &PINA,
	(uint16_t) &PINB,
	(uint16_t) &PINC,
};

const uint8_t PROGMEM digital_pin_to_port_PGM[NUM_DIGITAL_PINS] =
{
  PORT_D0,
  PORT_D1,
  PORT_D2,
  PORT_D3,
  PORT_D4,
  PORT_D5,
  PORT_D6,
  PORT_D7,
  PORT_D8,
  PORT_D9,
  PORT_D10,
  PORT_D11,
  PORT_D12,
  PORT_D13,
  PORT_D14,
  PORT_D15,
  PORT_D16,
  PORT_D17
};

const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[NUM_DIGITAL_PINS] =
{
  _BV(BIT_D0),
  _BV(BIT_D1),
  _BV(BIT_D2),
  _BV(BIT_D3),
  _BV(BIT_D4),
  _BV(BIT_D5),
  _BV(BIT_D6),
  _BV(BIT_D7),
  _BV(BIT_D8),
  _BV(BIT_D9),
  _BV(BIT_D10),
  _BV(BIT_D11),
  _BV(BIT_D12),
  _BV(BIT_D13),
  _BV(BIT_D14),
  _BV(BIT_D15),
  _BV(BIT_D16),
  _BV(BIT_D17)
};

// OC0A (D 9),  OC0B (D 2)
// OC1A (D 8), OC1B (D 3)
// search for the usage of TIMER0B in arduino github to see how it is used
// e.g. it is defined in Arduino.h and used in wiring_digital.c to select a 
// case statement to clear bit function e.g. cbi(TCCR0A, COM0B1)
const uint8_t PROGMEM digital_pin_to_timer_PGM[NUM_DIGITAL_PINS] =
{
  NOT_ON_TIMER, // D0 PD0
  NOT_ON_TIMER, // D1 PD1
  TIMER0B,      // D2 PD2
  TIMER1B,      // D3 PD3
  NOT_ON_TIMER, // D4 PB0
  NOT_ON_TIMER, // D5 PB1
  NOT_ON_TIMER, // D6 PB3
  NOT_ON_TIMER, // D7 PC7
  TIMER1A,      // D8 PD6
  TIMER0A,      // D9 PD5
  NOT_ON_TIMER, // D10 PD4
  NOT_ON_TIMER, // D11 PD7
  NOT_ON_TIMER, // D12 PB6
  NOT_ON_TIMER, // D13 PB7
  NOT_ON_TIMER, // D14 PB5
  NOT_ON_TIMER, // D15 PC6
  NOT_ON_TIMER, // D16 PC5
  NOT_ON_TIMER // D17 PC4
};

#endif // ARDUINO_MAIN

#endif // Pins_Arduino_h
//

Not tried it yet, so clueless I am.

The ATTiny1634 can't be made to work completely with just a pins_arduino - wiring_digital and a few other things need to be changed too. pinMode() needs to use the PUE register. That pins_arduino doesn't have any sign of handling the PUE register, so pinMode() will be busted for sure, even with changes made to wiring_digital to use that.

Have you seen my ATTiny1634 core? It's tested and working (I use it all the time) - if you need a custom pin mapping, you should start from that (though, what's wrong with my pin mapping?)

Can install through board manager by adding this URL http://drazzy.com/package_drazzy.com_index.json

Or see github for more info: GitHub - SpenceKonde/arduino-tiny-841: Arduino core for ATtny841, 828, 1634 and 441

@ DrAzzy, yep I have seen your setup, it looks good and you seem to have sorted out most of what I need/want to work. With that said I am going to tinker with this a little before I give up. If I can figure out what needs to be changed, then maybe I can put in some issues on Arduino's GitHub. I would personally like to see a single Arduino core keeper (e.g. I like how Linux has a focus point). Failing that I will use your core. So far I have only used Atmel Studio to blink the LED on my board, but working with that IDE is causing my brain to melt (AS7 is powerful, but...)

I updated to 1.6.6 and found my mega1284P stuff has problems. All I had in the hardware was the variants folder with pins_arduino.h, and boards.txt. In the boards.txt file, I had .build.core=arduino:arduino which I thought was telling the system to use the Arduino core, but I guess that is not the case. This is making me think that everyone that wants to do their own board will also need their own core. Sadly any other approach may be totally unworkable. I am going to start using DrAzzy's tiny1634 core, even though I see the 1.6.6 IDE has a warning I don't understand, so that's my vote.

The warning from my core on 1.6.6 can be disregarded - it's complaining that I'm using the old way of specifying the path to core.a. But if I use the new way, it won't work on 1.6.5 and earlier! (that's the whole core.a thing that lots of people with 1.6.5 are talking about)

OK, I did see some in the github issues about the warning, but I probably skipped past the parts where the new fix broke in 1.6.5.

Thanks

Need to backtrack a little, looks like the warning I was seeing with the 1284P stuff was not from it at all... so .build.core=arduino:arduino is still working. In fact, I just tried .build.core=arduino-tiny-841:tiny and it worked. So I can define the settings and flags I want with my own boards.txt (mixed in with my 1284p stuff) and point it to use DrAzzy core. Now to look at the pin maps and do something to show that stuff on the schematic.

This is from the boards.txt file I'm using

# core is form https://github.com/SpenceKonde/arduino-tiny-841
############################################################
RPUadpt.name=RPUadpt tiny1634 (8MHz)

RPUadpt.upload.maximum_size=16384
RPUadpt.upload.maximum_data_size=1024
RPUadpt.upload.tool=avrdude

RPUadpt.bootloader.tool=avrdude
RPUadpt.bootloader.unlock_bits=0x03
RPUadpt.bootloader.lock_bits=0x03
# 8MHz internal, 2v7 B.O.D. Enabled
RPUadpt.bootloader.low_fuses=0xE2
RPUadpt.bootloader.high_fuses=0xD5
RPUadpt.bootloader.extended_fuses=0x1D

RPUadpt.build.mcu=attiny1634
RPUadpt.build.f_cpu=8000000L
RPUadpt.build.board=AVR_RPUadpt
RPUadpt.build.core=arduino-tiny-841:tiny