Add support for Arduino 1.5
sudar opened this issue · 83 comments
Arduino 1.5 has changed the directory structure.
Add an option to specify (or auto detect) Arduino version and then based on that change the directory paths.
Changes should be compatible with 1.0.x version of Arduino as well.
Soon, development in Arduino 1.0.x branch will stop and Arduino 1.5.x branch will come out of beta.
https://groups.google.com/a/arduino.cc/d/msg/developers/KeFMqEDu4jA/j-m7WZivlaAJ
I quickly had a look to see what all changed in Arduino 1.5.x
- Preference file path is changed.
- Library file directory is changed.
- boards.txt file has new properties
I am thinking of creating a new branch to start development for 1.5.x. Once it becomes stable, we can merge it back to master.
Also, boards.txt can be present inside a submenu. This should be supported as well. See xxxajk/Arduino_Makefile_master#2
Yes, I did an unclean fork. I also now auto detect libraries. :-) Please feel free to pull bits from mine.
@xxxajk I saw your repo the other day and made a note to steal code from you for library detection ;)
Jokes apart, would you be interested in merging both our repos?
Certainly, as long as my projects, and others still compile. But before we
merge anything, I need to make the include scanner just a touch smarter. --
Meaning that I need to look at what the java code is doing. Currently what
I do is a real lousy hack.
On Oct 25, 2013 5:26 AM, "Sudar" notifications@github.com wrote:
@xxxajk https://github.com/xxxajk I saw your repo the other day and
made a note to steal code from you for library detection ;)Jokes apart, would you be interested in merging both our repos?
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/45#issuecomment-27076613
.
You are now welcome to check out what is new. I will be adding support for the Teensy series from pjrc.com very soon, hopefully today. You are (of course) welcome to pull in the bits from that as well, and do with them as you please. As far as merging the two, I don't see that as really possible because of the vast differences in installation and use. For one, my version does not depend on knowing where you sketchbook is located. It does not need to know, because it expect that you have all the needed bits in ../libraries. This allows for independent trees for various boards and private trees automatically. I am considering, however to do a scan of where Arduino IDE WOULD look between the current search and the Arduino home directories searches. Another thing that is really needed is to gather this information more logically by doing a normal dependency gathering via the C Pre Processor, this way, nothing not needed is not compiled, and includes that won't be seen in the include path, won't be included in the path. That will increase compile speeds. Still, one feature at a time :-)
You are now welcome to check out what is new. I will be adding support for the Teensy series from pjrc.com very soon, hopefully today. You are (of course) welcome to pull in the bits from that as well, and do with them as you please.
Sure will do that, as soon as I get some free time.
As far as merging the two, I don't see that as really possible because of the vast differences in installation and use.
After your last comment, I was wondering the same. May be it is too much work to merge them right now. But if at all at any point you wish to merge them, I would be happy to help out.
Meanwhile, I will be looking into your makefile to grab the code that works for Arduino 1.5.x branch :)
is there currently a branch somewhere which works with latest ide ? I just got a yun so I need the latest library which killed my current setup (inotool) :/
@schmurfy unfortunately, we don't have any code that is compatible with Arduino 1.5.x yet
just seen ide 1.5.6 go into debian unstable..... ah no its a mistake
do we know the basic 1.5 changes - from a quick glance it seems to be that the hardware directory is split into avr and sam, making the paths to bootloaders, variants, boards.txt different. boards.txt has what looks like cosmetic changes, preferences.txt is pretty different.....
@sej7278 Those are pretty much the important changes.
Also if we decide to support sam based boards, then we might have to provide a way to detect the proper compiler based on the architecture.
You may want to look at the additions made to mine for support. Ours
already does it.
On Apr 2, 2014 12:31 AM, "Sudar" notifications@github.com wrote:
@sej7278 https://github.com/sej7278 Those are pretty much the important
changes.Also if we decide to support sam based boards, then we might have to
provide a way to detect the proper compiler based on the architecture.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/45#issuecomment-39287941
.
I ended up making my own build script, one thing I noticed was how horrible the boards.txt was to parse xD
Easy to use sed, it is just java properties.
On Apr 2, 2014 3:50 AM, "Julien Ammous" notifications@github.com wrote:
I ended up making my own build script, one thing I noticed was how
horrible the boards.txt was to parse xD—
Reply to this email directly or view it on GitHubhttps://github.com//issues/45#issuecomment-39297397
.
yeah but the structure is pretty stupid with those .menu. items.
@schmurfy you can just use split() on '=' to make a nice array.
or awk:
awk -F= {'print $1'} /usr/share/arduino/hardware/arduino/boards.txt
or grep like we do in the makefile:
grep -v "^\#" boards.txt | grep leonardo.upload.speed | cut -d = -f 2
oh yes the new splitting of cpu/board into menu's is pretty naff as they're kind of defining how the gui looks within boards.txt, assuming people are using the IDE....
@xxxajk is that it? surely there's more to it? although that's not backwards-compatible with 1.0 is it - or is that worked around by defining THIRD_PARTY_HARDWARE and/or ARD_HOME?
I've just made a quick'n'dirty 1.5 proof-of-concept branch which just inserts the architecture anywhere the hardware folder is referenced. its not a full-blown build but it does work unmodified with 1.0.5 and only requires a single variable in the Makefile to build on 1.5.6, so its not going to be too hard to implement.
References: library spec / hardware spec
Wow!! this is definitely a great start :)
i've added a few more commits including one that replaces hardcoded "arduino" wit a $VENDOR variable,
i think we're going to have to replace the ALTERNATE_CORES routines though, as its kind of built into 1.5 with build.core etc.
@sej7278 While it is desirable to have support for both 1.0.x and 1.5.x in the same branch/release, I am even open to having separate branch/release, if it proves to be too much work to make them compatible.
But I will leave the decision to you.
yes, we'll see how it goes. you can't have 2 versions of the ide installed at the same time so it wouldn't hurt to split the makefile into 2 versions.
it certainly needs a different git branch, so we can continue with the odd patch to 1.3.3
my branch is just a test really, but if you want i can make a pull request if you create a branch to pull it into
you can't have 2 versions of the ide installed at the same time so it wouldn't hurt to split the makefile into 2 versions.
Actually we can run two versions of the IDE, at least in mac and linux :) I downloaded both the IDE's as zip files (not the installed) and extracted them into different folders. I change the PATH variable based on which version of the IDE I want to work with.
it certainly needs a different git branch, so we can continue with the odd patch to 1.3.3
I agree.
my branch is just a test really, but if you want i can make a pull request if you create a branch to pull it into
Let's wait a little more till your branch is slightly stable. After that I can pull in all your changes as a separate branch and maintain it till we merge it back to master.
Here's what happened when I tried to make blink from @sej7278's repo:
Bogdan@Uranus ~/Arduino-Makefile/examples/blink
$ make ARDUINO_DIR=~/Arduino ARCHITECTURE=avr
-------------------------
Arduino.mk Configuration:
- [AUTODETECTED] CURRENT_OS = WINDOWS
- [COMPUTED] ARDMK_DIR = /home/Bogdan/Arduino-Makefile (relative to Common.mk)
- [USER] ARDUINO_DIR = /home/Bogdan/Arduino
- [AUTODETECTED] ARDUINO_VERSION = 156
- [USER] ARCHITECTURE = avr
- [DEFAULT] VENDOR = arduino
- [DEFAULT] ARDUINO_SKETCHBOOK = /home/Bogdan/sketchbook
- [BUNDLED] AVR_TOOLS_DIR = /home/Bogdan/Arduino/hardware/tools/avr (in Arduino distribution)
- [COMPUTED] ARDUINO_LIB_PATH = /home/Bogdan/Arduino/libraries (from ARDUINO_DIR)
- [DEFAULT] ARDUINO_CORE_PATH = /home/Bogdan/Arduino/hardware/arduino/avr/cores/arduino
- [COMPUTED] ARDUINO_VAR_PATH = /home/Bogdan/Arduino/hardware/arduino/avr/variants (from ARDUINO_DIR)
- [COMPUTED] BOARDS_TXT = /home/Bogdan/Arduino/hardware/arduino/avr/boards.txt (from ARDUINO_DIR)
- [DEFAULT] USER_LIB_PATH = /home/Bogdan/sketchbook/libraries (in user sketchbook)
- [DEFAULT] PRE_BUILD_HOOK = pre-build-hook.sh
- [USER] BOARD_TAG = uno
- [COMPUTED] OBJDIR = build-uno (from BOARD_TAG)
- [ASSUMED] MONITOR_BAUDRATE = 9600
- [DEFAULT] OPTIMIZATION_LEVEL = s
- [DEFAULT] MCU_FLAG_NAME = mmcu
- [DEFAULT] CFLAGS_STD = -std=gnu99
- [AUTODETECTED] Size utility: AVR-aware for enhanced output
- [COMPUTED] BOOTLOADER_PARENT = /home/Bogdan/Arduino/hardware/arduino/avr/bootloaders (from ARDUINO_DIR)
-------------------------
mkdir -p build-uno
/home/Bogdan/Arduino/hardware/tools/avr/bin/avr-g++ -x c++ -include Arduino.h -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=156 -D__PROG_TYPES_COMPAT__ -I. -I/home/Bogdan/Arduino/hardware/arduino/avr/cores/arduino -I/home/Bogdan/Arduino/hardware/arduino/avr/variants/standard -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions Blink.ino -o build-uno/Blink.o
cc1plus.exe: error: Arduino.h: No such file or directory
Blink.ino: In function 'void setup()':
Blink.ino:11: error: 'OUTPUT' was not declared in this scope
Blink.ino:11: error: 'pinMode' was not declared in this scope
Blink.ino: In function 'void loop()':
Blink.ino:15: error: 'HIGH' was not declared in this scope
Blink.ino:15: error: 'digitalWrite' was not declared in this scope
Blink.ino:16: error: 'delay' was not declared in this scope
Blink.ino:17: error: 'LOW' was not declared in this scope
../../Arduino.mk:1012: recipe for target 'build-uno/Blink.o' failed
make: *** [build-uno/Blink.o] Error 1
ah, according to #94 (and README.md !) you need to use a relative path for ARDUINO_DIR
on cygwin, i guess something like ARDUINO_DIR=Arduino
would work...?
It did. :)
brilliant, so now we know the 1.5 branch also works on windows, to the same degree as linux anyway. could you post your results back if you do something more advanced with 1.5, e.g. use some libraries or an arm chip?
i've raised issue #201 to add a check for a relative ARDUINO_DIR on windows.
Well, I tried building one of my projects from scratch, using two libraries (NewPing and Jeelib, the latter being rather big), and the building process has succeeded, although I didn't yet get around to actually uploading it to a board (hopefully, everything got compiled and linked).
Unfortunately, I don't have access to any ARM-based Arduino boards. I expect I will do more exhaustive testing tonight and during the following day.
ok great, i also merged in the windows check for ARDUINO_DIR being relative, so worth git pull'ing my repo again to update it.
jeelib works well with arduino 1.0.5 / makefile 1.3.3 despite being big, not tried 1.5.6 though
"menu" boards don't work yet
menu boards should work now
menu boards should work now
Wow!! cool :)
Well, maybe, but now it looks for boards.txt in the old directory. (Yes, I tried the right branch of Arduino-Makefile.)
@Boobies - you sure you did a git pull today? where's your makefile and error message? you still using windoze (that may not like double slashes)?
you don't have to define ARCHITECTURE unless you're using sam, or VENDOR unless you're using someone other than arduino, and you shouldn't define either if you're using arduino 1.0.5
works fine for me:
$ cat Makefile
BOARD_TAG = diecimila
BOARD_SUB = atmega168
include /home/simon/arduino-mk/my_git/Arduino-Makefile/Arduino.mk
$ make
-------------------------
Arduino.mk Configuration:
- [AUTODETECTED] CURRENT_OS = LINUX
- [COMPUTED] ARDMK_DIR = /home/simon/arduino-mk/my_git/Arduino-Makefile (relative to Common.mk)
- [AUTODETECTED] ARDUINO_DIR = /usr/share/arduino
- [AUTODETECTED] ARDUINO_VERSION = 156
- [DEFAULT] ARCHITECTURE = avr
- [DEFAULT] VENDOR = arduino
- [DEFAULT] ARDUINO_SKETCHBOOK = /home/simon/sketchbook
- [BUNDLED] AVR_TOOLS_DIR = /usr/share/arduino/hardware/tools/avr (in Arduino distribution)
- [COMPUTED] ARDUINO_LIB_PATH = /usr/share/arduino/libraries (from ARDUINO_DIR)
- [DEFAULT] ARDUINO_CORE_PATH = /usr/share/arduino/hardware/arduino/avr/cores/arduino
- [COMPUTED] ARDUINO_VAR_PATH = /usr/share/arduino/hardware/arduino/avr/variants (from ARDUINO_DIR)
- [COMPUTED] BOARDS_TXT = /usr/share/arduino/hardware/arduino/avr/boards.txt (from ARDUINO_DIR)
- [DEFAULT] USER_LIB_PATH = /home/simon/sketchbook/libraries (in user sketchbook)
- [DEFAULT] PRE_BUILD_HOOK = pre-build-hook.sh
- [USER] BOARD_SUB = atmega168
- [USER] BOARD_TAG = diecimila
- [COMPUTED] OBJDIR = build-diecimila (from BOARD_TAG)
- [ASSUMED] MONITOR_BAUDRATE = 9600
- [DEFAULT] OPTIMIZATION_LEVEL = s
- [DEFAULT] MCU_FLAG_NAME = mmcu
- [DEFAULT] CFLAGS_STD = -std=gnu99
- [AUTODETECTED] Size utility: AVR-aware for enhanced output
- [COMPUTED] BOOTLOADER_PARENT = /usr/share/arduino/hardware/arduino/avr/bootloaders (from ARDUINO_DIR)
$ cat Makefile
BOARD_TAG = leonardo
MONITOR_PORT = /dev/ttyACM0
include /data3/useful_software/arduino/arduino-mk/my_git/Arduino-Makefile/Arduino.mk
$ make
-------------------------
Arduino.mk Configuration:
- [AUTODETECTED] CURRENT_OS = LINUX
- [COMPUTED] ARDMK_DIR = /data3/useful_software/arduino/arduino-mk/my_git/Arduino-Makefile (relative to Common.mk)
- [AUTODETECTED] ARDUINO_DIR = /usr/share/arduino
- [AUTODETECTED] ARDUINO_VERSION = 105
- [DEFAULT] ARCHITECTURE =
- [DEFAULT] VENDOR = arduino
- [AUTODETECTED] ARDUINO_PREFERENCES_PATH = /home/simon/.arduino/preferences.txt
- [AUTODETECTED] ARDUINO_SKETCHBOOK = /home/simon/programming/c++/arduino (from arduino preferences file)
- [BUNDLED] AVR_TOOLS_DIR = /usr/share/arduino/hardware/tools/avr (in Arduino distribution)
- [COMPUTED] ARDUINO_LIB_PATH = /usr/share/arduino/libraries (from ARDUINO_DIR)
- [DEFAULT] ARDUINO_CORE_PATH = /usr/share/arduino/hardware/arduino//cores/arduino
- [COMPUTED] ARDUINO_VAR_PATH = /usr/share/arduino/hardware/arduino//variants (from ARDUINO_DIR)
- [COMPUTED] BOARDS_TXT = /usr/share/arduino/hardware/arduino//boards.txt (from ARDUINO_DIR)
- [DEFAULT] USER_LIB_PATH = /home/simon/programming/c++/arduino/libraries (in user sketchbook)
- [DEFAULT] PRE_BUILD_HOOK = pre-build-hook.sh
- [USER] BOARD_TAG = leonardo
- [COMPUTED] OBJDIR = build-leonardo (from BOARD_TAG)
- [ASSUMED] MONITOR_BAUDRATE = 9600
- [DEFAULT] OPTIMIZATION_LEVEL = s
- [DEFAULT] MCU_FLAG_NAME = mmcu
- [DEFAULT] CFLAGS_STD = -std=gnu99
- [AUTODETECTED] Size utility: AVR-aware for enhanced output
- [COMPUTED] BOOTLOADER_PARENT = /usr/share/arduino/hardware/arduino//bootloaders (from ARDUINO_DIR)
$ make show_boards
-------------------------
Arduino.mk Configuration:
- [AUTODETECTED] CURRENT_OS = LINUX
- [COMPUTED] ARDMK_DIR = /home/simon/arduino-mk/my_git/Arduino-Makefile (relative to Common.mk)
- [AUTODETECTED] ARDUINO_DIR = /usr/share/arduino
- [AUTODETECTED] ARDUINO_VERSION = 156
- [DEFAULT] ARCHITECTURE = avr
- [DEFAULT] VENDOR = arduino
- [DEFAULT] ARDUINO_SKETCHBOOK = /home/simon/sketchbook
- [BUNDLED] AVR_TOOLS_DIR = /usr/share/arduino/hardware/tools/avr (in Arduino distribution)
- [COMPUTED] ARDUINO_LIB_PATH = /usr/share/arduino/libraries (from ARDUINO_DIR)
- [DEFAULT] ARDUINO_CORE_PATH = /usr/share/arduino/hardware/arduino/avr/cores/arduino
- [COMPUTED] ARDUINO_VAR_PATH = /usr/share/arduino/hardware/arduino/avr/variants (from ARDUINO_DIR)
- [COMPUTED] BOARDS_TXT = /usr/share/arduino/hardware/arduino/avr/boards.txt (from ARDUINO_DIR)
- [DEFAULT] USER_LIB_PATH = /home/simon/sketchbook/libraries (in user sketchbook)
- [DEFAULT] PRE_BUILD_HOOK = pre-build-hook.sh
- [USER] BOARD_TAG = leonardo
- [COMPUTED] OBJDIR = build-leonardo (from BOARD_TAG)
- [DETECTED] MONITOR_BAUDRATE = 38400 (in sketch)
- [DEFAULT] OPTIMIZATION_LEVEL = s
- [DEFAULT] MCU_FLAG_NAME = mmcu
- [DEFAULT] CFLAGS_STD = -std=gnu99
- [AUTODETECTED] Size utility: AVR-aware for enhanced output
- [COMPUTED] BOOTLOADER_PARENT = /usr/share/arduino/hardware/arduino/avr/bootloaders (from ARDUINO_DIR)
-------------------------
atmegang Arduino NG or older
bt Arduino BT
diecimila Arduino Duemilanove or Diecimila
esplora Arduino Esplora
ethernet Arduino Ethernet
fio Arduino Fio
leonardo Arduino Leonardo
lilypad LilyPad Arduino
LilyPadUSB LilyPad Arduino USB
megaADK Arduino Mega ADK
mega Arduino Mega or Mega 2560
micro Arduino Micro
mini Arduino Mini
nano Arduino Nano
pro Arduino Pro or Pro Mini
robotControl Arduino Robot Control
robotMotor Arduino Robot Motor
uno Arduino Uno
yun Arduino Yún
interestingly enough, it looks like the arduino guys still need to do some work on the leonardo/promicro bootloader to get it to build on a gcc 4.7 system (pgmspace etc.) i guess in 1.5.6 they're still bundling that ancient gcc 4.3
ohh, they seem to have deprecated bootloader.path too, that is going to be a problem. as bootloader.file has changed syntax to include the bootloader.path e.g. what was:
BOOTLOADER_PATH = caterina
BOOTLOADER_FILE = Caterina-promicro16.hex
is now
BOOTLOADER_FILE = caterina/Caterina-promicro16.hex
removing bootloader.path meant that caterina detection no longer worked, that's fixed now as i'm also looking in bootloader.file oh and also menu.cpu.blah.bootloader.file (ffs!)
According to Github, your last commit was 5 days ago. I just downloaded the ZIP that Github has to offer---I don't really use git anymore. Even so, it's still strange since your branch did use to work for me. I believe something got screwed up when you did your relative path fix for Windows. Anyway, here's what I get when trying to build the Blink example (pay attention to where it's trying to look for boards.txt):
Bogdan@Uranus ~/arduino-makefile/examples/blink
$ make ARDUINO_DIR=../../../Arduino
-------------------------
Arduino.mk Configuration:
- [AUTODETECTED] CURRENT_OS = WINDOWS
- [COMPUTED] ARDMK_DIR = /cygdrive/d/muscle-online/Arduino-Makefile (relative to Common.mk)
- [USER] ARDUINO_DIR = ../../../Arduino
- [AUTODETECTED] ARDUINO_VERSION = 156
- [DEFAULT] ARDUINO_SKETCHBOOK = /home/Bogdan/sketchbook
- [BUNDLED] AVR_TOOLS_DIR = ../../../Arduino/hardware/tools/avr (in Arduino distribution)
- [COMPUTED] ARDUINO_LIB_PATH = ../../../Arduino/libraries (from ARDUINO_DIR)
- [DEFAULT] ARDUINO_CORE_PATH = ../../../Arduino/hardware/arduino/cores/arduino
- [COMPUTED] ARDUINO_VAR_PATH = ../../../Arduino/hardware/arduino/variants (from ARDUINO_DIR)
- [COMPUTED] BOARDS_TXT = ../../../Arduino/hardware/arduino/boards.txt (from ARDUINO_DIR)
- [DEFAULT] USER_LIB_PATH = /home/Bogdan/sketchbook/libraries (in user sketchbook)
- [DEFAULT] PRE_BUILD_HOOK = pre-build-hook.sh
- [USER] BOARD_TAG = uno
grep: ../../../Arduino/hardware/arduino/boards.txt: No such file or directory
- [COMPUTED] OBJDIR = build-uno (from BOARD_TAG)
grep: ../../../Arduino/hardware/arduino/boards.txt: No such file or directory
grep: ../../../Arduino/hardware/arduino/boards.txt: No such file or directory
- [ASSUMED] MONITOR_BAUDRATE = 9600
- [DEFAULT] OPTIMIZATION_LEVEL = s
- [DEFAULT] MCU_FLAG_NAME = mmcu
grep: ../../../Arduino/hardware/arduino/boards.txt: No such file or directory
- [DEFAULT] CFLAGS_STD = -std=gnu99
- [AUTODETECTED] Size utility: AVR-aware for enhanced output
- [COMPUTED] BOOTLOADER_PARENT = ../../../Arduino/hardware/arduino/bootloaders (from ARDUINO_DIR)
-------------------------
grep: ../../../Arduino/hardware/arduino/boards.txt: No such file or directory
grep: ../../../Arduino/hardware/arduino/boards.txt: No such file or directory
grep: ../../../Arduino/hardware/arduino/boards.txt: No such file or directory
grep: ../../../Arduino/hardware/arduino/boards.txt: No such file or directory
grep: ../../../Arduino/hardware/arduino/boards.txt: No such file or directory
grep: ../../../Arduino/hardware/arduino/boards.txt: No such file or directory
grep: ../../../Arduino/hardware/arduino/boards.txt: No such file or directory
grep: ../../../Arduino/hardware/arduino/boards.txt: No such file or directory
grep: ../../../Arduino/hardware/arduino/boards.txt: No such file or directory
grep: ../../../Arduino/hardware/arduino/boards.txt: No such file or directory
mkdir -p build-uno
grep: ../../../Arduino/hardware/arduino/boards.txt: No such file or directory
grep: ../../../Arduino/hardware/arduino/boards.txt: No such file or directory
grep: ../../../Arduino/hardware/arduino/boards.txt: No such file or directory
../../../Arduino/hardware/tools/avr/bin/avr-g++ -x c++ -include Arduino.h -MMD -c -mmcu= -DF_CPU= -DARDUINO=156 -D__PROG_TYPES_COMPAT__ -I. -I../../../Arduino/hardware/arduino/cores/arduino -I../../../Arduino/hardware/arduino/variants/ -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions Blink.ino -o build-uno/Blink.o
cc1plus.exe: error: missing argument to "-mmcu="
../../Arduino.mk:994: recipe for target 'build-uno/Blink.o' failed
make: *** [build-uno/Blink.o] Error 1
@Boobies it looks like you're running arduino 1.5.6 with the 1.3.3 makefile again, that's not the output from my 1.5 branch which i updated two hours ago.
please check what you're doing before reporting bugs.
@sudar starting to think we should output the arduino-mk version in the build details, and maybe a check for arduino >= 1.5 with error message
Jeez. I finally updated my bookmark. Sorry, long day. Menu boards don't work for this branch under Cygwin either. And neither does the new show_boards seem to be merged.
Bogdan@Uranus ~/arduino-makefile/src/device
$ make
-------------------------
Arduino.mk Configuration:
- [AUTODETECTED] CURRENT_OS = WINDOWS
- [COMPUTED] ARDMK_DIR = /cygdrive/d/muscle-online/Arduino-Makefile (relative to Common.mk)
- [USER] ARDUINO_DIR = ../../../Arduino
- [AUTODETECTED] ARDUINO_VERSION = 156
- [DEFAULT] ARCHITECTURE = avr
- [DEFAULT] VENDOR = arduino
- [DEFAULT] ARDUINO_SKETCHBOOK = /home/Bogdan/sketchbook
- [BUNDLED] AVR_TOOLS_DIR = ../../../Arduino/hardware/tools/avr (in Arduino distribution)
- [COMPUTED] ARDUINO_LIB_PATH = ../../../Arduino/libraries (from ARDUINO_DIR)
- [DEFAULT] ARDUINO_CORE_PATH = ../../../Arduino/hardware/arduino/avr/cores/arduino
- [COMPUTED] ARDUINO_VAR_PATH = ../../../Arduino/hardware/arduino/avr/variants (from ARDUINO_DIR)
- [COMPUTED] BOARDS_TXT = ../../../Arduino/hardware/arduino/avr/boards.txt (from ARDUINO_DIR)
- [DEFAULT] USER_LIB_PATH = /home/Bogdan/sketchbook/libraries (in user sketchbook)
- [DEFAULT] PRE_BUILD_HOOK = pre-build-hook.sh
- [USER] BOARD_TAG = pro5v328
- [COMPUTED] OBJDIR = build-pro5v328 (from BOARD_TAG)
- [ASSUMED] MONITOR_BAUDRATE = 9600
- [DEFAULT] OPTIMIZATION_LEVEL = s
- [DEFAULT] MCU_FLAG_NAME = mmcu
- [DEFAULT] CFLAGS_STD = -std=gnu99
- [AUTODETECTED] Size utility: AVR-aware for enhanced output
- [COMPUTED] BOOTLOADER_PARENT = ../../../Arduino/hardware/arduino/avr/bootloaders (from ARDUINO_DIR)
-------------------------
mkdir -p build-pro5v328
../../../Arduino/hardware/tools/avr/bin/avr-g++ -x c++ -include Arduino.h -MMD -c -mmcu= -DF_CPU= -DARDUINO=156 -D__PROG_TYPES_COMPAT__ -I. -I../../../Arduino/hardware/arduino/avr/cores/arduino -I../../../Arduino/hardware/arduino/avr/variants/ -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions device.ino -o build-pro5v328/device.o
cc1plus.exe: error: missing argument to "-mmcu="
../../Arduino.mk:1067: recipe for target 'build-pro5v328/device.o' failed
make: *** [build-pro5v328/device.o] Error 1
@Boobies looks like you're using a custom core as there's no such thing as a pro5v328 in arduino 1.5.6 boards.txt, that's why its failing, and that's why its not in make show_boards
as it doesn't exist.
ah, perhaps you mean pro.menu.cpu.16MHzatmega328=ATmega328 (5V, 16 MHz)
? in which case you need to set:
BOARD_TAG=pro
BOARD_SUB=16MHzatmega328
you've got to understand that none of these features will be merged in sudar's main branch, its all just in my 1.5 branch at the moment.
some notes on this parsing boards.txt
this gets all 1.0-style boards/names, plus any 1.5 boards/subs/cpu names, but not the 1.5-style commented names:
(echo 'BOARD_TAG:BOARD_SUB:NAME' ; cat /usr/share/arduino/hardware/arduino/avr/boards.txt \
/usr/share/arduino/hardware/arduino/sam/boards.txt| \
grep -E '^[a-zA-Z0-9_]+(.name|.menu.cpu.[a-zA-Z0-9_]+)=' |sort -uf | \
sed 's/.menu.cpu./:/;s/.name/: :/;s/=/:/') | column -s: -t
BOARD_TAG BOARD_SUB NAME
arduino_due_x_dbg Arduino Due (Programming Port)
arduino_due_x Arduino Due (Native USB Port)
atmegang atmega168 ATmega168
atmegang atmega8 ATmega8
atmegang Arduino NG or older
bt atmega168 ATmega168
bt atmega328 ATmega328
bt Arduino BT
diecimila atmega168 ATmega168
diecimila atmega328 ATmega328
diecimila Arduino Duemilanove or Diecimila
esplora Arduino Esplora
ethernet Arduino Ethernet
fio Arduino Fio
leonardo Arduino Leonardo
lilypad atmega168 ATmega168
lilypad atmega328 ATmega328
lilypad LilyPad Arduino
LilyPadUSB LilyPad Arduino USB
megaADK Arduino Mega ADK
mega atmega1280 ATmega1280
mega atmega2560 ATmega2560 (Mega 2560)
mega Arduino Mega or Mega 2560
micro Arduino Micro
mini atmega168 ATmega168
mini atmega328 ATmega328
mini Arduino Mini
nano atmega168 ATmega168
nano atmega328 ATmega328
nano Arduino Nano
pro 16MHzatmega168 ATmega168 (5V, 16 MHz)
pro 16MHzatmega328 ATmega328 (5V, 16 MHz)
pro 8MHzatmega168 ATmega168 (3.3V, 8 MHz)
pro 8MHzatmega328 ATmega328 (3.3V, 8 MHz)
pro Arduino Pro or Pro Mini
robotControl Arduino Robot Control
robotMotor Arduino Robot Motor
uno Arduino Uno
yun Arduino Yún
get all commented names from 1.5:
grep '## [^-]' /usr/share/arduino/hardware/arduino/avr/boards.txt | sort -uf
## Arduino BT w/ ATmega168
## Arduino BT w/ ATmega328
## Arduino Duemilanove or Diecimila w/ ATmega168
## Arduino Duemilanove or Diecimila w/ ATmega328
## Arduino Mega w/ ATmega1280
## Arduino Mega w/ ATmega2560
## Arduino Mini w/ ATmega168
## Arduino Mini w/ ATmega328
## Arduino Nano w/ ATmega168
## Arduino Nano w/ ATmega328
## Arduino NG or older w/ ATmega168
## Arduino NG or older w/ ATmega8
## Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega168
## Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328
## Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega168
## Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328
## LilyPad Arduino w/ ATmega168
## LilyPad Arduino w/ ATmega328
so we need to substitute these commented names into the 3rd column above instead of the cpu names
Thank you for writing this package! I'm excited to try to start using it.
Are the changes for Arduino 1.5.x merged into master currently, or is there a branch available to pull from? I've got Arduino-1.5.6-rc2 installed on my OS X Mavericks machine and the Makefile bombs trying to locate header files for the built in Servo library.
The Makefile is generates the avr-g++
line like so:
opt/local/bin/avr-g++ -MMD -c -I/opt/local/include -I/opt/local/include/sasl -I/opt/X11/include -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=156 -D__PROG_TYPES_COMPAT__ -I. -I/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/variants/standard -I/Applications/Arduino.app/Contents/Resources/Java/libraries/Servo -I/Users/cmalek/src/robotics/libraries/ObstacleAvoider/lib/Bounce2 -I/Users/cmalek/src/robotics/libraries/ObstacleAvoider/lib/NewPing -I/Users/cmalek/src/robotics/libraries/ObstacleAvoider/lib/Rolley -Wall -ffunction-sections -fdata-sections -Os -pedantic -Wall -Wextra -fno-exceptions -std=gnu++11 ObstacleAvoider.cpp -o /Users/cmalek/src/robotics/libraries/ObstacleAvoider/bin/uno/ObstacleAvoider/ObstacleAvoider.o
expecting Servo.h
to be in /Applications/Arduino.app/Contents/Resources/Java/libraries/Servo
when in fact it is now in /Applications/Arduino.app/Contents/Resources/Java/libraries/Servo/src
.
I fixed that in Arduino.mk only to get:
/opt/local/bin/avr-g++ -MMD -c -I/opt/local/include -I/opt/local/include/sasl -I/opt/X11/include -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=156 -D__PROG_TYPES_COMPAT__ -I. -I/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/variants/standard -I/Applications/Arduino.app/Contents/Resources/Java/libraries/Servo/src -I/Users/cmalek/src/robotics/libraries/ObstacleAvoider/lib/Bounce2 -I/Users/cmalek/src/robotics/libraries/ObstacleAvoider/lib/NewPing -I/Users/cmalek/src/robotics/libraries/ObstacleAvoider/lib/Rolley -Wall -ffunction-sections -fdata-sections -Os -pedantic -Wall -Wextra -fno-exceptions -std=gnu++11 ObstacleAvoider.cpp -o /Users/cmalek/src/robotics/libraries/ObstacleAvoider/bin/uno/ObstacleAvoider/ObstacleAvoider.o
In file included from ./ObstacleAvoider.h:4:0,
from ObstacleAvoider.cpp:1:
/Applications/Arduino.app/Contents/Resources/Java/libraries/Servo/src/Servo.h:67:2: error: #error "This library only supports boards with an AVR or SAM processor."
#error "This library only supports boards with an AVR or SAM processor."
^
make: *** [/Users/cmalek/src/robotics/libraries/ObstacleAvoider/bin/uno/ObstacleAvoider/ObstacleAvoider.o] Error 1
@cmalek are you using the Bare-Arduino-Project and not Arduino-Makefile, as this combination of flags is not a good idea:
-pedantic -Wall -Wextra -fno-exceptions -std=gnu++11
@cmalek Bare-Arduino-Project only works with Arduino 1.0.5
@sudar I'm using the uno.
@sej7278 I had copied Arduino-Makefile/examples/MakefileExample/Makefile-example.mk
into my project and edited it accordingly. Should I not have done that?
I did get a little further last night in building my project. I added "-DARDUINO_ARCH_AVR
" to my CPPFLAGS
and a lot of the requisite files were compiled except for Servo.cpp
, which wasn't even attempted to be compiled. Then the linking failed, of course.
I see that in the Arduino Servo system library, the code has been split into separate folders by architecture. So in /Applications/Arduino.app/Contents/Resources/Java/libraries/Servo
, the directory structure looks like this:
Servo/
├── examples
│ ├── Knob
│ │ └── Knob.ino
│ └── Sweep
│ └── Sweep.ino
├── keywords.txt
├── library.properties
└── src
├── Servo.h
├── avr
│ ├── Servo.cpp
│ └── ServoTimers.h
└── sam
├── Servo.cpp
└── ServoTimers.h
so that the code to be compiled for the avr
architecture is in Servo/src/avr/Servo.cpp
. Ugh, looks like only Servo does this -- none of the other bundled libraries have per architecture code directories.
I see that you're already setting ARCHITECTURE
appropriately on line 319 and then using it to get the correct ARDUINO_CORE_PATH
, ARDUINO_VAR_PATH
, BOARDS_TXT
and BOOTLOADER_PARENT
so you could reuse ARCHITECTURE
in figuring out where the appropriate source for Servo is. Not sure what the right answer is here since Servo is a one-off.
@cmalek - the easiest thing is to use arduino 1.0.5 instead of 1.5.6, there really is little point in using the new ide if you're using an uno.
it seems in 1.5 there are additional hardware-dependant libraries, so ARDUINO_LIB_PATH would have to search:
/usr/share/arduino/hardware/arduino/avr/libraries (for Wire, SPI etc.)
/usr/share/arduino/hardware/arduino/sam/libraries (as above but for ARM not AVR)
/usr/share/arduino/libraries (for Servo, LiquidCrystal etc.)
and inside each library are 2 versions of the library:
$ ls /usr/share/arduino/libraries/Servo/src
Servo.h
avr:
Servo.cpp ServoTimers.h
sam:
Servo.cpp ServoTimers.h
this is getting silly now, 1.5 is totally different to 1.0 and cores, sketches, libraries are all going to have to be rewritten. crazy!
support for 1.5 layout libraries with src/ subdirectory added to 1.0.6:
not that i've seen a 1.5-only library yet....
Actually, a lot is up coming for 1.5.x.
Since I am a beta tester for the Arduino Zero, I actually know what is going to be happening before it happens... for once in my life, anyway. LOL :-)
Correct... I can't even include support publicly for
https://github.com/xxxajk/Arduino_Makefile_master
But I can add in things ahead of time here, and then once the Zero is
released, push the additions.
On Thu, Sep 18, 2014 at 4:05 AM, Ladislas de Toldi <notifications@github.com
wrote:
@xxxajk https://github.com/xxxajk But you're tied by secret, right? :)
—
Reply to this email directly or view it on GitHub
#45 (comment)
.
Visit my github for awesome Arduino code @ https://github.com/xxxajk
well i'd appreciate any help i can get on 1.5 compatibility, i've pretty much given up and decided that 1.5 is a pile of poo
1.5 should work afaik with mine...
On Thu, Sep 18, 2014 at 4:22 AM, sej7278 notifications@github.com wrote:
well i'd appreciate any help i can get on 1.5 compatibility, i've pretty
much given up and decided that 1.5 is a pile of poo—
Reply to this email directly or view it on GitHub
#45 (comment)
.
Visit my github for awesome Arduino code @ https://github.com/xxxajk
What I can tell you is that there is at least a hint in the new properties files.
From this you can at least find out if you even need to scan the directory.
The actual use for it is actually to provide for the menus in the so-called IDE.
Just so you know a result of "*" means any.
Here are a few examples that I am allowed to show you:
cat /opt/arduino-1.5.8-zero-r03/libraries/WiFi/library.properties | grep -e "^architectures" | cut -f2- -d"="
*
cat /opt/arduino-1.5.8-zero-r03/libraries/Scheduler/library.properties | grep -e "^architectures" | cut -f2- -d"="
sam
cat /opt/arduino-1.5.8-zero-r03/libraries/GSM/library.properties | grep -e "^architectures" | cut -f2- -d"="
avr
If you have a match, just use the libraries path + src, and recursively scan all the directories for your sources, and header files, just like you should be doing for the legacy ones.
There is also more bits and chunks from boards.txt too, and those (as well as the programmers.txt) will need to be parsed as well. That is all I am allowed to comment on without breaching any promises I have made.
1.5 should work afaik with mine...
looking at your makefile it only works with 1.5 doesn't it?
this makefile seems to work with 1.5 for avr as long as the libraries aren't 1.5-specific, for arm i doubt its anywhere near working - we've not looked at the toolchain yet.
no, works with them all
On Thu, Sep 18, 2014 at 10:22 AM, sej7278 notifications@github.com wrote:
1.5 should work afaik with mine...
looking at your makefile it only works with 1.5 doesn't it?
—
Reply to this email directly or view it on GitHub
#45 (comment)
.
Visit my github for awesome Arduino code @ https://github.com/xxxajk
Not really.. They just need to do their code correctly, and use relative
include statements,
which work everywhere.
On Thu, Sep 18, 2014 at 10:30 AM, sej7278 notifications@github.com wrote:
we're going to have to implement recursive searches for source files
somehow, not just for 1.5 libraries, as we seem to be getting a lot of
people lately (maybe from BareArduinoProject?) wanting weird subdirectory
structures:—
Reply to this email directly or view it on GitHub
#45 (comment)
.
Visit my github for awesome Arduino code @ https://github.com/xxxajk
well yeah, but you try telling users their coding stinks as they're confusing node.js with c++ ;-)
@sej7278 if you think that the BareArduinoProject is causing all the problem, we can remove it from the documentation. But I can assure you that I don't get a lot of forks and/or clones on this repo, so it might no only be me :)
the thing is: if people are bored with the IDE and want to use a Makefile it's not to do exactly what the IDE does by typing it in the cli.
People want robustness, flexibility and to try new stuff. The way I see it, but I might be wrong, is that I don't want to use the Makefile if it's just a little more convenient than the IDE. the libraries and sketch folder are great for beginner but are not convenient for source control and when the project gets bigger. The idea behind the Bare Arduino Project was to give the tools to grow bigger without the Arduino hassles. I think that people who want to use a Makefile know enough of programming to build their way and ask questions. If it has to be as easy to use as the IDE, why not just stick with the IDE or use some SublimeText plugins to make your life easier.
It has to be working out of the box but must also support deep customisation. :)
Amen @ladislas - I think the Arduino-Makefile project must assume a level of familiarity with C/C++ and Make. As cool and approachable as having this Makefile be a drop-in replacement for the IDE would be, I think you'll always be playing catch-up with the IDE developers until they use the Makefile themselves. I think this Makefile will be easier to maintain, user and document if it's just the bare minimum to compile a project using the core library from the Arduino IDE and Arduino-compatible libs, and the rest is straight GNU Make.
👍
@ladislas i meant no offence, i just meant that we've had a lot of very similar issues lately regarding directory structures, which coincides with the release of BAP, which itself uses subdirectories and such, so I assume that's where the issues are coming from.
It would be nice to get a PR or two from users rather than just new feature requests ;-)
@sej7278 I know :) I think we can blame node.js
It would be nice to get a PR or two from users rather than just new feature requests ;-)
Agreed. I'll try to do my best with the different things I've been asking for :)
i think its safe to blame node.js for everything ;-)
The arduino "IDE" is a really poor substitute for anything serious, and we
all know it.
It is designed for beginners, with the minimums to just blink an LED.
Even a lot of the options are hidden, and the tab-stops are horrible... 4
spaces?? really? YUCK!
TABS are EIGHT and always have been on everything from typewriters, to
printers, to teletypes, to every command prompt on the planet by default...
and there is a good reason for it! 80/10. If you need more than that for
indenting, you can go 132 column or 160, which are both also standard, or,
do the smart thing and use macros/break up code.
As far as a real IDE I just use netbeans for everything except Python.
Editra rules the Python world, period.
it does C/C++ and everything else just fine, and I find it easier and more
intuitive than eclipse...
It is one reason why I choose it, but there are many others.
I personally find eclipse clumsy and awkward to use.
I also as well find anything else that tries to emulate crappy M$
studio-like (including eclipse here!) very awkward.
Not trying to start a pissing contest over editors or IDEs, use what you
like or what works well for you. However if you don't at least try
different editors, I think you are really missing out. I try eclipse every
now and then, and well, still not leaving netbeans.
eclipse, especially for arduino development is horrible. the eclipse plugin for arduino requires you to have a copy of the core (and i think libraries) for every sketch!
what annoys me is that the IDE is pretty much the arduino product - atmel makes the chips, gnu makes the toolchain. just using the libraries and cores like we do with the makefile should be the de-facto way of working, but i guess its a barrier to entry, people want a crappy gui.
Well, unfortunately, they already drank the kool-aide when they start using
that IDE, and the bad habits, such as not doing proper includes, 4 space
tabs, and then wondering why the formatting is screwed up when it is looked
at on a web site or other editor, etc etc etc... I could write a list of
bad habits the program agitates to probabbly fill a small paperback book.
We all know what they are, and we see these things all over the net.
On Thu, Sep 18, 2014 at 12:27 PM, sej7278 notifications@github.com wrote:
eclipse, especially for arduino development is horrible. the eclipse
plugin for arduino requires you to have a copy of the core (and i think
libraries) for every sketch!what annoys me is that the IDE is pretty much the arduino product - atmel
makes the chips, gnu makes the toolchain. just using the libraries and
cores like we do with the makefile should be the de-facto way of working,
but i guess its a barrier to entry, people want a crappy gui.—
Reply to this email directly or view it on GitHub
#45 (comment)
.
Visit my github for awesome Arduino code @ https://github.com/xxxajk
Has anyone gotten the Arduino Makefile to build for the Arduino Due platform? Changing my BOARD_TAG to arduino_due_x or arduino_due_x_dbg throws an error:
avr-g++: error: missing argument to '-mmcu='
but I suspect that this is because avr-g++ is trying to compile code for an arm platform, whereas I'd like to invoke some arm compiler (I'm not sure how Arduino-1.5.8 is actually compiling for ARM platforms).
no, building for arm is a completely different toolchain.
our 1.5 efforts so far are really just building for avr.
Got it. So the Arduino Makefile project doesn't have plans to extend to the Due and Zero platforms in the near future?
Got it. So the Arduino Makefile project doesn't have plans to extend to the Due and Zero platforms in the near future?
It's not that we don't have plans to extend. We want to get avr to work first properly with the new 1.5.x library format and once that works we will extend it to other platforms. Unfortunately we don't have an ETA for it.
If you are on macos or Linux, you can always try mine, which supports 1.5.x :-)
https://github.com/xxxajk/Arduino_Makefile_master
@Poofjunior Yes. Should support the Due.
Should support the zero too. I have a zero but have not tried it yet...
Looks like I'll have to do some things a little bit differently for the Due. Expect support in a day or so.
>= 1.5
now supported in mine.
I works on my IDE 1.5.8. It also autodetects all the environment variables.
A very very nice work!
it works with the Arduino IDE 1.6 too
@mulderp which are you talking about, this Arduino-Makefile or xxxajk's Arduino_Makefile_master ?
this makefile supports 1.6.1 for a lot of the AVR chips and teensy, not ARM, although the IDE 1.6.2 that just got released has broken a lot of it (well the IDE itself is broken on linux at least).
I tried this project with the Blink example and Arduino 1.6.0
In fact, I think this project is great. I wrote some thoughts about command line usage for Arduino here:
http://thinkingonthinking.com/an-arduino-sketch-from-scratch/
As of today, master supports Arduino 1.6.3, hence closing this.
Support for SAM and other non-avr boards is not available yet. It will be tracked in #343
Oh and happy Easter, I'm just not one for traditional holidays.
On Sun, Apr 5, 2015 at 11:40 PM, Sudar Muthu notifications@github.com
wrote:
As of today, master supports Arduino 1.6.3, hence closing this.
Support for SAM and other non-avr boards is not available yet. It will be
tracked in #343 #343—
Reply to this email directly or view it on GitHub
#45 (comment)
.
Visit my github for awesome Arduino code @ https://github.com/xxxajk