Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Boards Directory #1263

Closed
wants to merge 1 commit into from

6 participants

@sgk
sgk commented

Load the board definitions from text files inside "board" directory
in addition to the "boards.txt" file.

This makes users to install a new board definition for third party
Arduino derivatives by just dropping a file.

@damellis
Owner

You can already add a board by simply adding a text file, you just need to put it in its own folder and call the file "boards.txt". Adding another, redundant, option seems confusing and unnecessary to me. Also, I think it's good to discourage people from adding new boards inside the Arduino application itself, because then they need to be copied when you update to a new version of the software.

@sgk
sgk commented

You can already add a board by simply adding a text file, you just need to put it in its own folder and call the file "boards.txt".

Do you mean adding a new platform? It is right that we can add a new platform by adding a new folder with "boards.txt", "platform.txt", "cores" and other files and folders. However, it is a little bit too hard to maintain the whole target platform folder contents when we want to just add one single board definition.

We still need to edit the "boards.txt" file to add a board definition for third party Arduino derivative.

Also, I think it's good to discourage people from adding new boards inside the Arduino application itself, because then they need to be copied when you update to a new version of the software.

No. I mean "users" are administrators like teachers, hackers and third party vendors of Arduino derivatives, who wants to prepare their own IDE before distributing. It is true that such people are able to edit the "boards.txt" file with no hassle. However, it is important to keep original files untouched even for such people. This is why I propose this feature.

It should be better for you to learn from the Linux and Unix history, which added directories like "/etc/cron.d" even when there already was another way to maintain the settings.

But, this should depend on if you, Arduino team, are willing to support third party vendors or not. If you don't want to support third party vendors, this pull request is just rubbish.

@damellis
Owner
@lestofante
@sgk
sgk commented
@damellis
Owner

The new, third-party hardware folder has two levels: package/platform. For example, "arduino/avr" or "teensy/arm". The idea is that the top-level folder represents the person or organization providing the folder; I imagine there will be lots of these. The second level folder (e.g. "avr" or "sam") represents the microcontroller architecture; there will probably be fewer of these. So for example, you might have "sanguino/avr/boards.txt". Or "bob/avr/boards.txt" or "jill/avr/boards.txt" or whatever. That doesn't seem too complicated to me, although I realize its an extra level of organization vs. 1.0.x.

Splitting up the current boards.txt files into multiple files (one per board) would be a big change. It might have been a better option if we were starting over, but it's not clear to me that any advantages it might have are worth the annoyance of switching formats.

@sgk
sgk commented

The new, third-party hardware folder has two levels: package/platform. For example, "arduino/avr" or "teensy/arm". The idea is that the top-level folder represents the person or organization providing the folder; I imagine there will be lots of these.

I see. I understand what you are saying. Teensy was not good example for this matter. When adding Teensy, it seems to be best to create a new brand directory like "teensy" under "hardware" to represent Teensy. This is because Teensy has different bootloader and runtime than Arduino.

Forget Teensy and pickup Arduino compatible boards like Boarduino. When adding such board, it is not good idea to have completely independent directory under "hardware", which has "platform.txt", "cores" and "platfrom.txt" in addition to the "boards.txt". It is too complicated to me.

And, if you succeed to prepare the directory with some files and sub-directories, there is another problem. The added board will occupy 1 extra entry on the "Board" menu in addition to the board names. The extra entry is grayed out platform name like "Arduino AVR Boards" or "Arduino ARM (32-bits) Boards".

"boards" directory feature is very simple.

Splitting up the current boards.txt files into multiple files (one per board) would be a big change. It might have been a better option if we were starting over, but it's not clear to me that any advantages it might have are worth the annoyance of switching formats.

No. It is not a big change. It does not change the format. It is not required to split to multiple files. The use of "boards" directory is optional. Both the current "boards.txt" file and the new "boards/*" files will be read. You do not have to alter the current "boards.txt" file.

"boards" directory feature is to give an easy way to add board definitions with less change to the source code and the file format.

If you still don't want to have the "duplicate" way to define boards, you should be better to remove the current "boards.txt" feature and just move "boards.txt" inside "boards" directory.

@sgk
sgk commented

Any ideas? > @ffissore @cmaglie

@cmaglie
Owner

sgk,

