We needed to modify the boot loader for custom boards that we use (we basically removed the double tap option of the SAMD21 to get a faster boot time needed for our push button controller).
So far so good. When I manually add the new variant to the desired folder:
(Where manufacturer is in this case RobotPatient)
- the new board shows up under Tools | Board
But I want to do it more like the official way since we might also involve students in the project (since it is part of a larger research project together with a college) etc.
So I created a package json file (package_robotpatient_index.json)
I really don't like the manual work involved in creating such a file so I though it would be useful to create a python script that does most of the work (no different versions for now). It can be improved but seems to do the job for now (I checked and double checked the output). This includes adding all package files inside a subfolder "package" into a tar.bz2 file, computing file size and SHA256 hash.
If I add the JSON to the Board Manager URL's it is downloaded. But then when I go to the boards manager and try to install I get ugly Java errors in the console:
Caused by: java.lang.NullPointerException
... 1 more
Apparently the (tar.bz2) file can't be downloaded and extracted? But I don't see the issue: the links work in my browser. Hope someone else has had the same problem and found a solution? Otherwise at least enjoy the Python script, I think it would be useful.
There were several errors in your JSON file:
- archive_file_name should be archiveFileName
- website_url should be websiteURL
- tools_dependencies should be toolsDependencies
- the value of size should be in quotes
After fixing that, there is still an error caused by the structure of your installation archive (https://robotpatient.com/modules/boards/RobotPatient-samd-1.0.0.tar.bz2). You have all the files of the package just dumped right into the root of the archive file. That is not allowed. You need to have a valid folder structure. Download an established hardware package to see how it should be:
The structure should be something like this:
It doesn't matter what the name of the root folder of the package is (because the installation folder will be named according to the "name" value in your JSON file, but there does need to be a root folder in the archive. If you want the package to actually work (instead of installing but then compilations for your board failing), you also need to make sure the various files are in the correct subfolders.
We've done a pretty thorough job of documenting the requirements for the Boards Manager support. You might find it useful to refer to it:
Thanks pert, I did use that format specification though, but I took some shortcut that now bytes me, by looking into other JSON files, (maybe they have the same problem). Will try to fix it and report the outcomes.
B.t.w. the dump must have been caused by me trying to not at the root itself in python, my previous version had "package" and then the structure like you explained in it.
Aha. Something else happend I do use archiveFileName etc. but it is incorrectly converted by my Python script!
Here's the fixed JSON file:
"maintainer": "RobotPatient Simulators BV",
"name": "RobotPatient SAMD21"
"name": "RobotPatient SAMD21",
The URL if you want to try it out:
Thanks again. Was a simple but very nasty problem that I just overlooked (aren't all the bugs). Fresh eyes...
The JSON generator script looks interesting. I am in charge of adding entries for new releases to the JSON files of several hardware packages and I've been meaning to do something of the sort for a while. Ideally, the whole process would happen automatically every time a Git tag was pushed to the repository, probably as part of the continuous integration system.
It was a very tiny bug in the script: pickle_platform = jsonpickle.encode(myBoards.to_dict(), unpicklable=False)
I forgot the to_dict()! Now it works (it then translates it back to correct keynames instead of the variable names of the objects). Thanks for showing me my mistake pert Happy to improve the script etc. I think it will really help the community indeed!