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

First pass at some boards.txt handling where no Arduino IDE only GCC AVR #470

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dansut
Copy link
Contributor

@dansut dansut commented Jan 6, 2016

Sorry Mikael, the makefile BOARDS_TXT_AVAILABLE fix you cherry picked from last pull request certainly helps but I'm still not having much joy using Cosa out of the box with a build environment with no Arduino IDE install and only GCC AVR present. I can fudge it to make it work no problem but I'd like to contribute and get this aspect of Cosa so that it works without much messing around.

This pull request is not really intended to be merged immediately, it is more for you comment and critique to see if you (or others) can spot anything I may be doing that can break other things. Plus it is far from ideal in that if any of boards txt files are updated these changes have no way of being automatically fixed in the generated boards.txt, which should be possible to get working within the context of a Makefile.

Moved the boards.txt into the Cosa.mk as it felt like the right place to do it given that Arduino.mk is a seperately maintained project... or do you view this as being forked and changed enough so it would be too difficult to get back on track with the upstream version?

A few other minor suggestions:

  • What do you think of moving all command line build instructions from COSA_DIR/INSTALL.txt into COSA_DIR/build/INSTALL.txt leaving only clue pointer text in the root one? Not sure how this would relate to COSA_DIR/doc/02-install.md ..?
  • None of install instructions really mention ARDUINO_DIR needs to be set to something for Arduino.mk - I set mine to 'whocares', which works, but it might help to automatically set it to something if not already set up in build/cosa or Cosa.mk
  • Similar for ARDUINO_SKETCHBOOK but this needs to be set to something sensible, at least it needs to be directory that contains hardware/ and libraries/ as far as I have worked out so far.
  • My gut tells me generated boards.txt really ought to go in COSA_DIR/obj/ rather than in build but maybe you have your reasons for where it is..?

Hope this all makes sense and is at least little bit helpful.
Cheers
/dan

@mikaelpatel
Copy link
Owner

Thanks Dan! I think this is a better approach, i.e. adding the boards.txt generation to Cosa.mk instead. Actually my first attempt generated the file to the obj directory but there where some issues for other users that wanted to be able to move the obj directory.

Building the boards.txt from the boards directory is also a very good idea. And now I better understand your initial pull request.

I will play around with the changes and see how well it works with the Arduino stuff.

Thanks again! Mikael

@dansut
Copy link
Contributor Author

dansut commented Jan 7, 2016

Found time to have a look at how this works with the Arduino IDE 1.0 and 1.6 versions at the end of the day today - can't say I'll be using them any time soon but I understand supporting them is important to keep Cosa accessible.

