Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Arduino 1.5 #45

Closed
sudar opened this issue May 21, 2013 · 83 comments
Closed

Add support for Arduino 1.5 #45

sudar opened this issue May 21, 2013 · 83 comments

Comments

@sudar
Copy link
Owner

sudar commented May 21, 2013

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.

sudar referenced this issue Jul 10, 2013
This commit modifies a few things in Arduino.mk to be able to support
overriding the necessary configuration options to support the chipKIT build,
and also includes an example sketch configured to build for the Max32 platform.

In addition the following changes were done as well

- Control C standard with a CFLAGS_STD flag, GNU99 by default.
- Duplicate show_config_variable in each sub-makefile.
- Remove redundant output of ARDUINO_PREFERENCES_PATH from config table.
- Defer Priting ARDMK_DIR until Arduino.mk.
- Define names of compiler tools earlier to use for path checking.

Duplicating show_config_variable is unfortunate because the code is duplicated,
but I don't see a good way around it since we need to dupliacate the check
for ARDMK_DIR before we can find Common.mk.

Fix #98
@sudar
Copy link
Owner Author

sudar commented Oct 2, 2013

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.

@sudar
Copy link
Owner Author

sudar commented Oct 5, 2013

Also, boards.txt can be present inside a submenu. This should be supported as well. See xxxajk/Arduino_Makefile_master#2

@xxxajk
Copy link

xxxajk commented Oct 24, 2013

Yes, I did an unclean fork. I also now auto detect libraries. :-) Please feel free to pull bits from mine.

@sudar
Copy link
Owner Author

sudar commented Oct 25, 2013

@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?

@xxxajk
Copy link

xxxajk commented Oct 25, 2013

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
.

@xxxajk
Copy link

xxxajk commented Nov 29, 2013

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 :-)

@sudar
Copy link
Owner Author

sudar commented Dec 1, 2013

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 :)

@schmurfy
Copy link

schmurfy commented Feb 4, 2014

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) :/

@sudar
Copy link
Owner Author

sudar commented Feb 4, 2014

@schmurfy unfortunately, we don't have any code that is compatible with Arduino 1.5.x yet

@sej7278
Copy link
Collaborator

sej7278 commented Apr 1, 2014

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.....

@sudar
Copy link
Owner Author

sudar commented Apr 2, 2014

@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.

@xxxajk
Copy link

xxxajk commented Apr 2, 2014

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
.

@schmurfy
Copy link

schmurfy commented Apr 2, 2014

I ended up making my own build script, one thing I noticed was how horrible the boards.txt was to parse xD

@xxxajk
Copy link

xxxajk commented Apr 2, 2014

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
.

@schmurfy
Copy link

schmurfy commented Apr 2, 2014

yeah but the structure is pretty stupid with those .menu. items.

@sej7278
Copy link
Collaborator

sej7278 commented Apr 2, 2014

@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?

@sej7278
Copy link
Collaborator

sej7278 commented Apr 21, 2014

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

@sudar
Copy link
Owner Author

sudar commented Apr 21, 2014

Wow!! this is definitely a great start :)

@sej7278
Copy link
Collaborator

sej7278 commented Apr 21, 2014

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.

@sudar
Copy link
Owner Author

sudar commented Apr 22, 2014

@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.

@sej7278
Copy link
Collaborator

sej7278 commented Apr 22, 2014

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

@sudar
Copy link
Owner Author

sudar commented Apr 22, 2014

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.

@Boobies
Copy link

Boobies commented May 19, 2014

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

@ladislas
Copy link
Contributor

👍

@sej7278
Copy link
Collaborator

sej7278 commented Sep 18, 2014

@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 ;-)

@ladislas
Copy link
Contributor

@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 :)

@sej7278
Copy link
Collaborator

sej7278 commented Sep 18, 2014

i think its safe to blame node.js for everything ;-)

@xxxajk
Copy link

xxxajk commented Sep 18, 2014

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.

@sej7278
Copy link
Collaborator

sej7278 commented Sep 18, 2014

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.

@xxxajk
Copy link

xxxajk commented Sep 18, 2014

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

@Poofjunior
Copy link
Contributor

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).

@sej7278
Copy link
Collaborator

sej7278 commented Nov 6, 2014

no, building for arm is a completely different toolchain.

our 1.5 efforts so far are really just building for avr.

@Poofjunior
Copy link
Contributor

Got it. So the Arduino Makefile project doesn't have plans to extend to the Due and Zero platforms in the near future?

@sudar
Copy link
Owner Author

sudar commented Nov 7, 2014

@Poofjunior

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.

@xxxajk
Copy link

xxxajk commented Nov 7, 2014

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
Copy link
Contributor

@sudar
Sounds good. Having this working for AVR has been a fantastic boost to organizing files in Arduino, so I really appreciate what y'all are doing.

@xxxajk
Thanks, I am working in Linux, but will this Makefile alternative support the Due?

@xxxajk
Copy link

xxxajk commented Nov 7, 2014

@Poofjunior Yes. Should support the Due.
Should support the zero too. I have a zero but have not tried it yet...

@xxxajk
Copy link

xxxajk commented Nov 7, 2014

Looks like I'll have to do some things a little bit differently for the Due. Expect support in a day or so.

@xxxajk
Copy link

xxxajk commented Nov 19, 2014

>= 1.5 now supported in mine.

@daitangio
Copy link

I works on my IDE 1.5.8. It also autodetects all the environment variables.
A very very nice work!

@mulderp
Copy link

mulderp commented Mar 30, 2015

it works with the Arduino IDE 1.6 too

@sej7278
Copy link
Collaborator

sej7278 commented Mar 30, 2015

@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).

@mulderp
Copy link

mulderp commented Mar 31, 2015

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/

sej7278 pushed a commit to sej7278/Arduino-Makefile that referenced this issue Apr 6, 2015
We can probably close issue sudar#45 and maybe open a new one for ARM
SAM support, as 1.6.3 is supported now (and 1.5 is dead).
@sudar
Copy link
Owner Author

sudar commented Apr 6, 2015

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

@sudar sudar closed this as completed Apr 6, 2015
@xxxajk
Copy link

xxxajk commented Apr 6, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests