Clone of official tools
export/__init__.py@35:da9c89f8be7d, 2017-02-15 (annotated)
- Committer:
- The Other Jimmy
- Date:
- Wed Feb 15 13:53:18 2017 -0600
- Revision:
- 35:da9c89f8be7d
- Parent:
- 31:8ea194f6145b
- Child:
- 36:96847d42f010
Update tools to mbed-os 5.3.5
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
The Other Jimmy |
31:8ea194f6145b | 1 | """The generic interface for all exporters. |
screamer | 0:66f3b5499f7f | 2 | """ |
The Other Jimmy |
31:8ea194f6145b | 3 | # mbed SDK |
The Other Jimmy |
31:8ea194f6145b | 4 | # Copyright (c) 2011-2016 ARM Limited |
The Other Jimmy |
31:8ea194f6145b | 5 | # |
The Other Jimmy |
31:8ea194f6145b | 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
The Other Jimmy |
31:8ea194f6145b | 7 | # you may not use this file except in compliance with the License. |
The Other Jimmy |
31:8ea194f6145b | 8 | # You may obtain a copy of the License at |
The Other Jimmy |
31:8ea194f6145b | 9 | # |
The Other Jimmy |
31:8ea194f6145b | 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
The Other Jimmy |
31:8ea194f6145b | 11 | # |
The Other Jimmy |
31:8ea194f6145b | 12 | # Unless required by applicable law or agreed to in writing, software |
The Other Jimmy |
31:8ea194f6145b | 13 | # distributed under the License is distributed on an "AS IS" BASIS, |
The Other Jimmy |
31:8ea194f6145b | 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
The Other Jimmy |
31:8ea194f6145b | 15 | # See the License for the specific language governing permissions and |
The Other Jimmy |
31:8ea194f6145b | 16 | # limitations under the License. |
screamer | 0:66f3b5499f7f | 17 | |
The Other Jimmy |
31:8ea194f6145b | 18 | from tools.export import codered, ds5_5, iar, makefile |
The Other Jimmy |
35:da9c89f8be7d | 19 | from tools.export import embitz, coide, kds, simplicity, atmelstudio |
The Other Jimmy |
31:8ea194f6145b | 20 | from tools.export import sw4stm32, e2studio, zip, cmsis, uvision, cdt |
The Other Jimmy |
31:8ea194f6145b | 21 | from tools.targets import TARGET_NAMES |
screamer | 0:66f3b5499f7f | 22 | |
screamer | 0:66f3b5499f7f | 23 | EXPORTERS = { |
The Other Jimmy |
31:8ea194f6145b | 24 | 'uvision5': uvision.Uvision, |
The Other Jimmy |
31:8ea194f6145b | 25 | 'uvision': uvision.Uvision, |
screamer | 0:66f3b5499f7f | 26 | 'lpcxpresso': codered.CodeRed, |
The Other Jimmy |
31:8ea194f6145b | 27 | 'gcc_arm': makefile.GccArm, |
The Other Jimmy |
31:8ea194f6145b | 28 | 'make_gcc_arm': makefile.GccArm, |
The Other Jimmy |
31:8ea194f6145b | 29 | 'make_armc5': makefile.Armc5, |
The Other Jimmy |
31:8ea194f6145b | 30 | 'make_iar': makefile.IAR, |
screamer | 0:66f3b5499f7f | 31 | 'ds5_5': ds5_5.DS5_5, |
The Other Jimmy |
31:8ea194f6145b | 32 | 'iar': iar.IAR, |
The Other Jimmy |
35:da9c89f8be7d | 33 | 'embitz' : embitz.EmBitz, |
screamer | 0:66f3b5499f7f | 34 | 'coide' : coide.CoIDE, |
screamer | 0:66f3b5499f7f | 35 | 'kds' : kds.KDS, |
The Other Jimmy |
35:da9c89f8be7d | 36 | 'simplicityv3' : simplicity.SimplicityV3, |
screamer | 0:66f3b5499f7f | 37 | 'atmelstudio' : atmelstudio.AtmelStudio, |
screamer | 0:66f3b5499f7f | 38 | 'sw4stm32' : sw4stm32.Sw4STM32, |
screamer | 13:ab47a20b66f0 | 39 | 'e2studio' : e2studio.E2Studio, |
The Other Jimmy |
31:8ea194f6145b | 40 | 'eclipse_gcc_arm' : cdt.EclipseGcc, |
The Other Jimmy |
31:8ea194f6145b | 41 | 'eclipse_iar' : cdt.EclipseIAR, |
The Other Jimmy |
31:8ea194f6145b | 42 | 'eclipse_armc5' : cdt.EclipseArmc5, |
The Other Jimmy |
31:8ea194f6145b | 43 | 'zip' : zip.ZIP, |
The Other Jimmy |
31:8ea194f6145b | 44 | 'cmsis' : cmsis.CMSIS |
screamer | 0:66f3b5499f7f | 45 | } |
screamer | 0:66f3b5499f7f | 46 | |
screamer | 0:66f3b5499f7f | 47 | ERROR_MESSAGE_UNSUPPORTED_TOOLCHAIN = """ |
screamer | 0:66f3b5499f7f | 48 | Sorry, the target %s is not currently supported on the %s toolchain. |
screamer | 0:66f3b5499f7f | 49 | Please refer to <a href='/handbook/Exporting-to-offline-toolchains' target='_blank'>Exporting to offline toolchains</a> for more information. |
screamer | 0:66f3b5499f7f | 50 | """ |
screamer | 0:66f3b5499f7f | 51 | |
screamer | 0:66f3b5499f7f | 52 | ERROR_MESSAGE_NOT_EXPORT_LIBS = """ |
screamer | 0:66f3b5499f7f | 53 | To export this project please <a href='http://mbed.org/compiler/?import=http://mbed.org/users/mbed_official/code/mbed-export/k&mode=lib' target='_blank'>import the export version of the mbed library</a>. |
screamer | 0:66f3b5499f7f | 54 | """ |
screamer | 0:66f3b5499f7f | 55 | |
The Other Jimmy |
31:8ea194f6145b | 56 | def mcu_ide_matrix(verbose_html=False): |
The Other Jimmy |
31:8ea194f6145b | 57 | """Shows target map using prettytable |
screamer | 0:66f3b5499f7f | 58 | |
The Other Jimmy |
31:8ea194f6145b | 59 | Keyword argumets: |
The Other Jimmy |
31:8ea194f6145b | 60 | verbose_html - print the matrix in html format |
screamer | 0:66f3b5499f7f | 61 | """ |
The Other Jimmy |
31:8ea194f6145b | 62 | supported_ides = sorted(EXPORTERS.keys()) |
The Other Jimmy |
31:8ea194f6145b | 63 | # Only use it in this function so building works without extra modules |
The Other Jimmy |
31:8ea194f6145b | 64 | from prettytable import PrettyTable, ALL |
screamer | 0:66f3b5499f7f | 65 | |
screamer | 0:66f3b5499f7f | 66 | # All tests status table print |
The Other Jimmy |
31:8ea194f6145b | 67 | table_printer = PrettyTable(["Platform"] + supported_ides) |
screamer | 0:66f3b5499f7f | 68 | # Align table |
The Other Jimmy |
31:8ea194f6145b | 69 | for col in supported_ides: |
The Other Jimmy |
31:8ea194f6145b | 70 | table_printer.align[col] = "c" |
The Other Jimmy |
31:8ea194f6145b | 71 | table_printer.align["Platform"] = "l" |
screamer | 0:66f3b5499f7f | 72 | |
screamer | 0:66f3b5499f7f | 73 | perm_counter = 0 |
screamer | 0:66f3b5499f7f | 74 | for target in sorted(TARGET_NAMES): |
screamer | 0:66f3b5499f7f | 75 | row = [target] # First column is platform name |
screamer | 0:66f3b5499f7f | 76 | for ide in supported_ides: |
screamer | 0:66f3b5499f7f | 77 | text = "-" |
screamer | 0:66f3b5499f7f | 78 | if target in EXPORTERS[ide].TARGETS: |
screamer | 0:66f3b5499f7f | 79 | if verbose_html: |
screamer | 0:66f3b5499f7f | 80 | text = "✓" |
screamer | 0:66f3b5499f7f | 81 | else: |
screamer | 0:66f3b5499f7f | 82 | text = "x" |
screamer | 0:66f3b5499f7f | 83 | perm_counter += 1 |
screamer | 0:66f3b5499f7f | 84 | row.append(text) |
The Other Jimmy |
31:8ea194f6145b | 85 | table_printer.add_row(row) |
screamer | 0:66f3b5499f7f | 86 | |
The Other Jimmy |
31:8ea194f6145b | 87 | table_printer.border = True |
The Other Jimmy |
31:8ea194f6145b | 88 | table_printer.vrules = ALL |
The Other Jimmy |
31:8ea194f6145b | 89 | table_printer.hrules = ALL |
screamer | 0:66f3b5499f7f | 90 | # creates a html page in a shorter format suitable for readme.md |
The Other Jimmy |
31:8ea194f6145b | 91 | if verbose_html: |
The Other Jimmy |
31:8ea194f6145b | 92 | result = table_printer.get_html_string() |
The Other Jimmy |
31:8ea194f6145b | 93 | else: |
The Other Jimmy |
31:8ea194f6145b | 94 | result = table_printer.get_string() |
screamer | 0:66f3b5499f7f | 95 | result += "\n" |
screamer | 0:66f3b5499f7f | 96 | result += "Total IDEs: %d\n"% (len(supported_ides)) |
The Other Jimmy |
31:8ea194f6145b | 97 | if verbose_html: |
The Other Jimmy |
31:8ea194f6145b | 98 | result += "<br>" |
The Other Jimmy |
31:8ea194f6145b | 99 | result += "Total platforms: %d\n"% (len(TARGET_NAMES)) |
The Other Jimmy |
31:8ea194f6145b | 100 | if verbose_html: |
The Other Jimmy |
31:8ea194f6145b | 101 | result += "<br>" |
screamer | 0:66f3b5499f7f | 102 | result += "Total permutations: %d"% (perm_counter) |
The Other Jimmy |
31:8ea194f6145b | 103 | if verbose_html: |
The Other Jimmy |
31:8ea194f6145b | 104 | result = result.replace("&", "&") |
screamer | 0:66f3b5499f7f | 105 | return result |