-
Notifications
You must be signed in to change notification settings - Fork 3k
[Exporters] Update exporters to include and use mbed_conf.h (Was #1964) #1975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
That's more an attribute of the exporter itself than a configuration variable. If it supports |
Thanks for the clarification @bogdanm. That was what I was trying to say, but used the wrong word (configuration varible) as opposed to exporter attribute. |
6ac1703
to
b202db5
Compare
@bogdanm, does the 7th commit (Create and enable...) resolve the switching between |
b202db5
to
c2ed550
Compare
To answer my own question, No the mechanism does not work yet. |
Well, actually it might. I don't have any content in my |
@@ -47,6 +48,9 @@ def flags(self): | |||
def progen_flags(self): | |||
if not hasattr(self, "_progen_flag_cache") : | |||
self._progen_flag_cache = dict([(key + "_flags", value) for key,value in self.flags.iteritems()]) | |||
if self.config_header: | |||
self._progen_flag_cache['c_flags'] += self.toolchain.get_config_option(self.config_header) | |||
self._progen_flag_cache['cxx_flags'] += self.toolchain.get_config_option(self.config_header) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just realized that you might need to add this to ASM files as well, since some toolchains (like GCC) can preprocess the ASM file before invoking the assembler, and we use this feature in a few parts of the system. Not sure though if this is something that we want to enable for all toolchains or only for a few of them.
The mechanism looks like it'll probably work, but I didn't test it locally yet. |
Let me know when you do. |
Doing my best, but there seem to be some unrelated issues with the exporters right now. We don't really have a test suite for exporters, so all I can do is try a few manually and see if they work. Also, #1968 happened meanwhile, so the name of the configuration file is now |
c2ed550
to
aed51dc
Compare
Rebased. @bogdanm is the move to one location commit what you want? |
@@ -121,6 +121,8 @@ class GccArm(Exporter): | |||
|
|||
DOT_IN_RELATIVE_PATH = True | |||
|
|||
MBED_CONF_ACTIVE = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@theotherjimmy Can you rename this to HAS_MBED_CONFIG
please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this flag to signal if mbed config is active (=present) or if there is a configuration somewhere (has config)? I would say the former, same as PROGEN_ACTIVE
flag. @theotherjimmy what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should really be MBED_CONF_HEADER_SUPPORTED
. If present, this field says "this exporter can use the header files generated by the configuration system". If not present, the exporter can still work with the configuration system, but using the old method (direct generation of macros for the configuration system).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing now.
LGTM |
Minor comment. Noticed that MBED_CONF_ACTIVE is always true. Isn't it fair/safe to assume that the config is always there (even if empty)? |
The point of |
@theotherjimmy, did you test this PR with uvision? It doesn't seem to work for me. A .uvproj file is created and I can see this line in it:
As you can see, Tested with uVision 5.20, project-generator 0.9.4. |
@bogdanm this looks better I think: |
@theotherjimmy, that looks better indeed. Now I'm getting a different set of errors:
and so on. It looks like that paths are messed up. I doubt this is because of this PR, but in any case, it means that I can't really test it. Cc @0xc0170. |
I am looking at it, seems to me that master is broken, thus is not fault of this PR. The paths are wrong. I should have a fix for it today. |
With #2026 in place, this works with uVision on blinky. IAR still fails, but for a different reason (duplicate object names). So I'd say that after we merge #2026 we're good to merge this. |
7b7c9ee
to
daf6c67
Compare
self.config_macros = config.get_config_data_macros() | ||
|
||
|
||
if hasattr(self, "MBED_CONFIG_HEADER_SUPPORTED") and self.MBED_CONF_ACTIVE : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and self.MBED_CONFIG_HEADER_SUPPORTED
. Please do not issue/modify a PR without testing its functionality at least once locally.
thanks @screamerbg! |
@bogdanm, @0xc0170, @screamerbg is this ready to merge? |
Just a moment, the changes in this branch is out of date. Rebasing. |
I suspect we'll have some problems related to assembler flags, but let's merge it like this for now and see how it goes. However, it looks like it needs to be rebased. |
Yeah, I'm working on it right now. |
4995e70
to
ad0e429
Compare
Don't merge just yet, I need to verify that IAR asm gets the right flags. |
ad0e429
to
7190244
Compare
get_conifg_option -> get_config_option
The mbed_conf_active feature disables configuration macros on the command line and replaces them with a preinclude header file
relpaces the --preinclude mbed_config.h with --preinclude=mbed_config.h
…rt/$file -e "s/MBED_CONF_ACTIVE/MBED_CONFIG_HEADER_SUPPORTED/"; done
7190244
to
7b83c30
Compare
Looks fine. Side note: IAR IDE works on my Linux machine! |
def get_compile_options(self, defines, includes, for_asm=False): | ||
opts = ['-D%s' % d for d in defines] + ['-f', self.get_inc_file(includes)] | ||
opts = ['-f', self.get_inc_file(includes)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defines
isn't used anymore ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh, whoops. I did not intend to delete that. OTOH, they still seem to propagate to the exporters. I suspect this would break the direct build on IAR, but not an exported project.
def get_compile_options(self, defines, includes, for_asm=False): | ||
opts = ['-D%s' % d for d in defines] + ['-f', self.get_inc_file(includes)] | ||
config_header = self.get_config_header() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicated (see below in the else:
block). Not a real problem though.
+1, ready to merge. |
This commit address the issue presented in #2073. Previously, mbed_config.h was automatically included by the toolchain. With this change, all the sources that need "mbed_config.h" need to include it manually. However, "mbed.h" now includes "mbed_config.h", so configuration data is automatically available to sources that include "mbed.h". With this change, even if there's no configuration data in the project being built, an empty "mbed_config.h" is generated by the build system. This change looks big, but most of it is an almost complete reversal of #1975. This is likely a breaking change, and needs to be properly communicated.
Affected exporters:
Summary of discussion:
@0xc0170:
We should wait until the name of mbed_conf.h is set in stone.
@bogdanm:
We should introduce a configuration variable for all exporters to indicate if they export the mbed_conf.h. This will help eliminate duplication.