@@ -246,9 +246,9 @@ public static void addCodeFolder(IProject project, String PathVarName, String Su
246
246
}
247
247
248
248
/**
249
- * This method creates a link folder in the project and adds the folder as a source path to the project it also adds the path to the include folder
250
- * if the includepath parameter points to a path that contains a subfolder named "utility" this subfolder will be added to the include path as
251
- * well <br/>
249
+ * This method creates a link folder in the project and adds the folder as a source path to the project it also adds the path to the include
250
+ * folder if the includepath parameter points to a path that contains a subfolder named "utility" this subfolder will be added to the include path
251
+ * as well <br/>
252
252
* <br/>
253
253
*
254
254
* note Arduino has these subfolders in the libraries that need to be include.<br/>
@@ -711,8 +711,7 @@ private static boolean isThisMenuItemSelected(ArduinoBoards boardsFile, ICConfig
711
711
* the info of the selected board to set the variables for
712
712
*/
713
713
714
-
715
- public static void setTheEnvironmentVariables (IProject project , ICConfigurationDescription confDesc , boolean debugConfig ) {
714
+ public static void setTheEnvironmentVariables (IProject project , ICConfigurationDescription confDesc ) {
716
715
717
716
IEnvironmentVariableManager envManager = CCorePlugin .getDefault ().getBuildEnvironmentManager ();
718
717
IContributedEnvironment contribEnv = envManager .getContributedEnvironment ();
@@ -738,10 +737,10 @@ public static void setTheEnvironmentVariables(IProject project, ICConfigurationD
738
737
setTheEnvironmentVariablesAddtheBoardsTxt (contribEnv , confDesc , boardFileName , boardName );
739
738
// Do some post processing
740
739
setTheEnvironmentVariablesPostProcessing (contribEnv , confDesc );
741
-
742
- //If this is a debug config we modify the environment variables for compilation
743
- if ( debugConfig ) {
744
- setTheEnvironmentVariablesModifyDebugCompilerSettings (confDesc , envManager , contribEnv );
740
+
741
+ // If this is a debug config we modify the environment variables for compilation
742
+ if ( confDesc . getName (). startsWith ( "Debug" ) ) {
743
+ setTheEnvironmentVariablesModifyDebugCompilerSettings (confDesc , envManager , contribEnv );
745
744
}
746
745
747
746
} catch (Exception e ) {// Catch exception if any
@@ -806,47 +805,41 @@ private static void setTheEnvironmentVariablesPostProcessing(IContributedEnviron
806
805
}
807
806
808
807
/**
809
- * Converts the CPP and C compiler flags to not optimise for space/size and to leave symbols in.
810
- * These changes allow step through debugging with JTAG and Dragon AVR
808
+ * Converts the CPP and C compiler flags to not optimise for space/size and to leave symbols in. These changes allow step through debugging with
809
+ * JTAG and Dragon AVR
810
+ *
811
811
* @param confDesc
812
812
* @param envManager
813
813
* @param contribEnv
814
814
*/
815
815
816
- private static void setTheEnvironmentVariablesModifyDebugCompilerSettings (
817
- ICConfigurationDescription confDesc ,
818
- IEnvironmentVariableManager envManager ,
819
- IContributedEnvironment contribEnv ) {
820
-
821
- //Modify the compiler flags for the debug configuration
822
- //Replace "-g" with "-g2"
823
- //Replace "-Os" with ""
824
- //TODO: This should move to another location eventually -- a bit hacky here (considering other env vars come from other -- a little bit magical -- places).
825
- //I couldn't easily determine where that magic happened :(
826
- IEnvironmentVariable original = null ;
827
- IEnvironmentVariable replacement = null ;
828
-
829
- original = envManager .getVariable ( ENV_KEY_ARDUINO_START + "COMPILER.C.FLAGS" , confDesc , true );
830
- if (original != null )
831
- {
832
- replacement = new EnvironmentVariable (original .getName (),
833
- original .getValue ().replace ("-g" , "-g2" ).replace ("-Os" , "" ),
834
- original .getOperation (), original .getDelimiter () );
835
- contribEnv .addVariable (replacement , confDesc );
836
- }
837
-
838
- original = envManager .getVariable ( ENV_KEY_ARDUINO_START + "COMPILER.CPP.FLAGS" , confDesc , true );
839
- if (original != null )
840
- {
841
- replacement = new EnvironmentVariable (original .getName (),
842
- original .getValue ().replace ("-g" , "-g2" ).replace ("-Os" , "" ),
843
- original .getOperation (), original .getDelimiter () );
844
- contribEnv .addVariable (replacement , confDesc );
845
- }
816
+ private static void setTheEnvironmentVariablesModifyDebugCompilerSettings (ICConfigurationDescription confDesc ,
817
+ IEnvironmentVariableManager envManager , IContributedEnvironment contribEnv ) {
818
+
819
+ // Modify the compiler flags for the debug configuration
820
+ // Replace "-g" with "-g2"
821
+ // Replace "-Os" with ""
822
+ // TODO: This should move to another location eventually -- a bit hacky here (considering other env vars come from other -- a little bit
823
+ // magical -- places).
824
+ // I couldn't easily determine where that magic happened :(
825
+ IEnvironmentVariable original = null ;
826
+ IEnvironmentVariable replacement = null ;
827
+
828
+ original = envManager .getVariable (ENV_KEY_ARDUINO_START + "COMPILER.C.FLAGS" , confDesc , true );
829
+ if (original != null ) {
830
+ replacement = new EnvironmentVariable (original .getName (), original .getValue ().replace ("-g" , "-g2" ).replace ("-Os" , "" ),
831
+ original .getOperation (), original .getDelimiter ());
832
+ contribEnv .addVariable (replacement , confDesc );
846
833
}
847
834
848
-
849
-
835
+ original = envManager .getVariable (ENV_KEY_ARDUINO_START + "COMPILER.CPP.FLAGS" , confDesc , true );
836
+ if (original != null ) {
837
+ replacement = new EnvironmentVariable (original .getName (), original .getValue ().replace ("-g" , "-g2" ).replace ("-Os" , "" ),
838
+ original .getOperation (), original .getDelimiter ());
839
+ contribEnv .addVariable (replacement , confDesc );
840
+ }
841
+ }
842
+
850
843
/**
851
844
* When parsing boards.txt and platform.txt some processing needs to be done to get "acceptable environment variable values" This method does the
852
845
* parsing
0 commit comments