diff --git a/bsp/stm32/stm32f103-dofly-M3S/.cproject b/bsp/stm32/stm32f103-dofly-M3S/.cproject
index 3dceacb108..9d9d054816 100644
--- a/bsp/stm32/stm32f103-dofly-M3S/.cproject
+++ b/bsp/stm32/stm32f103-dofly-M3S/.cproject
@@ -107,6 +107,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -122,11 +142,37 @@
-
+
+
+
+
+
+
-
+
diff --git a/bsp/stm32/stm32f103-yf-ufun/.cproject b/bsp/stm32/stm32f103-yf-ufun/.cproject
index b37a91bc57..ac0a340b53 100644
--- a/bsp/stm32/stm32f103-yf-ufun/.cproject
+++ b/bsp/stm32/stm32f103-yf-ufun/.cproject
@@ -106,6 +106,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -121,11 +141,36 @@
-
+
+
+
+
+
+
-
+
diff --git a/bsp/stm32/stm32f401-st-nucleo/.cproject b/bsp/stm32/stm32f401-st-nucleo/.cproject
index 194d91778d..840b6ea8a3 100644
--- a/bsp/stm32/stm32f401-st-nucleo/.cproject
+++ b/bsp/stm32/stm32f401-st-nucleo/.cproject
@@ -108,6 +108,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -123,11 +143,36 @@
-
+
+
+
+
+
+
-
+
diff --git a/bsp/stm32/stm32f405-smdz-breadfruit/.cproject b/bsp/stm32/stm32f405-smdz-breadfruit/.cproject
index 1742bda37c..28875aebba 100644
--- a/bsp/stm32/stm32f405-smdz-breadfruit/.cproject
+++ b/bsp/stm32/stm32f405-smdz-breadfruit/.cproject
@@ -108,6 +108,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -123,11 +143,36 @@
-
+
+
+
+
+
+
-
+
diff --git a/bsp/stm32/stm32f407-atk-explorer/.cproject b/bsp/stm32/stm32f407-atk-explorer/.cproject
index ca7e2cbe65..29d2070c6b 100644
--- a/bsp/stm32/stm32f407-atk-explorer/.cproject
+++ b/bsp/stm32/stm32f407-atk-explorer/.cproject
@@ -109,6 +109,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -124,11 +144,37 @@
-
+
+
+
+
+
+
-
+
diff --git a/bsp/stm32/stm32f411-st-nucleo/.cproject b/bsp/stm32/stm32f411-st-nucleo/.cproject
index 541ca5a624..ede41532a6 100644
--- a/bsp/stm32/stm32f411-st-nucleo/.cproject
+++ b/bsp/stm32/stm32f411-st-nucleo/.cproject
@@ -108,6 +108,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -123,11 +143,36 @@
-
+
+
+
+
+
+
-
+
diff --git a/bsp/stm32/stm32f429-atk-apollo/.cproject b/bsp/stm32/stm32f429-atk-apollo/.cproject
index e561b1f4eb..146667cb3e 100644
--- a/bsp/stm32/stm32f429-atk-apollo/.cproject
+++ b/bsp/stm32/stm32f429-atk-apollo/.cproject
@@ -109,6 +109,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -124,11 +144,37 @@
-
+
+
+
+
+
+
-
+
diff --git a/bsp/stm32/stm32f429-fire-challenger/.cproject b/bsp/stm32/stm32f429-fire-challenger/.cproject
index 5c47f8b9b4..a0ebec16c0 100644
--- a/bsp/stm32/stm32f429-fire-challenger/.cproject
+++ b/bsp/stm32/stm32f429-fire-challenger/.cproject
@@ -109,6 +109,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -124,11 +144,37 @@
-
+
+
+
+
+
+
-
+
diff --git a/bsp/stm32/stm32f767-atk-apollo/.cproject b/bsp/stm32/stm32f767-atk-apollo/.cproject
index 6851f72111..5a0a52f726 100644
--- a/bsp/stm32/stm32f767-atk-apollo/.cproject
+++ b/bsp/stm32/stm32f767-atk-apollo/.cproject
@@ -109,6 +109,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -124,11 +144,37 @@
-
+
+
+
+
+
+
-
+
diff --git a/bsp/stm32/stm32l475-atk-pandora/.cproject b/bsp/stm32/stm32l475-atk-pandora/.cproject
index d97eb3fc3e..396b895093 100644
--- a/bsp/stm32/stm32l475-atk-pandora/.cproject
+++ b/bsp/stm32/stm32l475-atk-pandora/.cproject
@@ -108,6 +108,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -123,11 +143,37 @@
-
+
+
+
+
+
+
-
+
diff --git a/tools/eclipse.py b/tools/eclipse.py
index 253db37bea..0f001b8bb8 100644
--- a/tools/eclipse.py
+++ b/tools/eclipse.py
@@ -20,6 +20,10 @@ from utils import xml_indent
import xml.etree.ElementTree as etree
from xml.etree.ElementTree import SubElement
+from building import *
+
+MODULE_VER_NUM = 0
+
source_pattern = ['*.c', '*.cpp', '*.cxx', '*.s', '*.S', '*.asm']
def OSPath(path):
@@ -134,57 +138,66 @@ def IsRttEclipsePathFormat(path):
return True
else :
return False
+
+
+def IsCppProject():
+ return GetDepend('RT_USING_CPLUSPLUS')
-
+
def HandleToolOption(tools, env, project, reset):
+ is_cpp_prj = IsCppProject()
BSP_ROOT = os.path.abspath(env['BSP_ROOT'])
CPPDEFINES = project['CPPDEFINES']
paths = [ConverToRttEclipsePathFormat(RelativeProjectPath(env, os.path.normpath(i)).replace('\\', '/')) for i in project['CPPPATH']]
- compile_include_paths_option = None
- compile_include_files_option = None
- compile_defs_option = None
+ compile_include_paths_options = []
+ compile_include_files_options = []
+ compile_defs_options = []
linker_scriptfile_option = None
linker_script_option = None
linker_nostart_option = None
linker_libs_option = None
linker_paths_option = None
+
linker_newlib_nano_option = None
for tool in tools:
- if tool.get('id').find('c.compile') != 1:
+ if tool.get('id').find('compile') != 1:
options = tool.findall('option')
# find all compile options
for option in options:
- if option.get('id').find('c.compiler.include.paths') != -1 or option.get('id').find('c.compiler.option.includepaths') != -1:
- compile_include_paths_option = option
- elif option.get('id').find('c.compiler.include.files') != -1 or option.get('id').find('c.compiler.option.includefiles') != -1 :
- compile_include_files_option = option
- elif option.get('id').find('c.compiler.defs') != -1 or option.get('id').find('c.compiler.option.definedsymbols') != -1:
- compile_defs_option = option
+ if option.get('id').find('compiler.include.paths') != -1 or option.get('id').find('compiler.option.includepaths') != -1:
+ compile_include_paths_options += [option]
+ elif option.get('id').find('compiler.include.files') != -1 or option.get('id').find('compiler.option.includefiles') != -1 :
+ compile_include_files_options += [option]
+ elif option.get('id').find('compiler.defs') != -1 or option.get('id').find('compiler.option.definedsymbols') != -1:
+ compile_defs_options += [option]
- if tool.get('id').find('c.linker') != -1:
+ if tool.get('id').find('linker') != -1:
options = tool.findall('option')
# find all linker options
for option in options:
- if option.get('id').find('c.linker.scriptfile') != -1:
+ # the project type and option type must equal
+ if is_cpp_prj != (option.get('id').find('cpp.linker') != -1):
+ continue
+
+ if option.get('id').find('linker.scriptfile') != -1:
linker_scriptfile_option = option
- elif option.get('id').find('c.linker.option.script') != -1:
+ elif option.get('id').find('linker.option.script') != -1:
linker_script_option = option
- elif option.get('id').find('c.linker.nostart') != -1:
+ elif option.get('id').find('linker.nostart') != -1:
linker_nostart_option = option
- elif option.get('id').find('c.linker.libs') != -1 and env.has_key('LIBS'):
+ elif option.get('id').find('linker.libs') != -1 and env.has_key('LIBS'):
linker_libs_option = option
- elif option.get('id').find('c.linker.paths') != -1 and env.has_key('LIBPATH'):
+ elif option.get('id').find('linker.paths') != -1 and env.has_key('LIBPATH'):
linker_paths_option = option
- elif option.get('id').find('c.linker.usenewlibnano') != -1:
+ elif option.get('id').find('linker.usenewlibnano') != -1:
linker_newlib_nano_option = option
# change the inclue path
- if compile_include_paths_option is not None :
- option = compile_include_paths_option
+ for option in compile_include_paths_options:
# find all of paths in this project
include_paths = option.findall('listOptionValue')
for item in include_paths:
@@ -196,8 +209,7 @@ def HandleToolOption(tools, env, project, reset):
for item in paths:
SubElement(option, 'listOptionValue', {'builtIn': 'false', 'value': item})
# change the inclue files (default) or definitions
- if compile_include_files_option is not None:
- option = compile_include_files_option
+ for option in compile_include_files_options:
# add '_REENT_SMALL' to CPPDEFINES when --specs=nano.specs has select
if linker_newlib_nano_option is not None and linker_newlib_nano_option.get('value') == 'true' and '_REENT_SMALL' not in CPPDEFINES:
CPPDEFINES += ['_REENT_SMALL']
@@ -227,25 +239,25 @@ def HandleToolOption(tools, env, project, reset):
break
if find_ok is False:
SubElement(option, 'listOptionValue', {'builtIn': 'false', 'value': rtt_pre_inc_item})
- elif compile_defs_option is not None :
- option = compile_defs_option
- defs = option.findall('listOptionValue')
- project_defs = []
- for item in defs:
- if reset is True:
- # clean all old configuration
- option.remove(item)
+ if len(compile_include_files_options) == 0:
+ for option in compile_defs_options:
+ defs = option.findall('listOptionValue')
+ project_defs = []
+ for item in defs:
+ if reset is True:
+ # clean all old configuration
+ option.remove(item)
+ else:
+ project_defs += [item.get('value')]
+ if len(project_defs) > 0:
+ cproject_defs = set(CPPDEFINES) - set(project_defs)
else:
- project_defs += [item.get('value')]
- if len(project_defs) > 0:
- cproject_defs = set(CPPDEFINES) - set(project_defs)
- else:
- cproject_defs = CPPDEFINES
+ cproject_defs = CPPDEFINES
- # print('c.compiler.defs')
- cproject_defs = sorted(cproject_defs)
- for item in cproject_defs:
- SubElement(option, 'listOptionValue', {'builtIn': 'false', 'value': item})
+ # print('c.compiler.defs')
+ cproject_defs = sorted(cproject_defs)
+ for item in cproject_defs:
+ SubElement(option, 'listOptionValue', {'builtIn': 'false', 'value': item})
# update linker script config
if linker_scriptfile_option is not None :