Skip to content

Commit 2dc5d08

Browse files
committed
+1.5.2 Arduino IDE beta (modded) should work now.
1 parent c192a55 commit 2dc5d08

File tree

11 files changed

+245
-183
lines changed

11 files changed

+245
-183
lines changed

clientdb.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<com.ibm.magnolia.clientmodel:ClientModelRoot xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:com.ibm.magnolia.clientmodel="http:///com/ibm/magnolia/clientmodel.ecore">
33
<workItemEditorHistory>
4+
<internalContents date="2013-10-22T21:46:58.977+0200" description="279: adopt to library specification 1.5 (as much as possible)" repository="https://clm.jkebanking.net/ccm/">
5+
<workItem itemId="_mZNwgDdDEeODMsLYASdLkg"/>
6+
</internalContents>
7+
<internalContents date="2013-10-22T21:41:40.586+0200" description="284: synching with github" repository="https://clm.jkebanking.net/ccm/">
8+
<workItem itemId="_H82vEDtREeOVS9Zte3uxGA"/>
9+
</internalContents>
410
<internalContents date="2013-07-02T00:19:53.824+0200" description="272: make 2.1.4 release and increase wait times" repository="https://clm.jkebanking.net/ccm/">
511
<workItem itemId="_RIttoOKcEeK7io-fU_sKrQ"/>
612
</internalContents>
@@ -183,6 +189,10 @@
183189
<columns attribute="creator" sorting="0" sortOrder="0" visible="true" width="-1"/>
184190
<id xsi:nil="true"/>
185191
</internalContents>
192+
<internalContents name="closed work items for me" repository="https://clm.jkebanking.net/ccm/" uuid="_UrqukDtSEeOVS9Zte3uxGA" id="closed work items for me">
193+
<columns attribute="id" sorting="0" sortOrder="-1" visible="true" width="-1"/>
194+
<columns attribute="summary" sorting="0" sortOrder="-1" visible="true" width="901"/>
195+
</internalContents>
186196
<internalContents name="Default" repository="https://clm.jkebanking.net/ccm/" uuid="_7-Kz0H3EEeKrroe5IR9OeQ" id="com.ibm.magnolia.workItemExplorer.">
187197
<columns attribute="workItemType" sorting="0" sortOrder="0" visible="true" width="-1"/>
188198
<columns attribute="id" sorting="2" sortOrder="1" visible="true" width="-1"/>

it.baeyens.arduino.common/librxtxSerial.jnilib

100644100755
File mode changed.

it.baeyens.arduino.common/librxtxSerial.so

100644100755
File mode changed.

it.baeyens.arduino.common/librxtxSerialx86_64.so

100644100755
File mode changed.

it.baeyens.arduino.common/rxtxSerial.dll

100644100755
File mode changed.

it.baeyens.arduino.common/rxtxSerial64.dll

100644100755
File mode changed.