I don't want to decide right now to accept or discard your patch, I need to work out some details inside the IDE to figure out if it is worth or not. I want to ask you to be a little patient.

Don't look at the actual 1.5 behaviour, we are working toward an implementation that doesn't require a platform.txt file to add a new board. When its ready you should be able to add a new board by "only" putting a file in hardware/sgk/avr/boards.txt.

And, if you succeed to prepare the directory with some files and sub-directories, there is another problem. The added board will occupy 1 extra entry on the "Board" menu in addition to the board names. The extra entry is grayed out platform name like "Arduino AVR Boards" or "Arduino ARM (32-bits) Boards".

Probably this could be avoided if we make possible, from the boards.txt file, to point to another platform.

C

@PaulStoffregen
Collaborator

Hi Christian,

As the creator of Teensy, I'm watching and waiting for 1.5.x to settle before I support it. The exact details of boards.txt, platforms.txt and other things really do not matter much. My installer already needs to add many patches to the IDE for Teensy's special features which are very different from any official Arduino board.

What matter most to me, as a 3rd party board provider, is a relatively stable platform. The last thing I want to do is a lot of work to support 1.5.1, and then have to redo it all over again for 1.5.2 or future versions that make substantial changes. I know some ongoing change is inevitable, but my wish is for as much platform stability as is reasonably possible.

But if I could make one small request..... please consider bringing keywords.txt into this package/platform/board/variant system. As a 3rd party board with additional keywords, overwriting the global keywords.txt file is not a good solution.

@barbudor
@sgk

Thank you Christian,

I don't want to decide right now to accept or discard your patch

I understand. I don't have any objection to your plan. I don't want to insist on my pull request if you are trying to find the best solution for the platform package directory format. As you pointed out, it seems that the current directory format is not perfect. I would like to help if you want.

Please remember to try this pull request or an equivalent implementation even when you rearranged the directory format. I believe the "boards" directory should be useful even when we can add a package directory with only "boards.txt" file.

Thanks you.

@sgk sgk Boards Directory
Load the board definitions from text files inside "board" directory
in addition to the "boards.txt" file.

This makes users to install a new board definition for third party
Arduino derivatives by just dropping a file.
210a698
@sgk sgk closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 16, 2013
  1. @sgk

    Boards Directory

    sgk authored
    Load the board definitions from text files inside "board" directory
    in addition to the "boards.txt" file.
    
    This makes users to install a new board definition for third party
    Arduino derivatives by just dropping a file.
This page is out of date. Refresh to see the latest.
Showing with 28 additions and 6 deletions.
  1. +28 −6 app/src/processing/app/debug/TargetPlatform.java
View
34 app/src/processing/app/debug/TargetPlatform.java
@@ -53,21 +53,43 @@ public TargetPlatform(String _name, File _folder) {
String notused = _("Processor");
}
+ PreferencesMap boardPreferences = new PreferencesMap();
+
try {
File boardsFile = new File(_folder, "boards.txt");
if (boardsFile.exists() && boardsFile.canRead()) {
- PreferencesMap boardPreferences = new PreferencesMap();
boardPreferences.load(boardsFile);
- boards = boardPreferences.createFirstLevelMap();
- customMenus = MapWithSubkeys.createFrom(boards.get("menu"));
- boards.remove("menu");
}
} catch (Exception e) {
- e.printStackTrace();
- System.err.println("Error loading boards from boards.txt: " + e);
}
try {
+ File boardsDir = new File(_folder, "boards");
+ if (boardsDir.isDirectory()) {
+ for (String name : boardsDir.list()) {
+ if (name.endsWith(".txt")) {
+ try {
+ File boardsFile = new File(boardsDir, name);
+ if (boardsFile.exists()) {
+ boardPreferences.load(boardsFile);
+ }
+ } catch (Exception e) {
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ }
+
+ if (boardPreferences.size() == 0) {
+ System.err.println("No board definitions found in boards.txt and boards directory");
+ }
+
+ boards = boardPreferences.createFirstLevelMap();
+ customMenus = MapWithSubkeys.createFrom(boards.get("menu"));
+ boards.remove("menu");
+
+ try {
File platformsFile = new File(_folder, "platform.txt");
if (platformsFile.exists() && platformsFile.canRead()) {
preferences.load(platformsFile);
Something went wrong with that request. Please try again.