It seems like they both use the COSA_HOME/boards.txt file, so now I am unsure of what uses the boards/*.txt files (other than my patch). I like the idea of splitting the boards up into separate files but if nothing is really using the split out files, and the IDE can't be made to build the boards.txt then I'm not sure I understand the duplicating of the data. Maybe you could explain @mikaelpatel ..?

A thought I had when messing around with different IDE versions is that it seems the Cosa install instructions could be made generic over 1.0 and 1.5+ by simply placing a symlink in COSA_HOME that is named avr and points to its containing directory: ln -s . avr Maybe this wouldn't work on Windows though..?

Glad you appreciate some of my suggestions, I shall keep hacking at this until it feels as simple as it could get.
Cheers

@mikaelpatel
Copy link
Owner

The Arduino IDE support is mainly for users that have outgrown the Arduino core and would like a more powerful framework and platform. I used the Arduino IDE build in the very beginning but quickly left that for the make based command line build.

The Arduino IDE requires a core to define boards.txt and a possible platform.txt. This allows adding to the Boards and Tools menu, and building with additional options etc. The Cosa command line build has a few dependencies to these files that might need to be removed (as this might be the root cause of many of the issues and ripple effects).

The command line build uses the boards.txt file mainly for the list of boards (variants) and some minor info (include path etc).

The latest refactoring of Cosa custom boards into a set of separate repos (cores) had a ripple effect on the command line build. The Cosa boards.txt was no longer a collection of all supported boards. The info needed to be collected from installed Cosa custom boards (cores) as well. The quick fix was to generate a new boards.txt for the command line build and change the path. There are some alternatives to this. A more radical approach is to cut the dependency to boards.txt and add the necessary information to the boards files in the variants directory.

In any case I appreciate that you are taking the time to test and improve this.

Cheers! Mikael

@dansut
Copy link
Contributor Author

dansut commented Jan 8, 2016

My story of path taken with Arduino is very similar to yours - I have very little patience with IDEs having used many during ~25yr of coding professionally and always seeming to come back to the command line and Vim :) It pays to experience everything though as you never know when you might learn from some feature or other; and I appreciate we all have personal preferences and it is really the results that are most important not how you get there.

Am I right in saying that the build/Arduino-Makefile contained in Cosa is a modifed version of Arduino-Makefile and that this is also intended to provide a command line build with the AVR-GCC toolchain supplied with the Arduino IDE, and not just with the AVR GCC stuff installed stadn alone? Do you see any worth in putting effort in updating the version in Cosa to pull in updates from upstream?

I am keen to coordinate with you to make the command line build of Cosa work cleanly whilst not affecting the IDE integration in any way (I think the JSON based Boards Manager integration is nice and clean making Cosa accessible to those that come to it that way) so please feel free to let me know if you'd like me to work on any particular areas (or leave other areas alone) so we can avoid duplicating effort and reach the projects goals quicker together. Treat me as a resource with regards to this ;)

I shall have a look at the way that other boards have been split off into their own git repositories and are pulled into variants in more detail...

Cheers
/dan

@mikaelpatel
Copy link
Owner

@dansut
Yes - the command line build is based on Arduino-Makefile. The idea was to start with something available and then trim it back to the "bare-bone" necessary makefile driven based build. This took a different direction when I could remove the need for makefiles all together. The "trimming" became less necessary. Cosa.mk and the shell script cosa removed the need for all the makefile hacks.

There has been some updates to improve reseting of the board and the serial monitor is based on a modified miniterm.py which also is a bit shaky after the update of Python Serial module. This makes aligning with upstream "difficult". I would really like to remove all the "dead-code" instead. There is a lot of legacy in the Arduino-Makefile that is not used.

The build has not been on the "refactor-clean-up" list for some time. It is more "fix-when-broken" :)

I have been using the build with AVR GCC installed directly in Ubuntu but that is some time ago. That seems to be broken? At least this seems to be what you have been trying to get back on track.

There is a "third level" integration, i.e. IDE integration, that I have not come around to. I have only tested with GNU Emacs and Geany. There has been some integration with other IDEs but I have not been involved in these.

I appreciate that you have an attention on the command line build for pure AVR GCC. Please feel free to update and improve this.

Cheers!

@dansut
Copy link
Contributor Author

dansut commented Jan 15, 2016

Not had much time to look at this over this week but thought it worth updating the issue to say that I am totally onboard with your approach and will try to make progress in this area with an eye to stripping unnecessary along the way. Removing complexity and increasing clarity is one of my life goals ;)

The other approach I toyed with was along the lines of what you have being doing with other parts of Cosa: stripping it out into its own module so those wanting a command line build would have to pull in that module and maybe the Arduino-Makefile - but that would probably take up way too much time with not that much to gain.

I've possibly stated this before, but I'm using this mostly under CentOS where I've built my own avr-gcc toolchain RPMs based on Fedora's as the ones in EPEL are old - if anyone is interested in these then I can make them public. avr-gcc 4.93, avr-binutils 2.25, avrdude 6.1.2, avr-libc 1.8.0

Cheers
/dan

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

Successfully merging this pull request may close these issues.

2 participants