it.baeyens.arduino.common/src/it/baeyens/arduino/common/ArduinoConst.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ public class ArduinoConst {
7676
public static final String ENV_KEY_build_system_path = ENV_KEY_ARDUINO_START + "BUILD.SYSTEM.PATH";
7777
public static final String ENV_KEY_build_generic_path = ENV_KEY_ARDUINO_START + "BUILD.GENERIC.PATH";
7878
public static final String ENV_KEY_SOFTWARE = ENV_KEY_ARDUINO_START + "SOFTWARE";
79+
public static final String ENV_KEY_ARCHITECTURE = ENV_KEY_ARDUINO_START + "ARCHITECTURE";
80+
public static final String ENV_KEY_BUILD_ARCH = ENV_KEY_ARDUINO_START + "BUILD.ARCH";
81+
7982
public static final String ENV_KEY_runtime_ide_version = ENV_KEY_ARDUINO_START + "RUNTIME.IDE.VERSION";
8083
public static final String ENV_KEY_build_path = ENV_KEY_ARDUINO_START + "BUILD.PATH";
8184
public static final String ENV_KEY_build_project_name = ENV_KEY_ARDUINO_START + "BUILD.PROJECT_NAME";

it.baeyens.arduino.core/src/it/baeyens/arduino/tools/ArduinoBoards.java

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public Map<String, String> getSection(String SectionKey) {
8585
*
8686
* @return a list of all the menu option name
8787
*/
88-
public String[] getOptionNames() {
88+
public String[] getMenuNames() {
8989
HashSet<String> ret = new HashSet<String>();
9090
for (Entry<String, Map<String, String>> entry : mArduinoSupportedBoards.entrySet()) {
9191
if (entry.getKey().equals("menu")) {
@@ -107,7 +107,7 @@ public String[] getOptionNames() {
107107
* the name of a board not the ide
108108
* @return
109109
*/
110-
public String[] getOptionValues(String menuLabel, String boardName) {
110+
public String[] getMenuItemNames(String menuLabel, String boardName) {
111111
String menuID = null;
112112
String boardID = getBoardIDFromName(boardName);
113113
HashSet<String> ret = new HashSet<String>();
@@ -123,6 +123,17 @@ public String[] getOptionValues(String menuLabel, String boardName) {
123123
if ((numsubkeys == 3) && (startOk))
124124
ret.add(e2.getValue());
125125
}
126+
// from Arduino IDE 1.5.4 menu is subset of the board. The previous code will not return a result
127+
Map<String, String> boardInfo = mArduinoSupportedBoards.get(boardID);
128+
if (boardInfo != null) {
129+
SearchKey = "menu." + menuID + ".";
130+
for (Entry<String, String> e2 : boardInfo.entrySet()) {
131+
int numsubkeys = e2.getKey().split("\\.").length;
132+
boolean startOk = e2.getKey().startsWith(SearchKey);
133+
if ((numsubkeys == 3) && (startOk))
134+
ret.add(e2.getValue());
135+
}
136+
}
126137
return ret.toArray(new String[ret.size()]);
127138
}
128139

@@ -364,4 +375,58 @@ public String getBoardsTxtName() {
364375
return mLastLoadedBoardsFile.getAbsolutePath();
365376
}
366377

378+
public String getMenuNameFromID(String menuID) {
379+
Map<String, String> menuSectionMap = getSection("menu");
380+
for (Entry<String, String> curOption : menuSectionMap.entrySet()) {
381+
if (curOption.getKey().equals(menuID)) {
382+
return curOption.getValue();
383+
}
384+
}
385+
return "menu ID " + menuID + " not found";
386+
}
387+
388+
public String getMenuIDFromName(String menuName) {
389+
Map<String, String> menuSectionMap = getSection("menu");
390+
for (Entry<String, String> curOption : menuSectionMap.entrySet()) {
391+
if (curOption.getValue().equals(menuName)) {
392+
return curOption.getKey();
393+
}
394+
}
395+
return "menu name " + menuName + " not found";
396+
}
397+
398+
public String getMenuItemIDFromName(String boardID, String menuID, String menuItemName) {
399+
// look in the pre 1.5.4 way "menu".menuid.boardid.menuitemid=name
400+
Map<String, String> menuSectionMap = getSection("menu");
401+
for (Entry<String, String> curOption : menuSectionMap.entrySet()) {
402+
if (curOption.getValue().equals(menuItemName)) {
403+
String[] keySplit = curOption.getKey().split("\\.");
404+
if (keySplit.length == 3 && keySplit[0].equals(menuID) && keySplit[1].equals(boardID))
405+
return keySplit[2];
406+
}
407+
}
408+
// nothing found so look in the post 1.5.4 way boardid."menu".menuid.menuitemid=name
409+
// TODO implement in 1.5.4 case
410+
return "getMenuItemIDFromName not yet implemented in 1.5.4 way";
411+
}
412+
413+
public String getMenuItemNameFromID(String boardID, String menuID, String menuItemID) {
414+
// look in the pre 1.5.4 way "menu".menuid.boardid.menuitemid=name
415+
Map<String, String> menuSectionMap = getSection("menu");
416+
String lookupValue = menuID + "." + boardID + "." + menuItemID;
417+
for (Entry<String, String> curOption : menuSectionMap.entrySet()) {
418+
if (curOption.getKey().equalsIgnoreCase(lookupValue))
419+
return curOption.getValue();
420+
}
421+
// nothing found so look in the post 1.5.4 way boardid."menu".menuid.menuitemid=name
422+
Map<String, String> BoardIDSectionMap = getSection(boardID);
423+
String loopupValue = "menu." + menuID + "." + menuItemID;
424+
for (Entry<String, String> curOption : BoardIDSectionMap.entrySet()) {
425+
if (curOption.getKey().equalsIgnoreCase(loopupValue))
426+
return curOption.getValue();
427+
}
428+
// TODO implement 1.5.4 way
429+
return "getMenuItemNameFromID did not find " + boardID + " " + menuID + " " + menuItemID;
430+
}
431+
367432
}

it.baeyens.arduino.core/src/it/baeyens/arduino/tools/ArduinoHelpers.java

Lines changed: 87 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ public static void addIncludeFolder(IProject project, IPath IncludePath) {
174174
* This method creates a link folder in the project and add the folder as a source path to the project it also adds the path to the include folder
175175
* if the includepath parameter points to a path that contains a subfolder named "utility" this subfolder will be added to the include path as
176176
* well <br/>
177+
* Forget about this. Arduino made this all so complicated I don't know anymore what needs to be added to what<br/>
177178
* <br/>
178179
*
179180
* note Arduino has these subfolders in the libraries that need to be include.<br/>
@@ -212,9 +213,30 @@ public static void addCodeFolder(IProject project, String PathVarName, String Su
212213

213214
IPathVariableManager pathMan = project.getPathVariableManager();
214215

215-
File file = new File(new Path(pathMan.getURIValue(PathVarName).getPath()).append(SubFolder).append("utility").toString());
216+
String possibleIncludeFolder = "utility";
217+
File file = new File(new Path(pathMan.getURIValue(PathVarName).getPath()).append(SubFolder).append(possibleIncludeFolder).toString());
216218
if (file.exists()) {
217-
addIncludeFolder(configurationDescription, link.getFullPath().append("utility"));
219+
addIncludeFolder(configurationDescription, link.getFullPath().append(possibleIncludeFolder));
220+
}
221+
222+
possibleIncludeFolder = "src";
223+
file = new File(new Path(pathMan.getURIValue(PathVarName).getPath()).append(SubFolder).append(possibleIncludeFolder).toString());
224+
if (file.exists()) {
225+
addIncludeFolder(configurationDescription, link.getFullPath().append(possibleIncludeFolder));
226+
// possibleIncludeFolder = "src/utility";
227+
// file = new File(new Path(pathMan.getURIValue(PathVarName).getPath()).append(SubFolder).append(possibleIncludeFolder).toString());
228+
// if (file.exists()) {
229+
// addIncludeFolder(configurationDescription, link.getFullPath().append(possibleIncludeFolder));
230+
// }
231+
}
232+
233+
possibleIncludeFolder = "arch";
234+
file = new File(new Path(pathMan.getURIValue(PathVarName).getPath()).append(SubFolder).append(possibleIncludeFolder).toString());
235+
if (file.exists()) {
236+
addIncludeFolder(configurationDescription,
237+
link.getFullPath().append(possibleIncludeFolder).append(makeEnvironmentVar(ENV_KEY_ARCHITECTURE)));
238+
// addIncludeFolder(configurationDescription,
239+
// link.getFullPath().append(possibleIncludeFolder).append(makeEnvironmentVar(ENV_KEY_ARCHITECTURE)).append("utility"));
218240
}
219241

220242
// projectDescription.setActiveConfiguration(configurationDescription);
@@ -458,49 +480,54 @@ private static void RemoveAllArduinoEnvironmentVariables(IContributedEnvironment
458480
* Used to define the hardware as different settings are needed for avr and sam
459481
*/
460482
private static void setTheEnvironmentVariablesSetTheDefaults(IContributedEnvironment contribEnv, ICConfigurationDescription confDesc,
461-
IPath platformFile, boolean firstTime) {
483+
IPath platformFile) {
462484
// Set some default values because the platform.txt does not contain
463485
// them
464486
IEnvironmentVariable var = new EnvironmentVariable(ENV_KEY_ARDUINO_PATH, getArduinoPath().toString());
465487
contribEnv.addVariable(var, confDesc);
466488

467-
// I'm not sure why but till now arduino refused to put this in the
468-
// platform.txt file
489+
// from 1.5.3 onwards 2 more enviroment variables need to be added
490+
var = new EnvironmentVariable(ENV_KEY_ARCHITECTURE, platformFile.removeLastSegments(1).lastSegment());
491+
contribEnv.addVariable(var, confDesc);
492+
var = new EnvironmentVariable(ENV_KEY_BUILD_ARCH, platformFile.removeLastSegments(1).lastSegment().toUpperCase());
493+
contribEnv.addVariable(var, confDesc);
494+
495+
// I'm not sure why but till now arduino refused to put this in the platform.txt file
469496
// I won't call them idiots for this but it is getting close
470497
var = new EnvironmentVariable(ENV_KEY_SOFTWARE, "ARDUINO");
471498
contribEnv.addVariable(var, confDesc);
472499
var = new EnvironmentVariable(ENV_KEY_runtime_ide_version, GetARDUINODefineValue());
473500
contribEnv.addVariable(var, confDesc);
474-
// End of section permitting denigrating remarks on arduino software
475-
// development team
501+
// End of section permitting denigrating remarks on arduino software development team
476502

477503
// Arduino uses the board approach for the upload tool.
478504
// as I'm not I create some special entries to work around it
479-
var = new EnvironmentVariable("A.CMD", "${A.TOOLS.BOSSAC.CMD}");
505+
var = new EnvironmentVariable("A.CMD", makeEnvironmentVar("A.TOOLS.BOSSAC.CMD"));
480506
contribEnv.addVariable(var, confDesc);
481-
var = new EnvironmentVariable("A.PATH", "${A.TOOLS.BOSSAC.PATH}");
507+
var = new EnvironmentVariable("A.PATH", makeEnvironmentVar("A.TOOLS.BOSSAC.PATH"));
482508
contribEnv.addVariable(var, confDesc);
483-
var = new EnvironmentVariable("A.CMD.PATH", "${A.TOOLS.AVRDUDE.CMD.PATH}");
509+
var = new EnvironmentVariable("A.CMD.PATH", makeEnvironmentVar("A.TOOLS.AVRDUDE.CMD.PATH"));
484510
contribEnv.addVariable(var, confDesc);
485-
var = new EnvironmentVariable("A.CONFIG.PATH", "${A.TOOLS.AVRDUDE.CONFIG.PATH}");
511+
var = new EnvironmentVariable("A.CONFIG.PATH", makeEnvironmentVar("A.TOOLS.AVRDUDE.CONFIG.PATH"));
486512
contribEnv.addVariable(var, confDesc); // End of section Arduino uses
487513
// the board approach for the
488514
// upload tool.
489515

490516
// For Teensy I added a flag that allows to compile everything in one
491517
// project not using the archiving functionality
492-
// I set the value to default to use the archiver
518+
// I set the default value to: use the archiver
493519
var = new EnvironmentVariable(ENV_KEY_use_archiver, "true");
494520
contribEnv.addVariable(var, confDesc);
495521
// End of Teensy specific settings
496522

497523
if (platformFile.segment(platformFile.segmentCount() - 2).equals("avr")) {
498-
var = new EnvironmentVariable(ENV_KEY_compiler_path, "${A.RUNTIME.IDE.PATH}/hardware/tools/avr/bin/");
524+
var = new EnvironmentVariable(ENV_KEY_compiler_path, makeEnvironmentVar("A.RUNTIME.IDE.PATH") + "/hardware/tools/avr/bin/");
499525
contribEnv.addVariable(var, confDesc);
500526
} else if (platformFile.segment(platformFile.segmentCount() - 2).equals("sam")) {
501-
var = new EnvironmentVariable(ENV_KEY_build_system_path, "${A.RUNTIME.IDE.PATH}/hardware/arduino/sam/system");
527+
var = new EnvironmentVariable(ENV_KEY_build_system_path, makeEnvironmentVar("A.RUNTIME.IDE.PATH") + "/hardware/arduino/sam/system");
502528
contribEnv.addVariable(var, confDesc);
503-
var = new EnvironmentVariable(ENV_KEY_build_generic_path, "${A.RUNTIME.IDE.PATH}/hardware/tools/g++_arm_none_eabi/arm-none-eabi/bin");
529+
var = new EnvironmentVariable(ENV_KEY_build_generic_path, makeEnvironmentVar("A.RUNTIME.IDE.PATH")
530+
+ "/hardware/tools/g++_arm_none_eabi/arm-none-eabi/bin");
504531
contribEnv.addVariable(var, confDesc);
505532
}
506533

@@ -516,12 +543,12 @@ private static void setTheEnvironmentVariablesSetTheDefaults(IContributedEnviron
516543
var = new EnvironmentVariable(ENV_KEY_build_path, "${ProjDirPath}/${ConfigName}");
517544
contribEnv.addVariable(var, confDesc);
518545

519-
var = new EnvironmentVariable(ENV_KEY_build_project_name, "${ProjName}");
546+
var = new EnvironmentVariable(ENV_KEY_build_project_name, makeEnvironmentVar("ProjName"));
520547
contribEnv.addVariable(var, confDesc);
521548

522549
// if (firstTime) {
523550
if (getBuildEnvironmentVariable(confDesc, ENV_KEY_SIZE_SWITCH, "").isEmpty()) {
524-
var = new EnvironmentVariable(ENV_KEY_SIZE_SWITCH, "${" + ENV_KEY_recipe_size_pattern + "}");
551+
var = new EnvironmentVariable(ENV_KEY_SIZE_SWITCH, makeEnvironmentVar(ENV_KEY_recipe_size_pattern));
525552
contribEnv.addVariable(var, confDesc);
526553
}
527554
if (getBuildEnvironmentVariable(confDesc, ENV_KEY_JANTJE_SIZE_COMMAND, "").isEmpty()) {
@@ -585,16 +612,33 @@ private static void setTheEnvironmentVariablesAddtheBoardsTxt(IContributedEnviro
585612
ArduinoBoards boardsFile = new ArduinoBoards(boardFileName.toOSString());
586613
String boardID = boardsFile.getBoardIDFromName(boardName);
587614

588-
// Get the boards section and add all entries to the environment
589-
// variables
615+
// Get the boards section and add all entries to the environment variables
590616
Map<String, String> boardSectionMap = boardsFile.getSection(boardID);
591617
for (Entry<String, String> currentPair : boardSectionMap.entrySet()) {
592-
contribEnv.addVariable(new EnvironmentVariable(MakeKeyString(currentPair.getKey()), MakeEnvironmentString(currentPair.getValue())),
593-
confDesc);
618+
// if it is not a menu item add it
619+
if (!currentPair.getKey().startsWith("menu.")) {
620+
String keyString = MakeKeyString(currentPair.getKey());
621+
String valueString = MakeEnvironmentString(currentPair.getValue());
622+
contribEnv.addVariable(new EnvironmentVariable(keyString, valueString), confDesc);
623+
} else {
624+
625+
String[] keySplit = currentPair.getKey().split("\\.");
626+
String menuID = keySplit[1];
627+
String menuItemID = keySplit[2];
628+
if (isThisMenuItemSelected(boardsFile, confDesc, boardID, menuID, menuItemID)) {
629+
// we also need to skip the name
630+
String StartValue = "menu." + menuID + "." + menuItemID + ".";
631+
if (currentPair.getKey().startsWith(StartValue)) {
632+
String keyString = MakeKeyString(currentPair.getKey().substring(StartValue.length()));
633+
String valueString = MakeEnvironmentString(currentPair.getValue());
634+
contribEnv.addVariable(new EnvironmentVariable(keyString, valueString), confDesc);
635+
}
636+
}
637+
}
594638
}
595639

596640
Map<String, String> menuSectionMap = boardsFile.getSection("menu");
597-
String[] optionNames = boardsFile.getOptionNames();
641+
String[] optionNames = boardsFile.getMenuNames();
598642
for (int currentOption = 0; currentOption < optionNames.length; currentOption++) {
599643
String optionName = optionNames[currentOption];
600644
String optionValue = getBuildEnvironmentVariable(confDesc, ArduinoConst.ENV_KEY_JANTJE_START + optionName, "");
@@ -639,6 +683,22 @@ private static void setTheEnvironmentVariablesAddtheBoardsTxt(IContributedEnviro
639683
}
640684
}
641685

686+
private static boolean isThisMenuItemSelected(ArduinoBoards boardsFile, ICConfigurationDescription confDesc, String boardID, String menuID,
687+
String menuItemID) {
688+
689+
String MenuName = boardsFile.getMenuNameFromID(menuID);
690+
String MenuItemName = boardsFile.getMenuItemNameFromID(boardID, menuID, menuItemID);
691+
692+
String SelectedMenuItemName = getBuildEnvironmentVariable(confDesc, ArduinoConst.ENV_KEY_JANTJE_START + MenuName, "");
693+
if (SelectedMenuItemName.isEmpty()) {
694+
return false; // This menu item has not been selected
695+
// this should not happen
696+
}
697+
if (MenuItemName.equalsIgnoreCase(SelectedMenuItemName))
698+
return true;
699+
return false;
700+
}
701+
642702
/**
643703
* This method creates environment variables based on the platform.txt and boards.txt platform.txt is processed first and then boards.txt. This
644704
* way boards.txt settings can overwrite common settings in platform.txt The environment variables are only valid for the project given as
@@ -650,7 +710,7 @@ private static void setTheEnvironmentVariablesAddtheBoardsTxt(IContributedEnviro
650710
* @param arduinoProperties
651711
* the info of the selected board to set the variables for
652712
*/
653-
public static void setTheEnvironmentVariables(IProject project, ICConfigurationDescription confDesc, boolean firstTime) {
713+
public static void setTheEnvironmentVariables(IProject project, ICConfigurationDescription confDesc) {
654714
IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
655715
IContributedEnvironment contribEnv = envManager.getContributedEnvironment();
656716

@@ -666,7 +726,7 @@ public static void setTheEnvironmentVariables(IProject project, ICConfigurationD
666726
// process the default env variables first. This way the platform.txt
667727
// and boards.txt will
668728
// overwrite the default settings
669-
setTheEnvironmentVariablesSetTheDefaults(contribEnv, confDesc, platformFilename, firstTime);
729+
setTheEnvironmentVariablesSetTheDefaults(contribEnv, confDesc, platformFilename);
670730
try {
671731
// process the platform.txt file first. This way the boards.txt will
672732
// overwrite the default settings
@@ -904,4 +964,7 @@ static public String GetIDEVersion(Path arduinoIDEPath) {
904964
}
905965
}
906966

967+
private static String makeEnvironmentVar(String string) {
968+
return "${" + string + "}";
969+
}
907970
}

0 commit comments

Comments
 (0)