Changed prefix file name to mbed_conf.h

Also changed some function names to make it clear that the prefix
headers feature is only used for config.
pull/1957/head
Bogdan Marinescu 2016-06-16 16:57:33 +03:00
parent 85eca37d29
commit a164224acf
5 changed files with 29 additions and 29 deletions

View File

@ -232,8 +232,8 @@ def build_project(src_path, build_path, target, toolchain_name,
prev_features = features
config.validate_config()
# Set the toolchain's prefix header with the config data
toolchain.set_prefix_header_content(config.get_config_data_header())
# Set the toolchain's config header with the config data
toolchain.set_config_header_content(config.get_config_data_header())
# Compile Sources
for path in src_paths:
@ -403,8 +403,8 @@ def build_library(src_paths, build_path, target, toolchain_name,
prev_features = features
config.validate_config()
# Set the toolchain's prefix header with the config data
toolchain.set_prefix_header_content(config.get_config_data_header())
# Set the toolchain's config header with the config data
toolchain.set_config_header_content(config.get_config_data_header())
# Compile Sources
for path in src_paths:

View File

@ -265,8 +265,8 @@ class mbedToolchain:
self.flags = deepcopy(self.DEFAULT_FLAGS)
# prefix_header_content will hold the content of the prefix header (if used)
self.prefix_header_content = None
# config_header_content will hold the content of the config header (if used)
self.config_header_content = None
def get_output(self):
return self.output
@ -871,24 +871,24 @@ class mbedToolchain:
memap.generate_output('csv-ci', map_csv)
# "Prefix headers" are automatically included by the compiler at the beginning of
# each source file.
# header_content - the content of the prefix header file.
def set_prefix_header_content(self, header_content):
self.prefix_header_content = header_content
# each source file. They are used to provide configuration data.
# header_content - the content of the config header file.
def set_config_header_content(self, header_content):
self.config_header_content = header_content
# Return the location of the prefix header. This function will create the prefix
# header first if needed. The header will be written in a file called "mbed_prefix.h"
# Return the location of the config header. This function will create the config
# header first if needed. The header will be written in a file called "mbed_conf.h"
# located in the project's build directory.
# If prefix headers are not used (self.prefix_header_content is None), the function
# If config headers are not used (self.config_header_content is None), the function
# returns None
def get_prefix_header(self):
if self.prefix_header_content is None:
def get_config_header(self):
if self.config_header_content is None:
return None
prefix_file = join(self.build_dir, "mbed_prefix.h")
if not exists(prefix_file):
with open(prefix_file, "wt") as f:
f.write(self.prefix_header_content)
return prefix_file
config_file = join(self.build_dir, "mbed_conf.h")
if not exists(config_file):
with open(config_file, "wt") as f:
f.write(self.config_header_content)
return config_file
from tools.settings import ARM_BIN

View File

@ -116,9 +116,9 @@ class ARM(mbedToolchain):
def get_compile_options(self, defines, includes):
opts = ['-D%s' % d for d in defines] + ['--via', self.get_inc_file(includes)]
prefix_header = self.get_prefix_header()
if prefix_header is not None:
opts = opts + ['--preinclude', prefix_header]
config_header = self.get_config_header()
if config_header is not None:
opts = opts + ['--preinclude', config_header]
return opts
@hook_tool

View File

@ -167,9 +167,9 @@ class GCC(mbedToolchain):
def get_compile_options(self, defines, includes):
opts = ['-D%s' % d for d in defines] + ['@%s' % self.get_inc_file(includes)]
prefix_header = self.get_prefix_header()
if prefix_header is not None:
opts = opts + ['-include', prefix_header]
config_header = self.get_config_header()
if config_header is not None:
opts = opts + ['-include', config_header]
return opts
@hook_tool

View File

@ -120,9 +120,9 @@ class IAR(mbedToolchain):
def get_compile_options(self, defines, includes):
opts = ['-D%s' % d for d in defines] + ['-f', self.get_inc_file(includes)]
prefix_header = self.get_prefix_header()
if prefix_header is not None:
opts = opts + ['--preinclude', prefix_header]
config_header = self.get_config_header()
if config_header is not None:
opts = opts + ['--preinclude', config_header]
return opts
@hook_tool