Go Down

Topic: Creating Custom Boards for Board Manager (Read 10393 times) previous topic - next topic

LukeZ

Our project uses a custom board based on the ATmega 2560 processor. The firmware can be compiled just fine using the Arduino Mega board in the IDE but we actually use a custom bootloader that takes up less space than the stock bootloader, so computed memory statistics are a bit off with this method (although it doesn't affect operation).

Up to now we have just been adding an entry to Arduino's boards.txt file but with recent versions of the IDE this is no longer the way to go.

Finally we have found issues when compiling with avr-gcc 4.9.2 and so would like to keep avr-gcc 4.8.1. I understand the new boards manager will allow us to do that.

Creating a new entry for board manager appears to be a pretty involved process. I feel confident I'm going to regret ever having to learn about it, but such is the way of infinite progress.

For others embarking on this same journey, documentation is not great but here are some links I've found:

Arduino IDE 1.6.x package_index.json format specification - We are up to 1.8.1 but I presume this information must still be accurate. This page describes how to create a json file that describes your custom board package, but by itself it is only essentially metadata, other elements are required.

Arduino IDE 1.5 3rd party Hardware specification - once again we are way beyond IDE 1.5 but I presume this information is also still relevant. This page is where the pain really starts to set in, as well as perhaps some brain tumors and/or ulcers, but perhaps not all of it is needed...

Boards Manager Support File Locations on GitHub - I also found this page that discusses various places you can host your json file on GitHub, but I think this is a topic that represents one of the last steps rather than the first.

Unofficial list of 3rd party boards support urls - We may glean information from how others have done things.


LukeZ

So first of all I started creating a json file using the example on this page. The format of the file is clearly explained, but I have questions about the content. Let's say I want our board to compile with avr-gcc 4.8.1. Do I need to maintain and update my own version/download of the compiler or can I simply refer to this somewhere at Arduino.cc? The example at the top of the page links to Arduino but what is the difference between 4.8.1-arduino2 and 4.8.1-arduino5? Do I need to specify compilers for every OS as implied in the example at the top of the page, or can I omit the tools entirely as implied by the example at the bottom of the page?

I probably don't even know enough to ask the right questions so I will gladly accept guidance on the most efficient way of proceeding from this point.

LukeZ

#2
Feb 21, 2017, 10:12 pm Last Edit: Feb 23, 2017, 08:55 pm by LukeZ
Ok, more fooling about. I've created a json file and an archive package and hosted them on GitHub here. They are not really functional yet but I imagine it is easier to help someone correct a thing they have already created, than to help someone create something that doesn't yet exist.

I am sort of basing my json around Adafruit's and the example listed previously in the documentation, and I organized my GitHub repository in the same way I see SparkFun did theirs. Of course I don't really know what I'm doing, just copying others without knowing the nuances.  

So I add the link to my json in the Arduino IDE Preferences -> Additional Board Manager URLs box. Then I open Boards Manager and get a java.lang.NullPointerException error, the full text of which is below. If I close the IDE and try to re-open, the IDE itself it will fail to load, until I delete the local copy of package_openpanzer_index.json from the Arduino15 folder.

(FYI: I am still using IDE 1.6.9 if that makes a difference...)

Here is the link to my json file if you want to crash your own copy:
https://raw.githubusercontent.com/openpanzerproject/Arduino_Boards/master/IDE_Board_Manager/package_openpanzer_index.json

EDIT: Changed later to this:
Code: [Select]
https://openpanzerproject.github.io/OpenPanzerBoards/package_openpanzer_index.json

There are no doubt too many errors to count in my setup... I'm just trying to get a framework established so hopefully whatever kind soul attempts to assist doesn't have to walk me through getting GitHub setup, etc...


Code: [Select]
java.lang.NullPointerException
java.lang.RuntimeException: java.lang.NullPointerException
 at cc.arduino.contributions.packages.ui.ContributionManagerUI.lambda$onUpdatePressed$19(ContributionManagerUI.java:151)
 at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
 at cc.arduino.contributions.packages.ContributionsIndex.findPackage(ContributionsIndex.java:49)
 at cc.arduino.contributions.packages.ContributionsIndexer.syncBuiltInHardwareFolder(ContributionsIndexer.java:197)
 at cc.arduino.contributions.packages.ContributionsIndexer.syncWithFilesystem(ContributionsIndexer.java:187)
 at processing.app.BaseNoGui.initPackages(BaseNoGui.java:626)
 at processing.app.Base$9.onIndexesUpdated(Base.java:1307)
 at cc.arduino.contributions.packages.ui.ContributionManagerUI.lambda$onUpdatePressed$19(ContributionManagerUI.java:149)
 ... 1 more
java.lang.NullPointerException
 at cc.arduino.contributions.packages.ContributionsIndex.findPackage(ContributionsIndex.java:49)
 at cc.arduino.contributions.packages.ContributionsIndexer.syncBuiltInHardwareFolder(ContributionsIndexer.java:197)
 at cc.arduino.contributions.packages.ContributionsIndexer.syncWithFilesystem(ContributionsIndexer.java:187)
 at processing.app.BaseNoGui.initPackages(BaseNoGui.java:626)
 at processing.app.Base.openBoardsManager(Base.java:1325)
 at processing.app.Base$10.actionPerformed(Base.java:1348)
 at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
 at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
 at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
 at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
 at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
 at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
 at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
 at java.awt.Component.processMouseEvent(Component.java:6535)
 at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
 at java.awt.Component.processEvent(Component.java:6300)
 at java.awt.Container.processEvent(Container.java:2236)
 at java.awt.Component.dispatchEventImpl(Component.java:4891)
 at java.awt.Container.dispatchEventImpl(Container.java:2294)
 at java.awt.Component.dispatchEvent(Component.java:4713)
 at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
 at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
 at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
 at java.awt.Container.dispatchEventImpl(Container.java:2280)
 at java.awt.Window.dispatchEventImpl(Window.java:2750)
 at java.awt.Component.dispatchEvent(Component.java:4713)
 at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
 at java.awt.EventQueue.access$500(EventQueue.java:97)
 at java.awt.EventQueue$3.run(EventQueue.java:709)
 at java.awt.EventQueue$3.run(EventQueue.java:703)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
 at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
 at java.awt.EventQueue$4.run(EventQueue.java:731)
 at java.awt.EventQueue$4.run(EventQueue.java:729)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
 at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
 at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
 at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
 at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
 at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
 at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
 at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

pert

documentation is not great
If there's anything specific let me know and I'll see what I can do. Sometimes someone reading documentation for the first time can spot things that seemed obvious to the author only because they have become so familiar with the subject matter.

Boards Manager Support File Locations on GitHub - I also found this page that discusses various places you can host your json file on GitHub, but I think this is a topic that represents one of the last steps rather than the first.
I wrote that one (actually I'm one of the authors of the official JSON specification too). I found I was discussing those options every time I added Boards Manager support for a hardware package so decided it was easiest to just publish it in a central location. I have been meaning to update the last part regarding use of the archive file that GitHub automatically generates. We had an issue with the first Boards Manager project I did where the checksum of the archive file changed, causing Boards Manager installation to fail. I don't know why this happened but I haven't seen it happen since then so it may not be so inadvisable. It's possible it was caused by a force push. The downside to that is the repository must have the correct folder structure so that the automatically generated archive file will have the correct folder structure. This folder structure is different from the one required for manual installation. Some people can't use Boards Manager due to network security settings, etc. so it's nice to still offer the option of easy manual installation. So it may be more convenient to set up the repository folder structure for manual installation and then create your own Boards Manager archive file with the correct folder structure at each release.

Let's say I want our board to compile with avr-gcc 4.8.1. Do I need to maintain and update my own version/download of the compiler or can I simply refer to this somewhere at Arduino.cc?
The way you have it set up now does work but unfortunately there was a bug in previous versions of the Arduino IDE that will cause installation of your hardware package in Arduino IDE 1.6.10 to break the Arduino AVR Boards package. For more information see:
https://github.com/arduino/Arduino/issues/5168
So the options are to just state that the package is not compatible with Arduino IDE 1.6.10 or to change the JSON file so that your package uses its own avr-gcc tool instead of using the arduino tool. You can still have the file downloaded from their server.

what is the difference between 4.8.1-arduino2 and 4.8.1-arduino5?
Arduino has their own custom builds of avr-gcc. so the 4.8.1 is the official avr-gcc release version and the -arduino5 is the revision of the Arduino build. I'm not sure exactly what the changes are, I think you can see them at https://github.com/arduino/toolchain-avr.

I imagine it is easier to help someone correct a thing they have already created, than to help someone create something that doesn't yet exist.
I think that's a good approach. I find GitHub to be an excellent tool for facilitating collaboration.

Then I open Boards Manager and get a java.lang.NullPointerException error
For anyone else following along, I think we have this issue fixed now.

LukeZ

Once again thank you so much Pert for all your help, you're a one-man support banshee and I really appreciate it.

documentation is not great
Well it is better than it at first appears, one big problem is that any Google search of this topic brings up primarily lots of information on the old method of modifying boards.txt, or if you do find a tutorial on the new method it is actually a tutorial on how to paste someone's JSON URL into your preferences, rather than creating your own archive. Once I did find your pages I was able to get pretty far all things considered, but there are so many options and possibilities that are not expounded upon, nor probably easily summarized. Most of these I suspect are basically optional but that is not clear to the newbie.

Also page headings that say things like "this is for Arduino 1.5.3" tend to throw people off, or anyway they did me, since I was leery of using instructions from a prehistoric version in my quest to make my code compatible with the latest version.

Nevertheless, my brain tumors have not been too painful yet, and it's only day 1 and I have a working board package (with your help), so it was not as bad as I feared.

This folder structure is different from the one required for manual installation. Some people can't use Boards Manager due to network security settings, etc. so it's nice to still offer the option of easy manual installation. So it may be more convenient to set up the repository folder structure for manual installation and then create your own Boards Manager archive file with the correct folder structure at each release.
Looking at Sparkfun and others it doesn't appear most actually do provide the correct folder for manual installation? Sparkfun's layout, which I copied, has this folder structure in their GitHub repository:
sparkfun\avr\stuff...

Whereas I would imagine for manual install it should be something like this instead:
sparkfun\hardware\avr\1.0.0\stuff...

...with instructions that the sparkfun folder should be dumped into the ..\Arduino15\packages\ folder. I suppose maybe SparkFun is only keeping the most recent version of the individual files but the version number still needs to be part of the path (I think) - at least to judge from the way Arduino installs things. Am I understanding this correctly?

The way SparkFun has their files arranged seems to be in a way that would be convenient for creating the installation archive. But presumably they are the only ones creating the archive, and anyone else who wanted the individual files would only need them for manual install. I like having a single repository for all this the way SparkFun does (and I'm not brave/motivated enough to try the automatically generated GitHub release), but perhaps I can align my folder structure to what people will need for manual install, if indeed I have divined that structure correctly.

So the options are to just state that the package is not compatible with Arduino IDE 1.6.10 or to change the JSON file so that your package uses its own avr-gcc tool instead of using the arduino tool. You can still have the file downloaded from their server.
Laziness tells me to do the former, but it wouldn't be hard to change the JSON I guess. My concern is related to getting the correct link to Arduino's stash and how to maintain that if they change/upgrade it? But this may be an issue anyway, eg:

Arduino has their own custom builds of avr-gcc. so the 4.8.1 is the official avr-gcc release version and the -arduino5 is the revision of the Arduino build.
Would one be safe to assume that Arduino is not going to release a version -arduino6? If they did no one would remember to go back and change their JSON files. What I would prefer is to have the JSON tell the IDE "I want to use avr-gcc 4.8.1 and you take care of getting me the best version of that without me having to think about it." But it seems that is perhaps not possible/practical regardless of whether I specify my own tool or use Arduino's.

Amazingly I haven't even got to my real list of questions yet but I'll give you a temporary rest here. The board does install correctly in Arduino so it's not so much an issue of getting it to work as of better understanding what I'm doing.

pert

Nevertheless, my brain tumors have not been too painful yet
For a couple months after Boards Manager was added to the Arduino IDE there was absolutely no documentation. I had to figure it out by trial and error. Talk about brain tumors! Finally there were enough other people asking questions about it that I decided to write a tutorial. The next day Arduino came out with the first draft of the JSON specification page and requested that I incorporate the content from my tutorial into the specification. I commented that I should have waited a day to write my tutorial but they said it was seeing my tutorial that made them realize they really should get on writing some official documentation. The playground page you linked above was the left over content when I finished moving the rest over.

Looking at Sparkfun and others it doesn't appear most actually do provide the correct folder for manual installation? Sparkfun's layout, which I copied, has this folder structure in their GitHub repository:
sparkfun\avr\stuff...

Whereas I would imagine for manual install it should be something like this instead:
sparkfun\hardware\avr\1.0.0\stuff...
That is the manual installation folder structure. Manual installation doesn't have the version folder. The Boards Manager folder structure would be sparkfun\stuff because the architecture and version folders are automatically generated during Boards Manager installation based on the information in the JSON file. It's quite annoying that they have to be slightly different. You will see that some hardware packages have completely switched to Boards Manager installation only and no longer have any instructions for manual installation. As I said before, I do think there is good reason to leave this option available to the users. Of course if you know what you're doing it's easy enough to just create the architecture folder during the manual installation but that's not really very user friendly.

but perhaps I can align my folder structure to what people will need for manual install, if indeed I have divined that structure correctly.
Yes, your repository currently has the correct folder structure for easy manual installation. The manual installation instructions would be:

Seems pretty simple, right?

My concern is related to getting the correct link to Arduino's stash and how to maintain that if they change/upgrade it?
You can just grab the URL from their JSON file:
http://downloads.arduino.cc/packages/package_index.json
I doubt they'd change the location anytime in the near future because that would require them to edit their JSON file but you could always download the file and host it yourself to be sure. I'm not sure what the etiquette is around using Arduino's download server to host your tools. Obviously it's not something they're terribly worried about since Boards Manager already has a mechanism for referencing their tools, as your JSON file currently does.

Would one be safe to assume that Arduino is not going to release a version -arduino6?
No, I don't think there's any chance of that because they've already moved on to avr-gcc 4.9.2. They will likely release some new revisions of 4.9.2 in the future.

What I would prefer is to have the JSON tell the IDE "I want to use avr-gcc 4.8.1 and you take care of getting me the best version of that without me having to think about it." But it seems that is perhaps not possible/practical regardless of whether I specify my own tool or use Arduino's.
You could probably write some sort of script that parses through Arduino's JSON file to fine the latest revision of 4.8.1 and then inserts that version in the JSON file or downloads it to your own hosting location and renames it but that would be done independent of the Arduino IDE as it has no mechanism for this sort of thing.

If you want a good example of a hardware package that is easy to do a manual or Boards Manager installation of check out:
https://github.com/MCUdude/MightyCore
(or any of MCUdude/hansibull's other packages). The master branch has the package in the manual installation folder structure. The JSON file and Boards Manager installation archive files for each release are located in the gh-pages branch. Putting these in the separate branch makes downloads for manual installation smaller and removes any files that would be unnecessary for that purpose. The reason the gh-pages branch has that name is it makes the Boards Manager URL a little shorter due to the special properties GitHub gives branches of that name:
Code: [Select]
https://mcudude.github.io/MightyCore/package_MCUdude_MightyCore_index.json
rather than:
Code: [Select]
https://github.com/MCUdude/MightyCore/raw/gh-pages/package_MCUdude_MightyCore_index.json
as it would need to be in a branch of any other name.

The only downside of this system is that the folder structure must be changed for Boards Manager compatibility and the archive file manually generated but that's not so bad. I've considered writing a script to automate this as well as generating the JSON file entry (something like this) but it's easy enough to do it manually and the releases aren't so frequent.

LukeZ

That is the manual installation folder structure. Manual installation doesn't have the version folder. The Boards Manager folder structure would be sparkfun\stuff because the architecture and version folders are automatically generated during Boards Manager installation based on the information in the JSON file.
Ok, after many hours re-reading your posts and looking at other's GitHub pages I understand where my confusion was coming from with regards to the installation folders.

I knew that Boards Manager installed the package in the Arduino15 folder:
Code: [Select]
C:\Users\username\AppData\Local\Arduino15\packages\

Although the constructed package that Boards Manager downloads only needs the folder projectname\stuff, I also knew that when Boards Manager unpacked it to the Arduino15 folder, it adds all kinds of other intermediate folders automatically -
Code: [Select]
Arduino15\packages\projectname\hardware\avr\version\stuff

My assumption was that manual install must do the same thing. I see now that not only does manual install require a different folder structure, it doesn't even go into the same folder. Perhaps the average user is not supposed to know about the Arduino15 folder and maybe I only knew enough to be dangerous.

So for those reading this later with the same confusion, ignore what Boards Manager does in Arduino15. For manual install the files go into the user's sketchbook directory in the hardware subfolder (create it if it doesn't exist):
Code: [Select]
sketchbookfolder\hardware\projectname\avr\stuff




Ok, so anyway I have taken various of your suggestions and created a new repository from scratch. I've edited my prior posts to point to the new, hopefully final locations for anyone else following along.

GitHub: OpenPanzerProject\OpenPanzerBoards

This repo has two branches. The master branch (also the default) has the manual installation files. The gh-pages branch (I'd never heard of such a thing before), has our JSON and packages for the IDE Boards Manager. I've modelled this after MCUDude's setup as you mentioned.

I think MCUDude's method would be a good example to use on the Boards Manager Support File Locations on GitHub example page, perhaps replacing Adafruit. Adafruit is a little unusual, they actually use two different repositories entirely, one for manual install files (Adafruit_Arduino_Boards) and the other for the Boards Manager packages (arduino-board-index). They do use a gh-pages branch on this latter one but that is also essentially the only branch in that repo. It took me a while to dig up both these repos and understand what they had done, as neither one is linked from the example page.

I'm also still a relative newbie when it comes to GitHub, so to me the pros/cons of adding another branch aren't really apparent. What I detect is that branches are perhaps typically intended eventually to be merged and GitHub wants to keep reminding me of that with my gh-pages branch, although in this application I will want the master and gh-pages branch to remain separate for all eternity and basically represent completely different things.





Finally, I've tested my package in several versions of the IDE. My case is a little unusual than most in that I am trying to force the use of avr-gcc-4.8.1 even in later versions of the IDE that would otherwise use the newer 4.9.2. I found that when I tried anything beyond 1.6.9 I would get compile errors, which I was finally able to correct by copying the platform.txt from AVR Boards 1.6.11 (the last AVR Boards version to use avr-gcc-4.8.1, and not to be confused with the IDE version). Now it seems all to be working.

In my JSON I've specified the avr-gcc specifically in the "Tools" section, copying the URLs from Arduino's JSON. I'm not going to host them myself, I'll just use theirs. Hopefully this avoids the bug in IDE 1.6.10. It seems to work in my testing but of course I'm only testing my own board... I did not add avrdude to the "Tools" section, I don't know if that will cause issues in IDE 1.6.10 or not, I'm assuming not.




pert

I think MCUDude's method would be a good example to use on the Boards Manager Support File Locations on GitHub example page, perhaps replacing Adafruit. Adafruit is a little unusual
That's a good idea. At the time I wrote that page MightyCore didn't exist. There were only a few existing 3rd party packages available to use as examples.

I'm also still a relative newbie when it comes to GitHub, so to me the pros/cons of adding another branch aren't really apparent.
In this case the pros are:
  • Someone wanting to do a manual installation won't have to download an be confused by the Boards Manager support files, which are irrelevant to their usage.
  • The commit history for each branch is kept separate, which makes sense because they are not really relevant to each other.
  • People wanting to contribute work to the project won't be confused by the presence of these mysterious Boards Manager files.
  • gh-pages branch allows a shorter Boards Manager URL.

The only con I can think of is it makes the repository structure a little more confusing but if that's a problem a little documentation will make things clear. I think the README.md you added to your gh-pages branch does a good job of this.

What I detect is that branches are perhaps typically intended eventually to be merged
Certainly the standard flow for contributing commits is fork, branch, commit, pull request but that's not the only use for branches. GitHub added the gh-pages branch feature specifically with the intent that branch would never be merged to master so using as you are is quite standard.

In my JSON I've specified the avr-gcc specifically in the "Tools" section, copying the URLs from Arduino's JSON. I'm not going to host them myself, I'll just use theirs. Hopefully this avoids the bug in IDE 1.6.10.
I'll take a look at this later to see if I notice any issues. It can be very tricky and time consuming trying to support backwards compatibility with a reasonable range of Arduino IDE versions but people do tend to stick with whatever IDE version they've become comfortable with so it is good to at least make an attempt.

I did not add avrdude to the "Tools" section, I don't know if that will cause issues in IDE 1.6.10 or not, I'm assuming not.
That shouldn't be a problem. I've seen mixed results as to whether the new avrdude version gets used by Arduino AVR Boards in old IDE versions but even if it does it shouldn't break anything. Using avr-gcc 4.8.1 with Arduino AVR Boards 1.6.12 or newer doesn't work because it uses LTO, which is not supported by Arduino's avr-gcc 4.8.1 versions.

LukeZ

Thanks again Pert for all your help, and I hope this thread and your comments will be of use to others looking for more information as they create their own custom boards. The best advice I can give is to study how others have done it, but of course one needs to be pretty well educated on a lot of topics to begin with, which I suppose anyone should be who has gotten to this point. But I myself have gotten to this point and I don't feel hardly educated at all.

I hope I have not trespassed any etiquette but I took the liberty of adding our humble board to the Unofficial List of 3rd Party Boards page. If I should not have done or did it incorrectly of course please let me know.

LukeZ

So I figured out my other problem with the compiler which I will post about in the other thread, but the result is that I am now free to use the later version of the avr-gcc compiler.

I can go ahead and just specify "4.9.2-atmel3.5.3-arduino2" in my toolsDependencies, which I see is the latest version as of today. But then when Arduino releases 4.9.2-xx-arduino3 or whatever, I will need to update my package once again.

Browsing through other peoples JSON files, I note two things:

  • Big companies like SparkFun and Adafruit have not specified 4.9.2 yet; if they list anything it's 4.8.1. Could this just be a consequence of the hassle of updating your JSON every time Arduino decides to upgrade which seems to be about every five minutes? Or could it be that they prefer the older compiler for some reason I don't know about?
  • I also notice that many JSONs don't list any toolsDependencies. Could it be that when this value is left blank the IDE will simply use whatever version is active for the currently loaded AVR Boards, which would be dependent on the IDE version?

If #2 is true then it would seem the easiest thing to do from a maintenance standpoint is to leave the entry blank and let the IDE take care of it. But I don't know if that's necessarily the case.

I will do some testing but I wondered if there was a best-practice or guidance on this.

pert

    Big companies like SparkFun and Adafruit have not specified 4.9.2 yet; if they list anything it's 4.8.1. Could this just be a consequence of the hassle of updating your JSON every time Arduino decides to upgrade which seems to be about every five minutes? Or could it be that they prefer the older compiler for some reason I don't know about?
    [/list]
    There's a good chance it's just that they haven't released a new package version since the new compiler became available. It might also be that they tend to just blindly copy and paste the previous entry for each new release. It could also be that they know things work with the old version and don't want to spend time testing and dealing with any possible issues upgrading could cause.

    I also notice that many JSONs don't list any toolsDependencies. Could it be that when this value is left blank the IDE will simply use whatever version is active for the currently loaded AVR Boards, which would be dependent on the IDE version?
    Yes, whatever tool versions Arduino AVR Boards is using will be used when the toolsDependencies field is left blank. The toolsDependencies entries were removed from those JSON files because that was the easiest way of dealing with https://github.com/arduino/Arduino/issues/5168. That bug has been fixed since but there are likely still some people using Arduino IDE 1.6.10. The downside is that you don't have any control over which tool versions are used with your package but it does make the JSON file more simple and you don't need to worry about checking to see what the latest tool versions are at each package release. It also means that the installation of your package will always be super fast since the tools will never have to be downloaded.

    LukeZ

    Thanks Pert. The next question that naturally arises is, since we are allowed to leave toolsDependencies blank and let the IDE choose the compiler for us, are we therefore also allowed to omit platform.txt from our package? Since platform.txt varies depending on the compiler version and we don't know which version will be used, it would seem this must be so.

    I've done a test package with toolsDependencies left blank and platform.txt omitted, and all seems to work as it should. But just wanted to make sure this is technically correct, since I don't see others doing this.

    Looking at MCUDude's MightyCore repo for example, he leaves toolsDependencies blank, but then he has a platform.txt file that appears to be rather old (it doesn't for example specify LTO compiler flags that were introduced back with IDE 1.6.10). Because toolsDependencies is blank the IDE is going to use the latest version of avr-gcc, but his platform.txt file is going to preclude him from taking advantage of its new features. Maybe he doesn't want those new features, or maybe this is a case where he's letting the IDE take care of one decision while not recognizing he should let the IDE take care of the other decisions as well.


    pert

    Thanks Pert. The next question that naturally arises is, since we are allowed to leave toolsDependencies blank and let the IDE choose the compiler for us, are we therefore also allowed to omit platform.txt from our package? Since platform.txt varies depending on the compiler version and we don't know which version will be used, it would seem this must be so.

    I've done a test package with toolsDependencies left blank and platform.txt omitted, and all seems to work as it should. But just wanted to make sure this is technically correct, since I don't see others doing this.
    Yes, because your package references the arduino:arduino core the Arduino AVR Boards platform.txt will be used if your core doesn't have one or if the platform.txt in your package is incomplete (for example, sometimes a core will have a platform.txt only so the package name can be defined but the rest is left blank since the referenced package's platform.txt works fine).

    Looking at MCUDude's MightyCore repo for example, he leaves toolsDependencies blank, but then he has a platform.txt file
    MightyCore uses its own core so it must have a complete platform.txt file.

    Maybe he doesn't want those new features, or maybe this is a case where he's letting the IDE take care of one decision while not recognizing he should let the IDE take care of the other decisions as well.
    Because MightyCore must have its own platform.txt and avr-gcc 4.8.1 doesn't support LTO adding that feature would break backwards compatibility with older IDE/Arduino AVR Boards versions. We had a lot of discussion regarding adding an avr-gcc tool to MightyCore but I think the main issue was the added complication this would cause for manual installation.

    pert

    Actually I forgot, MightyCore does have a custom tools menu to turn LTO on or off e.g.:
    https://github.com/MCUdude/MightyCore/blob/master/avr/boards.txt#L61-L72
    This allows the feature to by used by people who have a recent version of avr-gcc installed while retaining backwards compatibility.

    LukeZ

    Yes, because your package references the arduino:arduino core the Arduino AVR Boards platform.txt will be used if your core doesn't have one or if the platform.txt in your package is incomplete (for example, sometimes a core will have a platform.txt only so the package name can be defined but the rest is left blank since the referenced package's platform.txt works fine).
    Thanks for confirming that, and also the tidbit about the package name! I was wondering why my header disappeared in the Boards list.

    The very word "core" starts to make me feel like a headache is approaching, so I am going to please myself with the thought I don't need to worry about such things yet (I'm not sure I even comprehend what all a core entails - thankfully). In the end my package is quite simple and I am letting the IDE choose most things for me. This means our code needs to be compatible with many versions of the IDE but for us that is a good goal anyway. If something breaks again like we started off with, I now have a much better grasp of how to create a more tailored package.

    I appreciate again all your help and I do hope this thread is useful to some other poor sap out there who has graduated to this level...

    Go Up