sudar / Arduino-Makefile

Makefile for Arduino sketches. It defines the workflows for compiling code, flashing it to Arduino and even communicating through Serial.
http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile
GNU Lesser General Public License v2.1
2.02k stars 449 forks source link

Compatibility with various attiny cores, or lack thereof #443

Closed celem closed 7 years ago

celem commented 8 years ago

Documentation in the header of Version 1.5.1 Arduino.mk implies support of The HLT (attiny-master) core:

excerpt immediately below:

# The HLT (attiny-master) core can be used just by specifying
# ALTERNATE_CORE, assuming your core is in your ~/sketchbook/hardware
# directory. For example:
#
# ISP_PORT          = /dev/ttyACM0
# BOARD_TAG         = attiny85
# ALTERNATE_CORE    = attiny-master

ALTERNATE_CORE_PATH was computed incorrectly as "~/Arduino/hardware/attiny-master/avr" which is incorrect because attiny-master has no avr directory under "~/Arduino/hardware/attiny-master. Consequentially, the header statement "The HLT (attiny-master) core can be used just by specifying ALTERNATE_CORE" is incorrect.

Also, F_CPU, will not successfully parse from either of the formulas defined in Arduino.mk (see below), requiring it to manually set in Makefile, which degrades the the usefullness of Arduino.mk

Excerpts from attiny-master's board.txt:

ATtinyX5.menu.clock.internal8.build.f_cpu=8000000L
...
ATtinyX5.menu.cpu.attiny85.build.mcu=attiny85

Excerpts from Arduino.mk

  ifndef MCU
        MCU := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).build.mcu)
        ifndef MCU
            MCU := $(call PARSE_BOARD,$(BOARD_TAG),build.mcu)
        endif
    endif

   ifndef F_CPU
        F_CPU := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).build.f_cpu)
        ifndef F_CPU
            F_CPU := $(call PARSE_BOARD,$(BOARD_TAG),build.f_cpu)
        endif
    endif

Also, you might find this exchange of interest. It is between myself and Spence Konde (aka Dr. Azzy) author of SpenceKonde/ATTinyCore:

----------Messages---------- I realize that your ATTinyCore is designed for use with the Arduino IDE but many folks, including myself, like to use Makefiles instead of the Arduino IDE. Please consider future versions of ATTinyCore that could be compatible with both the Arduino IDE and the sudar/Arduino-Makefile. Consequentially, this issue is more of a suggestion than a bug, per se.

See: https://github.com/sudar/Arduino-Makefile

I tried to utilize ATTinyCore with the very popular sudar/Arduino-Makefile but gave up after encountering more than one incompatibility.

Sudar's boards.txt expects the same format used by the Arduino IDE but ATTinyCore uses "...menu.chip.85..." instead of the Arduino IDE's "...menu.cpu.85...". I edited the boards text to fix that problem but then I encountered other problems.

attinyx5.build.variant=tinyx5 needed to be attinyx5.build.variant=tiny in order to match the directory structure.

The f_cpu is in an unexpected format. The Arduino IDE and the sudar/Arduino-Makefile use these two formats: attinyx5.menu.cpu.85.build.f_cpu=8000000L (compatible with ATTinyCore menu structure) or attinyx5-8.build.f_cpu=8000000L (not compatible with ATTinyCore menu structure) However, ATTinyCore's boards.txt uses this structure: attinyx5.menu.clock.8internal.build.f_cpu=8000000L (not compatible with sudar/Arduino-Makefile)

At this point, I gave up - simply much too incompatible. --------next-message------ I would opine that this is an issue with their makefile not supporting a valid boards.txt file due to an incomplete implementation of support for the user defined menus that are available in 1.6.x versions - you should raise the issue with them.

My brief impression looking at your issue is that the makefile does not support a single board definition having a submenu to select the clock speed - is that accurate? If so, I cannot resolve this issue without gutting the core - notice how my core supports multiple submenus for all chips, allowing configuration of not only the clock speed (we could never have as many clock options if we didn't have a submenu, as the tools->boards menu would be unusably long) but the BOD settings, and in the case of the Tiny85 and Tiny861, the clock source for Timer1 (ie, system clock, PLL, or PLL/2). --------next-message------ sudar/Arduino-Makefile does support sub-menus, although its use isn't well documented. For example, I was mostly able to parse your boards.txt sub-menus with the Makefile define shown below. It can also improve parsing by setting "BOARD_SUB". I used BOARD_SUB = 85 with a boards.txt with the format: "attinyx5.menu.cpu.85.build.mcu=ATtiny85"

ALTERNATE_CORE = ATTinyCore ISP_PORT = /dev/ttyS0 AVRDUDE_ARD_PROGRAMMER = usbasp

F_CPU defined here below due to incompatible syntax in boards.txt F_CPU = 8000000L BOARDS_TXT = /home/ecomer/Arduino/hardware/ATTinyCore/avr/boards.txt ARDUINO_VAR_PATH = /home/ecomer/Arduino/hardware/ATTinyCore/avr/cores ARDUINO_CORE_PATH = /home/ecomer/Arduino/hardware/ATTinyCore/avr/cores/tiny BOARD_TAG = attinyx5

I am currently using "http://code.google.com/p/arduino-tiny/downloads/detail?name=arduino-tiny-0150-0020.zip" because I have it working 100% with sudar/Arduino-Makefile

sej7278 commented 8 years ago

we're referring to the 1.0.5 ide which works fine, 1.6 screwed up the attiny-core and its been forked rather a lot to try to fix it, but yes, there's far too much use of unofficial submenu's for the makefile to handle. personally i much prefer the arduino-tiny core anyway. note that we did just merge the chip vs. cpu fix for attiny, but its unlikely to be enough to get it working.