-
Notifications
You must be signed in to change notification settings - Fork 3k
Add exporter for Analog Devices' CrossCore Embedded Studio #5666
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
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.
Thanks for contributing a new exporter. I'm especially excited to see that it has a build method.
It looks like much of this exporter was copied then modified from the GNU ARM Eclipse exporter. Please inherit from the GNU ARM Eclipse exporter instead. Further code comments below.
tools/export/cces/__init__.py
Outdated
from tools.targets import TARGET_MAP | ||
from tools.export.exporters import Exporter | ||
|
||
class Option: |
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.
Could this class be a named tuple?
tools/export/cces/__init__.py
Outdated
target_name - the name of the target. | ||
""" | ||
target = TARGET_MAP[target_name] | ||
return cls.TOOLCHAIN in target.supported_toolchains |
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.
From your description:
Currently only supports Analog Devices (ADI) targets:
- EVAL_ADICUP3029
- EV_COG_AD3029LZ
- EV_COG_AD4050LZ
Could you make the code here check for that? It currently would try to export for K64F, for example.
tools/export/cces/__init__.py
Outdated
booleans = {"-v": "arm.assembler.option.verbose", | ||
"-g": "arm.assembler.option.debuginfo"} | ||
|
||
for flag in booleans: |
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.
Since you use both the key and the value from the booleans
variable, you can iterate through the key, value pairs instead of doing double lookups?
for flag, setting in booleans.items():
value = "false"
if flag in flags:
value = "true"
flags.remove(flag)
options[setting] = Option("baseId", value)
tools/export/cces/__init__.py
Outdated
"-Werror": "arm.base.compiler.option.warningaserror", | ||
"-Wconversion": "arm.base.compiler.option.conversionwarning"} | ||
|
||
for flag in booleans: |
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.
See the comment about booleans above. Given that this loop appeared twice in this code, could you extract it into it's own function?
tools/export/cces/__init__.py
Outdated
"-s": "arm.linker.option.strip", | ||
"-Wl,--gc-sections": "arm.linker.option.elimination"} | ||
|
||
for flag in booleans: |
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.
Here's the 3rd invocation of the same thing. Please extract this snippet into it's own function.
tools/export/cces/__init__.py
Outdated
|
||
self.resources.win_to_unix() | ||
|
||
t = TARGET_MAP[self.target] |
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.
You should not create your own target object. Please use toolchain.target
instead.
tools/export/cces/__init__.py
Outdated
lib, ext = os.path.splitext(os.path.basename(libpath)) | ||
libs.append(lib[3:]) # skip 'lib' prefix | ||
|
||
system_libs = [ |
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 variable is part of the toolchain object. Please use toolchain.sys_libs
.
tools/export/cces/__init__.py
Outdated
self.gen_file('cces/cces.json.tmpl', jinja_ctx, | ||
json, trim_blocks=True, lstrip_blocks=True) | ||
|
||
# import .json file using CCES headless builder |
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.
You cannot run IDE commands in an exporter. Please remove the following section of code. It looks like this was intended for the build
method, and eventually made its way there.
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.
Thanks for the review. I'm not sure I understand this comment but perhaps some clarification on our end will help. Here we generate the cces.json file as an input to our headlesstools application to generate the project files ('-command projectcreate'). There isn't any building done at this time - only project creation. The user can then import the project into the IDE for building / debugging, or use the build method (note the differences in command line arguments). Does this help clarify things, or am I misunderstanding your comment?
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.
Does this help clarify things, or am I misunderstanding your comment?
Yes. This is still not allowed in exporters.
The online IDE does not have your IDE's executable installed. How can it be expected to handle this part of the export process?
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.
Understood - I hadn't considered the online IDE. Thanks for the clarification.
Is there a way to invoke the exporter build command from the mbed command line? Wondering about the user experience after running the exporter but before importing into the IDE. |
Not sure but maybe @theotherjimmy would know. |
Our exporters provide static method |
@mharringADI Has any progress been made on this PR? If you have a PR in mbed-cli in progress, feel free to link it here for reference. |
@cmonr We are making some changes internally and will post them here once reviewed. Apologies for the delays. |
@mharringADI, any updates? |
@theotherjimmy Mind taking another look? |
@mharringADI Thanks for the update. Could you please rebase instead of |
c3b92a8
to
1f3a587
Compare
Thanks @0xc0170, I've rebased and pushed the changes. |
Hi @theotherjimmy - could you let us know what the final change request is so that we can address it? It's not terribly clear to us. Thanks for your support with this update! Super appreciated! |
Looks like we just need to resolve the conflict. Hopefully we're good after that. |
…ME describing how to use headless tools after exporting.
1f3a587
to
d93bdaf
Compare
All set - I've resolved the conflict. It doesn't look like the new changes have been reviewed yet. |
Ping @theotherjimmy |
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.
I suggested a few simplifications, and a method for better online compiler support.
tools/export/cces/__init__.py
Outdated
remove = ["-c"] | ||
for flag in remove: | ||
if flag in flags: | ||
flags.remove(flag) |
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.
These 3 lines should be a call to clean_flags
tools/export/cces/__init__.py
Outdated
remove = ["-x", "assembler-with-cpp"] | ||
for flag in remove: | ||
if flag in flags: | ||
flags.remove(flag) |
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.
These 3 lines should be a call to clean_flags
tools/export/cces/__init__.py
Outdated
"WORKSPACE", project) | ||
} | ||
|
||
self.gen_file('cces/README.md.tmpl', jinja_ctx, "README.md") |
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.
As it stands, This file will be generated incorrectly in the online export system. You depend on the exporting machine's OS, which will always be Linux in the online compiler, irrespective the OS of the requesting computer. Could you change these files to contain instructions for all 3 OSs?
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.
Thanks @theotherjimmy. The resulting README.md should be the same for all OSs - note that the full OS path isn't used for the jinja context since we don't know the client's OS. That said, having instructions for each OS seems reasonable.
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.
My mistake. It looks like get_cces_path
is only called from build
(which will be called from the same machine invoking the build; no tricks there)
…tems. Reduced duplicate code.
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.
Looks good. Thanks.
@mharringADI How can we add this exporter to CI? |
/morph build |
Build : SUCCESSBuild number : 1129 Triggering tests/morph test |
Test : SUCCESSBuild number : 937 |
Exporter Build : SUCCESSBuild number : 806 |
Waiting on feedback from @mharringADI @studavekar on how to add to CI. |
@theotherjimmy @cmonr I'm not familiar with your CI process, do you have any documentation available? In terms of testing the exporter with CCES, we are creating automated tests on our end that:
|
@mharringADI We use a python script to automate steps 2-4. We use the |
Thanks @theotherjimmy. Looking at |
@mharringADI Should we put this on hold? or would you rather merge now, and submit another PR to turn on CI for it when it's released? |
I think it makes sense to merge now and I'll submit another PR for the CI once it's released. Thanks for all your efforts on this - much appreciated! |
This is in turn dependent on #5848 now targeted at 5.8 |
Notes:
Description
This pull request adds an exporter for Analog Devices' CrossCore Embedded Studio (CCES) Eclipse-based IDE (http://www.analog.com/en/design-center/processors-and-dsp/evaluation-and-development-software/adswt-cces.html#dsp-overview).
Currently only supports Analog Devices (ADI) targets:
Status
READY
Migrations
NO
Related PRs
None.
Todos
Deploy notes
Requires CrossCore Embedded Studio 2.8.0 or newer to be installed (set to release in March 2018). 30-day evaluation licenses are available. Once installed, set CCES_HOME environment variable to point to the top level of the installation (i.e. "C:\Analog Devices\CrossCore Embedded Studio 2.8.0")
Steps to test or reproduce
Export a project to CCES:
mbed export -i cces -m EV_COG_AD4050LZ